coreboot-kgpe-d16/payloads/libpayload/drivers/usb
Julius Werner d13e2c4ab7 libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices
This patch represents a major overhaul of the USB enumeration code in
order to make it cleaner and much more robust to weird or malicious
devices. The main improvement is that it correctly parses the USB
descriptors even if there are unknown descriptors interspersed within,
which is perfectly legal and in particular present on all SuperSpeed
devices (due to the SuperSpeed Endpoint Companion Descriptor).

In addition, it gets rid of the really whacky and special cased
get_descriptor() function, which would read every descriptor twice
whether it made sense or not. The new code makes the callers allocate
descriptor memory and only read stuff twice when it's really necessary
(i.e. the device and configuration descriptors).

Finally, it also moves some more responsibilities into the
controller-specific set_address() function in order to make sure things
are initialized at the same stage for all controllers. In the new model
it initializes the device entry (which zeroes the endpoint array), sets
up endpoint 0 (including MPS), sets the device address and finally
returns the whole usbdev_t structure with that address correctly set.

Note that this should make SuperSpeed devices work, but SuperSpeed hubs
are a wholly different story and would require a custom hub driver
(since the hub descriptor and port status formats are different for USB
3.0 ports, and the whole issue about the same hub showing up as two
different devices on two different ports might present additional
challenges). The stack currently just issues a warning and refuses to
initialize this part of the hub, which means that 3.0 devices connected
through a 3.0 hub may not work correctly.

Change-Id: Ie0b82dca23b7a750658ccc1a85f9daae5fbc20e1
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/170666
Reviewed-by: Kees Cook <keescook@chromium.org>
(cherry picked from commit ecec80e062f7efe32a9a17479dcf8cb678a4a98b)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6780
Tested-by: build bot (Jenkins)
2014-09-04 01:59:15 +02:00
..
TODO Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
ehci.c libpayload: Make EHCI driver cache-aware 2014-08-14 23:40:25 +02:00
ehci.h libpayload: Use unsigned long for BARs in *hci_init() 2014-07-10 20:55:41 +02:00
ehci_private.h libpayload: Make EHCI driver cache-aware 2014-08-14 23:40:25 +02:00
ehci_rh.c libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
generic_hub.c libpayload: usb: Unify USB speed between XHCI stack and USB core 2014-09-04 01:28:42 +02:00
generic_hub.h libpayload: usb: Unify USB speed between XHCI stack and USB core 2014-09-04 01:28:42 +02:00
ohci.c libpayload: Make USB transfer functions return amount of bytes 2014-08-12 22:03:28 +02:00
ohci.h libpayload: Use unsigned long for BARs in *hci_init() 2014-07-10 20:55:41 +02:00
ohci_private.h libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
ohci_rh.c libpayload: usb: Unify USB speed between XHCI stack and USB core 2014-09-04 01:28:42 +02:00
quirks.c libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices 2014-09-04 01:59:15 +02:00
uhci.c libpayload: Make USB transfer functions return amount of bytes 2014-08-12 22:03:28 +02:00
uhci.h libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
uhci_private.h libpayload: Remove bitfield use from UHCI data structures 2012-01-10 00:02:54 +01:00
uhci_rh.c libpayload: usb: Unify USB speed between XHCI stack and USB core 2014-09-04 01:28:42 +02:00
usb.c libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices 2014-09-04 01:59:15 +02:00
usb_dev.c
usbhid.c libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices 2014-09-04 01:59:15 +02:00
usbhub.c libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices 2014-09-04 01:59:15 +02:00
usbinit.c libpayload: usb: Allow direct instantiation of MMIO host controllers 2014-08-28 00:09:32 +02:00
usbmsc.c libpayload: usb: Fix several minor USB stack bugs 2014-08-19 23:31:05 +02:00
xhci.c libpayload: xhci: Ensure to reset dequeue pointer on stopped endpoints 2014-08-31 23:49:54 +02:00
xhci.h libpayload: Use unsigned long for BARs in *hci_init() 2014-07-10 20:55:41 +02:00
xhci_commands.c libpayload: xhci: Make XHCI stack usable on ARM 2014-08-14 23:41:21 +02:00
xhci_debug.c libpayload: xhci: Make XHCI stack usable on ARM 2014-08-14 23:41:21 +02:00
xhci_devconf.c libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices 2014-09-04 01:59:15 +02:00
xhci_events.c libpayload: xhci: Make XHCI stack usable on ARM 2014-08-14 23:41:21 +02:00
xhci_private.h libpayload: usb: Refactor USB enumeration to fix SuperSpeed devices 2014-09-04 01:59:15 +02:00
xhci_rh.c libpayload: usb: Unify USB speed between XHCI stack and USB core 2014-09-04 01:28:42 +02:00