aboutsummaryrefslogtreecommitdiff
path: root/sys/pc98/cbus/pcrtc.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2008-03-26 22:12:00 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2008-03-26 22:12:00 +0000
commitdad3b6c6fd41ae85474bda91ea5282c8cca3d8c5 (patch)
tree20d0b26b46164667259cfe3e02b7532d073ad9f7 /sys/pc98/cbus/pcrtc.c
parent1d73a9dc742ef7fdbe616a7ea23b2c623a1d2557 (diff)
downloadsrc-dad3b6c6fd41ae85474bda91ea5282c8cca3d8c5.tar.gz
src-dad3b6c6fd41ae85474bda91ea5282c8cca3d8c5.zip
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.
Notes
Notes: svn path=/head/; revision=177651
Diffstat (limited to 'sys/pc98/cbus/pcrtc.c')
-rw-r--r--sys/pc98/cbus/pcrtc.c98
1 files changed, 0 insertions, 98 deletions
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 38f9854f40f3..05d34c5ec80a 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);