--- 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 -#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)