coreboot/payloads/libpayload/drivers/usb
Julius Werner e39e2d8476 libpayload: Make USB transfer functions return amount of bytes
The USB bulk and control transfer functions in libpayload currently
always return 0 for success and 1 for all errors. This is sufficient for
current use cases (essentially just mass storage), but other classes
(like certain Ethernet adapters) need to be able to tell if a transfer
reached the intended amount of bytes, or if it fell short.

This patch slightly changes that USB API to return -1 on errors, and the
amount of transferred bytes on successes. All drivers in the current
libpayload mainline are modified to conform to the new error detection
model. Any third party users of this API will need to adapt their
if (...<controller>->bulk/control(...)) checks to
if (...<controller>->bulk/control(...) < 0) as well.

The host controller drivers for OHCI and EHCI correctly implement the
new behavior. UHCI and the XHCI stub just comply with the new API by
returning 0 or -1, but do not actually count the returned bytes.

BUG=chrome-os-partner:16957
TEST=None
BRANCH=None

CQ-DEPEND=CL:59674

Change-Id: Ic2ea2810c5edb992cbe185bc9711d2f8f557cae6
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48308
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
2013-06-24 14:03:27 -07:00
..
ehci.c libpayload: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07:00
ehci.h libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
ehci_private.h libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
ehci_rh.c libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
ohci.c libpayload: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07:00
ohci.h libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
ohci_private.h libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07: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
TODO Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
uhci.c libpayload: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07:00
uhci.h libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07: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: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07: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: Make keycode constants available outside of curses.h. 2013-03-18 20:45:48 +01:00
usbhub.c libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
usbinit.c libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
usbmsc.c libpayload: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07:00
xhci.c libpayload: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07:00
xhci.h libpayload: Add USB support for non-PCI controllers 2013-05-20 17:01:26 -07:00
xhci_private.h Add support for OHCI controllers and prelimiary support for xHCI (USB3) controllers. 2010-08-13 09:18:58 +00:00
xhci_rh.c libpayload: Turn the "debug" #define into the usb_debug static inline function. 2012-11-07 18:38:37 +01:00