Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/x86/busdma_bounce.c
Show First 20 Lines • Show All 401 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static int | static int | ||||
bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, | bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, | ||||
bus_dmamap_t *mapp) | bus_dmamap_t *mapp) | ||||
{ | { | ||||
vm_memattr_t attr; | vm_memattr_t attr; | ||||
int mflags; | int mflags; | ||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__); | |||||
if (flags & BUS_DMA_NOWAIT) | if (flags & BUS_DMA_NOWAIT) | ||||
mflags = M_NOWAIT; | mflags = M_NOWAIT; | ||||
else | else | ||||
mflags = M_WAITOK; | mflags = M_WAITOK; | ||||
/* If we succeed, no mapping/bouncing will be required */ | /* If we succeed, no mapping/bouncing will be required */ | ||||
*mapp = NULL; | *mapp = NULL; | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | if (*vaddr == NULL) { | ||||
printf("bus_dmamem_alloc failed to align memory properly.\n"); | printf("bus_dmamem_alloc failed to align memory properly.\n"); | ||||
} | } | ||||
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", | CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", | ||||
__func__, dmat, dmat->common.flags, 0); | __func__, dmat, dmat->common.flags, 0); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Free a piece of memory and it's allociated dmamap, that was allocated | * Free a piece of memory and its associated dmamap, that was allocated | ||||
* via bus_dmamem_alloc. Make the same choice for free/contigfree. | * via bus_dmamem_alloc. Make the same choice for free/contigfree. | ||||
*/ | */ | ||||
static void | static void | ||||
bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) | bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) | ||||
{ | { | ||||
/* | /* | ||||
* dmamem does not need to be bounced, so the map should be | * dmamem does not need to be bounced, so the map should be | ||||
* NULL and the BUS_DMA_KMEM_ALLOC flag cleared if malloc() | * NULL and the BUS_DMA_KMEM_ALLOC flag cleared if malloc() | ||||
▲ Show 20 Lines • Show All 845 Lines • Show Last 20 Lines |