Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2010 18:25:51 GMT
From:      Hans Petter Selasky <hselasky@skunkworks.freebsd.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 182110 for review
Message-ID:  <201008111825.o7BIPpbv083780@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182110?ac=10

Change 182110 by hselasky@hselasky_laptop001 on 2010/08/08 22:06:26

	
	USB core:
		- correct calculations for Super Speed USB.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#184 edit

Differences ...

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

@@ -322,6 +322,7 @@
 	usb_frcount_t x;
 	uint8_t type;
 	uint8_t zmps;
+	uint8_t mult;
 
 	/*
 	 * Sanity check. The following parameters must be initialized before
@@ -358,12 +359,36 @@
 			xfer->max_packet_count = 3;
 		xfer->max_packet_size &= 0x7FF;
 		break;
+
 	case USB_SPEED_SUPER:
-		if (xfer->endpoint->ecomp != NULL)
-			xfer->max_packet_count += xfer->endpoint->ecomp->bMaxBurst;
+		xfer->max_packet_count += (xfer->max_packet_size >> 11) & 3;
+		mult = 1;
+
+		/* compute additional bMaxBurst */
+		if (xfer->endpoint->ecomp != NULL) {
+			xfer->max_packet_count +=
+			    xfer->endpoint->ecomp->bMaxBurst;
+
+			if (type == UE_ISOCHRONOUS) {
+				mult +=
+				    (xfer->endpoint->ecomp->bmAttributes & 3);
+			}
+		}
+
+		xfer->max_packet_count *= mult;
+
 		/* check for invalid max packet count */
-		if (xfer->max_packet_count > 15)
-			xfer->max_packet_count = 15;
+		if (type == UE_ISOCHRONOUS) {
+			if ((xfer->max_packet_count == 0) || 
+			    (xfer->max_packet_count > (16 * 3)))
+				xfer->max_packet_count = (16 * 3);
+		} else {
+			if ((xfer->max_packet_count == 0) || 
+			    (xfer->max_packet_count > (16 * 1)))
+				xfer->max_packet_count = (16 * 1);
+		}
+
+		xfer->max_packet_size &= 0x7FF;
 		break;
 	default:
 		break;



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