summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2008-03-26 22:12:00 +0000
committerphk <phk@FreeBSD.org>2008-03-26 22:12:00 +0000
commitc763b22a79ef10c0a961b24ae617980231681e06 (patch)
tree20d0b26b46164667259cfe3e02b7532d073ad9f7
parentf5d8b746903f5367297004175baffffdc7d01824 (diff)
downloadFreeBSD-src-c763b22a79ef10c0a961b24ae617980231681e06.zip
FreeBSD-src-c763b22a79ef10c0a961b24ae617980231681e06.tar.gz
Back in the good old days, PC's had random pieces of rock for
frequency generation and what frequency the generated was anyones guess. In general the 32.768kHz RTC clock x-tal was the best, because that was a regular wrist-watch Xtal, whereas the X-tal generating the ISA bus frequency was much lower quality, often costing as much as several cents a piece, so it made good sense to check the ISA bus frequency against the RTC clock. The other relevant property of those machines, is that they typically had no more than 16MB RAM. These days, CPU chips croak if their clocks are not tightly within specs and all necessary frequencies are derived from the master crystal by means if PLL's. Considering that it takes on average 1.5 second to calibrate the frequency of the i8254 counter, that more likely than not, we will not actually use the result of the calibration, and as the final clincher, we seldom use the i8254 for anything besides BEL in syscons anyway, it has become time to drop the calibration code. If you need to tell the system what frequency your i8254 runs, you can do so from the loader using hw.i8254.freq or using the sysctl kern.timecounter.tc.i8254.frequency.
-rw-r--r--sys/amd64/conf/NOTES13
-rw-r--r--sys/amd64/isa/clock.c112
-rw-r--r--sys/conf/options.amd642
-rw-r--r--sys/conf/options.i3862
-rw-r--r--sys/conf/options.pc982
-rw-r--r--sys/i386/conf/NOTES13
-rw-r--r--sys/i386/isa/clock.c122
-rw-r--r--sys/isa/atrtc.c122
-rw-r--r--sys/pc98/cbus/clock.c98
-rw-r--r--sys/pc98/cbus/pcrtc.c98
-rw-r--r--sys/pc98/conf/NOTES17
11 files changed, 0 insertions, 601 deletions
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index bfa1c9b..9be763e 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -88,19 +88,6 @@ options BPF_JITTER
#####################################################################
# CLOCK OPTIONS
-# The following options are used for debugging clock behavior only, and
-# should not be used for production systems.
-
-# CLK_CALIBRATION_LOOP causes clock calibration to be run in a loop at
-# startup until the user presses a key. (The i8254 clock is always
-# calibrated relative to the RTC (mc146818a) and this option causes the
-# calibration to be repeated.)
-options CLK_CALIBRATION_LOOP
-
-# CLK_USE_I8254_CALIBRATION causes the calibrated frequency of the i8254
-# clock to actually be used.
-options CLK_USE_I8254_CALIBRATION
-
# Provide read/write access to the memory in the clock chip.
device nvram # Access to rtc cmos via /dev/nvram
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 342fe18..5cc076e 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -430,86 +430,6 @@ readrtc(int port)
return(bcd2bin(rtcin(port)));
}
-static u_int
-calibrate_clocks(void)
-{
- u_int count, prev_count, tot_count;
- int sec, start_sec, timeout;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- if (!(rtcin(RTC_STATUSD) & RTCSD_PWR))
- goto fail;
- timeout = 100000000;
-
- /* Read the mc146818A seconds counter. */
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Wait for the mC146818A seconds counter to change. */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- if (sec != start_sec)
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Start keeping track of the i8254 counter. */
- prev_count = getit();
- if (prev_count == 0 || prev_count > i8254_max_count)
- goto fail;
- tot_count = 0;
-
- /*
- * Wait for the mc146818A seconds counter to change. Read the i8254
- * counter for each iteration since this is convenient and only
- * costs a few usec of inaccuracy. The timing of the final reads
- * of the counters almost matches the timing of the initial reads,
- * so the main cause of inaccuracy is the varying latency from
- * inside getit() or rtcin(RTC_STATUSA) to the beginning of the
- * rtcin(RTC_SEC) that returns a changed seconds count. The
- * maximum inaccuracy from this cause is < 10 usec on 486's.
- */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP))
- sec = rtcin(RTC_SEC);
- count = getit();
- if (count == 0 || count > i8254_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - i8254_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- i8254_freq);
- return (i8254_freq);
-}
-
static void
set_i8254_freq(u_int freq, int intr_freq)
{
@@ -547,42 +467,10 @@ i8254_init(void)
void
startrtclock()
{
- u_int delta, freq;
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > i8254_freq ? freq - i8254_freq : i8254_freq - freq;
- if (delta < i8254_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = i8254_freq;
-#endif
- i8254_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, i8254_freq);
- }
-
set_i8254_freq(i8254_freq, hz);
tc_init(&i8254_timecounter);
diff --git a/sys/conf/options.amd64 b/sys/conf/options.amd64
index 258b0b7..b05b770 100644
--- a/sys/conf/options.amd64
+++ b/sys/conf/options.amd64
@@ -21,8 +21,6 @@ LINPROCFS opt_dontuse.h
LINSYSFS opt_dontuse.h
NDISAPI opt_dontuse.h
-CLK_CALIBRATION_LOOP opt_clock.h
-CLK_USE_I8254_CALIBRATION opt_clock.h
TIMER_FREQ opt_clock.h
# options for serial support
diff --git a/sys/conf/options.i386 b/sys/conf/options.i386
index 3fc3fb1..8cdaa5e 100644
--- a/sys/conf/options.i386
+++ b/sys/conf/options.i386
@@ -36,8 +36,6 @@ KVA_PAGES opt_global.h
# Physical address extensions and support for >4G ram. As above.
PAE opt_global.h
-CLK_CALIBRATION_LOOP opt_clock.h
-CLK_USE_I8254_CALIBRATION opt_clock.h
TIMER_FREQ opt_clock.h
CPU_ATHLON_SSE_HACK opt_cpu.h
diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98
index 605870a..d910ff2 100644
--- a/sys/conf/options.pc98
+++ b/sys/conf/options.pc98
@@ -31,8 +31,6 @@ PECOFF_SUPPORT opt_dontuse.h
# Change KVM size. Changes things all over the kernel.
KVA_PAGES opt_global.h
-CLK_CALIBRATION_LOOP opt_clock.h
-CLK_USE_I8254_CALIBRATION opt_clock.h
TIMER_FREQ opt_clock.h
# options for serial support
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 7fac7b8..c8401d0 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -259,19 +259,6 @@ options BPF_JITTER
#####################################################################
# CLOCK OPTIONS
-# The following options are used for debugging clock behavior only, and
-# should not be used for production systems.
-
-# CLK_CALIBRATION_LOOP causes clock calibration to be run in a loop at
-# startup until the user presses a key. (The i8254 clock is always
-# calibrated relative to the RTC (mc146818a) and this option causes the
-# calibration to be repeated.)
-options CLK_CALIBRATION_LOOP
-
-# CLK_USE_I8254_CALIBRATION causes the calibrated frequency of the i8254
-# clock to actually be used.
-options CLK_USE_I8254_CALIBRATION
-
# Provide read/write access to the memory in the clock chip.
device nvram # Access to rtc cmos via /dev/nvram
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index d5aa118..09a9dc4 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -56,34 +56,24 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>
#include <sys/proc.h>
-#include <sys/time.h>
#include <sys/timetc.h>
-#include <sys/uio.h>
#include <sys/kernel.h>
-#include <sys/limits.h>
#include <sys/module.h>
#include <sys/sched.h>
#include <sys/sysctl.h>
-#include <sys/cons.h>
-#include <sys/power.h>
#include <machine/clock.h>
#include <machine/cpu.h>
-#include <machine/cputypes.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
#include <machine/md_var.h>
-#include <machine/psl.h>
#ifdef DEV_APIC
#include <machine/apicvar.h>
#endif
-#include <machine/specialreg.h>
#include <machine/ppireg.h>
#include <machine/timerreg.h>
@@ -445,86 +435,6 @@ readrtc(int port)
return(bcd2bin(rtcin(port)));
}
-static u_int
-calibrate_clocks(void)
-{
- u_int count, prev_count, tot_count;
- int sec, start_sec, timeout;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- if (!(rtcin(RTC_STATUSD) & RTCSD_PWR))
- goto fail;
- timeout = 100000000;
-
- /* Read the mc146818A seconds counter. */
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Wait for the mC146818A seconds counter to change. */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- if (sec != start_sec)
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Start keeping track of the i8254 counter. */
- prev_count = getit();
- if (prev_count == 0 || prev_count > i8254_max_count)
- goto fail;
- tot_count = 0;
-
- /*
- * Wait for the mc146818A seconds counter to change. Read the i8254
- * counter for each iteration since this is convenient and only
- * costs a few usec of inaccuracy. The timing of the final reads
- * of the counters almost matches the timing of the initial reads,
- * so the main cause of inaccuracy is the varying latency from
- * inside getit() or rtcin(RTC_STATUSA) to the beginning of the
- * rtcin(RTC_SEC) that returns a changed seconds count. The
- * maximum inaccuracy from this cause is < 10 usec on 486's.
- */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP))
- sec = rtcin(RTC_SEC);
- count = getit();
- if (count == 0 || count > i8254_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - i8254_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- i8254_freq);
- return (i8254_freq);
-}
-
static void
set_i8254_freq(u_int freq, int intr_freq)
{
@@ -601,42 +511,10 @@ i8254_init(void)
void
startrtclock()
{
- u_int delta, freq;
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > i8254_freq ? freq - i8254_freq : i8254_freq - freq;
- if (delta < i8254_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = i8254_freq;
-#endif
- i8254_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, i8254_freq);
- }
-
set_i8254_freq(i8254_freq, hz);
tc_init(&i8254_timecounter);
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index d5aa118..09a9dc4 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -56,34 +56,24 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>
#include <sys/proc.h>
-#include <sys/time.h>
#include <sys/timetc.h>
-#include <sys/uio.h>
#include <sys/kernel.h>
-#include <sys/limits.h>
#include <sys/module.h>
#include <sys/sched.h>
#include <sys/sysctl.h>
-#include <sys/cons.h>
-#include <sys/power.h>
#include <machine/clock.h>
#include <machine/cpu.h>
-#include <machine/cputypes.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
#include <machine/md_var.h>
-#include <machine/psl.h>
#ifdef DEV_APIC
#include <machine/apicvar.h>
#endif
-#include <machine/specialreg.h>
#include <machine/ppireg.h>
#include <machine/timerreg.h>
@@ -445,86 +435,6 @@ readrtc(int port)
return(bcd2bin(rtcin(port)));
}
-static u_int
-calibrate_clocks(void)
-{
- u_int count, prev_count, tot_count;
- int sec, start_sec, timeout;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- if (!(rtcin(RTC_STATUSD) & RTCSD_PWR))
- goto fail;
- timeout = 100000000;
-
- /* Read the mc146818A seconds counter. */
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Wait for the mC146818A seconds counter to change. */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- if (sec != start_sec)
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Start keeping track of the i8254 counter. */
- prev_count = getit();
- if (prev_count == 0 || prev_count > i8254_max_count)
- goto fail;
- tot_count = 0;
-
- /*
- * Wait for the mc146818A seconds counter to change. Read the i8254
- * counter for each iteration since this is convenient and only
- * costs a few usec of inaccuracy. The timing of the final reads
- * of the counters almost matches the timing of the initial reads,
- * so the main cause of inaccuracy is the varying latency from
- * inside getit() or rtcin(RTC_STATUSA) to the beginning of the
- * rtcin(RTC_SEC) that returns a changed seconds count. The
- * maximum inaccuracy from this cause is < 10 usec on 486's.
- */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP))
- sec = rtcin(RTC_SEC);
- count = getit();
- if (count == 0 || count > i8254_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - i8254_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- i8254_freq);
- return (i8254_freq);
-}
-
static void
set_i8254_freq(u_int freq, int intr_freq)
{
@@ -601,42 +511,10 @@ i8254_init(void)
void
startrtclock()
{
- u_int delta, freq;
writertc(RTC_STATUSA, rtc_statusa);
writertc(RTC_STATUSB, RTCSB_24HR);
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > i8254_freq ? freq - i8254_freq : i8254_freq - freq;
- if (delta < i8254_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = i8254_freq;
-#endif
- i8254_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, i8254_freq);
- }
-
set_i8254_freq(i8254_freq, hz);
tc_init(&i8254_timecounter);
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 38f9854..05d34c5 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$");
#include <sys/limits.h>
#include <sys/module.h>
#include <sys/sysctl.h>
-#include <sys/cons.h>
#include <sys/power.h>
#include <machine/clock.h>
@@ -325,71 +324,6 @@ DELAY(int n)
#endif
}
-static u_int
-calibrate_clocks(void)
-{
- int timeout;
- u_int count, prev_count, tot_count;
- u_short sec, start_sec;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- /* Check ARTIC. */
- if (!(PC98_SYSTEM_PARAMETER(0x458) & 0x80) &&
- !(PC98_SYSTEM_PARAMETER(0x45b) & 0x04))
- goto fail;
- timeout = 100000000;
-
- /* Read the ARTIC. */
- sec = inw(0x5e);
-
- /* Wait for the ARTIC to changes. */
- start_sec = sec;
- for (;;) {
- sec = inw(0x5e);
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- /* Start keeping track of the i8254 counter. */
- prev_count = getit();
- if (prev_count == 0 || prev_count > i8254_max_count)
- goto fail;
- tot_count = 0;
-
- start_sec = sec;
- for (;;) {
- sec = inw(0x5e);
- count = getit();
- if (count == 0 || count > i8254_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - i8254_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if ((sec == start_sec + 1200) || /* 1200 = 307.2KHz >> 8 */
- (sec < start_sec &&
- (u_int)sec + 0x10000 == (u_int)start_sec + 1200))
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- i8254_freq);
- return (i8254_freq);
-}
-
static void
set_i8254_freq(u_int freq, int intr_freq)
{
@@ -459,38 +393,6 @@ i8254_init(void)
void
startrtclock()
{
- u_int delta, freq;
-
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > i8254_freq ? freq - i8254_freq : i8254_freq - freq;
- if (delta < i8254_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = i8254_freq;
-#endif
- i8254_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, i8254_freq);
- }
set_i8254_freq(i8254_freq, hz);
tc_init(&i8254_timecounter);
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 38f9854..05d34c5 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$");
#include <sys/limits.h>
#include <sys/module.h>
#include <sys/sysctl.h>
-#include <sys/cons.h>
#include <sys/power.h>
#include <machine/clock.h>
@@ -325,71 +324,6 @@ DELAY(int n)
#endif
}
-static u_int
-calibrate_clocks(void)
-{
- int timeout;
- u_int count, prev_count, tot_count;
- u_short sec, start_sec;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- /* Check ARTIC. */
- if (!(PC98_SYSTEM_PARAMETER(0x458) & 0x80) &&
- !(PC98_SYSTEM_PARAMETER(0x45b) & 0x04))
- goto fail;
- timeout = 100000000;
-
- /* Read the ARTIC. */
- sec = inw(0x5e);
-
- /* Wait for the ARTIC to changes. */
- start_sec = sec;
- for (;;) {
- sec = inw(0x5e);
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- /* Start keeping track of the i8254 counter. */
- prev_count = getit();
- if (prev_count == 0 || prev_count > i8254_max_count)
- goto fail;
- tot_count = 0;
-
- start_sec = sec;
- for (;;) {
- sec = inw(0x5e);
- count = getit();
- if (count == 0 || count > i8254_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - i8254_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if ((sec == start_sec + 1200) || /* 1200 = 307.2KHz >> 8 */
- (sec < start_sec &&
- (u_int)sec + 0x10000 == (u_int)start_sec + 1200))
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- i8254_freq);
- return (i8254_freq);
-}
-
static void
set_i8254_freq(u_int freq, int intr_freq)
{
@@ -459,38 +393,6 @@ i8254_init(void)
void
startrtclock()
{
- u_int delta, freq;
-
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > i8254_freq ? freq - i8254_freq : i8254_freq - freq;
- if (delta < i8254_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = i8254_freq;
-#endif
- i8254_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, i8254_freq);
- }
set_i8254_freq(i8254_freq, hz);
tc_init(&i8254_timecounter);
diff --git a/sys/pc98/conf/NOTES b/sys/pc98/conf/NOTES
index b5c3b00..6f50f50 100644
--- a/sys/pc98/conf/NOTES
+++ b/sys/pc98/conf/NOTES
@@ -197,23 +197,6 @@ options BPF_JITTER
#####################################################################
-# CLOCK OPTIONS
-
-# The following options are used for debugging clock behavior only, and
-# should not be used for production systems.
-
-# CLK_CALIBRATION_LOOP causes clock calibration to be run in a loop at
-# startup until the user presses a key. (The i8254 clock is always
-# calibrated relative to the RTC (mc146818a) and this option causes the
-# calibration to be repeated.)
-options CLK_CALIBRATION_LOOP
-
-# CLK_USE_I8254_CALIBRATION causes the calibrated frequency of the i8254
-# clock to actually be used.
-options CLK_USE_I8254_CALIBRATION
-
-
-#####################################################################
# MISCELLANEOUS DEVICES AND OPTIONS
#
OpenPOWER on IntegriCloud