From af1afb3c381797e6bf0fb56abd4505094cb6c11e Mon Sep 17 00:00:00 2001
From: Robert Noland <rnoland@2hip.net>
Date: Sun, 8 Mar 2009 22:55:01 -0500
Subject: FreeBSD: Fix up the flags to bus_dmamem_*

Allow it to sleep waiting for resources during the allocation stage.
Only use BUS_DMA_NOWAIT when loading the map.
---
 bsd-core/drm_scatter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c
index 7cb52fd8..09bc5aae 100644
--- a/bsd-core/drm_scatter.c
+++ b/bsd-core/drm_scatter.c
@@ -89,7 +89,7 @@ drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather *request)
 	}
 
 	ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr,
-	    BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_NOCACHE, &dmah->map);
+	    BUS_DMA_WAITOK | BUS_DMA_ZERO, &dmah->map);
 	if (ret != 0) {
 		bus_dma_tag_destroy(dmah->tag);
 		free(dmah, DRM_MEM_DMA);
@@ -99,7 +99,8 @@ drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather *request)
 	}
 
 	ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr,
-	    request->size, drm_sg_alloc_cb, entry, 0);
+	    request->size, drm_sg_alloc_cb, entry,
+	    BUS_DMA_NOWAIT | BUS_DMA_NOCACHE);
 	if (ret != 0) {
 		bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
 		bus_dma_tag_destroy(dmah->tag);
-- 
cgit v1.2.3