diff options
author | brian <brian@FreeBSD.org> | 2001-05-07 11:13:11 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-05-07 11:13:11 +0000 |
commit | b4e77391c3536ccca7aefca3e461c40868b19e4b (patch) | |
tree | c7d39edab6352934c4f07c09001bee997dcc07ff /sys | |
parent | 92ef63e056362d78915ae984627804545c04afa8 (diff) | |
download | FreeBSD-src-b4e77391c3536ccca7aefca3e461c40868b19e4b.zip FreeBSD-src-b4e77391c3536ccca7aefca3e461c40868b19e4b.tar.gz |
Change COM_LOCK/COM_UNLOCK to a regular mutex - still conditional on
SMP being defined.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/digi/digi.c | 39 | ||||
-rw-r--r-- | sys/dev/digi/digi.h | 9 | ||||
-rw-r--r-- | sys/dev/digi/digi_isa.c | 1 | ||||
-rw-r--r-- | sys/dev/digi/digi_pci.c | 1 |
4 files changed, 25 insertions, 25 deletions
diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 5c424b1..56b9f25 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -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, diff --git a/sys/dev/digi/digi.h b/sys/dev/digi/digi.h index baa03eb..f59f2af 100644 --- a/sys/dev/digi/digi.h +++ b/sys/dev/digi/digi.h @@ -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 diff --git a/sys/dev/digi/digi_isa.c b/sys/dev/digi/digi_isa.c index d88965e..780aaf0 100644 --- a/sys/dev/digi/digi_isa.c +++ b/sys/dev/digi/digi_isa.c @@ -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> diff --git a/sys/dev/digi/digi_pci.c b/sys/dev/digi/digi_pci.c index cdca91e..cad061e 100644 --- a/sys/dev/digi/digi_pci.c +++ b/sys/dev/digi/digi_pci.c @@ -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> |