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/fdc/fdc.c | |
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/fdc/fdc.c')
-rw-r--r-- | sys/dev/fdc/fdc.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 458c839..ed621b2 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -781,11 +781,9 @@ fdc_worker(struct fdc_data *fdc) /* Disable ISADMA if we bailed while it was active */ if (fd != NULL && (fd->flags & FD_ISADMA)) { - mtx_lock(&Giant); isa_dmadone( bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE, fd->fd_ioptr, fd->fd_iosize, fdc->dmachan); - mtx_unlock(&Giant); mtx_lock(&fdc->fdc_mtx); fd->flags &= ~FD_ISADMA; mtx_unlock(&fdc->fdc_mtx); @@ -958,11 +956,9 @@ fdc_worker(struct fdc_data *fdc) /* Setup ISADMA if we need it and have it */ if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_FMT)) && !(fdc->flags & FDC_NODMA)) { - mtx_lock(&Giant); isa_dmastart( bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE, fd->fd_ioptr, fd->fd_iosize, fdc->dmachan); - mtx_unlock(&Giant); mtx_lock(&fdc->fdc_mtx); fd->flags |= FD_ISADMA; mtx_unlock(&fdc->fdc_mtx); @@ -1040,11 +1036,9 @@ fdc_worker(struct fdc_data *fdc) /* Finish DMA */ if (fd->flags & FD_ISADMA) { - mtx_lock(&Giant); isa_dmadone( bp->bio_cmd & BIO_READ ? ISADMA_READ : ISADMA_WRITE, fd->fd_ioptr, fd->fd_iosize, fdc->dmachan); - mtx_unlock(&Giant); mtx_lock(&fdc->fdc_mtx); fd->flags &= ~FD_ISADMA; mtx_unlock(&fdc->fdc_mtx); |