diff options
author | nyan <nyan@FreeBSD.org> | 2004-07-13 12:58:36 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2004-07-13 12:58:36 +0000 |
commit | 72619ae6d5c8cd10bc420ae669927d9e3c1221e8 (patch) | |
tree | ff1f31f6455518881157a179c00855860a3da58d /sys/pc98 | |
parent | ec7d60de6989afd395a03fbf1d0f4b715b1fdac2 (diff) | |
download | FreeBSD-src-72619ae6d5c8cd10bc420ae669927d9e3c1221e8.zip FreeBSD-src-72619ae6d5c8cd10bc420ae669927d9e3c1221e8.tar.gz |
MFi386: revision 1.213.
Fix miss merging in previous change.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/cbus/clock.c | 36 | ||||
-rw-r--r-- | sys/pc98/cbus/pcrtc.c | 36 | ||||
-rw-r--r-- | sys/pc98/pc98/clock.c | 36 |
3 files changed, 60 insertions, 48 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index dbb986c..72a968e 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -55,15 +55,15 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> -#include <sys/limits.h> #include <sys/lock.h> #include <sys/kdb.h> -#include <sys/module.h> #include <sys/mutex.h> #include <sys/proc.h> #include <sys/time.h> #include <sys/timetc.h> #include <sys/kernel.h> +#include <sys/limits.h> +#include <sys/module.h> #include <sys/sysctl.h> #include <sys/cons.h> #include <sys/power.h> @@ -74,7 +74,6 @@ #include <machine/intr_machdep.h> #include <machine/md_var.h> #include <machine/psl.h> - #if defined(SMP) #include <machine/smp.h> #endif @@ -378,10 +377,7 @@ getit(void) { int high, low; -#ifdef KDB - if (!kdb_active) -#endif - mtx_lock_spin(&clock_lock); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -389,11 +385,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); -#ifdef KDB - if (!kdb_active) -#endif - mtx_unlock_spin(&clock_lock); - + mtx_unlock_spin(&clock_lock); return ((high << 8) | low); } @@ -434,8 +426,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 do + * locking for many reasons, but it calls here for at least atkbd + * input. */ - prev_tick = getit(); +#ifdef KDB + if (kdb_active) + prev_tick = 1; + else +#endif + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point @@ -462,10 +464,12 @@ DELAY(int n) / 1000000; while (ticks_left > 0) { -#ifdef DDB - if (db_active) { +#ifdef KDB + if (kdb_active) { outb(0x5f, 0); - tick = prev_tick + 1; + tick = prev_tick - 1; + if (tick <= 0) + tick = timer0_max_count; } else #endif tick = getit(); diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index dbb986c..72a968e 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -55,15 +55,15 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> -#include <sys/limits.h> #include <sys/lock.h> #include <sys/kdb.h> -#include <sys/module.h> #include <sys/mutex.h> #include <sys/proc.h> #include <sys/time.h> #include <sys/timetc.h> #include <sys/kernel.h> +#include <sys/limits.h> +#include <sys/module.h> #include <sys/sysctl.h> #include <sys/cons.h> #include <sys/power.h> @@ -74,7 +74,6 @@ #include <machine/intr_machdep.h> #include <machine/md_var.h> #include <machine/psl.h> - #if defined(SMP) #include <machine/smp.h> #endif @@ -378,10 +377,7 @@ getit(void) { int high, low; -#ifdef KDB - if (!kdb_active) -#endif - mtx_lock_spin(&clock_lock); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -389,11 +385,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); -#ifdef KDB - if (!kdb_active) -#endif - mtx_unlock_spin(&clock_lock); - + mtx_unlock_spin(&clock_lock); return ((high << 8) | low); } @@ -434,8 +426,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 do + * locking for many reasons, but it calls here for at least atkbd + * input. */ - prev_tick = getit(); +#ifdef KDB + if (kdb_active) + prev_tick = 1; + else +#endif + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point @@ -462,10 +464,12 @@ DELAY(int n) / 1000000; while (ticks_left > 0) { -#ifdef DDB - if (db_active) { +#ifdef KDB + if (kdb_active) { outb(0x5f, 0); - tick = prev_tick + 1; + tick = prev_tick - 1; + if (tick <= 0) + tick = timer0_max_count; } else #endif tick = getit(); diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c index dbb986c..72a968e 100644 --- a/sys/pc98/pc98/clock.c +++ b/sys/pc98/pc98/clock.c @@ -55,15 +55,15 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> -#include <sys/limits.h> #include <sys/lock.h> #include <sys/kdb.h> -#include <sys/module.h> #include <sys/mutex.h> #include <sys/proc.h> #include <sys/time.h> #include <sys/timetc.h> #include <sys/kernel.h> +#include <sys/limits.h> +#include <sys/module.h> #include <sys/sysctl.h> #include <sys/cons.h> #include <sys/power.h> @@ -74,7 +74,6 @@ #include <machine/intr_machdep.h> #include <machine/md_var.h> #include <machine/psl.h> - #if defined(SMP) #include <machine/smp.h> #endif @@ -378,10 +377,7 @@ getit(void) { int high, low; -#ifdef KDB - if (!kdb_active) -#endif - mtx_lock_spin(&clock_lock); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -389,11 +385,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); -#ifdef KDB - if (!kdb_active) -#endif - mtx_unlock_spin(&clock_lock); - + mtx_unlock_spin(&clock_lock); return ((high << 8) | low); } @@ -434,8 +426,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 do + * locking for many reasons, but it calls here for at least atkbd + * input. */ - prev_tick = getit(); +#ifdef KDB + if (kdb_active) + prev_tick = 1; + else +#endif + prev_tick = getit(); n -= 0; /* XXX actually guess no initial overhead */ /* * Calculate (n * (timer_freq / 1e6)) without using floating point @@ -462,10 +464,12 @@ DELAY(int n) / 1000000; while (ticks_left > 0) { -#ifdef DDB - if (db_active) { +#ifdef KDB + if (kdb_active) { outb(0x5f, 0); - tick = prev_tick + 1; + tick = prev_tick - 1; + if (tick <= 0) + tick = timer0_max_count; } else #endif tick = getit(); |