Commit 2e77a825 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

xhci: Add port status decoder for tracing purposes

Add PORTSC Port status and control register decoder to
show human readable tracing of portsc register
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7344ee32
......@@ -2399,6 +2399,87 @@ static inline const char *xhci_decode_slot_context(u32 info, u32 info2,
return str;
}
static inline const char *xhci_portsc_link_state_string(u32 portsc)
{
switch (portsc & PORT_PLS_MASK) {
case XDEV_U0:
return "U0";
case XDEV_U1:
return "U1";
case XDEV_U2:
return "U2";
case XDEV_U3:
return "U3";
case XDEV_DISABLED:
return "Disabled";
case XDEV_RXDETECT:
return "RxDetect";
case XDEV_INACTIVE:
return "Inactive";
case XDEV_POLLING:
return "Polling";
case XDEV_RECOVERY:
return "Recovery";
case XDEV_HOT_RESET:
return "Hot Reset";
case XDEV_COMP_MODE:
return "Compliance mode";
case XDEV_TEST_MODE:
return "Test mode";
case XDEV_RESUME:
return "Resume";
default:
break;
}
return "Unknown";
}
static inline const char *xhci_decode_portsc(u32 portsc)
{
static char str[256];
int ret;
ret = sprintf(str, "%s %s %s Link:%s ",
portsc & PORT_POWER ? "Powered" : "Powered-off",
portsc & PORT_CONNECT ? "Connected" : "Not-connected",
portsc & PORT_PE ? "Enabled" : "Disabled",
xhci_portsc_link_state_string(portsc));
if (portsc & PORT_OC)
ret += sprintf(str + ret, "OverCurrent ");
if (portsc & PORT_RESET)
ret += sprintf(str + ret, "In-Reset ");
ret += sprintf(str + ret, "Change: ");
if (portsc & PORT_CSC)
ret += sprintf(str + ret, "CSC ");
if (portsc & PORT_PEC)
ret += sprintf(str + ret, "PEC ");
if (portsc & PORT_WRC)
ret += sprintf(str + ret, "WRC ");
if (portsc & PORT_OCC)
ret += sprintf(str + ret, "OCC ");
if (portsc & PORT_RC)
ret += sprintf(str + ret, "PRC ");
if (portsc & PORT_PLC)
ret += sprintf(str + ret, "PLC ");
if (portsc & PORT_CEC)
ret += sprintf(str + ret, "CEC ");
if (portsc & PORT_CAS)
ret += sprintf(str + ret, "CAS ");
ret += sprintf(str + ret, "Wake: ");
if (portsc & PORT_WKCONN_E)
ret += sprintf(str + ret, "WCE ");
if (portsc & PORT_WKDISC_E)
ret += sprintf(str + ret, "WDE ");
if (portsc & PORT_WKOC_E)
ret += sprintf(str + ret, "WOE ");
return str;
}
static inline const char *xhci_ep_state_string(u8 state)
{
switch (state) {
......
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