Author: hselasky
Date: Tue Nov  3 08:42:43 2015
New Revision: 290326
URL: https://svnweb.freebsd.org/changeset/base/290326

Log:
  Relax the BUS_DMA_KEEP_PG_OFFSET requirement to allow optimising
  allocation of DMA bounce buffers.
  
  Discussed with:       ian @
  MFC after:    3 weeks

Modified:
  head/sys/dev/usb/usb_busdma.c

Modified: head/sys/dev/usb/usb_busdma.c
==============================================================================
--- head/sys/dev/usb/usb_busdma.c       Tue Nov  3 08:33:24 2015        
(r290325)
+++ head/sys/dev/usb/usb_busdma.c       Tue Nov  3 08:42:43 2015        
(r290326)
@@ -443,9 +443,13 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
        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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to