Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2008 00:05:15 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 150411 for review
Message-ID:  <200809250005.m8P05FGp066423@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=150411

Change 150411 by hselasky@hselasky_laptop001 on 2008/09/25 00:04:55

	
	Use correct boundary when allocating DMA memory.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_busdma.c#7 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_busdma.c#7 (text+ko) ====

@@ -339,7 +339,7 @@
 	if (bus_dma_tag_create
 	    ( /* parent    */ udt->tag_parent->tag,
 	     /* alignment */ align,
-	     /* boundary  */ 0,
+	     /* boundary  */ USB_PAGE_SIZE,
 	     /* lowaddr   */ (2ULL << (udt->tag_parent->dma_bits - 1)) - 1,
 	     /* highaddr  */ BUS_SPACE_MAXADDR,
 	     /* filter    */ NULL,
@@ -403,7 +403,6 @@
 	struct usb2_page *pg;
 	uint32_t rem;
 	uint8_t owned;
-	uint8_t ext_seg;		/* extend last segment */
 
 	pc = arg;
 	uptag = pc->tag_parent;
@@ -423,12 +422,6 @@
 	rem = segs->ds_addr & (USB_PAGE_SIZE - 1);
 	pc->page_offset_buf = rem;
 	pc->page_offset_end += rem;
-	if (nseg < ((pc->page_offset_end +
-	    (USB_PAGE_SIZE - 1)) / USB_PAGE_SIZE)) {
-		ext_seg = 1;
-	} else {
-		ext_seg = 0;
-	}
 	nseg--;
 
 	while (nseg > 0) {
@@ -438,14 +431,6 @@
 		pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1);
 	}
 
-	/*
-	 * XXX The segments we get from BUS-DMA are not aligned,
-	 * XXX so we need to extend the last segment if we are
-	 * XXX unaligned and cross the segment boundary!
-	 */
-	if (ext_seg && pc->ismultiseg) {
-		(pg + 1)->physaddr = pg->physaddr + USB_PAGE_SIZE;
-	}
 done:
 	owned = mtx_owned(uptag->mtx);
 	if (!owned)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809250005.m8P05FGp066423>