Commit 0b7c105a authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

usb: host: xhci: rename completion codes to match spec

Cleanup only. This patch is a mechaninal rename to make sure our macros
for TRB completion codes match what the specification uses to refer to
such errors. The idea behind this is that it makes it far easier to grep
the specification and match it with implementation.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ced09c95
...@@ -418,7 +418,8 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) ...@@ -418,7 +418,8 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
/* Wait for last stop endpoint command to finish */ /* Wait for last stop endpoint command to finish */
wait_for_completion(cmd->completion); wait_for_completion(cmd->completion);
if (cmd->status == COMP_CMD_ABORT || cmd->status == COMP_CMD_STOP) { if (cmd->status == COMP_COMMAND_ABORTED ||
cmd->status == COMP_STOPPED) {
xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n");
ret = -ETIME; ret = -ETIME;
} }
......
This diff is collapsed.
...@@ -1823,32 +1823,32 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci, ...@@ -1823,32 +1823,32 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
int ret; int ret;
switch (*cmd_status) { switch (*cmd_status) {
case COMP_CMD_ABORT: case COMP_COMMAND_ABORTED:
case COMP_CMD_STOP: case COMP_STOPPED:
xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n"); xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n");
ret = -ETIME; ret = -ETIME;
break; break;
case COMP_ENOMEM: case COMP_RESOURCE_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"Not enough host controller resources for new device state.\n"); "Not enough host controller resources for new device state.\n");
ret = -ENOMEM; ret = -ENOMEM;
/* FIXME: can we allocate more resources for the HC? */ /* FIXME: can we allocate more resources for the HC? */
break; break;
case COMP_BW_ERR: case COMP_BANDWIDTH_ERROR:
case COMP_2ND_BW_ERR: case COMP_SECONDARY_BANDWIDTH_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"Not enough bandwidth for new device state.\n"); "Not enough bandwidth for new device state.\n");
ret = -ENOSPC; ret = -ENOSPC;
/* FIXME: can we go back to the old state? */ /* FIXME: can we go back to the old state? */
break; break;
case COMP_TRB_ERR: case COMP_TRB_ERROR:
/* the HCD set up something wrong */ /* the HCD set up something wrong */
dev_warn(&udev->dev, "ERROR: Endpoint drop flag = 0, " dev_warn(&udev->dev, "ERROR: Endpoint drop flag = 0, "
"add flag = 1, " "add flag = 1, "
"and endpoint is not disabled.\n"); "and endpoint is not disabled.\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
case COMP_DEV_ERR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"ERROR: Incompatible device for endpoint configure command.\n"); "ERROR: Incompatible device for endpoint configure command.\n");
ret = -ENODEV; ret = -ENODEV;
...@@ -1874,33 +1874,33 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, ...@@ -1874,33 +1874,33 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci,
struct xhci_virt_device *virt_dev = xhci->devs[udev->slot_id]; struct xhci_virt_device *virt_dev = xhci->devs[udev->slot_id];
switch (*cmd_status) { switch (*cmd_status) {
case COMP_CMD_ABORT: case COMP_COMMAND_ABORTED:
case COMP_CMD_STOP: case COMP_STOPPED:
xhci_warn(xhci, "Timeout while waiting for evaluate context command\n"); xhci_warn(xhci, "Timeout while waiting for evaluate context command\n");
ret = -ETIME; ret = -ETIME;
break; break;
case COMP_EINVAL: case COMP_PARAMETER_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"WARN: xHCI driver setup invalid evaluate context command.\n"); "WARN: xHCI driver setup invalid evaluate context command.\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
case COMP_EBADSLT: case COMP_SLOT_NOT_ENABLED_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"WARN: slot not enabled for evaluate context command.\n"); "WARN: slot not enabled for evaluate context command.\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
case COMP_CTX_STATE: case COMP_CONTEXT_STATE_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"WARN: invalid context state for evaluate context command.\n"); "WARN: invalid context state for evaluate context command.\n");
xhci_dbg_ctx(xhci, virt_dev->out_ctx, 1); xhci_dbg_ctx(xhci, virt_dev->out_ctx, 1);
ret = -EINVAL; ret = -EINVAL;
break; break;
case COMP_DEV_ERR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"ERROR: Incompatible device for evaluate context command.\n"); "ERROR: Incompatible device for evaluate context command.\n");
ret = -ENODEV; ret = -ENODEV;
break; break;
case COMP_MEL_ERR: case COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR:
/* Max Exit Latency too large error */ /* Max Exit Latency too large error */
dev_warn(&udev->dev, "WARN: Max Exit Latency too large\n"); dev_warn(&udev->dev, "WARN: Max Exit Latency too large\n");
ret = -EINVAL; ret = -EINVAL;
...@@ -3496,13 +3496,13 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -3496,13 +3496,13 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
*/ */
ret = reset_device_cmd->status; ret = reset_device_cmd->status;
switch (ret) { switch (ret) {
case COMP_CMD_ABORT: case COMP_COMMAND_ABORTED:
case COMP_CMD_STOP: case COMP_STOPPED:
xhci_warn(xhci, "Timeout waiting for reset device command\n"); xhci_warn(xhci, "Timeout waiting for reset device command\n");
ret = -ETIME; ret = -ETIME;
goto command_cleanup; goto command_cleanup;
case COMP_EBADSLT: /* 0.95 completion code for bad slot ID */ case COMP_SLOT_NOT_ENABLED_ERROR: /* 0.95 completion for bad slot ID */
case COMP_CTX_STATE: /* 0.96 completion code for same thing */ case COMP_CONTEXT_STATE_ERROR: /* 0.96 completion code for same thing */
xhci_dbg(xhci, "Can't reset device (slot ID %u) in %s state\n", xhci_dbg(xhci, "Can't reset device (slot ID %u) in %s state\n",
slot_id, slot_id,
xhci_get_slot_state(xhci, virt_dev->out_ctx)); xhci_get_slot_state(xhci, virt_dev->out_ctx));
...@@ -3862,22 +3862,22 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, ...@@ -3862,22 +3862,22 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
* command on a timeout. * command on a timeout.
*/ */
switch (command->status) { switch (command->status) {
case COMP_CMD_ABORT: case COMP_COMMAND_ABORTED:
case COMP_CMD_STOP: case COMP_STOPPED:
xhci_warn(xhci, "Timeout while waiting for setup device command\n"); xhci_warn(xhci, "Timeout while waiting for setup device command\n");
ret = -ETIME; ret = -ETIME;
break; break;
case COMP_CTX_STATE: case COMP_CONTEXT_STATE_ERROR:
case COMP_EBADSLT: case COMP_SLOT_NOT_ENABLED_ERROR:
xhci_err(xhci, "Setup ERROR: setup %s command for slot %d.\n", xhci_err(xhci, "Setup ERROR: setup %s command for slot %d.\n",
act, udev->slot_id); act, udev->slot_id);
ret = -EINVAL; ret = -EINVAL;
break; break;
case COMP_TX_ERR: case COMP_USB_TRANSACTION_ERROR:
dev_warn(&udev->dev, "Device not responding to setup %s.\n", act); dev_warn(&udev->dev, "Device not responding to setup %s.\n", act);
ret = -EPROTO; ret = -EPROTO;
break; break;
case COMP_DEV_ERR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
dev_warn(&udev->dev, dev_warn(&udev->dev,
"ERROR: Incompatible device for setup %s command\n", act); "ERROR: Incompatible device for setup %s command\n", act);
ret = -ENODEV; ret = -ENODEV;
......
...@@ -1060,76 +1060,42 @@ struct xhci_transfer_event { ...@@ -1060,76 +1060,42 @@ struct xhci_transfer_event {
/* Completion Code - only applicable for some types of TRBs */ /* Completion Code - only applicable for some types of TRBs */
#define COMP_CODE_MASK (0xff << 24) #define COMP_CODE_MASK (0xff << 24)
#define GET_COMP_CODE(p) (((p) & COMP_CODE_MASK) >> 24) #define GET_COMP_CODE(p) (((p) & COMP_CODE_MASK) >> 24)
#define COMP_SUCCESS 1 #define COMP_INVALID 0
/* Data Buffer Error */ #define COMP_SUCCESS 1
#define COMP_DB_ERR 2 #define COMP_DATA_BUFFER_ERROR 2
/* Babble Detected Error */ #define COMP_BABBLE_DETECTED_ERROR 3
#define COMP_BABBLE 3 #define COMP_USB_TRANSACTION_ERROR 4
/* USB Transaction Error */ #define COMP_TRB_ERROR 5
#define COMP_TX_ERR 4 #define COMP_STALL_ERROR 6
/* TRB Error - some TRB field is invalid */ #define COMP_RESOURCE_ERROR 7
#define COMP_TRB_ERR 5 #define COMP_BANDWIDTH_ERROR 8
/* Stall Error - USB device is stalled */ #define COMP_NO_SLOTS_AVAILABLE_ERROR 9
#define COMP_STALL 6 #define COMP_INVALID_STREAM_TYPE_ERROR 10
/* Resource Error - HC doesn't have memory for that device configuration */ #define COMP_SLOT_NOT_ENABLED_ERROR 11
#define COMP_ENOMEM 7 #define COMP_ENDPOINT_NOT_ENABLED_ERROR 12
/* Bandwidth Error - not enough room in schedule for this dev config */ #define COMP_SHORT_PACKET 13
#define COMP_BW_ERR 8 #define COMP_RING_UNDERRUN 14
/* No Slots Available Error - HC ran out of device slots */ #define COMP_RING_OVERRUN 15
#define COMP_ENOSLOTS 9 #define COMP_VF_EVENT_RING_FULL_ERROR 16
/* Invalid Stream Type Error */ #define COMP_PARAMETER_ERROR 17
#define COMP_STREAM_ERR 10 #define COMP_BANDWIDTH_OVERRUN_ERROR 18
/* Slot Not Enabled Error - doorbell rung for disabled device slot */ #define COMP_CONTEXT_STATE_ERROR 19
#define COMP_EBADSLT 11 #define COMP_NO_PING_RESPONSE_ERROR 20
/* Endpoint Not Enabled Error */ #define COMP_EVENT_RING_FULL_ERROR 21
#define COMP_EBADEP 12 #define COMP_INCOMPATIBLE_DEVICE_ERROR 22
/* Short Packet */ #define COMP_MISSED_SERVICE_ERROR 23
#define COMP_SHORT_TX 13 #define COMP_COMMAND_RING_STOPPED 24
/* Ring Underrun - doorbell rung for an empty isoc OUT ep ring */ #define COMP_COMMAND_ABORTED 25
#define COMP_UNDERRUN 14 #define COMP_STOPPED 26
/* Ring Overrun - isoc IN ep ring is empty when ep is scheduled to RX */ #define COMP_STOPPED_LENGTH_INVALID 27
#define COMP_OVERRUN 15 #define COMP_STOPPED_SHORT_PACKET 28
/* Virtual Function Event Ring Full Error */ #define COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR 29
#define COMP_VF_FULL 16 #define COMP_ISOCH_BUFFER_OVERRUN 31
/* Parameter Error - Context parameter is invalid */ #define COMP_EVENT_LOST_ERROR 32
#define COMP_EINVAL 17 #define COMP_UNDEFINED_ERROR 33
/* Bandwidth Overrun Error - isoc ep exceeded its allocated bandwidth */ #define COMP_INVALID_STREAM_ID_ERROR 34
#define COMP_BW_OVER 18 #define COMP_SECONDARY_BANDWIDTH_ERROR 35
/* Context State Error - illegal context state transition requested */ #define COMP_SPLIT_TRANSACTION_ERROR 36
#define COMP_CTX_STATE 19
/* No Ping Response Error - HC didn't get PING_RESPONSE in time to TX */
#define COMP_PING_ERR 20
/* Event Ring is full */
#define COMP_ER_FULL 21
/* Incompatible Device Error */
#define COMP_DEV_ERR 22
/* Missed Service Error - HC couldn't service an isoc ep within interval */
#define COMP_MISSED_INT 23
/* Successfully stopped command ring */
#define COMP_CMD_STOP 24
/* Successfully aborted current command and stopped command ring */
#define COMP_CMD_ABORT 25
/* Stopped - transfer was terminated by a stop endpoint command */
#define COMP_STOP 26
/* Same as COMP_EP_STOPPED, but the transferred length in the event is invalid */
#define COMP_STOP_INVAL 27
/* Same as COMP_EP_STOPPED, but a short packet detected */
#define COMP_STOP_SHORT 28
/* Max Exit Latency Too Large Error */
#define COMP_MEL_ERR 29
/* TRB type 30 reserved */
/* Isoc Buffer Overrun - an isoc IN ep sent more data than could fit in TD */
#define COMP_BUFF_OVER 31
/* Event Lost Error - xHC has an "internal event overrun condition" */
#define COMP_ISSUES 32
/* Undefined Error - reported when other error codes don't apply */
#define COMP_UNKNOWN 33
/* Invalid Stream ID Error */
#define COMP_STRID_ERR 34
/* Secondary Bandwidth Error - may be returned by a Configure Endpoint cmd */
#define COMP_2ND_BW_ERR 35
/* Split Transaction Error */
#define COMP_SPLIT_ERR 36
struct xhci_link_trb { struct xhci_link_trb {
/* 64-bit segment pointer*/ /* 64-bit segment pointer*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment