Commit 6dc0d7f6 authored by David Mosberger's avatar David Mosberger Committed by David Mosberger

ia64: Fix more merge errors. Correct SN2 callbacks to also invoke the generic ia64

      callbacks so last_nsec_offset gets updated, too.
parent 3efebf18
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
#include <asm/system.h> #include <asm/system.h>
extern unsigned long wall_jiffies; extern unsigned long wall_jiffies;
extern unsigned long last_nsec_offset; unsigned long last_nsec_offset;
static unsigned long __ia64_gettimeoffset (void); static unsigned long ia64_gettimeoffset (void);
unsigned long (*gettimeoffset)(void) = &__ia64_gettimeoffset; unsigned long (*gettimeoffset)(void) = &ia64_gettimeoffset;
u64 jiffies_64 = INITIAL_JIFFIES; u64 jiffies_64 = INITIAL_JIFFIES;
...@@ -65,12 +65,38 @@ do_profile (unsigned long ip) ...@@ -65,12 +65,38 @@ do_profile (unsigned long ip)
atomic_inc((atomic_t *) &prof_buffer[ip]); atomic_inc((atomic_t *) &prof_buffer[ip]);
} }
void
ia64_reset_wall_time (void)
{
last_nsec_offset = 0;
}
/*
* Adjust for the fact that xtime has been advanced by delta_nsec (may be negative and/or
* larger than NSEC_PER_SEC.
*/
void
ia64_update_wall_time (long delta_nsec)
{
if (last_nsec_offset > 0) {
unsigned long new, old;
do {
old = last_nsec_offset;
if (old > delta_nsec)
new = old - delta_nsec;
else
new = 0;
} while (cmpxchg(&last_nsec_offset, old, new) != old);
}
}
/* /*
* Return the number of nano-seconds that elapsed since the last update to jiffy. The * Return the number of nano-seconds that elapsed since the last update to jiffy. The
* xtime_lock must be at least read-locked when calling this routine. * xtime_lock must be at least read-locked when calling this routine.
*/ */
static unsigned long unsigned long
__ia64_gettimeoffset (void) ia64_gettimeoffset (void)
{ {
unsigned long elapsed_cycles, lost = jiffies - wall_jiffies; unsigned long elapsed_cycles, lost = jiffies - wall_jiffies;
unsigned long now, last_tick; unsigned long now, last_tick;
...@@ -129,9 +155,7 @@ do_settimeofday (struct timeval *tv) ...@@ -129,9 +155,7 @@ do_settimeofday (struct timeval *tv)
time_status |= STA_UNSYNC; time_status |= STA_UNSYNC;
time_maxerror = NTP_PHASE_LIMIT; time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT;
if (update_wall_time_hook)
(*reset_wall_time_hook)(); (*reset_wall_time_hook)();
} }
write_sequnlock_irq(&xtime_lock); write_sequnlock_irq(&xtime_lock);
clock_was_set(); clock_was_set();
...@@ -345,6 +369,9 @@ static struct irqaction timer_irqaction = { ...@@ -345,6 +369,9 @@ static struct irqaction timer_irqaction = {
void __init void __init
time_init (void) time_init (void)
{ {
update_wall_time_hook = ia64_update_wall_time;
reset_wall_time_hook = ia64_reset_wall_time;
register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction); register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction);
efi_gettimeofday(&xtime); efi_gettimeofday(&xtime);
ia64_init_itm(); ia64_init_itm();
......
...@@ -58,8 +58,9 @@ sn_gettimeoffset(void) ...@@ -58,8 +58,9 @@ sn_gettimeoffset(void)
} }
void sn2_update_wall_time(void) void sn2_update_wall_time(long delta_nsec)
{ {
ia64_update_wall_time(delta_nsec);
rtc_offset -= min(rtc_offset, rtc_per_timer_tick); rtc_offset -= min(rtc_offset, rtc_per_timer_tick);
last_wall_rtc = GET_RTC_COUNTER(); last_wall_rtc = GET_RTC_COUNTER();
} }
...@@ -67,6 +68,7 @@ void sn2_update_wall_time(void) ...@@ -67,6 +68,7 @@ void sn2_update_wall_time(void)
void sn2_reset_wall_time(void) void sn2_reset_wall_time(void)
{ {
ia64_reset_wall_time();
rtc_offset = 0; rtc_offset = 0;
last_wall_rtc = GET_RTC_COUNTER(); last_wall_rtc = GET_RTC_COUNTER();
} }
......
...@@ -26,5 +26,7 @@ get_cycles (void) ...@@ -26,5 +26,7 @@ get_cycles (void)
} }
extern unsigned long (*gettimeoffset)(void); extern unsigned long (*gettimeoffset)(void);
extern void ia64_reset_wall_time (void);
extern void ia64_update_wall_time (long delta_nsec);
#endif /* _ASM_IA64_TIMEX_H */ #endif /* _ASM_IA64_TIMEX_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment