summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/clock.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1998-02-20 16:36:17 +0000
committerphk <phk@FreeBSD.org>1998-02-20 16:36:17 +0000
commit044e1e629691b102791a17fc6db270846b71b01c (patch)
tree73eeeac34c8a9254ecd3686eaa03c76379171a5c /sys/i386/include/clock.h
parentfba9e5d6630c11aef2f66bef4dd7fbf45179be87 (diff)
downloadFreeBSD-src-044e1e629691b102791a17fc6db270846b71b01c.zip
FreeBSD-src-044e1e629691b102791a17fc6db270846b71b01c.tar.gz
Replace TOD clock code with more systematic approach.
Highlights: * Simple model for underlying hardware. * Hardware basis for timekeeping can be changed on the fly. * Only one hardware clock responsible for TOD keeping. * Provides a real nanotime() function. * Time granularity: .232E-18 seconds. * Frequency granularity: .238E-12 s/s * Frequency adjustment is continuous in time. * Less overhead for frequency adjustment. * Improves xntpd performance. Reviewed by: bde, bde, bde
Diffstat (limited to 'sys/i386/include/clock.h')
-rw-r--r--sys/i386/include/clock.h66
1 files changed, 1 insertions, 65 deletions
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h
index 6013414..31b4632 100644
--- a/sys/i386/include/clock.h
+++ b/sys/i386/include/clock.h
@@ -3,16 +3,12 @@
* Garrett Wollman, September 1994.
* This file is in the public domain.
*
- * $Id: clock.h,v 1.30 1997/12/28 17:33:08 phk Exp $
+ * $Id: clock.h,v 1.31 1998/02/01 22:45:23 bde Exp $
*/
#ifndef _MACHINE_CLOCK_H_
#define _MACHINE_CLOCK_H_
-#define CPU_CLOCKUPDATE(otime, ntime) cpu_clockupdate((otime), (ntime))
-
-#define CPU_THISTICKLEN(dflt) dflt
-
#define TSC_COMULTIPLIER_SHIFT 20
#define TSC_MULTIPLIER_SHIFT 32
@@ -27,12 +23,7 @@ extern int disable_rtc_set;
extern int statclock_disable;
extern u_int timer_freq;
extern int timer0_max_count;
-extern u_int timer0_overflow_threshold;
-extern u_int timer0_prescaler_count;
-extern u_int tsc_bias;
-extern u_int tsc_comultiplier;
extern u_int tsc_freq;
-extern u_int tsc_multiplier;
extern int wall_cmos_clock;
/*
@@ -54,61 +45,6 @@ int release_timer1 __P((void));
#endif
int sysbeep __P((int pitch, int period));
-#ifdef CLOCK_HAIR
-
-#ifdef PC98
-#include <pc98/pc98/pc98.h> /* XXX */
-#else
-#include <i386/isa/isa.h> /* XXX */
-#endif
-#include <i386/isa/timerreg.h> /* XXX */
-
-static __inline u_int
-clock_latency(void)
-{
- u_char high, low;
-
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
- return (timer0_prescaler_count + timer0_max_count
- - ((high << 8) | low));
-}
-
-/*
- * When we update `time', we also update `tsc_bias' atomically (if we
- * are using the TSC). `tsc_bias' is the best available approximation
- * to the value of the TSC (mod 2^32) at the time of the i8254
- * counter transition that caused the clock interrupt that caused the
- * update. clock_latency() gives the time between the transition and
- * the update to within a few usec provided another such transition
- * hasn't occurred. We don't bother checking for counter overflow as
- * in microtime(), since if it occurs then we're close to losing clock
- * interrupts.
- */
-static __inline void
-cpu_clockupdate(volatile struct timeval *otime, struct timeval *ntime)
-{
- if (tsc_freq != 0) {
- u_int tsc_count; /* truncated */
- u_int i8254_count;
-
- disable_intr();
- i8254_count = clock_latency();
- tsc_count = rdtsc();
- tsc_bias = tsc_count
- - (u_int)
- (((unsigned long long)tsc_comultiplier
- * i8254_count)
- >> TSC_COMULTIPLIER_SHIFT);
- *otime = *ntime;
- enable_intr();
- } else
- *otime = *ntime;
-}
-
-#endif /* CLOCK_HAIR */
-
#endif /* KERNEL */
#endif /* !_MACHINE_CLOCK_H_ */
OpenPOWER on IntegriCloud