Changeset 91ca111 in mainline for uspace/drv/bus/usb/xhci/debug.c
- Timestamp:
- 2017-06-23T11:18:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 51b2693
- Parents:
- e4d7363
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/debug.c
re4d7363 r91ca111 35 35 36 36 #include <inttypes.h> 37 #include <byteorder.h> 37 38 #include <usb/debug.h> 38 39 … … 60 61 * Dumps all capability registers. 61 62 */ 62 void xhci_dump_cap_regs( xhci_cap_regs_t *cap)63 void xhci_dump_cap_regs(const xhci_cap_regs_t *cap) 63 64 { 64 65 usb_log_debug2("Capabilities:"); … … 99 100 } 100 101 101 void xhci_dump_port( xhci_port_regs_t *port)102 void xhci_dump_port(const xhci_port_regs_t *port) 102 103 { 103 104 DUMP_REG(port, XHCI_PORT_CCS); … … 124 125 } 125 126 126 void xhci_dump_state( xhci_hc_t *hc)127 void xhci_dump_state(const xhci_hc_t *hc) 127 128 { 128 129 usb_log_debug2("Operational registers:"); … … 171 172 } 172 173 173 void xhci_dump_ports( xhci_hc_t *hc)174 void xhci_dump_ports(const xhci_hc_t *hc) 174 175 { 175 176 const size_t num_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS); … … 230 231 } 231 232 232 void xhci_dump_trb( xhci_trb_t *trb)233 void xhci_dump_trb(const xhci_trb_t *trb) 233 234 { 234 235 usb_log_debug2("TRB(%p): type %s, cycle %u", trb, xhci_trb_str_type(TRB_TYPE(*trb)), TRB_CYCLE(*trb)); 236 } 237 238 static const char *ec_ids [] = { 239 [0] = "<empty>", 240 #define EC(t) [XHCI_EC_##t] = #t 241 EC(USB_LEGACY), 242 EC(SUPPORTED_PROTOCOL), 243 EC(EXTENDED_POWER_MANAGEMENT), 244 EC(IOV), 245 EC(MSI), 246 EC(LOCALMEM), 247 EC(DEBUG), 248 EC(MSIX), 249 #undef EC 250 [XHCI_EC_MAX] = NULL 251 }; 252 253 const char *xhci_ec_str_id(unsigned id) 254 { 255 static char buf [20]; 256 257 if (id < XHCI_EC_MAX && ec_ids[id] != NULL) 258 return ec_ids[id]; 259 260 snprintf(buf, sizeof(buf), "<unknown (%u)>", id); 261 return buf; 262 } 263 264 static void xhci_dump_psi(const xhci_psi_t *psi) 265 { 266 static const char speed_exp [] = " KMG"; 267 static const char *psi_types [] = { "", " rsvd", " RX", " TX" }; 268 269 usb_log_debug("Speed %u%s: %5u %cb/s, %s", 270 XHCI_REG_RD(psi, XHCI_PSI_PSIV), 271 psi_types[XHCI_REG_RD(psi, XHCI_PSI_PLT)], 272 XHCI_REG_RD(psi, XHCI_PSI_PSIM), 273 speed_exp[XHCI_REG_RD(psi, XHCI_PSI_PSIE)], 274 XHCI_REG_RD(psi, XHCI_PSI_PFD) ? "full-duplex" : ""); 275 } 276 277 void xhci_dump_extcap(const xhci_extcap_t *ec) 278 { 279 xhci_sp_name_t name; 280 unsigned ports_from, ports_to; 281 282 unsigned id = XHCI_REG_RD(ec, XHCI_EC_CAP_ID); 283 usb_log_debug("Extended capability %s", xhci_ec_str_id(id)); 284 285 switch (id) { 286 case XHCI_EC_SUPPORTED_PROTOCOL: 287 name.packed = host2uint32_t_le(XHCI_REG_RD(ec, XHCI_EC_SP_NAME)); 288 ports_from = XHCI_REG_RD(ec, XHCI_EC_SP_CP_OFF); 289 ports_to = ports_from + XHCI_REG_RD(ec, XHCI_EC_SP_CP_OFF) - 1; 290 usb_log_debug("\tProtocol %4s%u.%u, ports %u-%u", name.str, 291 XHCI_REG_RD(ec, XHCI_EC_SP_MAJOR), 292 XHCI_REG_RD(ec, XHCI_EC_SP_MINOR), 293 ports_from, ports_to); 294 295 unsigned psic = XHCI_REG_RD(ec, XHCI_EC_SP_PSIC); 296 for (unsigned i = 0; i < psic; i++) 297 xhci_dump_psi(xhci_extcap_psi(ec, i)); 298 break; 299 } 235 300 } 236 301
Note:
See TracChangeset
for help on using the changeset viewer.