summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2003-07-27 15:19:45 +0000
committertmm <tmm@FreeBSD.org>2003-07-27 15:19:45 +0000
commit6b3d53035396197bc0d608e72a19c6b7f9797c7b (patch)
tree8eb41d8be4b0810623456677d5c26ea63ab0a02a /sys/sparc64
parent82ea1f9d7eaae9e4b9228274afe78180a2386a62 (diff)
downloadFreeBSD-src-6b3d53035396197bc0d608e72a19c6b7f9797c7b.zip
FreeBSD-src-6b3d53035396197bc0d608e72a19c6b7f9797c7b.tar.gz
Respect BUS_DMA_ZERO in iommu_dvmamem_alloc().
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/iommu.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/sparc64/sparc64/iommu.c b/sys/sparc64/sparc64/iommu.c
index 97c7e09..f87863e 100644
--- a/sys/sparc64/sparc64/iommu.c
+++ b/sys/sparc64/sparc64/iommu.c
@@ -793,7 +793,7 @@ iommu_dvmamem_alloc(bus_dma_tag_t dt, void **vaddr, int flags,
bus_dmamap_t *mapp)
{
struct iommu_state *is = dt->dt_cookie;
- int error;
+ int error, mflags;
/*
* XXX: This will break for 32 bit transfers on machines with more than
@@ -801,8 +801,15 @@ iommu_dvmamem_alloc(bus_dma_tag_t dt, void **vaddr, int flags,
*/
if ((error = sparc64_dma_alloc_map(dt, mapp)) != 0)
return (error);
- if ((*vaddr = malloc(dt->dt_maxsize, M_IOMMU,
- (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) {
+
+ if ((flags & BUS_DMA_NOWAIT) != 0)
+ mflags = M_NOWAIT;
+ else
+ mflags = M_WAITOK;
+ if ((flags & BUS_DMA_ZERO) != 0)
+ mflags |= M_ZERO;
+
+ if ((*vaddr = malloc(dt->dt_maxsize, M_IOMMU, mflags)) == NULL) {
error = ENOMEM;
sparc64_dma_free_map(dt, *mapp);
return (error);
OpenPOWER on IntegriCloud