Commit d195fcff authored by Xenia Ragiadakou's avatar Xenia Ragiadakou Committed by Sarah Sharp

xhci: trace debug messages related to driver initialization and unload

This patch defines a new trace event, which is called xhci_dbg_init
and belongs to the event class xhci_log_msg, and adds tracepoints that
trace the debug statements in the functions used to start and stop the
xhci-hcd driver.

Also, it removes an unnecessary cast of variable val to unsigned int
in xhci_mem_init(), since val is already declared as unsigned int.
Signed-off-by: default avatarXenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
parent aa50b290
This diff is collapsed.
...@@ -57,6 +57,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb, ...@@ -57,6 +57,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb,
TP_ARGS(vaf) TP_ARGS(vaf)
); );
DEFINE_EVENT(xhci_log_msg, xhci_dbg_init,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);
DECLARE_EVENT_CLASS(xhci_log_ctx, DECLARE_EVENT_CLASS(xhci_log_ctx,
TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
unsigned int ep_num), unsigned int ep_num),
......
...@@ -101,7 +101,7 @@ void xhci_quiesce(struct xhci_hcd *xhci) ...@@ -101,7 +101,7 @@ void xhci_quiesce(struct xhci_hcd *xhci)
int xhci_halt(struct xhci_hcd *xhci) int xhci_halt(struct xhci_hcd *xhci)
{ {
int ret; int ret;
xhci_dbg(xhci, "// Halt the HC\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC");
xhci_quiesce(xhci); xhci_quiesce(xhci);
ret = xhci_handshake(xhci, &xhci->op_regs->status, ret = xhci_handshake(xhci, &xhci->op_regs->status,
...@@ -125,7 +125,7 @@ static int xhci_start(struct xhci_hcd *xhci) ...@@ -125,7 +125,7 @@ static int xhci_start(struct xhci_hcd *xhci)
temp = xhci_readl(xhci, &xhci->op_regs->command); temp = xhci_readl(xhci, &xhci->op_regs->command);
temp |= (CMD_RUN); temp |= (CMD_RUN);
xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n", xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Turn on HC, cmd = 0x%x.",
temp); temp);
xhci_writel(xhci, temp, &xhci->op_regs->command); xhci_writel(xhci, temp, &xhci->op_regs->command);
...@@ -163,7 +163,7 @@ int xhci_reset(struct xhci_hcd *xhci) ...@@ -163,7 +163,7 @@ int xhci_reset(struct xhci_hcd *xhci)
return 0; return 0;
} }
xhci_dbg(xhci, "// Reset the HC\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Reset the HC");
command = xhci_readl(xhci, &xhci->op_regs->command); command = xhci_readl(xhci, &xhci->op_regs->command);
command |= CMD_RESET; command |= CMD_RESET;
xhci_writel(xhci, command, &xhci->op_regs->command); xhci_writel(xhci, command, &xhci->op_regs->command);
...@@ -173,7 +173,8 @@ int xhci_reset(struct xhci_hcd *xhci) ...@@ -173,7 +173,8 @@ int xhci_reset(struct xhci_hcd *xhci)
if (ret) if (ret)
return ret; return ret;
xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Wait for controller to be ready for doorbell rings");
/* /*
* xHCI cannot write to any doorbells or operational registers other * xHCI cannot write to any doorbells or operational registers other
* than status until the "Controller Not Ready" flag is cleared. * than status until the "Controller Not Ready" flag is cleared.
...@@ -215,14 +216,16 @@ static int xhci_setup_msi(struct xhci_hcd *xhci) ...@@ -215,14 +216,16 @@ static int xhci_setup_msi(struct xhci_hcd *xhci)
ret = pci_enable_msi(pdev); ret = pci_enable_msi(pdev);
if (ret) { if (ret) {
xhci_dbg(xhci, "failed to allocate MSI entry\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"failed to allocate MSI entry");
return ret; return ret;
} }
ret = request_irq(pdev->irq, xhci_msi_irq, ret = request_irq(pdev->irq, xhci_msi_irq,
0, "xhci_hcd", xhci_to_hcd(xhci)); 0, "xhci_hcd", xhci_to_hcd(xhci));
if (ret) { if (ret) {
xhci_dbg(xhci, "disable MSI interrupt\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"disable MSI interrupt");
pci_disable_msi(pdev); pci_disable_msi(pdev);
} }
...@@ -285,7 +288,8 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) ...@@ -285,7 +288,8 @@ static int xhci_setup_msix(struct xhci_hcd *xhci)
ret = pci_enable_msix(pdev, xhci->msix_entries, xhci->msix_count); ret = pci_enable_msix(pdev, xhci->msix_entries, xhci->msix_count);
if (ret) { if (ret) {
xhci_dbg(xhci, "Failed to enable MSI-X\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Failed to enable MSI-X");
goto free_entries; goto free_entries;
} }
...@@ -301,7 +305,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci) ...@@ -301,7 +305,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci)
return ret; return ret;
disable_msix: disable_msix:
xhci_dbg(xhci, "disable MSI-X interrupt\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "disable MSI-X interrupt");
xhci_free_irq(xhci); xhci_free_irq(xhci);
pci_disable_msix(pdev); pci_disable_msix(pdev);
free_entries: free_entries:
...@@ -509,17 +513,18 @@ int xhci_init(struct usb_hcd *hcd) ...@@ -509,17 +513,18 @@ int xhci_init(struct usb_hcd *hcd)
struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct xhci_hcd *xhci = hcd_to_xhci(hcd);
int retval = 0; int retval = 0;
xhci_dbg(xhci, "xhci_init\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "xhci_init");
spin_lock_init(&xhci->lock); spin_lock_init(&xhci->lock);
if (xhci->hci_version == 0x95 && link_quirk) { if (xhci->hci_version == 0x95 && link_quirk) {
xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
"QUIRK: Not clearing Link TRB chain bits."); "QUIRK: Not clearing Link TRB chain bits.");
xhci->quirks |= XHCI_LINK_TRB_QUIRK; xhci->quirks |= XHCI_LINK_TRB_QUIRK;
} else { } else {
xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"xHCI doesn't need link TRB QUIRK");
} }
retval = xhci_mem_init(xhci, GFP_KERNEL); retval = xhci_mem_init(xhci, GFP_KERNEL);
xhci_dbg(xhci, "Finished xhci_init\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Finished xhci_init");
/* Initializing Compliance Mode Recovery Data If Needed */ /* Initializing Compliance Mode Recovery Data If Needed */
if (xhci_compliance_mode_recovery_timer_quirk_check()) { if (xhci_compliance_mode_recovery_timer_quirk_check()) {
...@@ -545,7 +550,8 @@ static int xhci_run_finished(struct xhci_hcd *xhci) ...@@ -545,7 +550,8 @@ static int xhci_run_finished(struct xhci_hcd *xhci)
if (xhci->quirks & XHCI_NEC_HOST) if (xhci->quirks & XHCI_NEC_HOST)
xhci_ring_cmd_db(xhci); xhci_ring_cmd_db(xhci);
xhci_dbg(xhci, "Finished xhci_run for USB3 roothub\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB3 roothub");
return 0; return 0;
} }
...@@ -576,7 +582,7 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -576,7 +582,7 @@ int xhci_run(struct usb_hcd *hcd)
if (!usb_hcd_is_primary_hcd(hcd)) if (!usb_hcd_is_primary_hcd(hcd))
return xhci_run_finished(xhci); return xhci_run_finished(xhci);
xhci_dbg(xhci, "xhci_run\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "xhci_run");
ret = xhci_try_enable_msi(hcd); ret = xhci_try_enable_msi(hcd);
if (ret) if (ret)
...@@ -594,9 +600,11 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -594,9 +600,11 @@ int xhci_run(struct usb_hcd *hcd)
xhci_dbg_ring_ptrs(xhci, xhci->event_ring); xhci_dbg_ring_ptrs(xhci, xhci->event_ring);
temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue);
temp_64 &= ~ERST_PTR_MASK; temp_64 &= ~ERST_PTR_MASK;
xhci_dbg(xhci, "ERST deq = 64'h%0lx\n", (long unsigned int) temp_64); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"ERST deq = 64'h%0lx", (long unsigned int) temp_64);
xhci_dbg(xhci, "// Set the interrupt modulation register\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"// Set the interrupt modulation register");
temp = xhci_readl(xhci, &xhci->ir_set->irq_control); temp = xhci_readl(xhci, &xhci->ir_set->irq_control);
temp &= ~ER_IRQ_INTERVAL_MASK; temp &= ~ER_IRQ_INTERVAL_MASK;
temp |= (u32) 160; temp |= (u32) 160;
...@@ -605,12 +613,13 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -605,12 +613,13 @@ int xhci_run(struct usb_hcd *hcd)
/* Set the HCD state before we enable the irqs */ /* Set the HCD state before we enable the irqs */
temp = xhci_readl(xhci, &xhci->op_regs->command); temp = xhci_readl(xhci, &xhci->op_regs->command);
temp |= (CMD_EIE); temp |= (CMD_EIE);
xhci_dbg(xhci, "// Enable interrupts, cmd = 0x%x.\n", xhci_dbg_trace(xhci, trace_xhci_dbg_init,
temp); "// Enable interrupts, cmd = 0x%x.", temp);
xhci_writel(xhci, temp, &xhci->op_regs->command); xhci_writel(xhci, temp, &xhci->op_regs->command);
temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); temp = xhci_readl(xhci, &xhci->ir_set->irq_pending);
xhci_dbg(xhci, "// Enabling event ring interrupter %p by writing 0x%x to irq_pending\n", xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"// Enabling event ring interrupter %p by writing 0x%x to irq_pending",
xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp));
xhci_writel(xhci, ER_IRQ_ENABLE(temp), xhci_writel(xhci, ER_IRQ_ENABLE(temp),
&xhci->ir_set->irq_pending); &xhci->ir_set->irq_pending);
...@@ -620,7 +629,8 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -620,7 +629,8 @@ int xhci_run(struct usb_hcd *hcd)
xhci_queue_vendor_command(xhci, 0, 0, 0, xhci_queue_vendor_command(xhci, 0, 0, 0,
TRB_TYPE(TRB_NEC_GET_FW)); TRB_TYPE(TRB_NEC_GET_FW));
xhci_dbg(xhci, "Finished xhci_run for USB2 roothub\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB2 roothub");
return 0; return 0;
} }
...@@ -680,7 +690,8 @@ void xhci_stop(struct usb_hcd *hcd) ...@@ -680,7 +690,8 @@ void xhci_stop(struct usb_hcd *hcd)
if (xhci->quirks & XHCI_AMD_PLL_FIX) if (xhci->quirks & XHCI_AMD_PLL_FIX)
usb_amd_dev_put(); usb_amd_dev_put();
xhci_dbg(xhci, "// Disabling event ring interrupts\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"// Disabling event ring interrupts");
temp = xhci_readl(xhci, &xhci->op_regs->status); temp = xhci_readl(xhci, &xhci->op_regs->status);
xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status);
temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); temp = xhci_readl(xhci, &xhci->ir_set->irq_pending);
...@@ -688,10 +699,11 @@ void xhci_stop(struct usb_hcd *hcd) ...@@ -688,10 +699,11 @@ void xhci_stop(struct usb_hcd *hcd)
&xhci->ir_set->irq_pending); &xhci->ir_set->irq_pending);
xhci_print_ir_set(xhci, 0); xhci_print_ir_set(xhci, 0);
xhci_dbg(xhci, "cleaning up memory\n"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "cleaning up memory");
xhci_mem_cleanup(xhci); xhci_mem_cleanup(xhci);
xhci_dbg(xhci, "xhci_stop completed - status = %x\n", xhci_dbg_trace(xhci, trace_xhci_dbg_init,
xhci_readl(xhci, &xhci->op_regs->status)); "xhci_stop completed - status = %x",
xhci_readl(xhci, &xhci->op_regs->status));
} }
/* /*
...@@ -716,8 +728,9 @@ void xhci_shutdown(struct usb_hcd *hcd) ...@@ -716,8 +728,9 @@ void xhci_shutdown(struct usb_hcd *hcd)
xhci_cleanup_msix(xhci); xhci_cleanup_msix(xhci);
xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", xhci_dbg_trace(xhci, trace_xhci_dbg_init,
xhci_readl(xhci, &xhci->op_regs->status)); "xhci_shutdown completed - status = %x",
xhci_readl(xhci, &xhci->op_regs->status));
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -758,7 +771,8 @@ static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) ...@@ -758,7 +771,8 @@ static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci)
xhci->cmd_ring->dequeue) & xhci->cmd_ring->dequeue) &
(u64) ~CMD_RING_RSVD_BITS) | (u64) ~CMD_RING_RSVD_BITS) |
xhci->cmd_ring->cycle_state; xhci->cmd_ring->cycle_state;
xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"// Setting command ring address to 0x%llx",
(long unsigned long) val_64); (long unsigned long) val_64);
xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring);
} }
......
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