NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/49091: xhci: wrong wMaxPacketSize value



>Number:         49091
>Category:       kern
>Synopsis:       xhci: wrong wMaxPacketSize value
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 08 07:40:00 +0000 2014
>Originator:     Takahiro HAYASHI
>Release:        NetBSD 6.99.49
>Organization:
>Environment:
System: NetBSD tama 6.99.49 NetBSD 6.99.49 (XHCIDEBUG) #10: Fri Aug  8 15:00:46 
JST 2014  root@halt:/build/head/obj.amd64/sys/arch/amd64/compile/XHCIDEBUG amd64
Architecture: x86_64
Machine: amd64
>Description:
        wMaxPacketSize must be (1 << bMaxPacketSize) (512),
        not plain value (9) when updating ep0 in xhci_new_device()
        in case 3.0 device is connected.

>How-To-Repeat:

>Fix:

--- src/sys/dev/usb/xhci.c      2014-08-05 22:24:27.000000000 +0900
+++ src/sys/dev/usb/xhci.c      2014-08-08 15:57:37.000000000 +0900
@@ -1524,10 +2159,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;

-- 
t-hash



Home | Main Index | Thread Index | Old Index