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;
} }
......
...@@ -304,10 +304,10 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, ...@@ -304,10 +304,10 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
/* Turn all aborted commands in list to no-ops, then restart */ /* Turn all aborted commands in list to no-ops, then restart */
list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) { 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; continue;
i_cmd->status = COMP_CMD_STOP; i_cmd->status = COMP_STOPPED;
xhci_dbg(xhci, "Turn aborted command %p to no-op\n", xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
i_cmd->command_trb); i_cmd->command_trb);
...@@ -1038,10 +1038,10 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, ...@@ -1038,10 +1038,10 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id,
unsigned int slot_state; unsigned int slot_state;
switch (cmd_comp_code) { 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"); xhci_warn(xhci, "WARN Set TR Deq Ptr cmd invalid because of stream ID configuration\n");
break; 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"); 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); ep_state = GET_EP_CTX_STATE(ep_ctx);
slot_state = le32_to_cpu(slot_ctx->dev_state); slot_state = le32_to_cpu(slot_ctx->dev_state);
...@@ -1050,7 +1050,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, ...@@ -1050,7 +1050,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id,
"Slot state = %u, EP state = %u", "Slot state = %u, EP state = %u",
slot_state, ep_state); slot_state, ep_state);
break; 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", xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because slot %u was not enabled.\n",
slot_id); slot_id);
break; break;
...@@ -1247,7 +1247,7 @@ void xhci_cleanup_command_queue(struct xhci_hcd *xhci) ...@@ -1247,7 +1247,7 @@ void xhci_cleanup_command_queue(struct xhci_hcd *xhci)
{ {
struct xhci_command *cur_cmd, *tmp_cmd; struct xhci_command *cur_cmd, *tmp_cmd;
list_for_each_entry_safe(cur_cmd, tmp_cmd, &xhci->cmd_list, cmd_list) 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) void xhci_handle_command_timeout(struct work_struct *work)
...@@ -1270,7 +1270,7 @@ void xhci_handle_command_timeout(struct work_struct *work) ...@@ -1270,7 +1270,7 @@ void xhci_handle_command_timeout(struct work_struct *work)
return; return;
} }
/* mark this command to be cancelled */ /* 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 */ /* Make sure command ring is running before aborting it */
hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
...@@ -1344,7 +1344,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1344,7 +1344,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status)); 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 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); complete_all(&xhci->cmd_ring_stop_completion);
return; return;
} }
...@@ -1361,9 +1361,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1361,9 +1361,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
* The command ring is stopped now, but the xHC will issue a Command * The command ring is stopped now, but the xHC will issue a Command
* Ring Stopped event which will cause us to restart it. * 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; 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) if (xhci->current_cmd == cmd)
xhci->current_cmd = NULL; xhci->current_cmd = NULL;
goto event_handled; goto event_handled;
...@@ -1399,8 +1399,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ...@@ -1399,8 +1399,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
break; break;
case TRB_CMD_NOOP: case TRB_CMD_NOOP:
/* Is this an aborted command turned to NO-OP? */ /* Is this an aborted command turned to NO-OP? */
if (cmd->status == COMP_CMD_STOP) if (cmd->status == COMP_STOPPED)
cmd_comp_code = COMP_CMD_STOP; cmd_comp_code = COMP_STOPPED;
break; break;
case TRB_RESET_EP: case TRB_RESET_EP:
WARN_ON(slot_id != TRB_TO_SLOT_ID( WARN_ON(slot_id != TRB_TO_SLOT_ID(
...@@ -1793,9 +1793,9 @@ static int xhci_requires_manual_halt_cleanup(struct xhci_hcd *xhci, ...@@ -1793,9 +1793,9 @@ static int xhci_requires_manual_halt_cleanup(struct xhci_hcd *xhci,
unsigned int trb_comp_code) unsigned int trb_comp_code)
{ {
/* TRB completion codes that may require a manual halt cleanup */ /* TRB completion codes that may require a manual halt cleanup */
if (trb_comp_code == COMP_TX_ERR || if (trb_comp_code == COMP_USB_TRANSACTION_ERROR ||
trb_comp_code == COMP_BABBLE || trb_comp_code == COMP_BABBLE_DETECTED_ERROR ||
trb_comp_code == COMP_SPLIT_ERR) trb_comp_code == COMP_SPLIT_TRANSACTION_ERROR)
/* The 0.95 spec says a babbling control endpoint /* The 0.95 spec says a babbling control endpoint
* is not halted. The 0.96 spec says it is. Some HW * is not halted. The 0.96 spec says it is. Some HW
* claims to be 0.95 compliant, but it halts the control * claims to be 0.95 compliant, but it halts the control
...@@ -1849,9 +1849,9 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -1849,9 +1849,9 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
if (skip) if (skip)
goto td_cleanup; goto td_cleanup;
if (trb_comp_code == COMP_STOP_INVAL || if (trb_comp_code == COMP_STOPPED_LENGTH_INVALID ||
trb_comp_code == COMP_STOP || trb_comp_code == COMP_STOPPED ||
trb_comp_code == COMP_STOP_SHORT) { trb_comp_code == COMP_STOPPED_SHORT_PACKET) {
/* The Endpoint Stop Command completion will take care of any /* The Endpoint Stop Command completion will take care of any
* stopped TDs. A stopped TD may be restarted, so don't update * stopped TDs. A stopped TD may be restarted, so don't update
* the ring dequeue pointer or take this TD off any lists yet. * the ring dequeue pointer or take this TD off any lists yet.
...@@ -1859,7 +1859,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -1859,7 +1859,7 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td,
ep->stopped_td = td; ep->stopped_td = td;
return 0; return 0;
} }
if (trb_comp_code == COMP_STALL || if (trb_comp_code == COMP_STALL_ERROR ||
xhci_requires_manual_halt_cleanup(xhci, ep_ctx, xhci_requires_manual_halt_cleanup(xhci, ep_ctx,
trb_comp_code)) { trb_comp_code)) {
/* Issue a reset endpoint command to clear the host side /* Issue a reset endpoint command to clear the host side
...@@ -1970,16 +1970,16 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -1970,16 +1970,16 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
} }
*status = 0; *status = 0;
break; break;
case COMP_SHORT_TX: case COMP_SHORT_PACKET:
*status = 0; *status = 0;
break; break;
case COMP_STOP_SHORT: case COMP_STOPPED_SHORT_PACKET:
if (trb_type == TRB_DATA || trb_type == TRB_NORMAL) if (trb_type == TRB_DATA || trb_type == TRB_NORMAL)
td->urb->actual_length = remaining; td->urb->actual_length = remaining;
else else
xhci_warn(xhci, "WARN: Stopped Short Packet on ctrl setup or status TRB\n"); xhci_warn(xhci, "WARN: Stopped Short Packet on ctrl setup or status TRB\n");
goto finish_td; goto finish_td;
case COMP_STOP: case COMP_STOPPED:
switch (trb_type) { switch (trb_type) {
case TRB_SETUP: case TRB_SETUP:
td->urb->actual_length = 0; td->urb->actual_length = 0;
...@@ -1993,7 +1993,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -1993,7 +1993,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
trb_type); trb_type);
goto finish_td; goto finish_td;
} }
case COMP_STOP_INVAL: case COMP_STOPPED_LENGTH_INVALID:
goto finish_td; goto finish_td;
default: default:
if (!xhci_requires_manual_halt_cleanup(xhci, if (!xhci_requires_manual_halt_cleanup(xhci,
...@@ -2002,7 +2002,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -2002,7 +2002,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
xhci_dbg(xhci, "TRB error %u, halted endpoint index = %u\n", xhci_dbg(xhci, "TRB error %u, halted endpoint index = %u\n",
trb_comp_code, ep_index); trb_comp_code, ep_index);
/* else fall through */ /* else fall through */
case COMP_STALL: case COMP_STALL_ERROR:
/* Did we transfer part of the data (middle) phase? */ /* Did we transfer part of the data (middle) phase? */
if (trb_type == TRB_DATA || trb_type == TRB_NORMAL) if (trb_type == TRB_DATA || trb_type == TRB_NORMAL)
td->urb->actual_length = requested - remaining; td->urb->actual_length = requested - remaining;
...@@ -2073,35 +2073,35 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -2073,35 +2073,35 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
} }
frame->status = 0; frame->status = 0;
break; break;
case COMP_SHORT_TX: case COMP_SHORT_PACKET:
frame->status = short_framestatus; frame->status = short_framestatus;
sum_trbs_for_length = true; sum_trbs_for_length = true;
break; break;
case COMP_BW_OVER: case COMP_BANDWIDTH_OVERRUN_ERROR:
frame->status = -ECOMM; frame->status = -ECOMM;
break; break;
case COMP_BUFF_OVER: case COMP_ISOCH_BUFFER_OVERRUN:
case COMP_BABBLE: case COMP_BABBLE_DETECTED_ERROR:
frame->status = -EOVERFLOW; frame->status = -EOVERFLOW;
break; break;
case COMP_DEV_ERR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
case COMP_STALL: case COMP_STALL_ERROR:
frame->status = -EPROTO; frame->status = -EPROTO;
break; break;
case COMP_TX_ERR: case COMP_USB_TRANSACTION_ERROR:
frame->status = -EPROTO; frame->status = -EPROTO;
if (ep_trb != td->last_trb) if (ep_trb != td->last_trb)
return 0; return 0;
break; break;
case COMP_STOP: case COMP_STOPPED:
sum_trbs_for_length = true; sum_trbs_for_length = true;
break; break;
case COMP_STOP_SHORT: case COMP_STOPPED_SHORT_PACKET:
/* field normally containing residue now contains tranferred */ /* field normally containing residue now contains tranferred */
frame->status = short_framestatus; frame->status = short_framestatus;
requested = remaining; requested = remaining;
break; break;
case COMP_STOP_INVAL: case COMP_STOPPED_LENGTH_INVALID:
requested = 0; requested = 0;
remaining = 0; remaining = 0;
break; break;
...@@ -2178,16 +2178,16 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, ...@@ -2178,16 +2178,16 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
} }
*status = 0; *status = 0;
break; break;
case COMP_SHORT_TX: case COMP_SHORT_PACKET:
xhci_dbg(xhci, "ep %#x - asked for %d bytes, %d bytes untransferred\n", xhci_dbg(xhci, "ep %#x - asked for %d bytes, %d bytes untransferred\n",
td->urb->ep->desc.bEndpointAddress, td->urb->ep->desc.bEndpointAddress,
requested, remaining); requested, remaining);
*status = 0; *status = 0;
break; break;
case COMP_STOP_SHORT: case COMP_STOPPED_SHORT_PACKET:
td->urb->actual_length = remaining; td->urb->actual_length = remaining;
goto finish_td; goto finish_td;
case COMP_STOP_INVAL: case COMP_STOPPED_LENGTH_INVALID:
/* stopped on ep trb with invalid length, exclude it */ /* stopped on ep trb with invalid length, exclude it */
ep_trb_len = 0; ep_trb_len = 0;
remaining = 0; remaining = 0;
...@@ -2293,50 +2293,50 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2293,50 +2293,50 @@ static int handle_tx_event(struct xhci_hcd *xhci,
if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
break; break;
if (xhci->quirks & XHCI_TRUST_TX_LENGTH) if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
trb_comp_code = COMP_SHORT_TX; trb_comp_code = COMP_SHORT_PACKET;
else else
xhci_warn_ratelimited(xhci, xhci_warn_ratelimited(xhci,
"WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n"); "WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n");
case COMP_SHORT_TX: case COMP_SHORT_PACKET:
break; break;
case COMP_STOP: case COMP_STOPPED:
xhci_dbg(xhci, "Stopped on Transfer TRB\n"); xhci_dbg(xhci, "Stopped on Transfer TRB\n");
break; break;
case COMP_STOP_INVAL: case COMP_STOPPED_LENGTH_INVALID:
xhci_dbg(xhci, "Stopped on No-op or Link TRB\n"); xhci_dbg(xhci, "Stopped on No-op or Link TRB\n");
break; break;
case COMP_STOP_SHORT: case COMP_STOPPED_SHORT_PACKET:
xhci_dbg(xhci, "Stopped with short packet transfer detected\n"); xhci_dbg(xhci, "Stopped with short packet transfer detected\n");
break; break;
case COMP_STALL: case COMP_STALL_ERROR:
xhci_dbg(xhci, "Stalled endpoint\n"); xhci_dbg(xhci, "Stalled endpoint\n");
ep->ep_state |= EP_HALTED; ep->ep_state |= EP_HALTED;
status = -EPIPE; status = -EPIPE;
break; break;
case COMP_TRB_ERR: case COMP_TRB_ERROR:
xhci_warn(xhci, "WARN: TRB error on endpoint\n"); xhci_warn(xhci, "WARN: TRB error on endpoint\n");
status = -EILSEQ; status = -EILSEQ;
break; break;
case COMP_SPLIT_ERR: case COMP_SPLIT_TRANSACTION_ERROR:
case COMP_TX_ERR: case COMP_USB_TRANSACTION_ERROR:
xhci_dbg(xhci, "Transfer error on endpoint\n"); xhci_dbg(xhci, "Transfer error on endpoint\n");
status = -EPROTO; status = -EPROTO;
break; break;
case COMP_BABBLE: case COMP_BABBLE_DETECTED_ERROR:
xhci_dbg(xhci, "Babble error on endpoint\n"); xhci_dbg(xhci, "Babble error on endpoint\n");
status = -EOVERFLOW; status = -EOVERFLOW;
break; break;
case COMP_DB_ERR: case COMP_DATA_BUFFER_ERROR:
xhci_warn(xhci, "WARN: HC couldn't access mem fast enough\n"); xhci_warn(xhci, "WARN: HC couldn't access mem fast enough\n");
status = -ENOSR; status = -ENOSR;
break; break;
case COMP_BW_OVER: case COMP_BANDWIDTH_OVERRUN_ERROR:
xhci_warn(xhci, "WARN: bandwidth overrun event on endpoint\n"); xhci_warn(xhci, "WARN: bandwidth overrun event on endpoint\n");
break; break;
case COMP_BUFF_OVER: case COMP_ISOCH_BUFFER_OVERRUN:
xhci_warn(xhci, "WARN: buffer overrun event on endpoint\n"); xhci_warn(xhci, "WARN: buffer overrun event on endpoint\n");
break; break;
case COMP_UNDERRUN: case COMP_RING_UNDERRUN:
/* /*
* When the Isoch ring is empty, the xHC will generate * When the Isoch ring is empty, the xHC will generate
* a Ring Overrun Event for IN Isoch endpoint or Ring * a Ring Overrun Event for IN Isoch endpoint or Ring
...@@ -2349,7 +2349,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2349,7 +2349,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
ep_index); ep_index);
goto cleanup; goto cleanup;
case COMP_OVERRUN: case COMP_RING_OVERRUN:
xhci_dbg(xhci, "overrun event on endpoint\n"); xhci_dbg(xhci, "overrun event on endpoint\n");
if (!list_empty(&ep_ring->td_list)) if (!list_empty(&ep_ring->td_list))
xhci_dbg(xhci, "Overrun Event for slot %d ep %d " xhci_dbg(xhci, "Overrun Event for slot %d ep %d "
...@@ -2357,11 +2357,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2357,11 +2357,11 @@ static int handle_tx_event(struct xhci_hcd *xhci,
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
ep_index); ep_index);
goto cleanup; goto cleanup;
case COMP_DEV_ERR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
xhci_warn(xhci, "WARN: detect an incompatible device"); xhci_warn(xhci, "WARN: detect an incompatible device");
status = -EPROTO; status = -EPROTO;
break; break;
case COMP_MISSED_INT: case COMP_MISSED_SERVICE_ERROR:
/* /*
* When encounter missed service error, one or more isoc tds * When encounter missed service error, one or more isoc tds
* may be missed by xHC. * may be missed by xHC.
...@@ -2371,7 +2371,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2371,7 +2371,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
ep->skip = true; ep->skip = true;
xhci_dbg(xhci, "Miss service interval error, set skip flag\n"); xhci_dbg(xhci, "Miss service interval error, set skip flag\n");
goto cleanup; goto cleanup;
case COMP_PING_ERR: case COMP_NO_PING_RESPONSE_ERROR:
ep->skip = true; ep->skip = true;
xhci_dbg(xhci, "No Ping response error, Skip one Isoc TD\n"); xhci_dbg(xhci, "No Ping response error, Skip one Isoc TD\n");
goto cleanup; goto cleanup;
...@@ -2395,8 +2395,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2395,8 +2395,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
* event if the device was suspended. Don't print * event if the device was suspended. Don't print
* warnings. * warnings.
*/ */
if (!(trb_comp_code == COMP_STOP || if (!(trb_comp_code == COMP_STOPPED ||
trb_comp_code == COMP_STOP_INVAL)) { trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) {
xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", 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)), TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
ep_index); ep_index);
...@@ -2437,8 +2437,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2437,8 +2437,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
* last TRB of the previous TD. The command completion handle * last TRB of the previous TD. The command completion handle
* will take care the rest. * will take care the rest.
*/ */
if (!ep_seg && (trb_comp_code == COMP_STOP || if (!ep_seg && (trb_comp_code == COMP_STOPPED ||
trb_comp_code == COMP_STOP_INVAL)) { trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) {
goto cleanup; goto cleanup;
} }
...@@ -2469,7 +2469,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2469,7 +2469,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
skip_isoc_td(xhci, td, event, ep, &status); skip_isoc_td(xhci, td, event, ep, &status);
goto cleanup; goto cleanup;
} }
if (trb_comp_code == COMP_SHORT_TX) if (trb_comp_code == COMP_SHORT_PACKET)
ep_ring->last_td_was_short = true; ep_ring->last_td_was_short = true;
else else
ep_ring->last_td_was_short = false; ep_ring->last_td_was_short = false;
...@@ -2502,8 +2502,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2502,8 +2502,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
&status); &status);
cleanup: cleanup:
handling_skipped_tds = ep->skip && handling_skipped_tds = ep->skip &&
trb_comp_code != COMP_MISSED_INT && trb_comp_code != COMP_MISSED_SERVICE_ERROR &&
trb_comp_code != COMP_PING_ERR; trb_comp_code != COMP_NO_PING_RESPONSE_ERROR;
/* /*
* Do not update event ring dequeue pointer if we're in a loop * Do not update event ring dequeue pointer if we're in a loop
......
...@@ -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_INVALID 0
#define COMP_SUCCESS 1 #define COMP_SUCCESS 1
/* Data Buffer Error */ #define COMP_DATA_BUFFER_ERROR 2
#define COMP_DB_ERR 2 #define COMP_BABBLE_DETECTED_ERROR 3
/* Babble Detected Error */ #define COMP_USB_TRANSACTION_ERROR 4
#define COMP_BABBLE 3 #define COMP_TRB_ERROR 5
/* USB Transaction Error */ #define COMP_STALL_ERROR 6
#define COMP_TX_ERR 4 #define COMP_RESOURCE_ERROR 7
/* TRB Error - some TRB field is invalid */ #define COMP_BANDWIDTH_ERROR 8
#define COMP_TRB_ERR 5 #define COMP_NO_SLOTS_AVAILABLE_ERROR 9
/* Stall Error - USB device is stalled */ #define COMP_INVALID_STREAM_TYPE_ERROR 10
#define COMP_STALL 6 #define COMP_SLOT_NOT_ENABLED_ERROR 11
/* Resource Error - HC doesn't have memory for that device configuration */ #define COMP_ENDPOINT_NOT_ENABLED_ERROR 12
#define COMP_ENOMEM 7 #define COMP_SHORT_PACKET 13
/* Bandwidth Error - not enough room in schedule for this dev config */ #define COMP_RING_UNDERRUN 14
#define COMP_BW_ERR 8 #define COMP_RING_OVERRUN 15
/* No Slots Available Error - HC ran out of device slots */ #define COMP_VF_EVENT_RING_FULL_ERROR 16
#define COMP_ENOSLOTS 9 #define COMP_PARAMETER_ERROR 17
/* Invalid Stream Type Error */ #define COMP_BANDWIDTH_OVERRUN_ERROR 18
#define COMP_STREAM_ERR 10 #define COMP_CONTEXT_STATE_ERROR 19
/* Slot Not Enabled Error - doorbell rung for disabled device slot */ #define COMP_NO_PING_RESPONSE_ERROR 20
#define COMP_EBADSLT 11 #define COMP_EVENT_RING_FULL_ERROR 21
/* Endpoint Not Enabled Error */ #define COMP_INCOMPATIBLE_DEVICE_ERROR 22
#define COMP_EBADEP 12 #define COMP_MISSED_SERVICE_ERROR 23
/* Short Packet */ #define COMP_COMMAND_RING_STOPPED 24
#define COMP_SHORT_TX 13 #define COMP_COMMAND_ABORTED 25
/* Ring Underrun - doorbell rung for an empty isoc OUT ep ring */ #define COMP_STOPPED 26
#define COMP_UNDERRUN 14 #define COMP_STOPPED_LENGTH_INVALID 27
/* Ring Overrun - isoc IN ep ring is empty when ep is scheduled to RX */ #define COMP_STOPPED_SHORT_PACKET 28
#define COMP_OVERRUN 15 #define COMP_MAX_EXIT_LATENCY_TOO_LARGE_ERROR 29
/* Virtual Function Event Ring Full Error */ #define COMP_ISOCH_BUFFER_OVERRUN 31
#define COMP_VF_FULL 16 #define COMP_EVENT_LOST_ERROR 32
/* Parameter Error - Context parameter is invalid */ #define COMP_UNDEFINED_ERROR 33
#define COMP_EINVAL 17 #define COMP_INVALID_STREAM_ID_ERROR 34
/* Bandwidth Overrun Error - isoc ep exceeded its allocated bandwidth */ #define COMP_SECONDARY_BANDWIDTH_ERROR 35
#define COMP_BW_OVER 18 #define COMP_SPLIT_TRANSACTION_ERROR 36
/* 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
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