aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-01-03 19:08:49 +0000
committerMichael Brown <mcb30@ipxe.org>2021-01-03 19:08:49 +0000
commit017b345d5a3c9ba8cc10e2ca69b6c986b91e0668 (patch)
tree929cec8ebc4769a625b2ccce16ca3dd4a819464f
parent988d2c13cdf0f0b4140685af35ced70ac5b3283c (diff)
downloadipxe-017b345d5a3c9ba8cc10e2ca69b6c986b91e0668.zip
ipxe-017b345d5a3c9ba8cc10e2ca69b6c986b91e0668.tar.gz
ipxe-017b345d5a3c9ba8cc10e2ca69b6c986b91e0668.tar.bz2
[xhci] Fail attempts to issue concurrent commands
The xHCI driver can handle only a single command TRB in progress at any one time. Immediately fail any attempts to issue concurrent commands (which should not occur in normal operation). Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/usb/xhci.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/usb/xhci.c b/src/drivers/usb/xhci.c
index 7bc2e35..7c8b2f2 100644
--- a/src/drivers/usb/xhci.c
+++ b/src/drivers/usb/xhci.c
@@ -1813,6 +1813,13 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
unsigned int i;
int rc;
+ /* Sanity check */
+ if ( xhci->pending != NULL ) {
+ DBGC ( xhci, "XHCI %s command ring busy\n", xhci->name );
+ rc = -EBUSY;
+ goto err_pending;
+ }
+
/* Record the pending command */
xhci->pending = trb;
@@ -1855,6 +1862,7 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
err_enqueue:
xhci->pending = NULL;
+ err_pending:
return rc;
}