summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-09-22 21:56:48 +0000
committerpeter <peter@FreeBSD.org>2003-09-22 21:56:48 +0000
commit202f4eece1c4620798a768857dd94e475d44a899 (patch)
treea71d40438c3a8463a71f3248fb752dd3e15f954f
parent9cd1883cc6b92fce290a70a6ce3787cac3ef1286 (diff)
downloadFreeBSD-src-202f4eece1c4620798a768857dd94e475d44a899.zip
FreeBSD-src-202f4eece1c4620798a768857dd94e475d44a899.tar.gz
MFi386: machdep.c:1.570 clock.c:1.204 by bde: Quick fix for calling DELAY
for ddb input in some atkbd-based console drivers. ddb must not use any normal locks but DELAY() normally calls getit() which needs clock_lock. This also removes the need for recursion on clock_lock.
-rw-r--r--sys/amd64/amd64/machdep.c2
-rw-r--r--sys/amd64/isa/clock.c20
2 files changed, 19 insertions, 3 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 86fff6c..1f5948b 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1166,7 +1166,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
* under witness.
*/
mutex_init();
- mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_RECURSE);
+ mtx_init(&clock_lock, "clk", NULL, MTX_SPIN);
mtx_init(&icu_lock, "icu", NULL, MTX_SPIN | MTX_NOWITNESS);
/* exceptions */
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 2ed1544..c88e488 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -413,8 +413,18 @@ DELAY(int n)
* takes about 1.5 usec for each of the i/o's in getit(). The loop
* takes about 6 usec on a 486/33 and 13 usec on a 386/20. The
* multiplications and divisions to scale the count take a while).
+ *
+ * However, if ddb is active then use a fake counter since reading
+ * the i8254 counter involves acquiring a lock. ddb must not go
+ * locking for many reasons, but it calls here for at least atkbd
+ * input.
*/
- prev_tick = getit();
+#ifdef DDB
+ if (db_active)
+ prev_tick = 0;
+ else
+#endif
+ prev_tick = getit();
n -= 0; /* XXX actually guess no initial overhead */
/*
* Calculate (n * (timer_freq / 1e6)) without using floating point
@@ -441,7 +451,13 @@ DELAY(int n)
/ 1000000;
while (ticks_left > 0) {
- tick = getit();
+#ifdef DDB
+ if (db_active) {
+ inb(0x84);
+ tick = prev_tick + 1;
+ } else
+#endif
+ tick = getit();
#ifdef DELAYDEBUG
++getit_calls;
#endif
OpenPOWER on IntegriCloud