Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/x86/busdma_bounce.c
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | |||||
* address space into bus device space. | * address space into bus device space. | ||||
*/ | */ | ||||
static int | static int | ||||
bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) | bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) | ||||
{ | { | ||||
struct bounce_zone *bz; | struct bounce_zone *bz; | ||||
int error, maxpages, pages; | int error, maxpages, pages; | ||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__); | |||||
cem: Ditto above. | |||||
jahAuthorUnsubmitted Done Inline ActionsIt wasn't newly added here, it was taken wholesale from the previous wrapper in bus_dma_machdep.c--see the deleted code immediately below this. I wanted to keep the diff as straightforward as possible, since this change was intended to be about header cleanup and not addressing (admittedly sketchy) checks within x86 busdma. jah: It wasn't newly added here, it was taken wholesale from the previous wrapper in bus_dma_machdep. | |||||
error = 0; | error = 0; | ||||
if (dmat->segments == NULL) { | if (dmat->segments == NULL) { | ||||
dmat->segments = (bus_dma_segment_t *)malloc( | dmat->segments = (bus_dma_segment_t *)malloc( | ||||
sizeof(bus_dma_segment_t) * dmat->common.nsegments, | sizeof(bus_dma_segment_t) * dmat->common.nsegments, | ||||
M_DEVBUF, M_NOWAIT); | M_DEVBUF, M_NOWAIT); | ||||
if (dmat->segments == NULL) { | if (dmat->segments == NULL) { | ||||
CTR3(KTR_BUSDMA, "%s: tag %p error %d", | CTR3(KTR_BUSDMA, "%s: tag %p error %d", | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
* A dmamap to for use with dmamap_load is also allocated. | * A dmamap to for use with dmamap_load is also allocated. | ||||
*/ | */ | ||||
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; | ||||
cemUnsubmitted Not Done Inline ActionsThis one should clearly be conditional on (flags & BUS_DMA_NOWAIT) == 0. cem: This one should clearly be conditional on `(flags & BUS_DMA_NOWAIT) == 0`. | |||||
cemUnsubmitted Not Done Inline ActionsThis one wasn't ever fixed. cem: This one wasn't ever fixed. | |||||
/* If we succeed, no mapping/bouncing will be required */ | /* If we succeed, no mapping/bouncing will be required */ | ||||
*mapp = NULL; | *mapp = NULL; | ||||
if (dmat->segments == NULL) { | if (dmat->segments == NULL) { | ||||
dmat->segments = (bus_dma_segment_t *)malloc( | dmat->segments = (bus_dma_segment_t *)malloc( | ||||
sizeof(bus_dma_segment_t) * dmat->common.nsegments, | sizeof(bus_dma_segment_t) * dmat->common.nsegments, | ||||
M_DEVBUF, mflags); | M_DEVBUF, mflags); | ||||
▲ Show 20 Lines • Show All 894 Lines • Show Last 20 Lines |
Ditto above.