Commit b7f769ae authored by Zhengjun Xing's avatar Zhengjun Xing Committed by Greg Kroah-Hartman

xhci: add slot and endpoint numbers to debug messages in handle_tx_event

There's one annoyance in how xhci prints debug messages, we often
get logs with messages but it's hard to say from which device and
endpoint the message originates. Add slot_id, ep_index messages
in handle_tx_event.
Signed-off-by: default avatarZhengjun Xing <zhengjun.xing@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 5d062aba
...@@ -2285,7 +2285,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2285,7 +2285,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags)); slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
xdev = xhci->devs[slot_id]; xdev = xhci->devs[slot_id];
if (!xdev) { if (!xdev) {
xhci_err(xhci, "ERROR Transfer event pointed to bad slot\n"); xhci_err(xhci, "ERROR Transfer event pointed to bad slot %u\n",
slot_id);
xhci_err(xhci, "@%016llx %08x %08x %08x %08x\n", xhci_err(xhci, "@%016llx %08x %08x %08x %08x\n",
(unsigned long long) xhci_trb_virt_to_dma( (unsigned long long) xhci_trb_virt_to_dma(
xhci->event_ring->deq_seg, xhci->event_ring->deq_seg,
...@@ -2305,8 +2306,9 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2305,8 +2306,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer)); ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index); ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index);
if (!ep_ring || GET_EP_CTX_STATE(ep_ctx) == EP_STATE_DISABLED) { if (!ep_ring || GET_EP_CTX_STATE(ep_ctx) == EP_STATE_DISABLED) {
xhci_err(xhci, "ERROR Transfer event for disabled endpoint " xhci_err(xhci,
"or incorrect stream ring\n"); "ERROR Transfer event for disabled endpoint slot %u ep %u or incorrect stream ring\n",
slot_id, ep_index);
xhci_err(xhci, "@%016llx %08x %08x %08x %08x\n", xhci_err(xhci, "@%016llx %08x %08x %08x %08x\n",
(unsigned long long) xhci_trb_virt_to_dma( (unsigned long long) xhci_trb_virt_to_dma(
xhci->event_ring->deq_seg, xhci->event_ring->deq_seg,
...@@ -2340,45 +2342,62 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2340,45 +2342,62 @@ static int handle_tx_event(struct xhci_hcd *xhci,
trb_comp_code = COMP_SHORT_PACKET; 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 for slot %u ep %u: needs XHCI_TRUST_TX_LENGTH quirk?\n",
slot_id, ep_index);
case COMP_SHORT_PACKET: case COMP_SHORT_PACKET:
break; break;
case COMP_STOPPED: case COMP_STOPPED:
xhci_dbg(xhci, "Stopped on Transfer TRB\n"); xhci_dbg(xhci, "Stopped on Transfer TRB for slot %u ep %u\n",
slot_id, ep_index);
break; break;
case COMP_STOPPED_LENGTH_INVALID: 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 for slot %u ep %u\n",
slot_id, ep_index);
break; break;
case COMP_STOPPED_SHORT_PACKET: case COMP_STOPPED_SHORT_PACKET:
xhci_dbg(xhci, "Stopped with short packet transfer detected\n"); xhci_dbg(xhci,
"Stopped with short packet transfer detected for slot %u ep %u\n",
slot_id, ep_index);
break; break;
case COMP_STALL_ERROR: case COMP_STALL_ERROR:
xhci_dbg(xhci, "Stalled endpoint\n"); xhci_dbg(xhci, "Stalled endpoint for slot %u ep %u\n", slot_id,
ep_index);
ep->ep_state |= EP_HALTED; ep->ep_state |= EP_HALTED;
status = -EPIPE; status = -EPIPE;
break; break;
case COMP_TRB_ERROR: case COMP_TRB_ERROR:
xhci_warn(xhci, "WARN: TRB error on endpoint\n"); xhci_warn(xhci,
"WARN: TRB error for slot %u ep %u on endpoint\n",
slot_id, ep_index);
status = -EILSEQ; status = -EILSEQ;
break; break;
case COMP_SPLIT_TRANSACTION_ERROR: case COMP_SPLIT_TRANSACTION_ERROR:
case COMP_USB_TRANSACTION_ERROR: case COMP_USB_TRANSACTION_ERROR:
xhci_dbg(xhci, "Transfer error on endpoint\n"); xhci_dbg(xhci, "Transfer error for slot %u ep %u on endpoint\n",
slot_id, ep_index);
status = -EPROTO; status = -EPROTO;
break; break;
case COMP_BABBLE_DETECTED_ERROR: case COMP_BABBLE_DETECTED_ERROR:
xhci_dbg(xhci, "Babble error on endpoint\n"); xhci_dbg(xhci, "Babble error for slot %u ep %u on endpoint\n",
slot_id, ep_index);
status = -EOVERFLOW; status = -EOVERFLOW;
break; break;
case COMP_DATA_BUFFER_ERROR: 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 for slot %u ep %u\n",
slot_id, ep_index);
status = -ENOSR; status = -ENOSR;
break; break;
case COMP_BANDWIDTH_OVERRUN_ERROR: case COMP_BANDWIDTH_OVERRUN_ERROR:
xhci_warn(xhci, "WARN: bandwidth overrun event on endpoint\n"); xhci_warn(xhci,
"WARN: bandwidth overrun event for slot %u ep %u on endpoint\n",
slot_id, ep_index);
break; break;
case COMP_ISOCH_BUFFER_OVERRUN: case COMP_ISOCH_BUFFER_OVERRUN:
xhci_warn(xhci, "WARN: buffer overrun event on endpoint\n"); xhci_warn(xhci,
"WARN: buffer overrun event for slot %u ep %u on endpoint",
slot_id, ep_index);
break; break;
case COMP_RING_UNDERRUN: case COMP_RING_UNDERRUN:
/* /*
...@@ -2402,7 +2421,9 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2402,7 +2421,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
ep_index); ep_index);
goto cleanup; goto cleanup;
case COMP_INCOMPATIBLE_DEVICE_ERROR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
xhci_warn(xhci, "WARN: detect an incompatible device"); xhci_warn(xhci,
"WARN: detect an incompatible device for slot %u ep %u",
slot_id, ep_index);
status = -EPROTO; status = -EPROTO;
break; break;
case COMP_MISSED_SERVICE_ERROR: case COMP_MISSED_SERVICE_ERROR:
...@@ -2413,19 +2434,24 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2413,19 +2434,24 @@ static int handle_tx_event(struct xhci_hcd *xhci,
* short transfer when process the ep_ring next time. * short transfer when process the ep_ring next time.
*/ */
ep->skip = true; ep->skip = true;
xhci_dbg(xhci, "Miss service interval error, set skip flag\n"); xhci_dbg(xhci,
"Miss service interval error for slot %u ep %u, set skip flag\n",
slot_id, ep_index);
goto cleanup; goto cleanup;
case COMP_NO_PING_RESPONSE_ERROR: 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 for slot %u ep %u, Skip one Isoc TD\n",
slot_id, ep_index);
goto cleanup; goto cleanup;
default: default:
if (xhci_is_vendor_info_code(xhci, trb_comp_code)) { if (xhci_is_vendor_info_code(xhci, trb_comp_code)) {
status = 0; status = 0;
break; break;
} }
xhci_warn(xhci, "ERROR Unknown event condition %u, HC probably busted\n", xhci_warn(xhci,
trb_comp_code); "ERROR Unknown event condition %u for slot %u ep %u , HC probably busted\n",
trb_comp_code, slot_id, ep_index);
goto cleanup; goto cleanup;
} }
...@@ -2451,8 +2477,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2451,8 +2477,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
} }
if (ep->skip) { if (ep->skip) {
ep->skip = false; ep->skip = false;
xhci_dbg(xhci, "td_list is empty while skip " xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n",
"flag set. Clear skip flag.\n"); slot_id, ep_index);
} }
goto cleanup; goto cleanup;
} }
...@@ -2460,8 +2486,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2460,8 +2486,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
/* We've skipped all the TDs on the ep ring when ep->skip set */ /* We've skipped all the TDs on the ep ring when ep->skip set */
if (ep->skip && td_num == 0) { if (ep->skip && td_num == 0) {
ep->skip = false; ep->skip = false;
xhci_dbg(xhci, "All tds on the ep_ring skipped. " xhci_dbg(xhci, "All tds on the ep_ring skipped. Clear skip flag for slot %u ep %u.\n",
"Clear skip flag.\n"); slot_id, ep_index);
goto cleanup; goto cleanup;
} }
...@@ -2520,7 +2546,9 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2520,7 +2546,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
ep_ring->last_td_was_short = false; ep_ring->last_td_was_short = false;
if (ep->skip) { if (ep->skip) {
xhci_dbg(xhci, "Found td. Clear skip flag.\n"); xhci_dbg(xhci,
"Found td. Clear skip flag for slot %u ep %u.\n",
slot_id, ep_index);
ep->skip = false; ep->skip = false;
} }
...@@ -2537,7 +2565,9 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2537,7 +2565,9 @@ static int handle_tx_event(struct xhci_hcd *xhci,
* the TD. * the TD.
*/ */
if (trb_is_noop(ep_trb)) { if (trb_is_noop(ep_trb)) {
xhci_dbg(xhci, "ep_trb is a no-op TRB. Skip it\n"); xhci_dbg(xhci,
"ep_trb is a no-op TRB. Skip it for slot %u ep %u\n",
slot_id, ep_index);
goto cleanup; goto cleanup;
} }
......
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