Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Aug 2008 19:49:10 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 146797 for review
Message-ID:  <200808061949.m76JnAE8086315@repoman.freebsd.org>

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

Change 146797 by hselasky@hselasky_laptop001 on 2008/08/06 19:48:16

	
	Sort some variables by size to 
	reduce stack consumption on embedded
	platforms.
	
	Bugfix: If we do not have room for an
	USB transfer, then set the length to
	zero instead of clearing the ACTIVE
	bit, hence the latter solution would
	lead to an infinite loop.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#9 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/controller/ehci2.c#9 (text+ko) ====

@@ -2410,23 +2410,23 @@
 	struct usb2_fs_isoc_schedule *fss_start;
 	struct usb2_fs_isoc_schedule *fss_end;
 	struct usb2_fs_isoc_schedule *fss;
+	ehci_sitd_t *td;
+	ehci_sitd_t *td_last = NULL;
+	ehci_sitd_t **pp_last;
+	uint32_t *plen;
 	uint32_t buf_offset;
 	uint32_t nframes;
 	uint32_t temp;
 	uint32_t sitd_mask;
-	uint32_t *plen;
 	uint16_t tlen;
+	uint8_t sa;
+	uint8_t sb;
+	uint8_t error;
 
 #ifdef USB_DEBUG
 	uint8_t once = 1;
 
 #endif
-	uint8_t sa;
-	uint8_t sb;
-	uint8_t error;
-	ehci_sitd_t *td;
-	ehci_sitd_t *td_last = NULL;
-	ehci_sitd_t **pp_last;
 
 	DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
 	    xfer, xfer->pipe->isoc_next, xfer->nframes);
@@ -2523,7 +2523,13 @@
 		 * full!
 		 */
 		error = usb2_fs_isoc_schedule_alloc(fss, &sa, *plen);
-
+		if (error) {
+			/*
+			 * The FULL speed schedule is FULL! Set length
+			 * to zero.
+			 */
+			*plen = 0;
+		}
 		if (*plen) {
 			/*
 			 * only call "usb2_get_page()" when we have a
@@ -2536,7 +2542,8 @@
 			 * NOTE: We need to subtract one from the offset so
 			 * that we are on a valid page!
 			 */
-			usb2_get_page(xfer->frbuffers, buf_offset - 1, &buf_res);
+			usb2_get_page(xfer->frbuffers, buf_offset - 1,
+			    &buf_res);
 			temp = buf_res.physaddr & ~0xFFF;
 		} else {
 			td->sitd_bp[0] = 0;
@@ -2588,15 +2595,6 @@
 			    (EHCI_SITD_ACTIVE |
 			    EHCI_SITD_SET_LEN(*plen));
 		}
-		if (error) {
-			/*
-			 * The FULL speed schedule is FULL! Pretend that the
-			 * transaction has been executed. The IOC bit should
-			 * be active even if the ACTIVE bit is zero.
-			 */
-			td->sitd_status &=
-			    ~htole32(EHCI_SITD_ACTIVE);
-		}
 		usb2_pc_cpu_flush(td->page_cache);
 
 #ifdef USB_DEBUG
@@ -2704,11 +2702,14 @@
 {
 	struct usb2_page_search buf_res;
 	ehci_softc_t *sc = xfer->usb2_sc;
+	ehci_itd_t *td;
+	ehci_itd_t *td_last = NULL;
+	ehci_itd_t **pp_last;
 	bus_size_t page_addr;
+	uint32_t *plen;
 	uint32_t status;
 	uint32_t buf_offset;
 	uint32_t nframes;
-	uint32_t *plen;
 	uint32_t itd_offset[8 + 1];
 	uint8_t x;
 	uint8_t td_no;
@@ -2718,9 +2719,6 @@
 	uint8_t once = 1;
 
 #endif
-	ehci_itd_t *td;
-	ehci_itd_t *td_last = NULL;
-	ehci_itd_t **pp_last;
 
 	DPRINTFN(6, "xfer=%p next=%d nframes=%d\n",
 	    xfer, xfer->pipe->isoc_next, xfer->nframes);



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