summaryrefslogtreecommitdiffstats
path: root/sys/pc98/cbus
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2007-01-23 08:48:26 +0000
committerbde <bde@FreeBSD.org>2007-01-23 08:48:26 +0000
commit3f550f19b818d619250c111bf839fe608ec3b224 (patch)
tree80c5b71ed106f040a78fa8a81aa0a00044aaac2a /sys/pc98/cbus
parent474b917526db60cd113b34f9bbb30e8d252bae24 (diff)
downloadFreeBSD-src-3f550f19b818d619250c111bf839fe608ec3b224.zip
FreeBSD-src-3f550f19b818d619250c111bf839fe608ec3b224.tar.gz
Oops, pc98 is independent of i386 for clock.c and machdep.c but not
for clock.h, so changing th i386 clock.h broke it. MFi386 (not tested): Cleaned up declaration and initialization of clock_lock. It is only used by clock code, so don't export it to the world for machdep.c to initialize. There is a minor problem initializing it before it is used, since although clock initialization is split up so that parts of it can be done early, the first part was never done early enough to actually work. Split it up a bit more and do the first part as late as possible to document the necessary order. The functions that implement the split are still bogusly exported. Cleaned up initialization of the i8254 clock hardware using the new split. Actually initialize it early enough, and don't work around it not being initialized in DELAY() when DELAY() is called early for initialization of some console drivers. This unfortunately moves a little more code before the early debugger breakpoint so that it is harder to debug. The ordering of console and related initialization is delicate because we want to do as little as possible before the breakpoint, but must initialize a console.
Diffstat (limited to 'sys/pc98/cbus')
-rw-r--r--sys/pc98/cbus/clock.c21
-rw-r--r--sys/pc98/cbus/pcrtc.c21
2 files changed, 18 insertions, 24 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 8706a99..1570572 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -263,13 +263,6 @@ DELAY(int n)
printf("DELAY(%d)...", n);
#endif
/*
- * Guard against the timer being uninitialized if we are called
- * early for console i/o.
- */
- if (timer0_max_count == 0)
- set_timer_freq(timer_freq, hz);
-
- /*
* Read the counter first, so that the rest of the setup overhead is
* counted. Guess the initial overhead is 20 usec (on most systems it
* takes about 1.5 usec for each of the i/o's in getit(). The loop
@@ -511,10 +504,15 @@ timer_restore(void)
i8254_restore(); /* restore timer_freq and hz */
}
-/*
- * Initialize 8254 timer 0 early so that it can be used in DELAY().
- * XXX initialization of other timers is unintentionally left blank.
- */
+/* This is separate from startrtclock() so that it can be called early. */
+void
+i8254_init(void)
+{
+
+ mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_NOPROFILE);
+ set_timer_freq(timer_freq, hz);
+}
+
void
startrtclock()
{
@@ -526,7 +524,6 @@ startrtclock()
else
timer_freq = 2457600L; /* 2.4576 MHz */
- set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 8706a99..1570572 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -263,13 +263,6 @@ DELAY(int n)
printf("DELAY(%d)...", n);
#endif
/*
- * Guard against the timer being uninitialized if we are called
- * early for console i/o.
- */
- if (timer0_max_count == 0)
- set_timer_freq(timer_freq, hz);
-
- /*
* Read the counter first, so that the rest of the setup overhead is
* counted. Guess the initial overhead is 20 usec (on most systems it
* takes about 1.5 usec for each of the i/o's in getit(). The loop
@@ -511,10 +504,15 @@ timer_restore(void)
i8254_restore(); /* restore timer_freq and hz */
}
-/*
- * Initialize 8254 timer 0 early so that it can be used in DELAY().
- * XXX initialization of other timers is unintentionally left blank.
- */
+/* This is separate from startrtclock() so that it can be called early. */
+void
+i8254_init(void)
+{
+
+ mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_NOPROFILE);
+ set_timer_freq(timer_freq, hz);
+}
+
void
startrtclock()
{
@@ -526,7 +524,6 @@ startrtclock()
else
timer_freq = 2457600L; /* 2.4576 MHz */
- set_timer_freq(timer_freq, hz);
freq = calibrate_clocks();
#ifdef CLK_CALIBRATION_LOOP
if (bootverbose) {
OpenPOWER on IntegriCloud