1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | /* |
3 | * xHCI host controller driver |
4 | * |
5 | * Copyright (C) 2013 Xenia Ragiadakou |
6 | * |
7 | * Author: Xenia Ragiadakou |
8 | * Email : burzalodowa@gmail.com |
9 | */ |
10 | |
11 | #undef TRACE_SYSTEM |
12 | #define TRACE_SYSTEM xhci-hcd |
13 | |
14 | /* |
15 | * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a |
16 | * legitimate C variable. It is not exported to user space. |
17 | */ |
18 | #undef TRACE_SYSTEM_VAR |
19 | #define TRACE_SYSTEM_VAR xhci_hcd |
20 | |
21 | #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
22 | #define __XHCI_TRACE_H |
23 | |
24 | #include <linux/tracepoint.h> |
25 | #include "xhci.h" |
26 | #include "xhci-dbgcap.h" |
27 | |
28 | DECLARE_EVENT_CLASS(xhci_log_msg, |
29 | TP_PROTO(struct va_format *vaf), |
30 | TP_ARGS(vaf), |
31 | TP_STRUCT__entry(__vstring(msg, vaf->fmt, vaf->va)), |
32 | TP_fast_assign( |
33 | __assign_vstr(msg, vaf->fmt, vaf->va); |
34 | ), |
35 | TP_printk("%s" , __get_str(msg)) |
36 | ); |
37 | |
38 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_address, |
39 | TP_PROTO(struct va_format *vaf), |
40 | TP_ARGS(vaf) |
41 | ); |
42 | |
43 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change, |
44 | TP_PROTO(struct va_format *vaf), |
45 | TP_ARGS(vaf) |
46 | ); |
47 | |
48 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks, |
49 | TP_PROTO(struct va_format *vaf), |
50 | TP_ARGS(vaf) |
51 | ); |
52 | |
53 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep, |
54 | TP_PROTO(struct va_format *vaf), |
55 | TP_ARGS(vaf) |
56 | ); |
57 | |
58 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb, |
59 | TP_PROTO(struct va_format *vaf), |
60 | TP_ARGS(vaf) |
61 | ); |
62 | |
63 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_init, |
64 | TP_PROTO(struct va_format *vaf), |
65 | TP_ARGS(vaf) |
66 | ); |
67 | |
68 | DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion, |
69 | TP_PROTO(struct va_format *vaf), |
70 | TP_ARGS(vaf) |
71 | ); |
72 | |
73 | DECLARE_EVENT_CLASS(xhci_log_ctx, |
74 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, |
75 | unsigned int ep_num), |
76 | TP_ARGS(xhci, ctx, ep_num), |
77 | TP_STRUCT__entry( |
78 | __field(int, ctx_64) |
79 | __field(unsigned, ctx_type) |
80 | __field(dma_addr_t, ctx_dma) |
81 | __field(u8 *, ctx_va) |
82 | __field(unsigned, ctx_ep_num) |
83 | __dynamic_array(u32, ctx_data, |
84 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) * |
85 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)) |
86 | ), |
87 | TP_fast_assign( |
88 | |
89 | __entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
90 | __entry->ctx_type = ctx->type; |
91 | __entry->ctx_dma = ctx->dma; |
92 | __entry->ctx_va = ctx->bytes; |
93 | __entry->ctx_ep_num = ep_num; |
94 | memcpy(__get_dynamic_array(ctx_data), ctx->bytes, |
95 | ((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) * |
96 | ((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1)); |
97 | ), |
98 | TP_printk("ctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p" , |
99 | __entry->ctx_64, __entry->ctx_type, |
100 | (unsigned long long) __entry->ctx_dma, __entry->ctx_va |
101 | ) |
102 | ); |
103 | |
104 | DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx, |
105 | TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, |
106 | unsigned int ep_num), |
107 | TP_ARGS(xhci, ctx, ep_num) |
108 | ); |
109 | |
110 | DECLARE_EVENT_CLASS(xhci_log_trb, |
111 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
112 | TP_ARGS(ring, trb), |
113 | TP_STRUCT__entry( |
114 | __field(u32, type) |
115 | __field(u32, field0) |
116 | __field(u32, field1) |
117 | __field(u32, field2) |
118 | __field(u32, field3) |
119 | ), |
120 | TP_fast_assign( |
121 | __entry->type = ring->type; |
122 | __entry->field0 = le32_to_cpu(trb->field[0]); |
123 | __entry->field1 = le32_to_cpu(trb->field[1]); |
124 | __entry->field2 = le32_to_cpu(trb->field[2]); |
125 | __entry->field3 = le32_to_cpu(trb->field[3]); |
126 | ), |
127 | TP_printk("%s: %s" , xhci_ring_type_string(__entry->type), |
128 | xhci_decode_trb(__get_buf(XHCI_MSG_MAX), XHCI_MSG_MAX, __entry->field0, |
129 | __entry->field1, __entry->field2, __entry->field3) |
130 | ) |
131 | ); |
132 | |
133 | DEFINE_EVENT(xhci_log_trb, xhci_handle_event, |
134 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
135 | TP_ARGS(ring, trb) |
136 | ); |
137 | |
138 | DEFINE_EVENT(xhci_log_trb, xhci_handle_command, |
139 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
140 | TP_ARGS(ring, trb) |
141 | ); |
142 | |
143 | DEFINE_EVENT(xhci_log_trb, xhci_handle_transfer, |
144 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
145 | TP_ARGS(ring, trb) |
146 | ); |
147 | |
148 | DEFINE_EVENT(xhci_log_trb, xhci_queue_trb, |
149 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
150 | TP_ARGS(ring, trb) |
151 | ); |
152 | |
153 | DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_event, |
154 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
155 | TP_ARGS(ring, trb) |
156 | ); |
157 | |
158 | DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_transfer, |
159 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
160 | TP_ARGS(ring, trb) |
161 | ); |
162 | |
163 | DEFINE_EVENT(xhci_log_trb, xhci_dbc_gadget_ep_queue, |
164 | TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb), |
165 | TP_ARGS(ring, trb) |
166 | ); |
167 | |
168 | DECLARE_EVENT_CLASS(xhci_log_free_virt_dev, |
169 | TP_PROTO(struct xhci_virt_device *vdev), |
170 | TP_ARGS(vdev), |
171 | TP_STRUCT__entry( |
172 | __field(void *, vdev) |
173 | __field(unsigned long long, out_ctx) |
174 | __field(unsigned long long, in_ctx) |
175 | __field(int, slot_id) |
176 | __field(u16, current_mel) |
177 | |
178 | ), |
179 | TP_fast_assign( |
180 | __entry->vdev = vdev; |
181 | __entry->in_ctx = (unsigned long long) vdev->in_ctx->dma; |
182 | __entry->out_ctx = (unsigned long long) vdev->out_ctx->dma; |
183 | __entry->slot_id = (int) vdev->slot_id; |
184 | __entry->current_mel = (u16) vdev->current_mel; |
185 | ), |
186 | TP_printk("vdev %p slot %d ctx %llx | %llx current_mel %d" , |
187 | __entry->vdev, __entry->slot_id, __entry->in_ctx, |
188 | __entry->out_ctx, __entry->current_mel |
189 | ) |
190 | ); |
191 | |
192 | DEFINE_EVENT(xhci_log_free_virt_dev, xhci_free_virt_device, |
193 | TP_PROTO(struct xhci_virt_device *vdev), |
194 | TP_ARGS(vdev) |
195 | ); |
196 | |
197 | DECLARE_EVENT_CLASS(xhci_log_virt_dev, |
198 | TP_PROTO(struct xhci_virt_device *vdev), |
199 | TP_ARGS(vdev), |
200 | TP_STRUCT__entry( |
201 | __field(void *, vdev) |
202 | __field(unsigned long long, out_ctx) |
203 | __field(unsigned long long, in_ctx) |
204 | __field(int, devnum) |
205 | __field(int, state) |
206 | __field(int, speed) |
207 | __field(u8, portnum) |
208 | __field(u8, level) |
209 | __field(int, slot_id) |
210 | ), |
211 | TP_fast_assign( |
212 | __entry->vdev = vdev; |
213 | __entry->in_ctx = (unsigned long long) vdev->in_ctx->dma; |
214 | __entry->out_ctx = (unsigned long long) vdev->out_ctx->dma; |
215 | __entry->devnum = vdev->udev->devnum; |
216 | __entry->state = vdev->udev->state; |
217 | __entry->speed = vdev->udev->speed; |
218 | __entry->portnum = vdev->udev->portnum; |
219 | __entry->level = vdev->udev->level; |
220 | __entry->slot_id = vdev->udev->slot_id; |
221 | ), |
222 | TP_printk("vdev %p ctx %llx | %llx num %d state %d speed %d port %d level %d slot %d" , |
223 | __entry->vdev, __entry->in_ctx, __entry->out_ctx, |
224 | __entry->devnum, __entry->state, __entry->speed, |
225 | __entry->portnum, __entry->level, __entry->slot_id |
226 | ) |
227 | ); |
228 | |
229 | DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device, |
230 | TP_PROTO(struct xhci_virt_device *vdev), |
231 | TP_ARGS(vdev) |
232 | ); |
233 | |
234 | DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_device, |
235 | TP_PROTO(struct xhci_virt_device *vdev), |
236 | TP_ARGS(vdev) |
237 | ); |
238 | |
239 | DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_addressable_virt_device, |
240 | TP_PROTO(struct xhci_virt_device *vdev), |
241 | TP_ARGS(vdev) |
242 | ); |
243 | |
244 | DEFINE_EVENT(xhci_log_virt_dev, xhci_stop_device, |
245 | TP_PROTO(struct xhci_virt_device *vdev), |
246 | TP_ARGS(vdev) |
247 | ); |
248 | |
249 | DECLARE_EVENT_CLASS(xhci_log_urb, |
250 | TP_PROTO(struct urb *urb), |
251 | TP_ARGS(urb), |
252 | TP_STRUCT__entry( |
253 | __field(void *, urb) |
254 | __field(unsigned int, pipe) |
255 | __field(unsigned int, stream) |
256 | __field(int, status) |
257 | __field(unsigned int, flags) |
258 | __field(int, num_mapped_sgs) |
259 | __field(int, num_sgs) |
260 | __field(int, length) |
261 | __field(int, actual) |
262 | __field(int, epnum) |
263 | __field(int, dir_in) |
264 | __field(int, type) |
265 | __field(int, slot_id) |
266 | ), |
267 | TP_fast_assign( |
268 | __entry->urb = urb; |
269 | __entry->pipe = urb->pipe; |
270 | __entry->stream = urb->stream_id; |
271 | __entry->status = urb->status; |
272 | __entry->flags = urb->transfer_flags; |
273 | __entry->num_mapped_sgs = urb->num_mapped_sgs; |
274 | __entry->num_sgs = urb->num_sgs; |
275 | __entry->length = urb->transfer_buffer_length; |
276 | __entry->actual = urb->actual_length; |
277 | __entry->epnum = usb_endpoint_num(&urb->ep->desc); |
278 | __entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc); |
279 | __entry->type = usb_endpoint_type(&urb->ep->desc); |
280 | __entry->slot_id = urb->dev->slot_id; |
281 | ), |
282 | TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x" , |
283 | __entry->epnum, __entry->dir_in ? "in" : "out" , |
284 | __print_symbolic(__entry->type, |
285 | { USB_ENDPOINT_XFER_INT, "intr" }, |
286 | { USB_ENDPOINT_XFER_CONTROL, "control" }, |
287 | { USB_ENDPOINT_XFER_BULK, "bulk" }, |
288 | { USB_ENDPOINT_XFER_ISOC, "isoc" }), |
289 | __entry->urb, __entry->pipe, __entry->slot_id, |
290 | __entry->actual, __entry->length, __entry->num_mapped_sgs, |
291 | __entry->num_sgs, __entry->stream, __entry->flags |
292 | ) |
293 | ); |
294 | |
295 | DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue, |
296 | TP_PROTO(struct urb *urb), |
297 | TP_ARGS(urb) |
298 | ); |
299 | |
300 | DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback, |
301 | TP_PROTO(struct urb *urb), |
302 | TP_ARGS(urb) |
303 | ); |
304 | |
305 | DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue, |
306 | TP_PROTO(struct urb *urb), |
307 | TP_ARGS(urb) |
308 | ); |
309 | |
310 | DECLARE_EVENT_CLASS(xhci_log_ep_ctx, |
311 | TP_PROTO(struct xhci_ep_ctx *ctx), |
312 | TP_ARGS(ctx), |
313 | TP_STRUCT__entry( |
314 | __field(u32, info) |
315 | __field(u32, info2) |
316 | __field(u64, deq) |
317 | __field(u32, tx_info) |
318 | ), |
319 | TP_fast_assign( |
320 | __entry->info = le32_to_cpu(ctx->ep_info); |
321 | __entry->info2 = le32_to_cpu(ctx->ep_info2); |
322 | __entry->deq = le64_to_cpu(ctx->deq); |
323 | __entry->tx_info = le32_to_cpu(ctx->tx_info); |
324 | ), |
325 | TP_printk("%s" , xhci_decode_ep_context(__get_buf(XHCI_MSG_MAX), |
326 | __entry->info, __entry->info2, __entry->deq, __entry->tx_info) |
327 | ) |
328 | ); |
329 | |
330 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_stop_ep, |
331 | TP_PROTO(struct xhci_ep_ctx *ctx), |
332 | TP_ARGS(ctx) |
333 | ); |
334 | |
335 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_set_deq_ep, |
336 | TP_PROTO(struct xhci_ep_ctx *ctx), |
337 | TP_ARGS(ctx) |
338 | ); |
339 | |
340 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_reset_ep, |
341 | TP_PROTO(struct xhci_ep_ctx *ctx), |
342 | TP_ARGS(ctx) |
343 | ); |
344 | |
345 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_config_ep, |
346 | TP_PROTO(struct xhci_ep_ctx *ctx), |
347 | TP_ARGS(ctx) |
348 | ); |
349 | |
350 | DEFINE_EVENT(xhci_log_ep_ctx, xhci_add_endpoint, |
351 | TP_PROTO(struct xhci_ep_ctx *ctx), |
352 | TP_ARGS(ctx) |
353 | ); |
354 | |
355 | DECLARE_EVENT_CLASS(xhci_log_slot_ctx, |
356 | TP_PROTO(struct xhci_slot_ctx *ctx), |
357 | TP_ARGS(ctx), |
358 | TP_STRUCT__entry( |
359 | __field(u32, info) |
360 | __field(u32, info2) |
361 | __field(u32, tt_info) |
362 | __field(u32, state) |
363 | ), |
364 | TP_fast_assign( |
365 | __entry->info = le32_to_cpu(ctx->dev_info); |
366 | __entry->info2 = le32_to_cpu(ctx->dev_info2); |
367 | __entry->tt_info = le64_to_cpu(ctx->tt_info); |
368 | __entry->state = le32_to_cpu(ctx->dev_state); |
369 | ), |
370 | TP_printk("%s" , xhci_decode_slot_context(__get_buf(XHCI_MSG_MAX), |
371 | __entry->info, __entry->info2, |
372 | __entry->tt_info, __entry->state) |
373 | ) |
374 | ); |
375 | |
376 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_alloc_dev, |
377 | TP_PROTO(struct xhci_slot_ctx *ctx), |
378 | TP_ARGS(ctx) |
379 | ); |
380 | |
381 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_free_dev, |
382 | TP_PROTO(struct xhci_slot_ctx *ctx), |
383 | TP_ARGS(ctx) |
384 | ); |
385 | |
386 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_disable_slot, |
387 | TP_PROTO(struct xhci_slot_ctx *ctx), |
388 | TP_ARGS(ctx) |
389 | ); |
390 | |
391 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_discover_or_reset_device, |
392 | TP_PROTO(struct xhci_slot_ctx *ctx), |
393 | TP_ARGS(ctx) |
394 | ); |
395 | |
396 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_setup_device_slot, |
397 | TP_PROTO(struct xhci_slot_ctx *ctx), |
398 | TP_ARGS(ctx) |
399 | ); |
400 | |
401 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_addr_dev, |
402 | TP_PROTO(struct xhci_slot_ctx *ctx), |
403 | TP_ARGS(ctx) |
404 | ); |
405 | |
406 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_reset_dev, |
407 | TP_PROTO(struct xhci_slot_ctx *ctx), |
408 | TP_ARGS(ctx) |
409 | ); |
410 | |
411 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_set_deq, |
412 | TP_PROTO(struct xhci_slot_ctx *ctx), |
413 | TP_ARGS(ctx) |
414 | ); |
415 | |
416 | DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint, |
417 | TP_PROTO(struct xhci_slot_ctx *ctx), |
418 | TP_ARGS(ctx) |
419 | ); |
420 | |
421 | DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx, |
422 | TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx), |
423 | TP_ARGS(ctrl_ctx), |
424 | TP_STRUCT__entry( |
425 | __field(u32, drop) |
426 | __field(u32, add) |
427 | ), |
428 | TP_fast_assign( |
429 | __entry->drop = le32_to_cpu(ctrl_ctx->drop_flags); |
430 | __entry->add = le32_to_cpu(ctrl_ctx->add_flags); |
431 | ), |
432 | TP_printk("%s" , xhci_decode_ctrl_ctx(__get_buf(XHCI_MSG_MAX), __entry->drop, __entry->add) |
433 | ) |
434 | ); |
435 | |
436 | DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_address_ctrl_ctx, |
437 | TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx), |
438 | TP_ARGS(ctrl_ctx) |
439 | ); |
440 | |
441 | DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_configure_endpoint_ctrl_ctx, |
442 | TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx), |
443 | TP_ARGS(ctrl_ctx) |
444 | ); |
445 | |
446 | DECLARE_EVENT_CLASS(xhci_log_ring, |
447 | TP_PROTO(struct xhci_ring *ring), |
448 | TP_ARGS(ring), |
449 | TP_STRUCT__entry( |
450 | __field(u32, type) |
451 | __field(void *, ring) |
452 | __field(dma_addr_t, enq) |
453 | __field(dma_addr_t, deq) |
454 | __field(dma_addr_t, enq_seg) |
455 | __field(dma_addr_t, deq_seg) |
456 | __field(unsigned int, num_segs) |
457 | __field(unsigned int, stream_id) |
458 | __field(unsigned int, cycle_state) |
459 | __field(unsigned int, bounce_buf_len) |
460 | ), |
461 | TP_fast_assign( |
462 | __entry->ring = ring; |
463 | __entry->type = ring->type; |
464 | __entry->num_segs = ring->num_segs; |
465 | __entry->stream_id = ring->stream_id; |
466 | __entry->enq_seg = ring->enq_seg->dma; |
467 | __entry->deq_seg = ring->deq_seg->dma; |
468 | __entry->cycle_state = ring->cycle_state; |
469 | __entry->bounce_buf_len = ring->bounce_buf_len; |
470 | __entry->enq = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue); |
471 | __entry->deq = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); |
472 | ), |
473 | TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d bounce %d cycle %d" , |
474 | xhci_ring_type_string(__entry->type), __entry->ring, |
475 | &__entry->enq, &__entry->enq_seg, |
476 | &__entry->deq, &__entry->deq_seg, |
477 | __entry->num_segs, |
478 | __entry->stream_id, |
479 | __entry->bounce_buf_len, |
480 | __entry->cycle_state |
481 | ) |
482 | ); |
483 | |
484 | DEFINE_EVENT(xhci_log_ring, xhci_ring_alloc, |
485 | TP_PROTO(struct xhci_ring *ring), |
486 | TP_ARGS(ring) |
487 | ); |
488 | |
489 | DEFINE_EVENT(xhci_log_ring, xhci_ring_free, |
490 | TP_PROTO(struct xhci_ring *ring), |
491 | TP_ARGS(ring) |
492 | ); |
493 | |
494 | DEFINE_EVENT(xhci_log_ring, xhci_ring_expansion, |
495 | TP_PROTO(struct xhci_ring *ring), |
496 | TP_ARGS(ring) |
497 | ); |
498 | |
499 | DEFINE_EVENT(xhci_log_ring, xhci_inc_enq, |
500 | TP_PROTO(struct xhci_ring *ring), |
501 | TP_ARGS(ring) |
502 | ); |
503 | |
504 | DEFINE_EVENT(xhci_log_ring, xhci_inc_deq, |
505 | TP_PROTO(struct xhci_ring *ring), |
506 | TP_ARGS(ring) |
507 | ); |
508 | |
509 | DECLARE_EVENT_CLASS(xhci_log_portsc, |
510 | TP_PROTO(struct xhci_port *port, u32 portsc), |
511 | TP_ARGS(port, portsc), |
512 | TP_STRUCT__entry( |
513 | __field(u32, busnum) |
514 | __field(u32, portnum) |
515 | __field(u32, portsc) |
516 | ), |
517 | TP_fast_assign( |
518 | __entry->busnum = port->rhub->hcd->self.busnum; |
519 | __entry->portnum = port->hcd_portnum; |
520 | __entry->portsc = portsc; |
521 | ), |
522 | TP_printk("port %d-%d: %s" , |
523 | __entry->busnum, |
524 | __entry->portnum, |
525 | xhci_decode_portsc(__get_buf(XHCI_MSG_MAX), __entry->portsc) |
526 | ) |
527 | ); |
528 | |
529 | DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status, |
530 | TP_PROTO(struct xhci_port *port, u32 portsc), |
531 | TP_ARGS(port, portsc) |
532 | ); |
533 | |
534 | DEFINE_EVENT(xhci_log_portsc, xhci_get_port_status, |
535 | TP_PROTO(struct xhci_port *port, u32 portsc), |
536 | TP_ARGS(port, portsc) |
537 | ); |
538 | |
539 | DEFINE_EVENT(xhci_log_portsc, xhci_hub_status_data, |
540 | TP_PROTO(struct xhci_port *port, u32 portsc), |
541 | TP_ARGS(port, portsc) |
542 | ); |
543 | |
544 | DECLARE_EVENT_CLASS(xhci_log_doorbell, |
545 | TP_PROTO(u32 slot, u32 doorbell), |
546 | TP_ARGS(slot, doorbell), |
547 | TP_STRUCT__entry( |
548 | __field(u32, slot) |
549 | __field(u32, doorbell) |
550 | ), |
551 | TP_fast_assign( |
552 | __entry->slot = slot; |
553 | __entry->doorbell = doorbell; |
554 | ), |
555 | TP_printk("Ring doorbell for %s" , |
556 | xhci_decode_doorbell(__get_buf(XHCI_MSG_MAX), __entry->slot, __entry->doorbell) |
557 | ) |
558 | ); |
559 | |
560 | DEFINE_EVENT(xhci_log_doorbell, xhci_ring_ep_doorbell, |
561 | TP_PROTO(u32 slot, u32 doorbell), |
562 | TP_ARGS(slot, doorbell) |
563 | ); |
564 | |
565 | DEFINE_EVENT(xhci_log_doorbell, xhci_ring_host_doorbell, |
566 | TP_PROTO(u32 slot, u32 doorbell), |
567 | TP_ARGS(slot, doorbell) |
568 | ); |
569 | |
570 | DECLARE_EVENT_CLASS(xhci_dbc_log_request, |
571 | TP_PROTO(struct dbc_request *req), |
572 | TP_ARGS(req), |
573 | TP_STRUCT__entry( |
574 | __field(struct dbc_request *, req) |
575 | __field(bool, dir) |
576 | __field(unsigned int, actual) |
577 | __field(unsigned int, length) |
578 | __field(int, status) |
579 | ), |
580 | TP_fast_assign( |
581 | __entry->req = req; |
582 | __entry->dir = req->direction; |
583 | __entry->actual = req->actual; |
584 | __entry->length = req->length; |
585 | __entry->status = req->status; |
586 | ), |
587 | TP_printk("%s: req %p length %u/%u ==> %d" , |
588 | __entry->dir ? "bulk-in" : "bulk-out" , |
589 | __entry->req, __entry->actual, |
590 | __entry->length, __entry->status |
591 | ) |
592 | ); |
593 | |
594 | DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_alloc_request, |
595 | TP_PROTO(struct dbc_request *req), |
596 | TP_ARGS(req) |
597 | ); |
598 | |
599 | DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_free_request, |
600 | TP_PROTO(struct dbc_request *req), |
601 | TP_ARGS(req) |
602 | ); |
603 | |
604 | DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_queue_request, |
605 | TP_PROTO(struct dbc_request *req), |
606 | TP_ARGS(req) |
607 | ); |
608 | |
609 | DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_giveback_request, |
610 | TP_PROTO(struct dbc_request *req), |
611 | TP_ARGS(req) |
612 | ); |
613 | #endif /* __XHCI_TRACE_H */ |
614 | |
615 | /* this part must be outside header guard */ |
616 | |
617 | #undef TRACE_INCLUDE_PATH |
618 | #define TRACE_INCLUDE_PATH . |
619 | |
620 | #undef TRACE_INCLUDE_FILE |
621 | #define TRACE_INCLUDE_FILE xhci-trace |
622 | |
623 | #include <trace/define_trace.h> |
624 | |