Author: hselasky
Date: Tue Nov 24 12:17:00 2015
New Revision: 291250
URL: https://svnweb.freebsd.org/changeset/base/291250

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

Modified:
  stable/10/sys/dev/usb/usb_busdma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_busdma.c
==============================================================================
--- stable/10/sys/dev/usb/usb_busdma.c  Tue Nov 24 12:11:56 2015        
(r291249)
+++ stable/10/sys/dev/usb/usb_busdma.c  Tue Nov 24 12:17:00 2015        
(r291250)
@@ -474,9 +474,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;
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to