diff options
author | Xenia Ragiadakou <burzalodowa@gmail.com> | 2013-08-06 00:52:45 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2013-08-13 19:05:41 -0400 |
commit | 4bdfe4c38fd5b06da558050a3288a0a48825a3e7 (patch) | |
tree | f241e6624b14dca4d6013c0da416d36b8f278734 /drivers/usb/host/xhci.c | |
parent | 3a7fa5bef06e1757d1aded8d78afd041b4552e11 (diff) |
xhci: add trace for debug messages related to quirks
This patch defines a new trace event, which is called xhci_dbg_quirks
and belongs in the event class xhci_log_msg, and adds tracepoints that
trace the debug messages associated with xHCs' quirks.
Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r-- | drivers/usb/host/xhci.c | 67 |
1 files changed, 43 insertions, 24 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index fa7b6f43642f..ffb3ed09eb0d 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -418,9 +418,11 @@ static void compliance_mode_recovery(unsigned long arg) | |||
418 | * Compliance Mode Detected. Letting USB Core | 418 | * Compliance Mode Detected. Letting USB Core |
419 | * handle the Warm Reset | 419 | * handle the Warm Reset |
420 | */ | 420 | */ |
421 | xhci_dbg(xhci, "Compliance mode detected->port %d\n", | 421 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
422 | "Compliance mode detected->port %d", | ||
422 | i + 1); | 423 | i + 1); |
423 | xhci_dbg(xhci, "Attempting compliance mode recovery\n"); | 424 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
425 | "Attempting compliance mode recovery"); | ||
424 | hcd = xhci->shared_hcd; | 426 | hcd = xhci->shared_hcd; |
425 | 427 | ||
426 | if (hcd->state == HC_STATE_SUSPENDED) | 428 | if (hcd->state == HC_STATE_SUSPENDED) |
@@ -458,7 +460,8 @@ static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci) | |||
458 | set_timer_slack(&xhci->comp_mode_recovery_timer, | 460 | set_timer_slack(&xhci->comp_mode_recovery_timer, |
459 | msecs_to_jiffies(COMP_MODE_RCVRY_MSECS)); | 461 | msecs_to_jiffies(COMP_MODE_RCVRY_MSECS)); |
460 | add_timer(&xhci->comp_mode_recovery_timer); | 462 | add_timer(&xhci->comp_mode_recovery_timer); |
461 | xhci_dbg(xhci, "Compliance mode recovery timer initialized\n"); | 463 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
464 | "Compliance mode recovery timer initialized"); | ||
462 | } | 465 | } |
463 | 466 | ||
464 | /* | 467 | /* |
@@ -509,7 +512,8 @@ int xhci_init(struct usb_hcd *hcd) | |||
509 | xhci_dbg(xhci, "xhci_init\n"); | 512 | xhci_dbg(xhci, "xhci_init\n"); |
510 | spin_lock_init(&xhci->lock); | 513 | spin_lock_init(&xhci->lock); |
511 | if (xhci->hci_version == 0x95 && link_quirk) { | 514 | if (xhci->hci_version == 0x95 && link_quirk) { |
512 | xhci_dbg(xhci, "QUIRK: Not clearing Link TRB chain bits.\n"); | 515 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
516 | "QUIRK: Not clearing Link TRB chain bits."); | ||
513 | xhci->quirks |= XHCI_LINK_TRB_QUIRK; | 517 | xhci->quirks |= XHCI_LINK_TRB_QUIRK; |
514 | } else { | 518 | } else { |
515 | xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n"); | 519 | xhci_dbg(xhci, "xHCI doesn't need link TRB QUIRK\n"); |
@@ -668,7 +672,8 @@ void xhci_stop(struct usb_hcd *hcd) | |||
668 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && | 672 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
669 | (!(xhci_all_ports_seen_u0(xhci)))) { | 673 | (!(xhci_all_ports_seen_u0(xhci)))) { |
670 | del_timer_sync(&xhci->comp_mode_recovery_timer); | 674 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
671 | xhci_dbg(xhci, "%s: compliance mode recovery timer deleted\n", | 675 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
676 | "%s: compliance mode recovery timer deleted", | ||
672 | __func__); | 677 | __func__); |
673 | } | 678 | } |
674 | 679 | ||
@@ -866,7 +871,8 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
866 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && | 871 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
867 | (!(xhci_all_ports_seen_u0(xhci)))) { | 872 | (!(xhci_all_ports_seen_u0(xhci)))) { |
868 | del_timer_sync(&xhci->comp_mode_recovery_timer); | 873 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
869 | xhci_dbg(xhci, "%s: compliance mode recovery timer deleted\n", | 874 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
875 | "%s: compliance mode recovery timer deleted", | ||
870 | __func__); | 876 | __func__); |
871 | } | 877 | } |
872 | 878 | ||
@@ -931,7 +937,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
931 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && | 937 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
932 | !(xhci_all_ports_seen_u0(xhci))) { | 938 | !(xhci_all_ports_seen_u0(xhci))) { |
933 | del_timer_sync(&xhci->comp_mode_recovery_timer); | 939 | del_timer_sync(&xhci->comp_mode_recovery_timer); |
934 | xhci_dbg(xhci, "Compliance Mode Recovery Timer deleted!\n"); | 940 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
941 | "Compliance Mode Recovery Timer deleted!"); | ||
935 | } | 942 | } |
936 | 943 | ||
937 | /* Let the USB core know _both_ roothubs lost power. */ | 944 | /* Let the USB core know _both_ roothubs lost power. */ |
@@ -1894,14 +1901,16 @@ static int xhci_reserve_host_resources(struct xhci_hcd *xhci, | |||
1894 | 1901 | ||
1895 | added_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); | 1902 | added_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); |
1896 | if (xhci->num_active_eps + added_eps > xhci->limit_active_eps) { | 1903 | if (xhci->num_active_eps + added_eps > xhci->limit_active_eps) { |
1897 | xhci_dbg(xhci, "Not enough ep ctxs: " | 1904 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
1898 | "%u active, need to add %u, limit is %u.\n", | 1905 | "Not enough ep ctxs: " |
1906 | "%u active, need to add %u, limit is %u.", | ||
1899 | xhci->num_active_eps, added_eps, | 1907 | xhci->num_active_eps, added_eps, |
1900 | xhci->limit_active_eps); | 1908 | xhci->limit_active_eps); |
1901 | return -ENOMEM; | 1909 | return -ENOMEM; |
1902 | } | 1910 | } |
1903 | xhci->num_active_eps += added_eps; | 1911 | xhci->num_active_eps += added_eps; |
1904 | xhci_dbg(xhci, "Adding %u ep ctxs, %u now active.\n", added_eps, | 1912 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
1913 | "Adding %u ep ctxs, %u now active.", added_eps, | ||
1905 | xhci->num_active_eps); | 1914 | xhci->num_active_eps); |
1906 | return 0; | 1915 | return 0; |
1907 | } | 1916 | } |
@@ -1919,7 +1928,8 @@ static void xhci_free_host_resources(struct xhci_hcd *xhci, | |||
1919 | 1928 | ||
1920 | num_failed_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); | 1929 | num_failed_eps = xhci_count_num_new_endpoints(xhci, ctrl_ctx); |
1921 | xhci->num_active_eps -= num_failed_eps; | 1930 | xhci->num_active_eps -= num_failed_eps; |
1922 | xhci_dbg(xhci, "Removing %u failed ep ctxs, %u now active.\n", | 1931 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
1932 | "Removing %u failed ep ctxs, %u now active.", | ||
1923 | num_failed_eps, | 1933 | num_failed_eps, |
1924 | xhci->num_active_eps); | 1934 | xhci->num_active_eps); |
1925 | } | 1935 | } |
@@ -1938,7 +1948,8 @@ static void xhci_finish_resource_reservation(struct xhci_hcd *xhci, | |||
1938 | num_dropped_eps = xhci_count_num_dropped_endpoints(xhci, ctrl_ctx); | 1948 | num_dropped_eps = xhci_count_num_dropped_endpoints(xhci, ctrl_ctx); |
1939 | xhci->num_active_eps -= num_dropped_eps; | 1949 | xhci->num_active_eps -= num_dropped_eps; |
1940 | if (num_dropped_eps) | 1950 | if (num_dropped_eps) |
1941 | xhci_dbg(xhci, "Removing %u dropped ep ctxs, %u now active.\n", | 1951 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
1952 | "Removing %u dropped ep ctxs, %u now active.", | ||
1942 | num_dropped_eps, | 1953 | num_dropped_eps, |
1943 | xhci->num_active_eps); | 1954 | xhci->num_active_eps); |
1944 | } | 1955 | } |
@@ -2099,18 +2110,21 @@ static int xhci_check_bw_table(struct xhci_hcd *xhci, | |||
2099 | * that the HS bus has enough bandwidth if we are activing a new TT. | 2110 | * that the HS bus has enough bandwidth if we are activing a new TT. |
2100 | */ | 2111 | */ |
2101 | if (virt_dev->tt_info) { | 2112 | if (virt_dev->tt_info) { |
2102 | xhci_dbg(xhci, "Recalculating BW for rootport %u\n", | 2113 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
2114 | "Recalculating BW for rootport %u", | ||
2103 | virt_dev->real_port); | 2115 | virt_dev->real_port); |
2104 | if (xhci_check_tt_bw_table(xhci, virt_dev, old_active_eps)) { | 2116 | if (xhci_check_tt_bw_table(xhci, virt_dev, old_active_eps)) { |
2105 | xhci_warn(xhci, "Not enough bandwidth on HS bus for " | 2117 | xhci_warn(xhci, "Not enough bandwidth on HS bus for " |
2106 | "newly activated TT.\n"); | 2118 | "newly activated TT.\n"); |
2107 | return -ENOMEM; | 2119 | return -ENOMEM; |
2108 | } | 2120 | } |
2109 | xhci_dbg(xhci, "Recalculating BW for TT slot %u port %u\n", | 2121 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
2122 | "Recalculating BW for TT slot %u port %u", | ||
2110 | virt_dev->tt_info->slot_id, | 2123 | virt_dev->tt_info->slot_id, |
2111 | virt_dev->tt_info->ttport); | 2124 | virt_dev->tt_info->ttport); |
2112 | } else { | 2125 | } else { |
2113 | xhci_dbg(xhci, "Recalculating BW for rootport %u\n", | 2126 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
2127 | "Recalculating BW for rootport %u", | ||
2114 | virt_dev->real_port); | 2128 | virt_dev->real_port); |
2115 | } | 2129 | } |
2116 | 2130 | ||
@@ -2218,8 +2232,9 @@ static int xhci_check_bw_table(struct xhci_hcd *xhci, | |||
2218 | xhci->rh_bw[port_index].num_active_tts; | 2232 | xhci->rh_bw[port_index].num_active_tts; |
2219 | } | 2233 | } |
2220 | 2234 | ||
2221 | xhci_dbg(xhci, "Final bandwidth: %u, Limit: %u, Reserved: %u, " | 2235 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
2222 | "Available: %u " "percent\n", | 2236 | "Final bandwidth: %u, Limit: %u, Reserved: %u, " |
2237 | "Available: %u " "percent", | ||
2223 | bw_used, max_bandwidth, bw_reserved, | 2238 | bw_used, max_bandwidth, bw_reserved, |
2224 | (max_bandwidth - bw_used - bw_reserved) * 100 / | 2239 | (max_bandwidth - bw_used - bw_reserved) * 100 / |
2225 | max_bandwidth); | 2240 | max_bandwidth); |
@@ -2825,8 +2840,9 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | |||
2825 | * XXX: No idea how this hardware will react when stream rings | 2840 | * XXX: No idea how this hardware will react when stream rings |
2826 | * are enabled. | 2841 | * are enabled. |
2827 | */ | 2842 | */ |
2828 | xhci_dbg(xhci, "Setting up input context for " | 2843 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
2829 | "configure endpoint command\n"); | 2844 | "Setting up input context for " |
2845 | "configure endpoint command"); | ||
2830 | xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, | 2846 | xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, |
2831 | ep_index, &deq_state); | 2847 | ep_index, &deq_state); |
2832 | } | 2848 | } |
@@ -3305,8 +3321,9 @@ void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, | |||
3305 | } | 3321 | } |
3306 | xhci->num_active_eps -= num_dropped_eps; | 3322 | xhci->num_active_eps -= num_dropped_eps; |
3307 | if (num_dropped_eps) | 3323 | if (num_dropped_eps) |
3308 | xhci_dbg(xhci, "Dropped %u ep ctxs, flags = 0x%x, " | 3324 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
3309 | "%u now active.\n", | 3325 | "Dropped %u ep ctxs, flags = 0x%x, " |
3326 | "%u now active.", | ||
3310 | num_dropped_eps, drop_flags, | 3327 | num_dropped_eps, drop_flags, |
3311 | xhci->num_active_eps); | 3328 | xhci->num_active_eps); |
3312 | } | 3329 | } |
@@ -3568,13 +3585,15 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
3568 | static int xhci_reserve_host_control_ep_resources(struct xhci_hcd *xhci) | 3585 | static int xhci_reserve_host_control_ep_resources(struct xhci_hcd *xhci) |
3569 | { | 3586 | { |
3570 | if (xhci->num_active_eps + 1 > xhci->limit_active_eps) { | 3587 | if (xhci->num_active_eps + 1 > xhci->limit_active_eps) { |
3571 | xhci_dbg(xhci, "Not enough ep ctxs: " | 3588 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
3572 | "%u active, need to add 1, limit is %u.\n", | 3589 | "Not enough ep ctxs: " |
3590 | "%u active, need to add 1, limit is %u.", | ||
3573 | xhci->num_active_eps, xhci->limit_active_eps); | 3591 | xhci->num_active_eps, xhci->limit_active_eps); |
3574 | return -ENOMEM; | 3592 | return -ENOMEM; |
3575 | } | 3593 | } |
3576 | xhci->num_active_eps += 1; | 3594 | xhci->num_active_eps += 1; |
3577 | xhci_dbg(xhci, "Adding 1 ep ctx, %u now active.\n", | 3595 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
3596 | "Adding 1 ep ctx, %u now active.", | ||
3578 | xhci->num_active_eps); | 3597 | xhci->num_active_eps); |
3579 | return 0; | 3598 | return 0; |
3580 | } | 3599 | } |