Commit 4586266b authored by David Mosberger's avatar David Mosberger

ia64: More time-interpolation cleanups; correct SN2 interpolator.

parent 768b6efa
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
* linux/arch/ia64/sn/kernel/sn2/timer.c * linux/arch/ia64/sn/kernel/sn2/timer.c
* *
* Copyright (C) 2003 Silicon Graphics, Inc. * Copyright (C) 2003 Silicon Graphics, Inc.
* Copyright (C) 2003 Hewlett-Packard Co
* David Mosberger <davidm@hpl.hp.com>: updated for new timer-interpolation infrastructure
*/ */
#include <linux/init.h> #include <linux/init.h>
...@@ -20,26 +22,36 @@ ...@@ -20,26 +22,36 @@
extern unsigned long sn_rtc_cycles_per_second; extern unsigned long sn_rtc_cycles_per_second;
static volatile unsigned long last_wall_rtc; static volatile unsigned long last_wall_rtc;
static unsigned long rtc_offset; /* updated only when xtime write-lock is held! */
static long rtc_nsecs_per_cycle; static long rtc_nsecs_per_cycle;
static long rtc_per_timer_tick; static long rtc_per_timer_tick;
static unsigned long static unsigned long
getoffset(void) getoffset(void)
{ {
return (long) (GET_RTC_COUNTER() - last_wall_rtc)*rtc_nsecs_per_cycle; return rtc_offset + (GET_RTC_COUNTER() - last_wall_rtc)*rtc_nsecs_per_cycle;
} }
static void static void
update(long delta_nsec) update(long delta_nsec)
{ {
last_wall_rtc = GET_RTC_COUNTER(); unsigned long rtc_counter = GET_RTC_COUNTER();
unsigned long offset = rtc_offset + (rtc_counter - last_wall_rtc)*rtc_nsecs_per_cycle;
/* Be careful about signed/unsigned comparisons here: */
if (delta_nsec < 0 || (unsigned long) delta_nsec < offset)
rtc_offset = offset - delta_nsec;
else
rtc_offset = 0;
last_wall_rtc = rtc_counter;
} }
static void static void
reset(void) reset(void)
{ {
rtc_offset = 0;
last_wall_rtc = GET_RTC_COUNTER(); last_wall_rtc = GET_RTC_COUNTER();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _ASM_IA64_TIMEX_H #define _ASM_IA64_TIMEX_H
/* /*
* Copyright (C) 1998-2001 Hewlett-Packard Co * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com> * David Mosberger-Tang <davidm@hpl.hp.com>
*/ */
/* /*
...@@ -25,8 +25,4 @@ get_cycles (void) ...@@ -25,8 +25,4 @@ get_cycles (void)
return ret; return ret;
} }
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