summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2001-08-15 17:26:54 +0000
committerwpaul <wpaul@FreeBSD.org>2001-08-15 17:26:54 +0000
commit0f92f56bab7fd418783c863fca973f29c4bbd234 (patch)
tree40ed4e6e76d3f1c89abdce9b3afa204bdfb34ca1 /sys/alpha
parent7965e326b3d19f97024b7bfe55a1e50dd5c01111 (diff)
downloadFreeBSD-src-0f92f56bab7fd418783c863fca973f29c4bbd234.zip
FreeBSD-src-0f92f56bab7fd418783c863fca973f29c4bbd234.tar.gz
Teach bus_dmamem_free() about contigfree(). This is a bit of a hack,
but it's better than the buggy behavior we have now. If we contigmalloc() buffers in bus_dmamem_alloc(), then we must configfree() them in bus_dmamem_free(). Trying to free() them is wrong, and will cause a panic (at least, it does on the alpha.) I tripped over this when trying to kldunload my busdma-ified if_rl driver.
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/busdma_machdep.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c
index ea984c3..7125636 100644
--- a/sys/alpha/alpha/busdma_machdep.c
+++ b/sys/alpha/alpha/busdma_machdep.c
@@ -384,7 +384,10 @@ bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
*/
if (map != &nobounce_dmamap)
panic("bus_dmamem_free: Invalid map freed\n");
- free(vaddr, M_DEVBUF);
+ if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) {
+ free(vaddr, M_DEVBUF);
+ else
+ contigfree(vaddr, dmat->maxsize, M_DEVBUF);
}
#define BUS_DMAMAP_NSEGS ((BUS_SPACE_MAXSIZE / PAGE_SIZE) + 1)
OpenPOWER on IntegriCloud