diff options
author | phk <phk@FreeBSD.org> | 1998-03-16 10:06:58 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1998-03-16 10:06:58 +0000 |
commit | 5fdc15af6dcb4803a94d776b15ae12820995c1a6 (patch) | |
tree | 9477701708d1391de00707f376f39c4ac6e8d083 /sys/isa | |
parent | b3e0fb3e16f57cd1cd09cd95b17e0dd4e7688e97 (diff) | |
download | FreeBSD-src-5fdc15af6dcb4803a94d776b15ae12820995c1a6.zip FreeBSD-src-5fdc15af6dcb4803a94d776b15ae12820995c1a6.tar.gz |
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.
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/atrtc.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index 607b340..6588165 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.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 <machine/ipl.h> #include <machine/limits.h> #include <machine/md_var.h> +#if NAPM > 0 +#include <machine/apm_bios.h> +#include <i386/apm/apm_setup.h> +#endif #ifdef APIC_IO #include <machine/segments.h> #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) */ } /* |