Module Name:    src
Committed By:   skrll
Date:           Mon Aug 11 10:37:59 UTC 2014

Modified Files:
        src/sys/dev/usb: xhci.c

Log Message:
PR/49091: xhci: wrong wMaxPacketSize value

While this is correct according to the specification only fixed sizes
are allowed, i.e. 512 for SS, etc. Maybe these should be used?


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/xhci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.23 src/sys/dev/usb/xhci.c:1.24
--- src/sys/dev/usb/xhci.c:1.23	Tue Aug  5 10:33:46 2014
+++ src/sys/dev/usb/xhci.c	Mon Aug 11 10:37:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.23 2014/08/05 10:33:46 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.24 2014/08/11 10:37:59 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23 2014/08/05 10:33:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.24 2014/08/11 10:37:59 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1524,10 +1524,17 @@ xhci_new_device(device_t parent, usbd_bu
 		err = usbd_get_initial_ddesc(dev, dd);
 		if (err)
 			return err;
-		USETW(dev->def_ep_desc.wMaxPacketSize, dd->bMaxPacketSize);
+		/* 4.8.2.1 */
+		if (speed == USB_SPEED_SUPER)
+			USETW(dev->def_ep_desc.wMaxPacketSize,
+			    (1 << dd->bMaxPacketSize));
+		else
+	 		USETW(dev->def_ep_desc.wMaxPacketSize,
+			    dd->bMaxPacketSize);
 		device_printf(sc->sc_dev, "%s bMaxPacketSize %u\n", __func__,
 		    dd->bMaxPacketSize);
-		xhci_update_ep0_mps(sc, xs, dd->bMaxPacketSize);
+		xhci_update_ep0_mps(sc, xs,
+		    UGETW(dev->def_ep_desc.wMaxPacketSize));
 		err = usbd_reload_device_desc(dev);
 		if (err)
 			return err;

Reply via email to