diff options
author | jhb <jhb@FreeBSD.org> | 2012-08-13 21:29:34 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2012-08-13 21:29:34 +0000 |
commit | 9bb02710c1bf485e546d9cd4f3ea231d9b5bc3f7 (patch) | |
tree | 4a840044734adb9f40c1b3bf6fdee9b417aebeb0 /sys/dev/twe/twevar.h | |
parent | 09a614af9c9c7f3f8f7c1cabbdfc5ffa704835d1 (diff) | |
download | FreeBSD-src-9bb02710c1bf485e546d9cd4f3ea231d9b5bc3f7.zip FreeBSD-src-9bb02710c1bf485e546d9cd4f3ea231d9b5bc3f7.tar.gz |
Add locking to the twe(4) driver and make it MPSAFE:
- Add per-controller configuration (sx) and I/O (mutex) locks. The
configuration lock protects the relationship of volumes and drives
while the I/O lock protects access to the controller's registers and
the main I/O path.
- Remove some checks for M_WAITOK malloc()'s failing.
- Remove the explicit bus space tag/handle from the softc and use
bus_*() rather than bus_space_*().
- Reuse the existing new-bus sysctl context instead of creating a
new one.
- Remove compat shims for FreeBSD 4.x.
- Use pci_enable_busmaster() rather than doing it by hand, and rely
on bus_alloc_resource() to enable PCI I/O decoding.
Tested by: Mike Tancsa mike sentex net
Reviewed by: scottl (partially)
MFC after: 1 month
Diffstat (limited to 'sys/dev/twe/twevar.h')
-rw-r--r-- | sys/dev/twe/twevar.h | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/sys/dev/twe/twevar.h b/sys/dev/twe/twevar.h index 4990ca8..d2017aa 100644 --- a/sys/dev/twe/twevar.h +++ b/sys/dev/twe/twevar.h @@ -134,6 +134,7 @@ struct twe_softc #define TWE_STATE_SUSPEND (1<<3) /* controller is suspended */ #define TWE_STATE_FRZN (1<<4) /* got EINPROGRESS */ #define TWE_STATE_CTLR_BUSY (1<<5) /* controller cmd queue full */ +#define TWE_STATE_DETACHING (1<<6) /* controller is being shut down */ int twe_host_id; struct twe_qstat twe_qstat[TWEQ_COUNT]; /* queue statistics */ @@ -209,46 +210,31 @@ twe_initq_ ## name (struct twe_softc *sc) \ static __inline void \ twe_enqueue_ ## name (struct twe_request *tr) \ { \ - int s; \ - \ - s = splbio(); \ TAILQ_INSERT_TAIL(&tr->tr_sc->twe_ ## name, tr, tr_link); \ TWEQ_ADD(tr->tr_sc, index); \ - splx(s); \ } \ static __inline void \ twe_requeue_ ## name (struct twe_request *tr) \ { \ - int s; \ - \ - s = splbio(); \ TAILQ_INSERT_HEAD(&tr->tr_sc->twe_ ## name, tr, tr_link); \ TWEQ_ADD(tr->tr_sc, index); \ - splx(s); \ } \ static __inline struct twe_request * \ twe_dequeue_ ## name (struct twe_softc *sc) \ { \ struct twe_request *tr; \ - int s; \ \ - s = splbio(); \ if ((tr = TAILQ_FIRST(&sc->twe_ ## name)) != NULL) { \ TAILQ_REMOVE(&sc->twe_ ## name, tr, tr_link); \ TWEQ_REMOVE(sc, index); \ } \ - splx(s); \ return(tr); \ } \ static __inline void \ twe_remove_ ## name (struct twe_request *tr) \ { \ - int s; \ - \ - s = splbio(); \ TAILQ_REMOVE(&tr->tr_sc->twe_ ## name, tr, tr_link); \ TWEQ_REMOVE(tr->tr_sc, index); \ - splx(s); \ } TWEQ_REQUEST_QUEUE(free, TWEQ_FREE) @@ -269,25 +255,18 @@ twe_initq_bio(struct twe_softc *sc) static __inline void twe_enqueue_bio(struct twe_softc *sc, twe_bio *bp) { - int s; - - s = splbio(); TWE_BIO_QINSERT(sc->twe_bioq, bp); TWEQ_ADD(sc, TWEQ_BIO); - splx(s); } static __inline twe_bio * twe_dequeue_bio(struct twe_softc *sc) { - int s; twe_bio *bp; - s = splbio(); if ((bp = TWE_BIO_QFIRST(sc->twe_bioq)) != NULL) { TWE_BIO_QREMOVE(sc->twe_bioq, bp); TWEQ_REMOVE(sc, TWEQ_BIO); } - splx(s); return(bp); } |