coreboot-kgpe-d16/payloads/libpayload/drivers/usb
Julius Werner 83da50173c libpayload: xhci: Use Event Data TRBs for transfer event generation
The current XHCI code only sets IOC on the last TRB of a TD, and
doesn't set ISP anywhere. On my Synopsys DesignWare3 controller, this
won't generate an event at all when we have a short transfer that is not
on the last TRB of a TD, resulting in event ring desync and everyone
having a bad time. However, just setting ISP on other TRBs doesn't
really make for a nice solution: we then need to do ugly special casing
to fish out the spurious second transfer event you get for short
packets, and we still need a way to figure out how many bytes were
transferred. Since the Short Packet transfer event only reports
untransferred bytes for the current TRB, we would have to manually walk
the rest of the unprocessed TRB chain and add up the bytes. Check out
U-Boot and the Linux kernel to see how complicated this looks in
practice.

Now what if we had a way to just tell the HC "I want an event at exactly
*this* point in the TD, I want it to have the right completion code for
the whole TD, and to contain the exact number of bytes written"? Enter
the Event Data TRB: this little gizmo really does pretty much exactly
what any sane XHCI driver would want, and I have no idea why it isn't
used more often. It solves both the short packet event generation and
counting the transferred bytes without requiring any special magic in
software.

Change-Id: Idab412d61edf30655ec69c80066bfffd80290403
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/170980
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
(cherry picked from commit e512c8bcaa5b8e05cae3b9d04cd4947298de999d)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6516
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2014-08-11 18:26:00 +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: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +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: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
ehci_rh.c libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
generic_hub.c libpayload: Add a generic driver for usb hubs 2013-06-13 22:17:42 +02:00
generic_hub.h libpayload: Add a generic driver for usb hubs 2013-06-13 22:17:42 +02:00
ohci.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +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: Rework connection state detection for OHCI 2012-11-24 08:46:34 +01:00
quirks.c libpayload: Turn the "debug" #define into the usb_debug static inline function. 2012-11-07 18:38:37 +01:00
uhci.c libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01: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: Turn the "debug" #define into the usb_debug static inline function. 2012-11-07 18:38:37 +01:00
usb.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00
usb_dev.c Fix the USB code to find the headers after they were moved. 2008-09-11 17:29:00 +00:00
usbhid.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00
usbhub.c libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
usbinit.c libpayload: Change CONFIG_* to CONFIG_LP_* in the kconfig. 2014-08-05 18:44:08 +02:00
usbmsc.c libpayload: usb mass storage card hot plug 2013-11-25 23:56:22 +01:00
xhci.c libpayload: xhci: Use Event Data TRBs for transfer event generation 2014-08-11 18:26:00 +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: Fill gaps in the xHCI driver 2013-06-13 22:21:20 +02:00
xhci_debug.c libpayload: Fill gaps in the xHCI driver 2013-06-13 22:21:20 +02:00
xhci_devconf.c libpayload: Fill gaps in the xHCI driver 2013-06-13 22:21:20 +02:00
xhci_events.c libpayload: Fill gaps in the xHCI driver 2013-06-13 22:21:20 +02:00
xhci_private.h libpayload: xhci: Use Event Data TRBs for transfer event generation 2014-08-11 18:26:00 +02:00
xhci_rh.c libpayload: Fill gaps in the xHCI driver 2013-06-13 22:21:20 +02:00