summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/clock.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-11-29 19:57:22 +0000
committerwollman <wollman@FreeBSD.org>1995-11-29 19:57:22 +0000
commit0b986693ce58208f4c247762f09f25d55ea20507 (patch)
tree0c68faafac80cd0928f1570233bb01cf233b1826 /sys/i386/include/clock.h
parent8476f980ecdc58fda564f3280af8a5f2003a5515 (diff)
downloadFreeBSD-src-0b986693ce58208f4c247762f09f25d55ea20507.zip
FreeBSD-src-0b986693ce58208f4c247762f09f25d55ea20507.tar.gz
Fix Pentium CPU rate diagnosis:
- Don't print out meaningless iCOMP numbers, those are for droids. - Use a shorter wait to determine clock rate to avoid deficiencies in DELAY(). - Use a fixed-point representation with 8 bits of fraction to store the rate and rationalize the variable name. It would be possible to use even more fraction if it turns out to be worthwhile (I rather doubt it). The question of source code arrangement remains unaddressed.
Diffstat (limited to 'sys/i386/include/clock.h')
-rw-r--r--sys/i386/include/clock.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h
index 96476a7..c231f5e 100644
--- a/sys/i386/include/clock.h
+++ b/sys/i386/include/clock.h
@@ -2,6 +2,8 @@
* Kernel interface to machine-dependent clock driver.
* Garrett Wollman, September 1994.
* This file is in the public domain.
+ *
+ * $Id$
*/
#ifndef _MACHINE_CLOCK_H_
@@ -22,7 +24,7 @@
*/
#define CPU_CLOCKUPDATE(otime, ntime) \
do { \
- if(pentium_mhz) { \
+ if(i586_ctr_rate) { \
disable_intr(); \
i586_ctr_bias = i586_last_tick; \
*(otime) = *(ntime); \
@@ -39,6 +41,8 @@
#define CPU_THISTICKLEN(dflt) dflt
#endif
+#define I586_CTR_RATE_SHIFT 8
+
#if defined(KERNEL) && !defined(LOCORE)
#include <sys/cdefs.h>
#include <machine/frame.h>
@@ -51,7 +55,7 @@
extern int adjkerntz;
extern int disable_rtc_set;
#ifdef I586_CPU
-extern int pentium_mhz;
+extern unsigned i586_ctr_rate; /* fixed point */
extern long long i586_last_tick;
extern long long i586_ctr_bias;
#endif
@@ -72,10 +76,11 @@ cpu_thisticklen(u_long dflt)
long long old;
long rv;
- if (pentium_mhz) {
+ if (i586_ctr_rate) {
old = i586_last_tick;
I586_CYCLECTR(i586_last_tick);
- rv = (i586_last_tick - old) / pentium_mhz;
+ rv = ((i586_last_tick - old) << I586_CTR_RATE_SHIFT)
+ / i586_ctr_rate;
} else {
rv = dflt;
}
OpenPOWER on IntegriCloud