diff options
author | Julius Werner <jwerner@chromium.org> | 2015-08-03 14:21:07 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-08-14 15:14:09 +0200 |
commit | 5f9a3f7fae0154008d4dfeeb2f3a84c6a5714e52 (patch) | |
tree | 0c0049d653578966eefb3e9c234c72fc7f10526c /payloads/libpayload/drivers | |
parent | 03e8188a3f92df480934d7e5ad92bb2ce9c008ef (diff) | |
download | coreboot-5f9a3f7fae0154008d4dfeeb2f3a84c6a5714e52.tar.xz |
libpayload: xhci: Carry over fixes from Chromium tree
This patch re-adds a few fixes that originally went into the
chromeos-2013.04 tree. I kinda seem to have slipped them into the
backport of Nico's original XHCI patch (crosreview.com/168097) instead
of making a new change, which was not very clever and caused them to be
forgotten in the later upstreaming wave.
Changing internal XHCI error numbers is just a cosmetic change to make
them uniquely identifyable in debug output. Bumping the timeout to 3
seconds is an actually important fix since we have seen mass storage
devices needing that much in the past.
BRANCH=None
BUG=None
TEST=Diffed payloads/libpayload/drivers/usb between chromeos-2013.04 and
chromeos-2015.07, confirmed that no serious differences remain.
Original-Change-Id: I03d865dbe536072d23374a49a0136e9f28568f8e
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/290423
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Change-Id: I5d773d3a23683fb2164916cc046f4a711b8d259e
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: http://review.coreboot.org/11178
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r-- | payloads/libpayload/drivers/usb/xhci_events.c | 14 | ||||
-rw-r--r-- | payloads/libpayload/drivers/usb/xhci_private.h | 11 |
2 files changed, 13 insertions, 12 deletions
diff --git a/payloads/libpayload/drivers/usb/xhci_events.c b/payloads/libpayload/drivers/usb/xhci_events.c index 391ebf6126..dacb5d8618 100644 --- a/payloads/libpayload/drivers/usb/xhci_events.c +++ b/payloads/libpayload/drivers/usb/xhci_events.c @@ -311,15 +311,15 @@ int xhci_wait_for_transfer(xhci_t *const xhci, const int slot_id, const int ep_id) { xhci_spew("Waiting for transfer on ID %d EP %d\n", slot_id, ep_id); - /* 2s for all types of transfers */ /* TODO: test, wait longer? */ - unsigned long timeout_us = 2 * 1000 * 1000; - int cc = TIMEOUT; + /* 3s for all types of transfers */ /* TODO: test, wait longer? */ + unsigned long timeout_us = 3 * 1000 * 1000; + int ret = TIMEOUT; while (xhci_wait_for_event_type(xhci, TRB_EV_TRANSFER, &timeout_us)) { if (TRB_GET(ID, xhci->er.cur) == slot_id && TRB_GET(EP, xhci->er.cur) == ep_id) { - cc = -TRB_GET(CC, xhci->er.cur); - if (cc == -CC_SUCCESS || cc == -CC_SHORT_PACKET) - cc = TRB_GET(EVTL, xhci->er.cur); + ret = -TRB_GET(CC, xhci->er.cur); + if (ret == -CC_SUCCESS || ret == -CC_SHORT_PACKET) + ret = TRB_GET(EVTL, xhci->er.cur); xhci_advance_event_ring(xhci); break; } @@ -329,5 +329,5 @@ xhci_wait_for_transfer(xhci_t *const xhci, const int slot_id, const int ep_id) if (!timeout_us) xhci_debug("Warning: Timed out waiting for TRB_EV_TRANSFER.\n"); xhci_update_event_dq(xhci); - return cc; + return ret; } diff --git a/payloads/libpayload/drivers/usb/xhci_private.h b/payloads/libpayload/drivers/usb/xhci_private.h index 26f7666539..05cf195235 100644 --- a/payloads/libpayload/drivers/usb/xhci_private.h +++ b/payloads/libpayload/drivers/usb/xhci_private.h @@ -46,11 +46,12 @@ #define MASK(startbit, lenbit) (((1<<(lenbit))-1)<<(startbit)) -#define TIMEOUT -1 -#define CONTROLLER_ERROR -2 -#define COMMUNICATION_ERROR -3 -#define OUT_OF_MEMORY -4 -#define DRIVER_ERROR -5 +/* Make these high enough to not collide with negative XHCI CCs */ +#define TIMEOUT -65 +#define CONTROLLER_ERROR -66 +#define COMMUNICATION_ERROR -67 +#define OUT_OF_MEMORY -68 +#define DRIVER_ERROR -69 #define CC_SUCCESS 1 #define CC_TRB_ERROR 5 |