xref: /linux/drivers/usb/host/xhci-trace.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
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, dma_addr_t dma),
112 	TP_ARGS(ring, trb, dma),
113 	TP_STRUCT__entry(
114 		__field(dma_addr_t, dma)
115 		__field(u32, type)
116 		__field(u32, field0)
117 		__field(u32, field1)
118 		__field(u32, field2)
119 		__field(u32, field3)
120 	),
121 	TP_fast_assign(
122 		__entry->dma = dma;
123 		__entry->type = ring->type;
124 		__entry->field0 = le32_to_cpu(trb->field[0]);
125 		__entry->field1 = le32_to_cpu(trb->field[1]);
126 		__entry->field2 = le32_to_cpu(trb->field[2]);
127 		__entry->field3 = le32_to_cpu(trb->field[3]);
128 	),
129 	TP_printk("%s: @%pad %s",
130 		  xhci_ring_type_string(__entry->type), &__entry->dma,
131 		  xhci_decode_trb(__get_buf(XHCI_MSG_MAX), XHCI_MSG_MAX, __entry->field0,
132 				  __entry->field1, __entry->field2, __entry->field3)
133 	)
134 );
135 
136 DEFINE_EVENT(xhci_log_trb, xhci_handle_event,
137 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
138 	TP_ARGS(ring, trb, dma)
139 );
140 
141 DEFINE_EVENT(xhci_log_trb, xhci_handle_command,
142 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
143 	TP_ARGS(ring, trb, dma)
144 );
145 
146 DEFINE_EVENT(xhci_log_trb, xhci_handle_transfer,
147 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
148 	TP_ARGS(ring, trb, dma)
149 );
150 
151 DEFINE_EVENT(xhci_log_trb, xhci_queue_trb,
152 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
153 	TP_ARGS(ring, trb, dma)
154 
155 );
156 
157 DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_event,
158 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
159 	TP_ARGS(ring, trb, dma)
160 );
161 
162 DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_transfer,
163 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
164 	TP_ARGS(ring, trb, dma)
165 );
166 
167 DEFINE_EVENT(xhci_log_trb, xhci_dbc_gadget_ep_queue,
168 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb, dma_addr_t dma),
169 	TP_ARGS(ring, trb, dma)
170 );
171 
172 DECLARE_EVENT_CLASS(xhci_log_free_virt_dev,
173 	TP_PROTO(struct xhci_virt_device *vdev),
174 	TP_ARGS(vdev),
175 	TP_STRUCT__entry(
176 		__field(void *, vdev)
177 		__field(unsigned long long, out_ctx)
178 		__field(unsigned long long, in_ctx)
179 		__field(int, slot_id)
180 		__field(u16, current_mel)
181 
182 	),
183 	TP_fast_assign(
184 		__entry->vdev = vdev;
185 		__entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
186 		__entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
187 		__entry->slot_id = (int) vdev->slot_id;
188 		__entry->current_mel = (u16) vdev->current_mel;
189 		),
190 	TP_printk("vdev %p slot %d ctx %llx | %llx current_mel %d",
191 		__entry->vdev, __entry->slot_id, __entry->in_ctx,
192 		__entry->out_ctx, __entry->current_mel
193 	)
194 );
195 
196 DEFINE_EVENT(xhci_log_free_virt_dev, xhci_free_virt_device,
197 	TP_PROTO(struct xhci_virt_device *vdev),
198 	TP_ARGS(vdev)
199 );
200 
201 DECLARE_EVENT_CLASS(xhci_log_virt_dev,
202 	TP_PROTO(struct xhci_virt_device *vdev),
203 	TP_ARGS(vdev),
204 	TP_STRUCT__entry(
205 		__field(void *, vdev)
206 		__field(unsigned long long, out_ctx)
207 		__field(unsigned long long, in_ctx)
208 		__field(int, devnum)
209 		__field(int, state)
210 		__field(int, speed)
211 		__field(u8, portnum)
212 		__field(u8, level)
213 		__field(int, slot_id)
214 	),
215 	TP_fast_assign(
216 		__entry->vdev = vdev;
217 		__entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
218 		__entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
219 		__entry->devnum = vdev->udev->devnum;
220 		__entry->state = vdev->udev->state;
221 		__entry->speed = vdev->udev->speed;
222 		__entry->portnum = vdev->udev->portnum;
223 		__entry->level = vdev->udev->level;
224 		__entry->slot_id = vdev->udev->slot_id;
225 	),
226 	TP_printk("vdev %p ctx %llx | %llx num %d state %d speed %d port %d level %d slot %d",
227 		__entry->vdev, __entry->in_ctx, __entry->out_ctx,
228 		__entry->devnum, __entry->state, __entry->speed,
229 		__entry->portnum, __entry->level, __entry->slot_id
230 	)
231 );
232 
233 DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device,
234 	TP_PROTO(struct xhci_virt_device *vdev),
235 	TP_ARGS(vdev)
236 );
237 
238 DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_device,
239 	TP_PROTO(struct xhci_virt_device *vdev),
240 	TP_ARGS(vdev)
241 );
242 
243 DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_addressable_virt_device,
244 	TP_PROTO(struct xhci_virt_device *vdev),
245 	TP_ARGS(vdev)
246 );
247 
248 DEFINE_EVENT(xhci_log_virt_dev, xhci_stop_device,
249 	TP_PROTO(struct xhci_virt_device *vdev),
250 	TP_ARGS(vdev)
251 );
252 
253 DECLARE_EVENT_CLASS(xhci_log_urb,
254 	TP_PROTO(struct urb *urb),
255 	TP_ARGS(urb),
256 	TP_STRUCT__entry(
257 		__string(devname, dev_name(&urb->dev->dev))
258 		__field(void *, urb)
259 		__field(unsigned int, pipe)
260 		__field(unsigned int, stream)
261 		__field(int, status)
262 		__field(unsigned int, flags)
263 		__field(int, num_mapped_sgs)
264 		__field(int, num_sgs)
265 		__field(int, length)
266 		__field(int, actual)
267 		__field(int, epnum)
268 		__field(int, dir_in)
269 		__field(int, type)
270 		__field(int, slot_id)
271 	),
272 	TP_fast_assign(
273 		__assign_str(devname);
274 		__entry->urb = urb;
275 		__entry->pipe = urb->pipe;
276 		__entry->stream = urb->stream_id;
277 		__entry->status = urb->status;
278 		__entry->flags = urb->transfer_flags;
279 		__entry->num_mapped_sgs = urb->num_mapped_sgs;
280 		__entry->num_sgs = urb->num_sgs;
281 		__entry->length = urb->transfer_buffer_length;
282 		__entry->actual = urb->actual_length;
283 		__entry->epnum = usb_endpoint_num(&urb->ep->desc);
284 		__entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc);
285 		__entry->type = usb_endpoint_type(&urb->ep->desc);
286 		__entry->slot_id = urb->dev->slot_id;
287 	),
288 	TP_printk("%s ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
289 			__get_str(devname),
290 			__entry->epnum, __entry->dir_in ? "in" : "out",
291 			__print_symbolic(__entry->type,
292 				   { USB_ENDPOINT_XFER_INT,	"intr" },
293 				   { USB_ENDPOINT_XFER_CONTROL,	"control" },
294 				   { USB_ENDPOINT_XFER_BULK,	"bulk" },
295 				   { USB_ENDPOINT_XFER_ISOC,	"isoc" }),
296 			__entry->urb, __entry->pipe, __entry->slot_id,
297 			__entry->actual, __entry->length, __entry->num_mapped_sgs,
298 			__entry->num_sgs, __entry->stream, __entry->flags
299 		)
300 );
301 
302 DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue,
303 	TP_PROTO(struct urb *urb),
304 	TP_ARGS(urb)
305 );
306 
307 DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback,
308 	TP_PROTO(struct urb *urb),
309 	TP_ARGS(urb)
310 );
311 
312 DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue,
313 	TP_PROTO(struct urb *urb),
314 	TP_ARGS(urb)
315 );
316 
317 DECLARE_EVENT_CLASS(xhci_log_stream_ctx,
318 	TP_PROTO(struct xhci_stream_info *info, unsigned int stream_id),
319 	TP_ARGS(info, stream_id),
320 	TP_STRUCT__entry(
321 		__field(unsigned int, stream_id)
322 		__field(u64, stream_ring)
323 		__field(dma_addr_t, ctx_array_dma)
324 
325 	),
326 	TP_fast_assign(
327 		__entry->stream_id = stream_id;
328 		__entry->stream_ring = le64_to_cpu(info->stream_ctx_array[stream_id].stream_ring);
329 		__entry->ctx_array_dma = info->ctx_array_dma + stream_id * 16;
330 
331 	),
332 	TP_printk("stream %u ctx @%pad: SCT %llu deq %llx", __entry->stream_id,
333 		&__entry->ctx_array_dma, CTX_TO_SCT(__entry->stream_ring),
334 		__entry->stream_ring
335 	)
336 );
337 
338 DEFINE_EVENT(xhci_log_stream_ctx, xhci_alloc_stream_info_ctx,
339 	TP_PROTO(struct xhci_stream_info *info, unsigned int stream_id),
340 	TP_ARGS(info, stream_id)
341 );
342 
343 DEFINE_EVENT(xhci_log_stream_ctx, xhci_handle_cmd_set_deq_stream,
344 	TP_PROTO(struct xhci_stream_info *info, unsigned int stream_id),
345 	TP_ARGS(info, stream_id)
346 );
347 
348 DECLARE_EVENT_CLASS(xhci_log_ep_ctx,
349 	TP_PROTO(struct xhci_ep_ctx *ctx),
350 	TP_ARGS(ctx),
351 	TP_STRUCT__entry(
352 		__field(u32, info)
353 		__field(u32, info2)
354 		__field(u64, deq)
355 		__field(u32, tx_info)
356 	),
357 	TP_fast_assign(
358 		__entry->info = le32_to_cpu(ctx->ep_info);
359 		__entry->info2 = le32_to_cpu(ctx->ep_info2);
360 		__entry->deq = le64_to_cpu(ctx->deq);
361 		__entry->tx_info = le32_to_cpu(ctx->tx_info);
362 	),
363 	TP_printk("%s", xhci_decode_ep_context(__get_buf(XHCI_MSG_MAX),
364 		__entry->info, __entry->info2, __entry->deq, __entry->tx_info)
365 	)
366 );
367 
368 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_stop_ep,
369 	TP_PROTO(struct xhci_ep_ctx *ctx),
370 	TP_ARGS(ctx)
371 );
372 
373 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_set_deq_ep,
374 	TP_PROTO(struct xhci_ep_ctx *ctx),
375 	TP_ARGS(ctx)
376 );
377 
378 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_reset_ep,
379 	TP_PROTO(struct xhci_ep_ctx *ctx),
380 	TP_ARGS(ctx)
381 );
382 
383 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_config_ep,
384 	TP_PROTO(struct xhci_ep_ctx *ctx),
385 	TP_ARGS(ctx)
386 );
387 
388 DEFINE_EVENT(xhci_log_ep_ctx, xhci_add_endpoint,
389 	TP_PROTO(struct xhci_ep_ctx *ctx),
390 	TP_ARGS(ctx)
391 );
392 
393 DECLARE_EVENT_CLASS(xhci_log_slot_ctx,
394 	TP_PROTO(struct xhci_slot_ctx *ctx),
395 	TP_ARGS(ctx),
396 	TP_STRUCT__entry(
397 		__field(u32, info)
398 		__field(u32, info2)
399 		__field(u32, tt_info)
400 		__field(u32, state)
401 	),
402 	TP_fast_assign(
403 		__entry->info = le32_to_cpu(ctx->dev_info);
404 		__entry->info2 = le32_to_cpu(ctx->dev_info2);
405 		__entry->tt_info = le64_to_cpu(ctx->tt_info);
406 		__entry->state = le32_to_cpu(ctx->dev_state);
407 	),
408 	TP_printk("%s", xhci_decode_slot_context(__get_buf(XHCI_MSG_MAX),
409 			__entry->info, __entry->info2,
410 			__entry->tt_info, __entry->state)
411 	)
412 );
413 
414 DEFINE_EVENT(xhci_log_slot_ctx, xhci_alloc_dev,
415 	TP_PROTO(struct xhci_slot_ctx *ctx),
416 	TP_ARGS(ctx)
417 );
418 
419 DEFINE_EVENT(xhci_log_slot_ctx, xhci_free_dev,
420 	TP_PROTO(struct xhci_slot_ctx *ctx),
421 	TP_ARGS(ctx)
422 );
423 
424 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_disable_slot,
425 	TP_PROTO(struct xhci_slot_ctx *ctx),
426 	TP_ARGS(ctx)
427 );
428 
429 DEFINE_EVENT(xhci_log_slot_ctx, xhci_discover_or_reset_device,
430 	TP_PROTO(struct xhci_slot_ctx *ctx),
431 	TP_ARGS(ctx)
432 );
433 
434 DEFINE_EVENT(xhci_log_slot_ctx, xhci_setup_device_slot,
435 	TP_PROTO(struct xhci_slot_ctx *ctx),
436 	TP_ARGS(ctx)
437 );
438 
439 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_addr_dev,
440 	TP_PROTO(struct xhci_slot_ctx *ctx),
441 	TP_ARGS(ctx)
442 );
443 
444 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_reset_dev,
445 	TP_PROTO(struct xhci_slot_ctx *ctx),
446 	TP_ARGS(ctx)
447 );
448 
449 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_set_deq,
450 	TP_PROTO(struct xhci_slot_ctx *ctx),
451 	TP_ARGS(ctx)
452 );
453 
454 DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint,
455 	TP_PROTO(struct xhci_slot_ctx *ctx),
456 	TP_ARGS(ctx)
457 );
458 
459 DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx,
460 	TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
461 	TP_ARGS(ctrl_ctx),
462 	TP_STRUCT__entry(
463 		__field(u32, drop)
464 		__field(u32, add)
465 	),
466 	TP_fast_assign(
467 		__entry->drop = le32_to_cpu(ctrl_ctx->drop_flags);
468 		__entry->add = le32_to_cpu(ctrl_ctx->add_flags);
469 	),
470 	TP_printk("%s", xhci_decode_ctrl_ctx(__get_buf(XHCI_MSG_MAX), __entry->drop, __entry->add)
471 	)
472 );
473 
474 DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_address_ctrl_ctx,
475 	TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
476 	TP_ARGS(ctrl_ctx)
477 );
478 
479 DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_configure_endpoint_ctrl_ctx,
480 	TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
481 	TP_ARGS(ctrl_ctx)
482 );
483 
484 DECLARE_EVENT_CLASS(xhci_log_ring,
485 	TP_PROTO(struct xhci_ring *ring),
486 	TP_ARGS(ring),
487 	TP_STRUCT__entry(
488 		__field(u32, type)
489 		__field(void *, ring)
490 		__field(dma_addr_t, enq)
491 		__field(dma_addr_t, deq)
492 		__field(unsigned int, num_segs)
493 		__field(unsigned int, stream_id)
494 		__field(unsigned int, cycle_state)
495 		__field(unsigned int, bounce_buf_len)
496 	),
497 	TP_fast_assign(
498 		__entry->ring = ring;
499 		__entry->type = ring->type;
500 		__entry->num_segs = ring->num_segs;
501 		__entry->stream_id = ring->stream_id;
502 		__entry->cycle_state = ring->cycle_state;
503 		__entry->bounce_buf_len = ring->bounce_buf_len;
504 		__entry->enq = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
505 		__entry->deq = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
506 	),
507 	TP_printk("%s %p: enq %pad deq %pad segs %d stream %d bounce %d cycle %d",
508 			xhci_ring_type_string(__entry->type), __entry->ring,
509 			&__entry->enq,
510 			&__entry->deq,
511 			__entry->num_segs,
512 			__entry->stream_id,
513 			__entry->bounce_buf_len,
514 			__entry->cycle_state
515 		)
516 );
517 
518 DEFINE_EVENT(xhci_log_ring, xhci_ring_alloc,
519 	TP_PROTO(struct xhci_ring *ring),
520 	TP_ARGS(ring)
521 );
522 
523 DEFINE_EVENT(xhci_log_ring, xhci_ring_free,
524 	TP_PROTO(struct xhci_ring *ring),
525 	TP_ARGS(ring)
526 );
527 
528 DEFINE_EVENT(xhci_log_ring, xhci_ring_expansion,
529 	TP_PROTO(struct xhci_ring *ring),
530 	TP_ARGS(ring)
531 );
532 
533 DEFINE_EVENT(xhci_log_ring, xhci_inc_enq,
534 	TP_PROTO(struct xhci_ring *ring),
535 	TP_ARGS(ring)
536 );
537 
538 DEFINE_EVENT(xhci_log_ring, xhci_inc_deq,
539 	TP_PROTO(struct xhci_ring *ring),
540 	TP_ARGS(ring)
541 );
542 
543 DECLARE_EVENT_CLASS(xhci_log_portsc,
544 		    TP_PROTO(struct xhci_port *port, u32 portsc),
545 		    TP_ARGS(port, portsc),
546 		    TP_STRUCT__entry(
547 				     __field(u32, busnum)
548 				     __field(u32, portnum)
549 				     __field(u32, portsc)
550 				     ),
551 		    TP_fast_assign(
552 				   __entry->busnum = port->rhub->hcd->self.busnum;
553 				   __entry->portnum = port->hcd_portnum;
554 				   __entry->portsc = portsc;
555 				   ),
556 		    TP_printk("port %d-%d: %s",
557 			      __entry->busnum,
558 			      __entry->portnum,
559 			      xhci_decode_portsc(__get_buf(XHCI_MSG_MAX), __entry->portsc)
560 			      )
561 );
562 
563 DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status,
564 	     TP_PROTO(struct xhci_port *port, u32 portsc),
565 	     TP_ARGS(port, portsc)
566 );
567 
568 DEFINE_EVENT(xhci_log_portsc, xhci_get_port_status,
569 	     TP_PROTO(struct xhci_port *port, u32 portsc),
570 	     TP_ARGS(port, portsc)
571 );
572 
573 DEFINE_EVENT(xhci_log_portsc, xhci_hub_status_data,
574 	     TP_PROTO(struct xhci_port *port, u32 portsc),
575 	     TP_ARGS(port, portsc)
576 );
577 
578 DECLARE_EVENT_CLASS(xhci_log_doorbell,
579 	TP_PROTO(u32 slot, u32 doorbell),
580 	TP_ARGS(slot, doorbell),
581 	TP_STRUCT__entry(
582 		__field(u32, slot)
583 		__field(u32, doorbell)
584 	),
585 	TP_fast_assign(
586 		__entry->slot = slot;
587 		__entry->doorbell = doorbell;
588 	),
589 	TP_printk("Ring doorbell for %s",
590 		  xhci_decode_doorbell(__get_buf(XHCI_MSG_MAX), __entry->slot, __entry->doorbell)
591 	)
592 );
593 
594 DEFINE_EVENT(xhci_log_doorbell, xhci_ring_ep_doorbell,
595 	     TP_PROTO(u32 slot, u32 doorbell),
596 	     TP_ARGS(slot, doorbell)
597 );
598 
599 DEFINE_EVENT(xhci_log_doorbell, xhci_ring_host_doorbell,
600 	     TP_PROTO(u32 slot, u32 doorbell),
601 	     TP_ARGS(slot, doorbell)
602 );
603 
604 DECLARE_EVENT_CLASS(xhci_dbc_log_request,
605 	TP_PROTO(struct dbc_request *req),
606 	TP_ARGS(req),
607 	TP_STRUCT__entry(
608 		__field(struct dbc_request *, req)
609 		__field(bool, dir)
610 		__field(unsigned int, actual)
611 		__field(unsigned int, length)
612 		__field(int, status)
613 	),
614 	TP_fast_assign(
615 		__entry->req = req;
616 		__entry->dir = req->direction;
617 		__entry->actual = req->actual;
618 		__entry->length = req->length;
619 		__entry->status = req->status;
620 	),
621 	TP_printk("%s: req %p length %u/%u ==> %d",
622 		__entry->dir ? "bulk-in" : "bulk-out",
623 		__entry->req, __entry->actual,
624 		__entry->length, __entry->status
625 	)
626 );
627 
628 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_alloc_request,
629 	TP_PROTO(struct dbc_request *req),
630 	TP_ARGS(req)
631 );
632 
633 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_free_request,
634 	TP_PROTO(struct dbc_request *req),
635 	TP_ARGS(req)
636 );
637 
638 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_queue_request,
639 	TP_PROTO(struct dbc_request *req),
640 	TP_ARGS(req)
641 );
642 
643 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_giveback_request,
644 	TP_PROTO(struct dbc_request *req),
645 	TP_ARGS(req)
646 );
647 #endif /* __XHCI_TRACE_H */
648 
649 /* this part must be outside header guard */
650 
651 #undef TRACE_INCLUDE_PATH
652 #define TRACE_INCLUDE_PATH .
653 
654 #undef TRACE_INCLUDE_FILE
655 #define TRACE_INCLUDE_FILE xhci-trace
656 
657 #include <trace/define_trace.h>
658