| From f7ddfde30b9abf4c11431393a9d13eae3a3c8a7c Mon Sep 17 00:00:00 2001 |
| From: Felipe Balbi <felipe.balbi@linux.intel.com> |
| Date: Mon, 23 Jan 2017 14:20:06 +0200 |
| Subject: [PATCH 194/255] 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: Felipe Balbi <felipe.balbi@linux.intel.com> |
| Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| (cherry picked from commit 0b7c105a04ca793acf5d39ff9bafebe89182fc6b) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/usb/host/xhci-hub.c | 3 - |
| drivers/usb/host/xhci-ring.c | 124 +++++++++++++++++++++---------------------- |
| drivers/usb/host/xhci.c | 48 ++++++++-------- |
| drivers/usb/host/xhci.h | 106 ++++++++++++------------------------ |
| 4 files changed, 124 insertions(+), 157 deletions(-) |
| |
| --- a/drivers/usb/host/xhci-hub.c |
| +++ b/drivers/usb/host/xhci-hub.c |
| @@ -437,7 +437,8 @@ static int xhci_stop_device(struct xhci_ |
| /* Wait for last stop endpoint command to finish */ |
| 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"); |
| ret = -ETIME; |
| } |
| --- a/drivers/usb/host/xhci-ring.c |
| +++ b/drivers/usb/host/xhci-ring.c |
| @@ -304,10 +304,10 @@ static void xhci_handle_stopped_cmd_ring |
| /* Turn all aborted commands in list to no-ops, then restart */ |
| list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) { |
| |
| - if (i_cmd->status != COMP_CMD_ABORT) |
| + if (i_cmd->status != COMP_COMMAND_ABORTED) |
| continue; |
| |
| - i_cmd->status = COMP_CMD_STOP; |
| + i_cmd->status = COMP_STOPPED; |
| |
| xhci_dbg(xhci, "Turn aborted command %p to no-op\n", |
| i_cmd->command_trb); |
| @@ -1041,10 +1041,10 @@ static void xhci_handle_cmd_set_deq(stru |
| unsigned int slot_state; |
| |
| switch (cmd_comp_code) { |
| - case COMP_TRB_ERR: |
| + case COMP_TRB_ERROR: |
| xhci_warn(xhci, "WARN Set TR Deq Ptr cmd invalid because of stream ID configuration\n"); |
| break; |
| - case COMP_CTX_STATE: |
| + case COMP_CONTEXT_STATE_ERROR: |
| xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.\n"); |
| ep_state = GET_EP_CTX_STATE(ep_ctx); |
| slot_state = le32_to_cpu(slot_ctx->dev_state); |
| @@ -1053,7 +1053,7 @@ static void xhci_handle_cmd_set_deq(stru |
| "Slot state = %u, EP state = %u", |
| slot_state, ep_state); |
| break; |
| - case COMP_EBADSLT: |
| + case COMP_SLOT_NOT_ENABLED_ERROR: |
| xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because slot %u was not enabled.\n", |
| slot_id); |
| break; |
| @@ -1250,7 +1250,7 @@ void xhci_cleanup_command_queue(struct x |
| { |
| struct xhci_command *cur_cmd, *tmp_cmd; |
| list_for_each_entry_safe(cur_cmd, tmp_cmd, &xhci->cmd_list, cmd_list) |
| - xhci_complete_del_and_free_cmd(cur_cmd, COMP_CMD_ABORT); |
| + xhci_complete_del_and_free_cmd(cur_cmd, COMP_COMMAND_ABORTED); |
| } |
| |
| void xhci_handle_command_timeout(struct work_struct *work) |
| @@ -1273,7 +1273,7 @@ void xhci_handle_command_timeout(struct |
| return; |
| } |
| /* mark this command to be cancelled */ |
| - xhci->current_cmd->status = COMP_CMD_ABORT; |
| + xhci->current_cmd->status = COMP_COMMAND_ABORTED; |
| |
| /* Make sure command ring is running before aborting it */ |
| hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); |
| @@ -1347,7 +1347,7 @@ static void handle_cmd_completion(struct |
| cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); |
| |
| /* If CMD ring stopped we own the trbs between enqueue and dequeue */ |
| - if (cmd_comp_code == COMP_CMD_STOP) { |
| + if (cmd_comp_code == COMP_STOPPED) { |
| complete_all(&xhci->cmd_ring_stop_completion); |
| return; |
| } |
| @@ -1364,9 +1364,9 @@ static void handle_cmd_completion(struct |
| * The command ring is stopped now, but the xHC will issue a Command |
| * Ring Stopped event which will cause us to restart it. |
| */ |
| - if (cmd_comp_code == COMP_CMD_ABORT) { |
| + if (cmd_comp_code == COMP_COMMAND_ABORTED) { |
| xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; |
| - if (cmd->status == COMP_CMD_ABORT) { |
| + if (cmd->status == COMP_COMMAND_ABORTED) { |
| if (xhci->current_cmd == cmd) |
| xhci->current_cmd = NULL; |
| goto event_handled; |
| @@ -1402,8 +1402,8 @@ static void handle_cmd_completion(struct |
| break; |
| case TRB_CMD_NOOP: |
| /* Is this an aborted command turned to NO-OP? */ |
| - if (cmd->status == COMP_CMD_STOP) |
| - cmd_comp_code = COMP_CMD_STOP; |
| + if (cmd->status == COMP_STOPPED) |
| + cmd_comp_code = COMP_STOPPED; |
| break; |
| case TRB_RESET_EP: |
| WARN_ON(slot_id != TRB_TO_SLOT_ID( |
| @@ -1796,9 +1796,9 @@ static int xhci_requires_manual_halt_cle |
| unsigned int trb_comp_code) |
| { |
| /* TRB completion codes that may require a manual halt cleanup */ |
| - if (trb_comp_code == COMP_TX_ERR || |
| - trb_comp_code == COMP_BABBLE || |
| - trb_comp_code == COMP_SPLIT_ERR) |
| + if (trb_comp_code == COMP_USB_TRANSACTION_ERROR || |
| + trb_comp_code == COMP_BABBLE_DETECTED_ERROR || |
| + trb_comp_code == COMP_SPLIT_TRANSACTION_ERROR) |
| /* The 0.95 spec says a babbling control endpoint |
| * is not halted. The 0.96 spec says it is. Some HW |
| * claims to be 0.95 compliant, but it halts the control |
| @@ -1852,9 +1852,9 @@ static int finish_td(struct xhci_hcd *xh |
| if (skip) |
| goto td_cleanup; |
| |
| - if (trb_comp_code == COMP_STOP_INVAL || |
| - trb_comp_code == COMP_STOP || |
| - trb_comp_code == COMP_STOP_SHORT) { |
| + if (trb_comp_code == COMP_STOPPED_LENGTH_INVALID || |
| + trb_comp_code == COMP_STOPPED || |
| + trb_comp_code == COMP_STOPPED_SHORT_PACKET) { |
| /* The Endpoint Stop Command completion will take care of any |
| * stopped TDs. A stopped TD may be restarted, so don't update |
| * the ring dequeue pointer or take this TD off any lists yet. |
| @@ -1862,7 +1862,7 @@ static int finish_td(struct xhci_hcd *xh |
| ep->stopped_td = td; |
| return 0; |
| } |
| - if (trb_comp_code == COMP_STALL || |
| + if (trb_comp_code == COMP_STALL_ERROR || |
| xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
| trb_comp_code)) { |
| /* Issue a reset endpoint command to clear the host side |
| @@ -1973,16 +1973,16 @@ static int process_ctrl_td(struct xhci_h |
| } |
| *status = 0; |
| break; |
| - case COMP_SHORT_TX: |
| + case COMP_SHORT_PACKET: |
| *status = 0; |
| break; |
| - case COMP_STOP_SHORT: |
| + case COMP_STOPPED_SHORT_PACKET: |
| if (trb_type == TRB_DATA || trb_type == TRB_NORMAL) |
| td->urb->actual_length = remaining; |
| else |
| xhci_warn(xhci, "WARN: Stopped Short Packet on ctrl setup or status TRB\n"); |
| goto finish_td; |
| - case COMP_STOP: |
| + case COMP_STOPPED: |
| switch (trb_type) { |
| case TRB_SETUP: |
| td->urb->actual_length = 0; |
| @@ -1996,7 +1996,7 @@ static int process_ctrl_td(struct xhci_h |
| trb_type); |
| goto finish_td; |
| } |
| - case COMP_STOP_INVAL: |
| + case COMP_STOPPED_LENGTH_INVALID: |
| goto finish_td; |
| default: |
| if (!xhci_requires_manual_halt_cleanup(xhci, |
| @@ -2005,7 +2005,7 @@ static int process_ctrl_td(struct xhci_h |
| xhci_dbg(xhci, "TRB error %u, halted endpoint index = %u\n", |
| trb_comp_code, ep_index); |
| /* else fall through */ |
| - case COMP_STALL: |
| + case COMP_STALL_ERROR: |
| /* Did we transfer part of the data (middle) phase? */ |
| if (trb_type == TRB_DATA || trb_type == TRB_NORMAL) |
| td->urb->actual_length = requested - remaining; |
| @@ -2076,35 +2076,35 @@ static int process_isoc_td(struct xhci_h |
| } |
| frame->status = 0; |
| break; |
| - case COMP_SHORT_TX: |
| + case COMP_SHORT_PACKET: |
| frame->status = short_framestatus; |
| sum_trbs_for_length = true; |
| break; |
| - case COMP_BW_OVER: |
| + case COMP_BANDWIDTH_OVERRUN_ERROR: |
| frame->status = -ECOMM; |
| break; |
| - case COMP_BUFF_OVER: |
| - case COMP_BABBLE: |
| + case COMP_ISOCH_BUFFER_OVERRUN: |
| + case COMP_BABBLE_DETECTED_ERROR: |
| frame->status = -EOVERFLOW; |
| break; |
| - case COMP_DEV_ERR: |
| - case COMP_STALL: |
| + case COMP_INCOMPATIBLE_DEVICE_ERROR: |
| + case COMP_STALL_ERROR: |
| frame->status = -EPROTO; |
| break; |
| - case COMP_TX_ERR: |
| + case COMP_USB_TRANSACTION_ERROR: |
| frame->status = -EPROTO; |
| if (ep_trb != td->last_trb) |
| return 0; |
| break; |
| - case COMP_STOP: |
| + case COMP_STOPPED: |
| sum_trbs_for_length = true; |
| break; |
| - case COMP_STOP_SHORT: |
| + case COMP_STOPPED_SHORT_PACKET: |
| /* field normally containing residue now contains tranferred */ |
| frame->status = short_framestatus; |
| requested = remaining; |
| break; |
| - case COMP_STOP_INVAL: |
| + case COMP_STOPPED_LENGTH_INVALID: |
| requested = 0; |
| remaining = 0; |
| break; |
| @@ -2181,16 +2181,16 @@ static int process_bulk_intr_td(struct x |
| } |
| *status = 0; |
| break; |
| - case COMP_SHORT_TX: |
| + case COMP_SHORT_PACKET: |
| xhci_dbg(xhci, "ep %#x - asked for %d bytes, %d bytes untransferred\n", |
| td->urb->ep->desc.bEndpointAddress, |
| requested, remaining); |
| *status = 0; |
| break; |
| - case COMP_STOP_SHORT: |
| + case COMP_STOPPED_SHORT_PACKET: |
| td->urb->actual_length = remaining; |
| goto finish_td; |
| - case COMP_STOP_INVAL: |
| + case COMP_STOPPED_LENGTH_INVALID: |
| /* stopped on ep trb with invalid length, exclude it */ |
| ep_trb_len = 0; |
| remaining = 0; |
| @@ -2296,50 +2296,50 @@ static int handle_tx_event(struct xhci_h |
| if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) |
| break; |
| if (xhci->quirks & XHCI_TRUST_TX_LENGTH) |
| - trb_comp_code = COMP_SHORT_TX; |
| + trb_comp_code = COMP_SHORT_PACKET; |
| else |
| xhci_warn_ratelimited(xhci, |
| "WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n"); |
| - case COMP_SHORT_TX: |
| + case COMP_SHORT_PACKET: |
| break; |
| - case COMP_STOP: |
| + case COMP_STOPPED: |
| xhci_dbg(xhci, "Stopped on Transfer TRB\n"); |
| break; |
| - case COMP_STOP_INVAL: |
| + case COMP_STOPPED_LENGTH_INVALID: |
| xhci_dbg(xhci, "Stopped on No-op or Link TRB\n"); |
| break; |
| - case COMP_STOP_SHORT: |
| + case COMP_STOPPED_SHORT_PACKET: |
| xhci_dbg(xhci, "Stopped with short packet transfer detected\n"); |
| break; |
| - case COMP_STALL: |
| + case COMP_STALL_ERROR: |
| xhci_dbg(xhci, "Stalled endpoint\n"); |
| ep->ep_state |= EP_HALTED; |
| status = -EPIPE; |
| break; |
| - case COMP_TRB_ERR: |
| + case COMP_TRB_ERROR: |
| xhci_warn(xhci, "WARN: TRB error on endpoint\n"); |
| status = -EILSEQ; |
| break; |
| - case COMP_SPLIT_ERR: |
| - case COMP_TX_ERR: |
| + case COMP_SPLIT_TRANSACTION_ERROR: |
| + case COMP_USB_TRANSACTION_ERROR: |
| xhci_dbg(xhci, "Transfer error on endpoint\n"); |
| status = -EPROTO; |
| break; |
| - case COMP_BABBLE: |
| + case COMP_BABBLE_DETECTED_ERROR: |
| xhci_dbg(xhci, "Babble error on endpoint\n"); |
| status = -EOVERFLOW; |
| break; |
| - case COMP_DB_ERR: |
| + case COMP_DATA_BUFFER_ERROR: |
| xhci_warn(xhci, "WARN: HC couldn't access mem fast enough\n"); |
| status = -ENOSR; |
| break; |
| - case COMP_BW_OVER: |
| + case COMP_BANDWIDTH_OVERRUN_ERROR: |
| xhci_warn(xhci, "WARN: bandwidth overrun event on endpoint\n"); |
| break; |
| - case COMP_BUFF_OVER: |
| + case COMP_ISOCH_BUFFER_OVERRUN: |
| xhci_warn(xhci, "WARN: buffer overrun event on endpoint\n"); |
| break; |
| - case COMP_UNDERRUN: |
| + case COMP_RING_UNDERRUN: |
| /* |
| * When the Isoch ring is empty, the xHC will generate |
| * a Ring Overrun Event for IN Isoch endpoint or Ring |
| @@ -2352,7 +2352,7 @@ static int handle_tx_event(struct xhci_h |
| TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), |
| ep_index); |
| goto cleanup; |
| - case COMP_OVERRUN: |
| + case COMP_RING_OVERRUN: |
| xhci_dbg(xhci, "overrun event on endpoint\n"); |
| if (!list_empty(&ep_ring->td_list)) |
| xhci_dbg(xhci, "Overrun Event for slot %d ep %d " |
| @@ -2360,11 +2360,11 @@ static int handle_tx_event(struct xhci_h |
| TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), |
| ep_index); |
| goto cleanup; |
| - case COMP_DEV_ERR: |
| + case COMP_INCOMPATIBLE_DEVICE_ERROR: |
| xhci_warn(xhci, "WARN: detect an incompatible device"); |
| status = -EPROTO; |
| break; |
| - case COMP_MISSED_INT: |
| + case COMP_MISSED_SERVICE_ERROR: |
| /* |
| * When encounter missed service error, one or more isoc tds |
| * may be missed by xHC. |
| @@ -2374,7 +2374,7 @@ static int handle_tx_event(struct xhci_h |
| ep->skip = true; |
| xhci_dbg(xhci, "Miss service interval error, set skip flag\n"); |
| goto cleanup; |
| - case COMP_PING_ERR: |
| + case COMP_NO_PING_RESPONSE_ERROR: |
| ep->skip = true; |
| xhci_dbg(xhci, "No Ping response error, Skip one Isoc TD\n"); |
| goto cleanup; |
| @@ -2398,8 +2398,8 @@ static int handle_tx_event(struct xhci_h |
| * event if the device was suspended. Don't print |
| * warnings. |
| */ |
| - if (!(trb_comp_code == COMP_STOP || |
| - trb_comp_code == COMP_STOP_INVAL)) { |
| + if (!(trb_comp_code == COMP_STOPPED || |
| + trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) { |
| xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", |
| TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), |
| ep_index); |
| @@ -2440,8 +2440,8 @@ static int handle_tx_event(struct xhci_h |
| * last TRB of the previous TD. The command completion handle |
| * will take care the rest. |
| */ |
| - if (!ep_seg && (trb_comp_code == COMP_STOP || |
| - trb_comp_code == COMP_STOP_INVAL)) { |
| + if (!ep_seg && (trb_comp_code == COMP_STOPPED || |
| + trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) { |
| goto cleanup; |
| } |
| |
| @@ -2472,7 +2472,7 @@ static int handle_tx_event(struct xhci_h |
| skip_isoc_td(xhci, td, event, ep, &status); |
| goto cleanup; |
| } |
| - if (trb_comp_code == COMP_SHORT_TX) |
| + if (trb_comp_code == COMP_SHORT_PACKET) |
| ep_ring->last_td_was_short = true; |
| else |
| ep_ring->last_td_was_short = false; |
| @@ -2505,8 +2505,8 @@ static int handle_tx_event(struct xhci_h |
| &status); |
| cleanup: |
| handling_skipped_tds = ep->skip && |
| - trb_comp_code != COMP_MISSED_INT && |
| - trb_comp_code != COMP_PING_ERR; |
| + trb_comp_code != COMP_MISSED_SERVICE_ERROR && |
| + trb_comp_code != COMP_NO_PING_RESPONSE_ERROR; |
| |
| /* |
| * Do not update event ring dequeue pointer if we're in a loop |
| --- a/drivers/usb/host/xhci.c |
| +++ b/drivers/usb/host/xhci.c |
| @@ -1868,32 +1868,32 @@ static int xhci_configure_endpoint_resul |
| int ret; |
| |
| switch (*cmd_status) { |
| - case COMP_CMD_ABORT: |
| - case COMP_CMD_STOP: |
| + case COMP_COMMAND_ABORTED: |
| + case COMP_STOPPED: |
| xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n"); |
| ret = -ETIME; |
| break; |
| - case COMP_ENOMEM: |
| + case COMP_RESOURCE_ERROR: |
| dev_warn(&udev->dev, |
| "Not enough host controller resources for new device state.\n"); |
| ret = -ENOMEM; |
| /* FIXME: can we allocate more resources for the HC? */ |
| break; |
| - case COMP_BW_ERR: |
| - case COMP_2ND_BW_ERR: |
| + case COMP_BANDWIDTH_ERROR: |
| + case COMP_SECONDARY_BANDWIDTH_ERROR: |
| dev_warn(&udev->dev, |
| "Not enough bandwidth for new device state.\n"); |
| ret = -ENOSPC; |
| /* FIXME: can we go back to the old state? */ |
| break; |
| - case COMP_TRB_ERR: |
| + case COMP_TRB_ERROR: |
| /* the HCD set up something wrong */ |
| dev_warn(&udev->dev, "ERROR: Endpoint drop flag = 0, " |
| "add flag = 1, " |
| "and endpoint is not disabled.\n"); |
| ret = -EINVAL; |
| break; |
| - case COMP_DEV_ERR: |
| + case COMP_INCOMPATIBLE_DEVICE_ERROR: |
| dev_warn(&udev->dev, |
| "ERROR: Incompatible device for endpoint configure command.\n"); |
| ret = -ENODEV; |
| @@ -1919,33 +1919,33 @@ static int xhci_evaluate_context_result( |
| struct xhci_virt_device *virt_dev = xhci->devs[udev->slot_id]; |
| |
| switch (*cmd_status) { |
| - case COMP_CMD_ABORT: |
| - case COMP_CMD_STOP: |
| + case COMP_COMMAND_ABORTED: |
| + case COMP_STOPPED: |
| xhci_warn(xhci, "Timeout while waiting for evaluate context command\n"); |
| ret = -ETIME; |
| break; |
| - case COMP_EINVAL: |
| + case COMP_PARAMETER_ERROR: |
| dev_warn(&udev->dev, |
| "WARN: xHCI driver setup invalid evaluate context command.\n"); |
| ret = -EINVAL; |
| break; |
| - case COMP_EBADSLT: |
| + case COMP_SLOT_NOT_ENABLED_ERROR: |
| dev_warn(&udev->dev, |
| "WARN: slot not enabled for evaluate context command.\n"); |
| ret = -EINVAL; |
| break; |
| - case COMP_CTX_STATE: |
| + case COMP_CONTEXT_STATE_ERROR: |
| dev_warn(&udev->dev, |
| "WARN: invalid context state for evaluate context command.\n"); |
| xhci_dbg_ctx(xhci, virt_dev->out_ctx, 1); |
| ret = -EINVAL; |
| break; |
| - case COMP_DEV_ERR: |
| + case COMP_INCOMPATIBLE_DEVICE_ERROR: |
| dev_warn(&udev->dev, |
| "ERROR: Incompatible device for evaluate context command.\n"); |
| ret = -ENODEV; |
| break; |
| - case COMP_MEL_ERR: |
| + case COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR: |
| /* Max Exit Latency too large error */ |
| dev_warn(&udev->dev, "WARN: Max Exit Latency too large\n"); |
| ret = -EINVAL; |
| @@ -3541,13 +3541,13 @@ int xhci_discover_or_reset_device(struct |
| */ |
| ret = reset_device_cmd->status; |
| switch (ret) { |
| - case COMP_CMD_ABORT: |
| - case COMP_CMD_STOP: |
| + case COMP_COMMAND_ABORTED: |
| + case COMP_STOPPED: |
| xhci_warn(xhci, "Timeout waiting for reset device command\n"); |
| ret = -ETIME; |
| goto command_cleanup; |
| - case COMP_EBADSLT: /* 0.95 completion code for bad slot ID */ |
| - case COMP_CTX_STATE: /* 0.96 completion code for same thing */ |
| + case COMP_SLOT_NOT_ENABLED_ERROR: /* 0.95 completion for bad slot ID */ |
| + 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", |
| slot_id, |
| xhci_get_slot_state(xhci, virt_dev->out_ctx)); |
| @@ -3907,22 +3907,22 @@ static int xhci_setup_device(struct usb_ |
| * command on a timeout. |
| */ |
| switch (command->status) { |
| - case COMP_CMD_ABORT: |
| - case COMP_CMD_STOP: |
| + case COMP_COMMAND_ABORTED: |
| + case COMP_STOPPED: |
| xhci_warn(xhci, "Timeout while waiting for setup device command\n"); |
| ret = -ETIME; |
| break; |
| - case COMP_CTX_STATE: |
| - case COMP_EBADSLT: |
| + case COMP_CONTEXT_STATE_ERROR: |
| + case COMP_SLOT_NOT_ENABLED_ERROR: |
| xhci_err(xhci, "Setup ERROR: setup %s command for slot %d.\n", |
| act, udev->slot_id); |
| ret = -EINVAL; |
| break; |
| - case COMP_TX_ERR: |
| + case COMP_USB_TRANSACTION_ERROR: |
| dev_warn(&udev->dev, "Device not responding to setup %s.\n", act); |
| ret = -EPROTO; |
| break; |
| - case COMP_DEV_ERR: |
| + case COMP_INCOMPATIBLE_DEVICE_ERROR: |
| dev_warn(&udev->dev, |
| "ERROR: Incompatible device for setup %s command\n", act); |
| ret = -ENODEV; |
| --- a/drivers/usb/host/xhci.h |
| +++ b/drivers/usb/host/xhci.h |
| @@ -1064,76 +1064,42 @@ struct xhci_transfer_event { |
| /* Completion Code - only applicable for some types of TRBs */ |
| #define COMP_CODE_MASK (0xff << 24) |
| #define GET_COMP_CODE(p) (((p) & COMP_CODE_MASK) >> 24) |
| -#define COMP_SUCCESS 1 |
| -/* Data Buffer Error */ |
| -#define COMP_DB_ERR 2 |
| -/* Babble Detected Error */ |
| -#define COMP_BABBLE 3 |
| -/* USB Transaction Error */ |
| -#define COMP_TX_ERR 4 |
| -/* TRB Error - some TRB field is invalid */ |
| -#define COMP_TRB_ERR 5 |
| -/* Stall Error - USB device is stalled */ |
| -#define COMP_STALL 6 |
| -/* Resource Error - HC doesn't have memory for that device configuration */ |
| -#define COMP_ENOMEM 7 |
| -/* Bandwidth Error - not enough room in schedule for this dev config */ |
| -#define COMP_BW_ERR 8 |
| -/* No Slots Available Error - HC ran out of device slots */ |
| -#define COMP_ENOSLOTS 9 |
| -/* Invalid Stream Type Error */ |
| -#define COMP_STREAM_ERR 10 |
| -/* Slot Not Enabled Error - doorbell rung for disabled device slot */ |
| -#define COMP_EBADSLT 11 |
| -/* Endpoint Not Enabled Error */ |
| -#define COMP_EBADEP 12 |
| -/* Short Packet */ |
| -#define COMP_SHORT_TX 13 |
| -/* Ring Underrun - doorbell rung for an empty isoc OUT ep ring */ |
| -#define COMP_UNDERRUN 14 |
| -/* Ring Overrun - isoc IN ep ring is empty when ep is scheduled to RX */ |
| -#define COMP_OVERRUN 15 |
| -/* Virtual Function Event Ring Full Error */ |
| -#define COMP_VF_FULL 16 |
| -/* Parameter Error - Context parameter is invalid */ |
| -#define COMP_EINVAL 17 |
| -/* Bandwidth Overrun Error - isoc ep exceeded its allocated bandwidth */ |
| -#define COMP_BW_OVER 18 |
| -/* Context State Error - illegal context state transition requested */ |
| -#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 |
| +#define COMP_INVALID 0 |
| +#define COMP_SUCCESS 1 |
| +#define COMP_DATA_BUFFER_ERROR 2 |
| +#define COMP_BABBLE_DETECTED_ERROR 3 |
| +#define COMP_USB_TRANSACTION_ERROR 4 |
| +#define COMP_TRB_ERROR 5 |
| +#define COMP_STALL_ERROR 6 |
| +#define COMP_RESOURCE_ERROR 7 |
| +#define COMP_BANDWIDTH_ERROR 8 |
| +#define COMP_NO_SLOTS_AVAILABLE_ERROR 9 |
| +#define COMP_INVALID_STREAM_TYPE_ERROR 10 |
| +#define COMP_SLOT_NOT_ENABLED_ERROR 11 |
| +#define COMP_ENDPOINT_NOT_ENABLED_ERROR 12 |
| +#define COMP_SHORT_PACKET 13 |
| +#define COMP_RING_UNDERRUN 14 |
| +#define COMP_RING_OVERRUN 15 |
| +#define COMP_VF_EVENT_RING_FULL_ERROR 16 |
| +#define COMP_PARAMETER_ERROR 17 |
| +#define COMP_BANDWIDTH_OVERRUN_ERROR 18 |
| +#define COMP_CONTEXT_STATE_ERROR 19 |
| +#define COMP_NO_PING_RESPONSE_ERROR 20 |
| +#define COMP_EVENT_RING_FULL_ERROR 21 |
| +#define COMP_INCOMPATIBLE_DEVICE_ERROR 22 |
| +#define COMP_MISSED_SERVICE_ERROR 23 |
| +#define COMP_COMMAND_RING_STOPPED 24 |
| +#define COMP_COMMAND_ABORTED 25 |
| +#define COMP_STOPPED 26 |
| +#define COMP_STOPPED_LENGTH_INVALID 27 |
| +#define COMP_STOPPED_SHORT_PACKET 28 |
| +#define COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR 29 |
| +#define COMP_ISOCH_BUFFER_OVERRUN 31 |
| +#define COMP_EVENT_LOST_ERROR 32 |
| +#define COMP_UNDEFINED_ERROR 33 |
| +#define COMP_INVALID_STREAM_ID_ERROR 34 |
| +#define COMP_SECONDARY_BANDWIDTH_ERROR 35 |
| +#define COMP_SPLIT_TRANSACTION_ERROR 36 |
| |
| struct xhci_link_trb { |
| /* 64-bit segment pointer*/ |