Author: marius
Date: Sat Sep 18 08:25:12 2010
New Revision: 212819
URL: http://svn.freebsd.org/changeset/base/212819

Log:
  MFC: r212621
  
  Use saner nsegments and maxsegsz parameters when creating certain DMA tags;
  tags for 1-byte allocations cannot possibly be split across 2 segments and
  maxsegsz must not exceed maxsize.
  
  Reviewed by:  Hans Petter Selasky

Modified:
  stable/8/sys/dev/usb/usb_busdma.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_busdma.c
==============================================================================
--- stable/8/sys/dev/usb/usb_busdma.c   Sat Sep 18 08:23:45 2010        
(r212818)
+++ stable/8/sys/dev/usb/usb_busdma.c   Sat Sep 18 08:25:12 2010        
(r212819)
@@ -366,9 +366,9 @@ usb_dma_tag_create(struct usb_dma_tag *u
             /* filter    */ NULL,
             /* filterarg */ NULL,
             /* maxsize   */ size,
-            /* nsegments */ (align == 1) ?
+            /* nsegments */ (align == 1 && size > 1) ?
            (2 + (size / USB_PAGE_SIZE)) : 1,
-            /* maxsegsz  */ (align == 1) ?
+            /* maxsegsz  */ (align == 1 && size > USB_PAGE_SIZE) ?
            USB_PAGE_SIZE : size,
             /* flags     */ BUS_DMA_KEEP_PG_OFFSET,
             /* lockfn    */ &usb_dma_lock_cb,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to