diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-09 20:29:10 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-09 20:29:10 +0000 |
commit | f446f9def72f6f270f8c63127857deb322120c23 (patch) | |
tree | f953f2131a083f2e622b5ad2d6a2edc3b54f19bf /sys/dev/ieee488 | |
parent | ab44b532fc14160602cb4a00f5a305b6f8750250 (diff) | |
download | FreeBSD-src-f446f9def72f6f270f8c63127857deb322120c23.zip FreeBSD-src-f446f9def72f6f270f8c63127857deb322120c23.tar.gz |
Make isa_dma functions MPSAFE by introducing its own private lock. These
functions are selfcontained (ie. they touch only isa_dma.c static variables
and hardware) so a private lock is sufficient to prevent races. This changes
only i386/amd64 while there are also isa_dma functions for ia64/sparc64.
Sparc64 are ones empty stubs and ia64 ones are unused as ia64 does not
have isa (says marcel).
This patch removes explicit locking of Giant from a few drivers (there
are some that requires this but lack ones - this patch fixes this) and
also removes the need for implicit locking of Giant from attach routines
where it's provided by newbus.
Approved by: ed (mentor, implicit)
Reviewed by: jhb, attilio (glanced by)
Tested by: Giovanni Trematerra <giovanni.trematerra gmail com>
IA64 clue: marcel
Diffstat (limited to 'sys/dev/ieee488')
-rw-r--r-- | sys/dev/ieee488/ibfoo.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/sys/dev/ieee488/ibfoo.c b/sys/dev/ieee488/ibfoo.c index f199920..7458d8b 100644 --- a/sys/dev/ieee488/ibfoo.c +++ b/sys/dev/ieee488/ibfoo.c @@ -397,18 +397,14 @@ dma_idata(struct upd7210 *u, u_char *data, int len) KASSERT(u->dmachan >= 0, ("Bogus dmachan %d", u->dmachan)); ib = u->ibfoo; ib->mode = DMA_IDATA; - mtx_lock(&Giant); isa_dmastart(ISADMA_READ, data, len, u->dmachan); - mtx_unlock(&Giant); mtx_lock(&u->mutex); upd7210_wr(u, IMR1, IXR1_ENDRX); upd7210_wr(u, IMR2, IMR2_DMAI); gpib_ib_wait_xfer(u, ib); mtx_unlock(&u->mutex); - mtx_lock(&Giant); j = isa_dmastatus(u->dmachan); isa_dmadone(ISADMA_READ, data, len, u->dmachan); - mtx_unlock(&Giant); return (len - j); } @@ -790,14 +786,12 @@ gpib_ib_open(struct cdev *dev, int oflags, int devtype, struct thread *td) mtx_unlock(&u->mutex); if (u->dmachan >= 0) { - mtx_lock(&Giant); error = isa_dma_acquire(u->dmachan); if (!error) { error = isa_dma_init(u->dmachan, PAGE_SIZE, M_WAITOK); if (error) isa_dma_release(u->dmachan); } - mtx_unlock(&Giant); } if (error) { @@ -855,9 +849,7 @@ gpib_ib_close(struct cdev *dev, int oflags, int devtype, struct thread *td) free(ib, M_IBFOO); if (u->dmachan >= 0) { - mtx_lock(&Giant); isa_dma_release(u->dmachan); - mtx_unlock(&Giant); } mtx_lock(&u->mutex); u->busy = 0; |