From 7ab95d0bab5a696c9cc7f2ade873106fb53a772f Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 16 Mar 1998 10:06:58 +0000 Subject: Be less draconian about the TSC if APM is configured, use it for timecounting if APM-BIOS isn't found. Be just as draconian about SMP as always, but explain it better. --- sys/i386/isa/clock.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'sys/i386/isa/clock.c') diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 607b34029f7d..65881655b0a3 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.115 1998/03/05 21:45:48 tegge Exp $ + * $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $ */ /* @@ -69,6 +69,10 @@ #include #include #include +#if NAPM > 0 +#include +#include +#endif #ifdef APIC_IO #include #endif @@ -689,13 +693,6 @@ startrtclock() else tsc_present = 0; -#ifdef SMP - tsc_present = 0; -#endif -#if NAPM > 0 - tsc_present = 0; -#endif - writertc(RTC_STATUSA, rtc_statusa); writertc(RTC_STATUSB, RTCSB_24HR); @@ -758,10 +755,36 @@ startrtclock() printf("TSC clock: %u Hz (Method B)\n", tsc_freq); #endif } + +#if !defined(SMP) + /* + * We can not use the TSC in SMP mode, until we figure out a + * cheap (impossible), reliable and precise (yeah right!) way + * to synchronize the TSCs of all the CPUs. + * Curse Intel for leaving the counter out of the I/O APIC. + */ + +#if NAPM > 0 + /* + * We can not use the TSC if we found an APM bios. Too many + * of them lie about their ability&intention to fiddle the CPU + * clock for us to rely on this. Precise timekeeping on an + * APM'ed machine is at best a fools pursuit anyway, since + * any and all of the time spent in various SMM code can't + * be reliably accounted for. Reading the RTC is your only + * source of reliable time info. The i8254 looses too of course + * but we need to have some kind of time... + */ + if (apm_version != APMINI_CANTFIND) + return; +#endif /* NAPM > 0 */ + if (tsc_present && tsc_freq != 0) { tsc_timecounter[0].frequency = tsc_freq; init_timecounter(tsc_timecounter); } + +#endif /* !defined(SMP) */ } /* -- cgit v1.2.3