From 167b6b11ddc14bb10cd5aa6a27d141de5551fc4e Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sun, 11 Jul 2004 13:46:10 +0000 Subject: [PATCH] MFi386: revision 1.212. --- sys/pc98/cbus/clock.c | 24 +++++++++++------------- sys/pc98/cbus/pcrtc.c | 24 +++++++++++------------- sys/pc98/pc98/clock.c | 24 +++++++++++------------- 3 files changed, 33 insertions(+), 39 deletions(-) diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index d6e57eccacc..dbb986ccde9 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -377,7 +378,10 @@ getit(void) { int high, low; - mtx_lock_spin(&clock_lock); +#ifdef KDB + if (!kdb_active) +#endif + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -385,7 +389,11 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); - mtx_unlock_spin(&clock_lock); +#ifdef KDB + if (!kdb_active) +#endif + mtx_unlock_spin(&clock_lock); + return ((high << 8) | low); } @@ -426,18 +434,8 @@ 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. */ -#ifdef DDB - if (db_active) - prev_tick = 0; - else -#endif - prev_tick = getit(); + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index d6e57eccacc..dbb986ccde9 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -377,7 +378,10 @@ getit(void) { int high, low; - mtx_lock_spin(&clock_lock); +#ifdef KDB + if (!kdb_active) +#endif + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -385,7 +389,11 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); - mtx_unlock_spin(&clock_lock); +#ifdef KDB + if (!kdb_active) +#endif + mtx_unlock_spin(&clock_lock); + return ((high << 8) | low); } @@ -426,18 +434,8 @@ 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. */ -#ifdef DDB - if (db_active) - prev_tick = 0; - else -#endif - prev_tick = getit(); + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c index d6e57eccacc..dbb986ccde9 100644 --- a/sys/pc98/pc98/clock.c +++ b/sys/pc98/pc98/clock.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -377,7 +378,10 @@ getit(void) { int high, low; - mtx_lock_spin(&clock_lock); +#ifdef KDB + if (!kdb_active) +#endif + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -385,7 +389,11 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); - mtx_unlock_spin(&clock_lock); +#ifdef KDB + if (!kdb_active) +#endif + mtx_unlock_spin(&clock_lock); + return ((high << 8) | low); } @@ -426,18 +434,8 @@ 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. */ -#ifdef DDB - if (db_active) - prev_tick = 0; - else -#endif - prev_tick = getit(); + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point