1 | /*
|
---|
2 | * Copyright (c) 2017 Ondrej Hlavaty
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup drvusbxhci
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | * Various functions to examine current state of the xHC.
|
---|
34 | */
|
---|
35 |
|
---|
36 | #include <inttypes.h>
|
---|
37 | #include <byteorder.h>
|
---|
38 | #include <usb/debug.h>
|
---|
39 |
|
---|
40 | #include "hw_struct/trb.h"
|
---|
41 | #include "debug.h"
|
---|
42 | #include "hc.h"
|
---|
43 |
|
---|
44 | #define PX "\t%-21s = "
|
---|
45 |
|
---|
46 | #define DUMP_REG_FIELD(ptr, title, size, ...) \
|
---|
47 | usb_log_debug2(PX "%" PRIu##size, title, XHCI_REG_RD_FIELD(ptr, size, ##__VA_ARGS__))
|
---|
48 |
|
---|
49 | #define DUMP_REG_RANGE(ptr, title, size, ...) \
|
---|
50 | usb_log_debug2(PX "%" PRIu##size, title, XHCI_REG_RD_RANGE(ptr, size, ##__VA_ARGS__))
|
---|
51 |
|
---|
52 | #define DUMP_REG_FLAG(ptr, title, size, ...) \
|
---|
53 | usb_log_debug2(PX "%s", title, XHCI_REG_RD_FLAG(ptr, size, ##__VA_ARGS__) ? "true" : "false")
|
---|
54 |
|
---|
55 | #define DUMP_REG_INNER(set, title, field, size, type, ...) \
|
---|
56 | DUMP_REG_##type(&(set)->field, title, size, ##__VA_ARGS__)
|
---|
57 |
|
---|
58 | #define DUMP_REG(set, c) DUMP_REG_INNER(set, #c, c)
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * Dumps all capability registers.
|
---|
62 | */
|
---|
63 | void xhci_dump_cap_regs(const xhci_cap_regs_t *cap)
|
---|
64 | {
|
---|
65 | usb_log_debug2("Capabilities:");
|
---|
66 |
|
---|
67 | DUMP_REG(cap, XHCI_CAP_LENGTH);
|
---|
68 | DUMP_REG(cap, XHCI_CAP_VERSION);
|
---|
69 | DUMP_REG(cap, XHCI_CAP_MAX_SLOTS);
|
---|
70 | DUMP_REG(cap, XHCI_CAP_MAX_INTRS);
|
---|
71 | DUMP_REG(cap, XHCI_CAP_MAX_PORTS);
|
---|
72 | DUMP_REG(cap, XHCI_CAP_IST);
|
---|
73 | DUMP_REG(cap, XHCI_CAP_ERST_MAX);
|
---|
74 | usb_log_debug2(PX "%u", "Max Scratchpad bufs", xhci_get_max_spbuf(cap));
|
---|
75 | DUMP_REG(cap, XHCI_CAP_SPR);
|
---|
76 | DUMP_REG(cap, XHCI_CAP_U1EL);
|
---|
77 | DUMP_REG(cap, XHCI_CAP_U2EL);
|
---|
78 | DUMP_REG(cap, XHCI_CAP_AC64);
|
---|
79 | DUMP_REG(cap, XHCI_CAP_BNC);
|
---|
80 | DUMP_REG(cap, XHCI_CAP_CSZ);
|
---|
81 | DUMP_REG(cap, XHCI_CAP_PPC);
|
---|
82 | DUMP_REG(cap, XHCI_CAP_PIND);
|
---|
83 | DUMP_REG(cap, XHCI_CAP_C);
|
---|
84 | DUMP_REG(cap, XHCI_CAP_LTC);
|
---|
85 | DUMP_REG(cap, XHCI_CAP_NSS);
|
---|
86 | DUMP_REG(cap, XHCI_CAP_PAE);
|
---|
87 | DUMP_REG(cap, XHCI_CAP_SPC);
|
---|
88 | DUMP_REG(cap, XHCI_CAP_SEC);
|
---|
89 | DUMP_REG(cap, XHCI_CAP_CFC);
|
---|
90 | DUMP_REG(cap, XHCI_CAP_MAX_PSA_SIZE);
|
---|
91 | DUMP_REG(cap, XHCI_CAP_XECP);
|
---|
92 | DUMP_REG(cap, XHCI_CAP_DBOFF);
|
---|
93 | DUMP_REG(cap, XHCI_CAP_RTSOFF);
|
---|
94 | DUMP_REG(cap, XHCI_CAP_U3C);
|
---|
95 | DUMP_REG(cap, XHCI_CAP_CMC);
|
---|
96 | DUMP_REG(cap, XHCI_CAP_FSC);
|
---|
97 | DUMP_REG(cap, XHCI_CAP_CTC);
|
---|
98 | DUMP_REG(cap, XHCI_CAP_LEC);
|
---|
99 | DUMP_REG(cap, XHCI_CAP_CIC);
|
---|
100 | }
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * Dumps registers of one port.
|
---|
104 | */
|
---|
105 | void xhci_dump_port(const xhci_port_regs_t *port)
|
---|
106 | {
|
---|
107 | DUMP_REG(port, XHCI_PORT_CCS);
|
---|
108 | DUMP_REG(port, XHCI_PORT_PED);
|
---|
109 | DUMP_REG(port, XHCI_PORT_OCA);
|
---|
110 | DUMP_REG(port, XHCI_PORT_PR);
|
---|
111 | DUMP_REG(port, XHCI_PORT_PLS);
|
---|
112 | DUMP_REG(port, XHCI_PORT_PP);
|
---|
113 | DUMP_REG(port, XHCI_PORT_PS);
|
---|
114 | DUMP_REG(port, XHCI_PORT_PIC);
|
---|
115 | DUMP_REG(port, XHCI_PORT_LWS);
|
---|
116 | DUMP_REG(port, XHCI_PORT_CSC);
|
---|
117 | DUMP_REG(port, XHCI_PORT_PEC);
|
---|
118 | DUMP_REG(port, XHCI_PORT_WRC);
|
---|
119 | DUMP_REG(port, XHCI_PORT_OCC);
|
---|
120 | DUMP_REG(port, XHCI_PORT_PRC);
|
---|
121 | DUMP_REG(port, XHCI_PORT_PLC);
|
---|
122 | DUMP_REG(port, XHCI_PORT_CEC);
|
---|
123 | DUMP_REG(port, XHCI_PORT_CAS);
|
---|
124 | DUMP_REG(port, XHCI_PORT_WCE);
|
---|
125 | DUMP_REG(port, XHCI_PORT_WDE);
|
---|
126 | DUMP_REG(port, XHCI_PORT_WOE);
|
---|
127 | DUMP_REG(port, XHCI_PORT_DR);
|
---|
128 | DUMP_REG(port, XHCI_PORT_WPR);
|
---|
129 | DUMP_REG(port, XHCI_PORT_USB3_U1TO);
|
---|
130 | DUMP_REG(port, XHCI_PORT_USB3_U2TO);
|
---|
131 | DUMP_REG(port, XHCI_PORT_USB3_FLPMA);
|
---|
132 | DUMP_REG(port, XHCI_PORT_USB3_LEC);
|
---|
133 | DUMP_REG(port, XHCI_PORT_USB3_RLC);
|
---|
134 | DUMP_REG(port, XHCI_PORT_USB3_TLC);
|
---|
135 | DUMP_REG(port, XHCI_PORT_USB2_L1S);
|
---|
136 | DUMP_REG(port, XHCI_PORT_USB2_RWE);
|
---|
137 | DUMP_REG(port, XHCI_PORT_USB2_BESL);
|
---|
138 | DUMP_REG(port, XHCI_PORT_USB2_L1DS);
|
---|
139 | DUMP_REG(port, XHCI_PORT_USB2_HLE);
|
---|
140 | DUMP_REG(port, XHCI_PORT_USB2_TM);
|
---|
141 | DUMP_REG(port, XHCI_PORT_USB2_HIRDM);
|
---|
142 | DUMP_REG(port, XHCI_PORT_USB2_L1TO);
|
---|
143 | DUMP_REG(port, XHCI_PORT_USB2_BESLD);
|
---|
144 | }
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * Dumps all registers that define state of the HC.
|
---|
148 | */
|
---|
149 | void xhci_dump_state(const xhci_hc_t *hc)
|
---|
150 | {
|
---|
151 | usb_log_debug2("Operational registers:");
|
---|
152 |
|
---|
153 | DUMP_REG(hc->op_regs, XHCI_OP_RS);
|
---|
154 | DUMP_REG(hc->op_regs, XHCI_OP_HCRST);
|
---|
155 | DUMP_REG(hc->op_regs, XHCI_OP_INTE);
|
---|
156 | DUMP_REG(hc->op_regs, XHCI_OP_HSEE);
|
---|
157 | DUMP_REG(hc->op_regs, XHCI_OP_LHCRST);
|
---|
158 | DUMP_REG(hc->op_regs, XHCI_OP_CSS);
|
---|
159 | DUMP_REG(hc->op_regs, XHCI_OP_CRS);
|
---|
160 | DUMP_REG(hc->op_regs, XHCI_OP_EWE);
|
---|
161 | DUMP_REG(hc->op_regs, XHCI_OP_EU3S);
|
---|
162 | DUMP_REG(hc->op_regs, XHCI_OP_CME);
|
---|
163 | DUMP_REG(hc->op_regs, XHCI_OP_HCH);
|
---|
164 | DUMP_REG(hc->op_regs, XHCI_OP_HSE);
|
---|
165 | DUMP_REG(hc->op_regs, XHCI_OP_EINT);
|
---|
166 | DUMP_REG(hc->op_regs, XHCI_OP_PCD);
|
---|
167 | DUMP_REG(hc->op_regs, XHCI_OP_SSS);
|
---|
168 | DUMP_REG(hc->op_regs, XHCI_OP_RSS);
|
---|
169 | DUMP_REG(hc->op_regs, XHCI_OP_SRE);
|
---|
170 | DUMP_REG(hc->op_regs, XHCI_OP_CNR);
|
---|
171 | DUMP_REG(hc->op_regs, XHCI_OP_HCE);
|
---|
172 | DUMP_REG(hc->op_regs, XHCI_OP_PAGESIZE);
|
---|
173 | DUMP_REG(hc->op_regs, XHCI_OP_NOTIFICATION);
|
---|
174 | DUMP_REG(hc->op_regs, XHCI_OP_RCS);
|
---|
175 | DUMP_REG(hc->op_regs, XHCI_OP_CS);
|
---|
176 | DUMP_REG(hc->op_regs, XHCI_OP_CA);
|
---|
177 | DUMP_REG(hc->op_regs, XHCI_OP_CRR);
|
---|
178 | DUMP_REG(hc->op_regs, XHCI_OP_CRCR_LO);
|
---|
179 | DUMP_REG(hc->op_regs, XHCI_OP_CRCR_HI);
|
---|
180 | DUMP_REG(hc->op_regs, XHCI_OP_DCBAAP_LO);
|
---|
181 | DUMP_REG(hc->op_regs, XHCI_OP_DCBAAP_HI);
|
---|
182 | DUMP_REG(hc->rt_regs, XHCI_RT_MFINDEX);
|
---|
183 |
|
---|
184 | usb_log_debug2("Interrupter 0 state:");
|
---|
185 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IP);
|
---|
186 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IE);
|
---|
187 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IMI);
|
---|
188 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IMC);
|
---|
189 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTSZ);
|
---|
190 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTBA_LO);
|
---|
191 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTBA_HI);
|
---|
192 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERDP_LO);
|
---|
193 | DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERDP_HI);
|
---|
194 | }
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * Dump registers of all ports.
|
---|
198 | */
|
---|
199 | void xhci_dump_ports(const xhci_hc_t *hc)
|
---|
200 | {
|
---|
201 | const size_t num_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS);
|
---|
202 | for (size_t i = 0; i < num_ports; i++) {
|
---|
203 | usb_log_debug2("Port %zu state:", i);
|
---|
204 |
|
---|
205 | xhci_dump_port(&hc->op_regs->portrs[i]);
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | static const char *trb_types [] = {
|
---|
210 | [0] = "<empty>",
|
---|
211 | #define TRB(t) [XHCI_TRB_TYPE_##t] = #t
|
---|
212 | TRB(NORMAL),
|
---|
213 | TRB(SETUP_STAGE),
|
---|
214 | TRB(DATA_STAGE),
|
---|
215 | TRB(STATUS_STAGE),
|
---|
216 | TRB(ISOCH),
|
---|
217 | TRB(LINK),
|
---|
218 | TRB(EVENT_DATA),
|
---|
219 | TRB(NO_OP),
|
---|
220 | TRB(ENABLE_SLOT_CMD),
|
---|
221 | TRB(DISABLE_SLOT_CMD),
|
---|
222 | TRB(ADDRESS_DEVICE_CMD),
|
---|
223 | TRB(CONFIGURE_ENDPOINT_CMD),
|
---|
224 | TRB(EVALUATE_CONTEXT_CMD),
|
---|
225 | TRB(RESET_ENDPOINT_CMD),
|
---|
226 | TRB(STOP_ENDPOINT_CMD),
|
---|
227 | TRB(SET_TR_DEQUEUE_POINTER_CMD),
|
---|
228 | TRB(RESET_DEVICE_CMD),
|
---|
229 | TRB(FORCE_EVENT_CMD),
|
---|
230 | TRB(NEGOTIATE_BANDWIDTH_CMD),
|
---|
231 | TRB(SET_LATENCY_TOLERANCE_VALUE_CMD),
|
---|
232 | TRB(GET_PORT_BANDWIDTH_CMD),
|
---|
233 | TRB(FORCE_HEADER_CMD),
|
---|
234 | TRB(NO_OP_CMD),
|
---|
235 | TRB(TRANSFER_EVENT),
|
---|
236 | TRB(COMMAND_COMPLETION_EVENT),
|
---|
237 | TRB(PORT_STATUS_CHANGE_EVENT),
|
---|
238 | TRB(BANDWIDTH_REQUEST_EVENT),
|
---|
239 | TRB(DOORBELL_EVENT),
|
---|
240 | TRB(HOST_CONTROLLER_EVENT),
|
---|
241 | TRB(DEVICE_NOTIFICATION_EVENT),
|
---|
242 | TRB(MFINDEX_WRAP_EVENT),
|
---|
243 | #undef TRB
|
---|
244 | [XHCI_TRB_TYPE_MAX] = NULL,
|
---|
245 | };
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * Stringify XHCI_TRB_TYPE_*.
|
---|
249 | */
|
---|
250 | const char *xhci_trb_str_type(unsigned type)
|
---|
251 | {
|
---|
252 | static char type_buf [20];
|
---|
253 |
|
---|
254 | if (type < XHCI_TRB_TYPE_MAX && trb_types[type] != NULL)
|
---|
255 | return trb_types[type];
|
---|
256 |
|
---|
257 | snprintf(type_buf, sizeof(type_buf), "<unknown (%u)>", type);
|
---|
258 | return type_buf;
|
---|
259 | }
|
---|
260 |
|
---|
261 | /**
|
---|
262 | * Dump a TRB.
|
---|
263 | */
|
---|
264 | void xhci_dump_trb(const xhci_trb_t *trb)
|
---|
265 | {
|
---|
266 | usb_log_debug2("TRB(%p): type %s, cycle %u", trb, xhci_trb_str_type(TRB_TYPE(*trb)), TRB_CYCLE(*trb));
|
---|
267 | }
|
---|
268 |
|
---|
269 | static const char *ec_ids [] = {
|
---|
270 | [0] = "<empty>",
|
---|
271 | #define EC(t) [XHCI_EC_##t] = #t
|
---|
272 | EC(USB_LEGACY),
|
---|
273 | EC(SUPPORTED_PROTOCOL),
|
---|
274 | EC(EXTENDED_POWER_MANAGEMENT),
|
---|
275 | EC(IOV),
|
---|
276 | EC(MSI),
|
---|
277 | EC(LOCALMEM),
|
---|
278 | EC(DEBUG),
|
---|
279 | EC(MSIX),
|
---|
280 | #undef EC
|
---|
281 | [XHCI_EC_MAX] = NULL
|
---|
282 | };
|
---|
283 |
|
---|
284 | /**
|
---|
285 | * Dump Extended Capability ID.
|
---|
286 | */
|
---|
287 | const char *xhci_ec_str_id(unsigned id)
|
---|
288 | {
|
---|
289 | static char buf [20];
|
---|
290 |
|
---|
291 | if (id < XHCI_EC_MAX && ec_ids[id] != NULL)
|
---|
292 | return ec_ids[id];
|
---|
293 |
|
---|
294 | snprintf(buf, sizeof(buf), "<unknown (%u)>", id);
|
---|
295 | return buf;
|
---|
296 | }
|
---|
297 |
|
---|
298 | /**
|
---|
299 | * Dump Protocol Speed ID.
|
---|
300 | */
|
---|
301 | static void xhci_dump_psi(const xhci_psi_t *psi)
|
---|
302 | {
|
---|
303 | static const char speed_exp [] = " KMG";
|
---|
304 | static const char *psi_types [] = { "", " rsvd", " RX", " TX" };
|
---|
305 |
|
---|
306 | usb_log_debug("Speed %u%s: %5u %cb/s, %s",
|
---|
307 | XHCI_REG_RD(psi, XHCI_PSI_PSIV),
|
---|
308 | psi_types[XHCI_REG_RD(psi, XHCI_PSI_PLT)],
|
---|
309 | XHCI_REG_RD(psi, XHCI_PSI_PSIM),
|
---|
310 | speed_exp[XHCI_REG_RD(psi, XHCI_PSI_PSIE)],
|
---|
311 | XHCI_REG_RD(psi, XHCI_PSI_PFD) ? "full-duplex" : "");
|
---|
312 | }
|
---|
313 |
|
---|
314 | /**
|
---|
315 | * Dump given Extended Capability.
|
---|
316 | */
|
---|
317 | void xhci_dump_extcap(const xhci_extcap_t *ec)
|
---|
318 | {
|
---|
319 | xhci_sp_name_t name;
|
---|
320 | unsigned ports_from, ports_to;
|
---|
321 |
|
---|
322 | unsigned id = XHCI_REG_RD(ec, XHCI_EC_CAP_ID);
|
---|
323 | usb_log_debug("Extended capability %s", xhci_ec_str_id(id));
|
---|
324 |
|
---|
325 | switch (id) {
|
---|
326 | case XHCI_EC_SUPPORTED_PROTOCOL:
|
---|
327 | name.packed = host2uint32_t_le(XHCI_REG_RD(ec, XHCI_EC_SP_NAME));
|
---|
328 | ports_from = XHCI_REG_RD(ec, XHCI_EC_SP_CP_OFF);
|
---|
329 | ports_to = ports_from + XHCI_REG_RD(ec, XHCI_EC_SP_CP_COUNT) - 1;
|
---|
330 | unsigned psic = XHCI_REG_RD(ec, XHCI_EC_SP_PSIC);
|
---|
331 |
|
---|
332 | usb_log_debug("\tProtocol %.4s%u.%u, ports %u-%u, %u protocol speeds", name.str,
|
---|
333 | XHCI_REG_RD(ec, XHCI_EC_SP_MAJOR),
|
---|
334 | XHCI_REG_RD(ec, XHCI_EC_SP_MINOR),
|
---|
335 | ports_from, ports_to, psic);
|
---|
336 |
|
---|
337 | for (unsigned i = 0; i < psic; i++)
|
---|
338 | xhci_dump_psi(xhci_extcap_psi(ec, i));
|
---|
339 | break;
|
---|
340 | }
|
---|
341 | }
|
---|
342 |
|
---|
343 | static void xhci_dump_slot_ctx(const struct xhci_slot_ctx *ctx)
|
---|
344 | {
|
---|
345 | #define SLOT_DUMP(name) usb_log_debug("\t" #name ":\t0x%x", XHCI_SLOT_##name(*ctx))
|
---|
346 | SLOT_DUMP(ROUTE_STRING);
|
---|
347 | SLOT_DUMP(SPEED);
|
---|
348 | SLOT_DUMP(MTT);
|
---|
349 | SLOT_DUMP(CTX_ENTRIES);
|
---|
350 | SLOT_DUMP(MAX_EXIT_LATENCY);
|
---|
351 | SLOT_DUMP(ROOT_HUB_PORT);
|
---|
352 | SLOT_DUMP(NUM_OF_PORTS);
|
---|
353 | SLOT_DUMP(TT_HUB_SLOT_ID);
|
---|
354 | SLOT_DUMP(TT_PORT_NUM);
|
---|
355 | SLOT_DUMP(TT_THINK_TIME);
|
---|
356 | SLOT_DUMP(INTERRUPTER);
|
---|
357 | SLOT_DUMP(DEVICE_ADDRESS);
|
---|
358 | SLOT_DUMP(SLOT_STATE);
|
---|
359 | #undef SLOT_DUMP
|
---|
360 | }
|
---|
361 |
|
---|
362 | static void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *ctx)
|
---|
363 | {
|
---|
364 | #define EP_DUMP_DW(name) usb_log_debug("\t" #name ":\t0x%x", XHCI_EP_##name(*ctx))
|
---|
365 | #define EP_DUMP_QW(name) usb_log_debug("\t" #name ":\t0x%llx", XHCI_EP_##name(*ctx))
|
---|
366 | EP_DUMP_DW(STATE);
|
---|
367 | EP_DUMP_DW(MULT);
|
---|
368 | EP_DUMP_DW(MAX_P_STREAMS);
|
---|
369 | EP_DUMP_DW(LSA);
|
---|
370 | EP_DUMP_DW(INTERVAL);
|
---|
371 | EP_DUMP_DW(ERROR_COUNT);
|
---|
372 | EP_DUMP_DW(TYPE);
|
---|
373 | EP_DUMP_DW(HID);
|
---|
374 | EP_DUMP_DW(MAX_BURST_SIZE);
|
---|
375 | EP_DUMP_DW(MAX_PACKET_SIZE);
|
---|
376 | EP_DUMP_QW(DCS);
|
---|
377 | EP_DUMP_QW(TR_DPTR);
|
---|
378 | EP_DUMP_DW(MAX_ESIT_PAYLOAD_LO);
|
---|
379 | EP_DUMP_DW(MAX_ESIT_PAYLOAD_HI);
|
---|
380 | #undef EP_DUMP_DW
|
---|
381 | #undef EP_DUMP_QW
|
---|
382 | }
|
---|
383 |
|
---|
384 | void xhci_dump_input_ctx(const struct xhci_input_ctx *ctx)
|
---|
385 | {
|
---|
386 | usb_log_debug("Input control context:");
|
---|
387 | usb_log_debug("\tDrop:\t0x%08x", xhci2host(32, ctx->ctrl_ctx.data[0]));
|
---|
388 | usb_log_debug("\tAdd:\t0x%08x", xhci2host(32, ctx->ctrl_ctx.data[1]));
|
---|
389 |
|
---|
390 | usb_log_debug("\tConfig:\t0x%02x", XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx->ctrl_ctx));
|
---|
391 | usb_log_debug("\tIface:\t0x%02x", XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx->ctrl_ctx));
|
---|
392 | usb_log_debug("\tAlternate:\t0x%02x", XHCI_INPUT_CTRL_CTX_ALTER_SETTING(ctx->ctrl_ctx));
|
---|
393 |
|
---|
394 | usb_log_debug("Slot context:");
|
---|
395 | xhci_dump_slot_ctx(&ctx->slot_ctx);
|
---|
396 |
|
---|
397 | for (uint8_t dci = 1; dci <= XHCI_EP_COUNT; dci++)
|
---|
398 | if (XHCI_INPUT_CTRL_CTX_DROP(ctx->ctrl_ctx, dci)
|
---|
399 | || XHCI_INPUT_CTRL_CTX_ADD(ctx->ctrl_ctx, dci)) {
|
---|
400 | usb_log_debug("Endpoint context DCI %u:", dci);
|
---|
401 | xhci_dump_endpoint_ctx(&ctx->endpoint_ctx[dci - 1]);
|
---|
402 | }
|
---|
403 | }
|
---|
404 |
|
---|
405 | /**
|
---|
406 | * @}
|
---|
407 | */
|
---|