Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Dec 2007 09:48:37 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 131662 for review
Message-ID:  <200712260948.lBQ9mbpi041588@repoman.freebsd.org>

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

Change 131662 by hselasky@hselasky_laptop001 on 2007/12/26 09:47:50

	
	Bugfix.
	
	Add some more debug prints. And make sure that 
	short received frames terminate the TD.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/at9100_dci.c#5 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/at9100_dci.c#5 (text+ko) ====

@@ -301,7 +301,7 @@
 	csr = bus_space_read_4(td->io_tag, td->io_hdl,
 	    td->status_reg);
 
-	DPRINTFN(4, "csr=0x%08x rem=%d\n", csr, td->remainder);
+	DPRINTFN(4, "csr=0x%08x rem=%u\n", csr, td->remainder);
 
 	temp = csr;
 	temp &= (AT91_UDP_CSR_RX_DATA_BK0 |
@@ -387,8 +387,10 @@
 	uint32_t temp;
 	uint16_t count;
 	uint8_t to;
+	uint8_t got_short;
 
 	to = 2;				/* don't loop forever! */
+	got_short = 0;
 
 	/* check if any of the FIFO banks have data */
 repeat:
@@ -396,7 +398,7 @@
 	csr = bus_space_read_4(td->io_tag, td->io_hdl,
 	    td->status_reg);
 
-	DPRINTFN(4, "csr=0x%08x\n", csr);
+	DPRINTFN(4, "csr=0x%08x rem=%u\n", csr, td->remainder);
 
 	if (csr & AT91_UDP_CSR_RXSETUP) {
 		if (td->remainder == 0) {
@@ -436,6 +438,7 @@
 		if (count < td->max_packet_size) {
 			/* we have a short packet */
 			td->short_pkt = 1;
+			got_short = 1;
 		} else {
 			/* invalid USB packet */
 			td->error = 1;
@@ -490,7 +493,7 @@
 	 */
 
 	/* check if we are complete */
-	if (td->remainder == 0) {
+	if ((td->remainder == 0) || got_short) {
 		if (td->short_pkt) {
 			/* we are complete */
 			return (0);
@@ -520,7 +523,7 @@
 	csr = bus_space_read_4(td->io_tag, td->io_hdl,
 	    td->status_reg);
 
-	DPRINTFN(4, "csr=0x%08x rem=%d\n", csr, td->remainder);
+	DPRINTFN(4, "csr=0x%08x rem=%u\n", csr, td->remainder);
 
 	if (csr & AT91_UDP_CSR_RXSETUP) {
 		/*
@@ -1267,7 +1270,7 @@
 
 	mtx_assert(&(udev->bus->mtx), MA_OWNED);
 
-	DPRINTFN(4, "\n");
+	DPRINTFN(4, "pipe=%p\n", pipe);
 
 	if (xfer) {
 		/* cancel any ongoing transfers */
@@ -1291,7 +1294,7 @@
 
 	mtx_assert(&(udev->bus->mtx), MA_OWNED);
 
-	DPRINTFN(4, "\n");
+	DPRINTFN(4, "pipe=%p\n", pipe);
 
 	/* reset pipe state */
 



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