Skip to content

Commit f6ba6fe

Browse files
Alex HeSarah Sharp
authored andcommitted
xHCI 1.0: Incompatible Device Error
It is one new TRB Completion Code for the xHCI spec v1.0. Asserted if the xHC detects a problem with a device that does not allow it to be successfully accessed, e.g. due to a device compliance or compatibility problem. This error may be returned by any command or transfer, and is fatal as far as the Slot is concerned. Return -EPROTO by urb->status or frame->status of ISOC for transfer case. And return -ENODEV for configure endpoint command, evaluate context command and address device command if there is an incompatible Device Error. The error codes will be sent back to the USB core to decide how to do. It's unnecessary for other commands because after the three commands run successfully means that the device has been accepted. Signed-off-by: Alex He <[email protected]> Signed-off-by: Sarah Sharp <[email protected]>
1 parent e1cf486 commit f6ba6fe

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
17331733
frame->status = -EOVERFLOW;
17341734
skip_td = true;
17351735
break;
1736+
case COMP_DEV_ERR:
17361737
case COMP_STALL:
17371738
frame->status = -EPROTO;
17381739
skip_td = true;
@@ -2016,6 +2017,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
20162017
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
20172018
ep_index);
20182019
goto cleanup;
2020+
case COMP_DEV_ERR:
2021+
xhci_warn(xhci, "WARN: detect an incompatible device");
2022+
status = -EPROTO;
2023+
break;
20192024
case COMP_MISSED_INT:
20202025
/*
20212026
* When encounter missed service error, one or more isoc tds

drivers/usb/host/xhci.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,11 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
15511551
"and endpoint is not disabled.\n");
15521552
ret = -EINVAL;
15531553
break;
1554+
case COMP_DEV_ERR:
1555+
dev_warn(&udev->dev, "ERROR: Incompatible device for endpoint "
1556+
"configure command.\n");
1557+
ret = -ENODEV;
1558+
break;
15541559
case COMP_SUCCESS:
15551560
dev_dbg(&udev->dev, "Successful Endpoint Configure command\n");
15561561
ret = 0;
@@ -1585,6 +1590,11 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci,
15851590
xhci_dbg_ctx(xhci, virt_dev->out_ctx, 1);
15861591
ret = -EINVAL;
15871592
break;
1593+
case COMP_DEV_ERR:
1594+
dev_warn(&udev->dev, "ERROR: Incompatible device for evaluate "
1595+
"context command.\n");
1596+
ret = -ENODEV;
1597+
break;
15881598
case COMP_MEL_ERR:
15891599
/* Max Exit Latency too large error */
15901600
dev_warn(&udev->dev, "WARN: Max Exit Latency too large\n");
@@ -2867,6 +2877,11 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
28672877
dev_warn(&udev->dev, "Device not responding to set address.\n");
28682878
ret = -EPROTO;
28692879
break;
2880+
case COMP_DEV_ERR:
2881+
dev_warn(&udev->dev, "ERROR: Incompatible device for address "
2882+
"device command.\n");
2883+
ret = -ENODEV;
2884+
break;
28702885
case COMP_SUCCESS:
28712886
xhci_dbg(xhci, "Successful Address Device command\n");
28722887
break;

drivers/usb/host/xhci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,8 @@ struct xhci_transfer_event {
874874
#define COMP_PING_ERR 20
875875
/* Event Ring is full */
876876
#define COMP_ER_FULL 21
877+
/* Incompatible Device Error */
878+
#define COMP_DEV_ERR 22
877879
/* Missed Service Error - HC couldn't service an isoc ep within interval */
878880
#define COMP_MISSED_INT 23
879881
/* Successfully stopped command ring */

0 commit comments

Comments
 (0)