diff options
author | hselasky <hselasky@FreeBSD.org> | 2015-11-03 08:42:43 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2015-11-03 08:42:43 +0000 |
commit | ff9474f133a21b2d744f961724e2383220ace849 (patch) | |
tree | 2d385673244fc498aa11ac21411865b19ee60dc4 | |
parent | 5ac24164c983486abfcd18ef4ae150b8faa5be56 (diff) | |
download | FreeBSD-src-ff9474f133a21b2d744f961724e2383220ace849.zip FreeBSD-src-ff9474f133a21b2d744f961724e2383220ace849.tar.gz |
Relax the BUS_DMA_KEEP_PG_OFFSET requirement to allow optimising
allocation of DMA bounce buffers.
Discussed with: ian @
MFC after: 3 weeks
-rw-r--r-- | sys/dev/usb/usb_busdma.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_busdma.c b/sys/dev/usb/usb_busdma.c index 1c36288..d9c1987 100644 --- a/sys/dev/usb/usb_busdma.c +++ b/sys/dev/usb/usb_busdma.c @@ -443,9 +443,13 @@ usb_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs, pc->page_offset_buf = rem; pc->page_offset_end += rem; #ifdef USB_DEBUG - if (rem != (USB_P2U(pc->buffer) & (USB_PAGE_SIZE - 1))) { + if (nseg > 1 && + ((segs->ds_addr + segs->ds_len) & (USB_PAGE_SIZE - 1)) != + ((segs + 1)->ds_addr & (USB_PAGE_SIZE - 1))) { /* - * This check verifies that the physical address is correct: + * This check verifies there is no page offset hole + * between the first and second segment. See the + * BUS_DMA_KEEP_PG_OFFSET flag. */ DPRINTFN(0, "Page offset was not preserved\n"); error = 1; |