svn commit: r245995 - head/sys/dev/usb

Hans Petter Selasky hselasky at FreeBSD.org
Sun Jan 27 18:01:03 UTC 2013


Author: hselasky
Date: Sun Jan 27 18:01:03 2013
New Revision: 245995
URL: http://svnweb.freebsd.org/changeset/base/245995

Log:
  Fix regression issue after r244500 and r244503:
  
  If a BUSDMA load operation results in a single segment which
  is greater than the PAGE_SIZE, the USB computed physical
  addresses will not be correct. Make sure that the first
  segment is unfolded like the sub-sequent segments are into
  USB_PAGE_SIZE big ranges.
  
  Found by:	Alexander Nedotsukov
  MFC after:	1 week

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

Modified: head/sys/dev/usb/usb_busdma.c
==============================================================================
--- head/sys/dev/usb/usb_busdma.c	Sun Jan 27 17:41:29 2013	(r245994)
+++ head/sys/dev/usb/usb_busdma.c	Sun Jan 27 18:01:03 2013	(r245995)
@@ -440,7 +440,6 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
 	rem = segs->ds_addr & (USB_PAGE_SIZE - 1);
 	pc->page_offset_buf = rem;
 	pc->page_offset_end += rem;
-	nseg--;
 #ifdef USB_DEBUG
 	if (rem != (USB_P2U(pc->buffer) & (USB_PAGE_SIZE - 1))) {
 		/*
@@ -451,7 +450,7 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
 		goto done;
 	}
 #endif
-	while (nseg > 0) {
+	while (1) {
 		off += USB_PAGE_SIZE;
 		if (off >= (segs->ds_len + rem)) {
 			/* page crossing */
@@ -459,6 +458,8 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
 			segs++;
 			off = 0;
 			rem = 0;
+			if (nseg == 0)
+				break;
 		}
 		pg++;
 		pg->physaddr = (segs->ds_addr + off) & ~(USB_PAGE_SIZE - 1);


More information about the svn-src-all mailing list