Project

General

Profile

Bug #728 ยป busdma_machdep_diff.txt

sepherosa, 07/13/2007 04:15 AM

 
--- busdma_machdep.c.orig 2007-07-13 12:07:26.073968370 +0800
+++ busdma_machdep.c 2007-07-13 12:06:18.324898557 +0800
@@ -45,7 +45,7 @@
#include <machine/md_var.h>
-#define MAX_BPAGES 128
+#define MAX_BPAGES 1024
struct bus_dma_tag {
bus_dma_tag_t parent;
@@ -289,9 +289,12 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
panic("bus_dmamap_create: page reallocation "
"not implemented");
}
- pages = atop(dmat->maxsize);
+
+ pages = MAX(atop(dmat->maxsize), 1);
pages = MIN(maxpages - total_bpages, pages);
- error = alloc_bounce_pages(dmat, pages);
+ pages = MAX(pages, 1);
+ if (alloc_bounce_pages(dmat, pages) < pages)
+ error = ENOMEM;
if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) {
if (error == 0)
    (1-1/1)