busdma_machdep_diff.txt

sepherosa, 07/13/2007 04:15 AM

Download (764 Bytes)

 
1
--- busdma_machdep.c.orig	2007-07-13 12:07:26.073968370 +0800
2
+++ busdma_machdep.c	2007-07-13 12:06:18.324898557 +0800
3
@@ -45,7 +45,7 @@
4
 
5
 #include <machine/md_var.h>
6
 
7
-#define MAX_BPAGES 128
8
+#define MAX_BPAGES 1024
9
 
10
 struct bus_dma_tag {
11
 	bus_dma_tag_t	  parent;
12
@@ -289,9 +289,12 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
13
 				panic("bus_dmamap_create: page reallocation "
14
 				      "not implemented");
15
 			}
16
-			pages = atop(dmat->maxsize);
17
+
18
+			pages = MAX(atop(dmat->maxsize), 1);
19
 			pages = MIN(maxpages - total_bpages, pages);
20
-			error = alloc_bounce_pages(dmat, pages);
21
+			pages = MAX(pages, 1);
22
+			if (alloc_bounce_pages(dmat, pages) < pages)
23
+				error = ENOMEM;
24
 
25
 			if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) {
26
 				if (error == 0)