Change COM_LOCK/COM_UNLOCK to a regular mutex - still conditional on
SMP being defined.
This commit is contained in:
parent
19fe482675
commit
cf8f8229d0
@ -77,24 +77,6 @@
|
||||
|
||||
#define CDEV_MAJOR 162
|
||||
|
||||
#ifdef SMP
|
||||
#include <sys/lock.h>
|
||||
#include <machine/smptests.h> /* USE_COMLOCK ? */
|
||||
#ifdef USE_COMLOCK
|
||||
extern struct mtx com_mtx;
|
||||
#define COM_LOCK() mtx_lock_spin(&com_mtx)
|
||||
#define COM_UNLOCK() mtx_unlock_spin(&com_mtx)
|
||||
#else
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
#endif /* USE_COMLOCK */
|
||||
#else
|
||||
#define COM_LOCK()
|
||||
#define COM_UNLOCK()
|
||||
#endif /* SMP */
|
||||
|
||||
/*#define DIGI_INTERRUPT*/
|
||||
|
||||
#define CTRL_DEV 0x800000
|
||||
#define CALLOUT_MASK 0x400000
|
||||
#define CONTROL_INIT_STATE 0x100000
|
||||
@ -107,11 +89,6 @@ extern struct mtx com_mtx;
|
||||
#define MINOR_TO_UNIT(mynor) (((mynor) & UNIT_MASK)>>16)
|
||||
#define MINOR_TO_PORT(mynor) ((mynor) & PORT_MASK)
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
#define enable_intr() COM_ENABLE_INTR()
|
||||
#endif /* SMP */
|
||||
|
||||
static d_open_t digiopen;
|
||||
static d_close_t digiclose;
|
||||
static d_read_t digiread;
|
||||
@ -696,6 +673,9 @@ digi_init(struct digi_softc *sc)
|
||||
}
|
||||
|
||||
sc->hidewin(sc);
|
||||
#ifdef DIGI_LOCK_INTR
|
||||
mtx_init(sc->intr_mutex, "digi interrupt mutex", MTX_DEF);
|
||||
#endif
|
||||
sc->inttest = timeout(digi_int_test, sc, hz);
|
||||
/* fepcmd_w(&sc->ports[0], 0xff, 0, 0); */
|
||||
sc->status = DIGI_STATUS_ENABLED;
|
||||
@ -1469,13 +1449,17 @@ digi_intr(void *vp)
|
||||
u_char lstat;
|
||||
} event;
|
||||
|
||||
COM_LOCK();
|
||||
sc = vp;
|
||||
|
||||
if (sc->status != DIGI_STATUS_ENABLED) {
|
||||
DLOG(DIGIDB_IRQ, (sc->dev, "interrupt on disabled board !\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DIGI_LOCK_INTR
|
||||
mtx_lock(sc->intr_mutex);
|
||||
#endif
|
||||
|
||||
#ifdef DIGI_INTERRUPT
|
||||
microtime(&sc->intr_timestamp);
|
||||
#endif
|
||||
@ -1675,7 +1659,9 @@ eoi:
|
||||
sc->towin(sc, 0);
|
||||
if (window != 0)
|
||||
sc->towin(sc, window);
|
||||
COM_UNLOCK();
|
||||
#ifdef DIGI_LOCK_INTR
|
||||
mtx_unlock(sc->intr_mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1881,6 +1867,9 @@ digi_free_state(struct digi_softc *sc)
|
||||
callout_handle_init(&sc->inttest);
|
||||
|
||||
bus_teardown_intr(sc->dev, sc->res.irq, sc->res.irqHandler);
|
||||
#ifdef DIGI_LOCK_INTR
|
||||
mtx_destroy(sc->intr_mutex);
|
||||
#endif
|
||||
#ifdef DIGI_INTERRUPT
|
||||
if (sc->res.irq != NULL) {
|
||||
bus_release_resource(dev, SYS_RES_IRQ, sc->res.irqrid,
|
||||
|
@ -37,6 +37,12 @@
|
||||
#define CE_NTYPES 3
|
||||
#define CE_RECORD(com, errnum) (++(com)->delta_error_counts[errnum])
|
||||
|
||||
#ifdef SMP
|
||||
#define DIGI_LOCK_INTR
|
||||
#endif
|
||||
|
||||
/*#define DIGI_INTERRUPT*/
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUG
|
||||
#endif
|
||||
@ -190,6 +196,9 @@ struct digi_softc {
|
||||
u_char *(*setwin)(struct digi_softc *_sc, unsigned _addr);
|
||||
void (*hidewin)(struct digi_softc *_sc);
|
||||
void (*towin)(struct digi_softc *_sc, int _win);
|
||||
#ifdef DIGI_LOCK_INTR
|
||||
struct mtx intr_mutex[1];
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
int intr_count;
|
||||
#endif
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <machine/resource.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <sys/mutex.h>
|
||||
|
||||
#include <digi/digireg.h>
|
||||
#include <digi/digiio.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user