From 27cbbd88a297ee95096971d969fc28f1f2c7a09c Mon Sep 17 00:00:00 2001 From: scottl Date: Wed, 29 Jan 2003 07:25:27 +0000 Subject: Implement bus_dmamem_alloc_size() and bus_dmamem_free_size() as counterparts to bus_dmamem_alloc() and bus_dmamem_free(). This allows the caller to specify the size of the allocation instead of it defaulting to the max_size field of the busdma tag. This is intended to aid in converting drivers to busdma. Lots of hardware cannot understand scatter/gather lists, which forces the driver to copy the i/o buffers to a single contiguous region before sending it to the hardware. Without these new methods, this would require a new busdma tag for each operation, or a complex internal allocator/cache for each driver. Allocations greater than PAGE_SIZE are rounded up to the next PAGE_SIZE by contigmalloc(), so this is not suitable for multiple static allocations that would be better served by a single fixed-length subdivided allocation. Reviewed by: jake (sparc64) --- sys/amd64/include/bus_dma.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/amd64/include/bus_dma.h') diff --git a/sys/amd64/include/bus_dma.h b/sys/amd64/include/bus_dma.h index 6790731..4a1740d 100644 --- a/sys/amd64/include/bus_dma.h +++ b/sys/amd64/include/bus_dma.h @@ -180,6 +180,9 @@ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map); * bus device space based on the constraints lited in the dma tag. * A dmamap to for use with dmamap_load is also allocated. */ +int bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, + bus_dmamap_t *mapp, bus_size_t size); + int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp); @@ -187,6 +190,9 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, * Free a piece of memory and it's allociated dmamap, that was allocated * via bus_dmamem_alloc. */ +void bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map, + bus_size_t size); + void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map); /* -- cgit v1.1