MFi386: revision 1.212.

This commit is contained in:
Yoshihiro Takahashi 2004-07-11 13:46:10 +00:00
parent fac5bedd49
commit 167b6b11dd
3 changed files with 33 additions and 39 deletions

View file

@ -57,6 +57,7 @@
#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>
@ -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

View file

@ -57,6 +57,7 @@
#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>
@ -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

View file

@ -57,6 +57,7 @@
#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>
@ -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