summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2003-03-13 17:18:48 +0000
committermux <mux@FreeBSD.org>2003-03-13 17:18:48 +0000
commit15b2d31e358554d642da71cfc6c4967e3bea1414 (patch)
tree89f0117eb121a46688fd90609d58fc94cc105a53 /sys/powerpc
parentd3ce48cb48061b92b1b7ac962379bf631017e7b1 (diff)
downloadFreeBSD-src-15b2d31e358554d642da71cfc6c4967e3bea1414.zip
FreeBSD-src-15b2d31e358554d642da71cfc6c4967e3bea1414.tar.gz
Grab Giant around calls to contigmalloc() and contigfree() so
that drivers converted to be MP safe don't have to deal with it.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/busdma_machdep.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c
index b7ff1de..6c6dd36 100644
--- a/sys/powerpc/powerpc/busdma_machdep.c
+++ b/sys/powerpc/powerpc/busdma_machdep.c
@@ -217,10 +217,12 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
* and handles multi-seg allocations. Nobody is doing
* multi-seg allocations yet though.
*/
+ mtx_lock(&Giant);
*vaddr = contigmalloc(dmat->maxsize, M_DEVBUF,
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
dmat->boundary);
+ mtx_unlock(&Giant);
}
if (*vaddr == NULL)
@@ -240,8 +242,11 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
panic("bus_dmamem_free: Invalid map freed\n");
if (dmat->maxsize <= PAGE_SIZE)
free(vaddr, M_DEVBUF);
- else
+ else {
+ mtx_lock(&Giant);
contigfree(vaddr, dmat->maxsize, M_DEVBUF);
+ mtx_unlock(&Giant);
+ }
}
/*
OpenPOWER on IntegriCloud