summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/sparc64/bus_machdep.c
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2003-07-27 13:52:10 +0000
committermux <mux@FreeBSD.org>2003-07-27 13:52:10 +0000
commit4e543dc21243ab3f7b1444dd28899ce4ce4f7a67 (patch)
treea4a7889831600966a860a57cdff8cfd02bf4f17f /sys/sparc64/sparc64/bus_machdep.c
parent0d4044b1e668c1fbed194bf8172757d4d61e9fdb (diff)
downloadFreeBSD-src-4e543dc21243ab3f7b1444dd28899ce4ce4f7a67.zip
FreeBSD-src-4e543dc21243ab3f7b1444dd28899ce4ce4f7a67.tar.gz
- Introduce a new busdma flag BUS_DMA_ZERO to request for zero'ed
memory in bus_dmamem_alloc(). This is possible now that contigmalloc() supports the M_ZERO flag. - Remove the locking of Giant around calls to contigmalloc() since contigmalloc() now grabs Giant itself.
Diffstat (limited to 'sys/sparc64/sparc64/bus_machdep.c')
-rw-r--r--sys/sparc64/sparc64/bus_machdep.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c
index 5843b73..e0655e2 100644
--- a/sys/sparc64/sparc64/bus_machdep.c
+++ b/sys/sparc64/sparc64/bus_machdep.c
@@ -612,23 +612,27 @@ static int
nexus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
bus_dmamap_t *mapp)
{
+ int mflags;
+
+ if (flags & BUS_DMA_NOWAIT)
+ mflags = M_NOWAIT;
+ else
+ mflags = M_WAITOK;
+ if (flags & BUS_DMA_ZERO)
+ mflags |= M_ZERO;
if ((dmat->dt_maxsize <= PAGE_SIZE)) {
- *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF,
- (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
+ *vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
} else {
/*
* XXX: Use contigmalloc until it is merged into this facility
* and handles multi-seg allocations. Nobody is doing multi-seg
* allocations yet though.
*/
- mtx_lock(&Giant);
- *vaddr = contigmalloc(dmat->dt_maxsize, M_DEVBUF,
- (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
+ *vaddr = contigmalloc(dmat->dt_maxsize, M_DEVBUF, mflags,
0ul, dmat->dt_lowaddr,
dmat->dt_alignment ? dmat->dt_alignment : 1UL,
dmat->dt_boundary);
- mtx_unlock(&Giant);
}
if (*vaddr == NULL)
return (ENOMEM);
OpenPOWER on IntegriCloud