From 645458e5a05a76b15cbef743fe1d3ff4ffa82569 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 18 Feb 2015 11:10:55 +0000 Subject: [xhci] Abort commands on timeout When a command times out, abort it (via the Command Abort bit in the Command Ring Control Register) so that subsequent commands may execute as expected. This improves robustness when a device fails to respond to the Set Address command, since the subsequent Disable Slot command will now succeed. Signed-off-by: Michael Brown --- src/drivers/usb/xhci.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/drivers/usb/xhci.h') diff --git a/src/drivers/usb/xhci.h b/src/drivers/usb/xhci.h index ec951bd6..30c6d1f4 100644 --- a/src/drivers/usb/xhci.h +++ b/src/drivers/usb/xhci.h @@ -178,6 +178,9 @@ enum xhci_default_psi_value { /** Command ring cycle state */ #define XHCI_CRCR_RCS 0x00000001UL +/** Command abort */ +#define XHCI_CRCR_CA 0x00000004UL + /** Command ring running */ #define XHCI_CRCR_CRR 0x00000008UL @@ -629,6 +632,8 @@ enum xhci_completion_code { XHCI_CMPLT_SUCCESS = 1, /** Short packet */ XHCI_CMPLT_SHORT = 13, + /** Command ring stopped */ + XHCI_CMPLT_CMD_STOPPED = 24, }; /** A port status change transfer request block */ @@ -987,6 +992,12 @@ xhci_ring_consumed ( struct xhci_trb_ring *ring ) { */ #define XHCI_COMMAND_MAX_WAIT_MS 500 +/** Time to delay after aborting a command + * + * This is a policy decision + */ +#define XHCI_COMMAND_ABORT_DELAY_MS 500 + /** Maximum time to wait for a port reset to complete * * This is a policy decision. @@ -1042,8 +1053,8 @@ struct xhci_device { struct xhci_trb_ring command; /** Event ring */ struct xhci_event_ring event; - /** Current command completion buffer (if any) */ - union xhci_trb *completion; + /** Current command (if any) */ + union xhci_trb *pending; /** Device slots, indexed by slot ID */ struct xhci_slot **slot; -- cgit