coreboot/payloads/libpayload/drivers
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
..
storage libpayload: Export device count in storage interface 2012-11-14 17:39:03 +01:00
usb libpayload: Make USB transfer functions return amount of bytes 2013-06-24 14:03:27 -07:00
video libpayload: If no video drivers initialize in video_init, return 1. 2013-03-13 23:06:14 +01:00
cbmem_console.c libpayload: Fix license headers 2013-02-20 02:41:24 +01:00
hid.c make keyboard reset driver generic (not pc keyboard driver dependent) 2010-03-25 18:52:24 +00:00
keyboard.c libpayload: Make keycode constants available outside of curses.h. 2013-03-18 20:45:48 +01:00
Makefile.inc libpayload: only compile drivers/serial.c on machines that use it. 2013-02-16 04:48:51 +01:00
nvram.c Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
options.c libpayload: Fix lookup by label in CMOS layouts 2012-11-30 06:05:50 +01:00
pci.c [PATCH] libpayload: Fix the PCI search function 2008-10-20 16:52:06 +00:00
serial.c libpayload: If there's no IO address space, don't try to use it for serial 2013-03-13 23:05:06 +01:00
speaker.c Fix libpayload speaker driver 2011-10-27 10:49:41 +02:00