diff options
Diffstat (limited to 'sys/i386/isa/clock.c')
-rw-r--r-- | sys/i386/isa/clock.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 6b787b8..9fb163f 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.135 1999/05/29 06:57:55 phk Exp $ + * $Id: clock.c,v 1.136 1999/05/31 18:35:59 dfr Exp $ */ /* @@ -585,6 +585,7 @@ readrtc(int port) static u_int calibrate_clocks(void) { + u_int64_t old_tsc; u_int count, prev_count, tot_count; int sec, start_sec, timeout; @@ -623,7 +624,7 @@ calibrate_clocks(void) tot_count = 0; if (tsc_present) - wrmsr(0x10, 0LL); /* XXX 0x10 is the MSR for the TSC */ + old_tsc = rdtsc(); /* * Wait for the mc146818A seconds counter to change. Read the i8254 @@ -658,7 +659,7 @@ calibrate_clocks(void) * similar to those for the i8254 clock. */ if (tsc_present) - tsc_freq = rdtsc(); + tsc_freq = rdtsc() - old_tsc; if (bootverbose) { if (tsc_present) @@ -762,9 +763,10 @@ startrtclock() * clock failed. Do a less accurate calibration relative * to the i8254 clock. */ - wrmsr(0x10, 0LL); /* XXX */ + u_int64_t old_tsc = rdtsc(); + DELAY(1000000); - tsc_freq = rdtsc(); + tsc_freq = rdtsc() - old_tsc; #ifdef CLK_USE_TSC_CALIBRATION if (bootverbose) printf("TSC clock: %u Hz (Method B)\n", tsc_freq); |