xref: /openbmc/linux/drivers/usb/host/xhci-trace.h (revision 7effbd18)
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 		__field(int, slot_id)
84 		__dynamic_array(u32, ctx_data,
85 			((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) *
86 			((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1))
87 	),
88 	TP_fast_assign(
89 		struct usb_device *udev;
90 
91 		udev = to_usb_device(xhci_to_hcd(xhci)->self.controller);
92 		__entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params);
93 		__entry->ctx_type = ctx->type;
94 		__entry->ctx_dma = ctx->dma;
95 		__entry->ctx_va = ctx->bytes;
96 		__entry->slot_id = udev->slot_id;
97 		__entry->ctx_ep_num = ep_num;
98 		memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
99 			((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) *
100 			((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1));
101 	),
102 	TP_printk("ctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p",
103 			__entry->ctx_64, __entry->ctx_type,
104 			(unsigned long long) __entry->ctx_dma, __entry->ctx_va
105 	)
106 );
107 
108 DEFINE_EVENT(xhci_log_ctx, xhci_address_ctx,
109 	TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
110 		 unsigned int ep_num),
111 	TP_ARGS(xhci, ctx, ep_num)
112 );
113 
114 DECLARE_EVENT_CLASS(xhci_log_trb,
115 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
116 	TP_ARGS(ring, trb),
117 	TP_STRUCT__entry(
118 		__field(u32, type)
119 		__field(u32, field0)
120 		__field(u32, field1)
121 		__field(u32, field2)
122 		__field(u32, field3)
123 		__dynamic_array(char, str, XHCI_MSG_MAX)
124 	),
125 	TP_fast_assign(
126 		__entry->type = ring->type;
127 		__entry->field0 = le32_to_cpu(trb->field[0]);
128 		__entry->field1 = le32_to_cpu(trb->field[1]);
129 		__entry->field2 = le32_to_cpu(trb->field[2]);
130 		__entry->field3 = le32_to_cpu(trb->field[3]);
131 	),
132 	TP_printk("%s: %s", xhci_ring_type_string(__entry->type),
133 		  xhci_decode_trb(__get_str(str), XHCI_MSG_MAX, __entry->field0, __entry->field1,
134 					__entry->field2, __entry->field3)
135 	)
136 );
137 
138 DEFINE_EVENT(xhci_log_trb, xhci_handle_event,
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_command,
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_handle_transfer,
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_queue_trb,
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_event,
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_handle_transfer,
164 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
165 	TP_ARGS(ring, trb)
166 );
167 
168 DEFINE_EVENT(xhci_log_trb, xhci_dbc_gadget_ep_queue,
169 	TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
170 	TP_ARGS(ring, trb)
171 );
172 
173 DECLARE_EVENT_CLASS(xhci_log_free_virt_dev,
174 	TP_PROTO(struct xhci_virt_device *vdev),
175 	TP_ARGS(vdev),
176 	TP_STRUCT__entry(
177 		__field(void *, vdev)
178 		__field(unsigned long long, out_ctx)
179 		__field(unsigned long long, in_ctx)
180 		__field(u8, fake_port)
181 		__field(u8, real_port)
182 		__field(u16, current_mel)
183 
184 	),
185 	TP_fast_assign(
186 		__entry->vdev = vdev;
187 		__entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
188 		__entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
189 		__entry->fake_port = (u8) vdev->fake_port;
190 		__entry->real_port = (u8) vdev->real_port;
191 		__entry->current_mel = (u16) vdev->current_mel;
192 		),
193 	TP_printk("vdev %p ctx %llx | %llx fake_port %d real_port %d current_mel %d",
194 		__entry->vdev, __entry->in_ctx, __entry->out_ctx,
195 		__entry->fake_port, __entry->real_port, __entry->current_mel
196 	)
197 );
198 
199 DEFINE_EVENT(xhci_log_free_virt_dev, xhci_free_virt_device,
200 	TP_PROTO(struct xhci_virt_device *vdev),
201 	TP_ARGS(vdev)
202 );
203 
204 DECLARE_EVENT_CLASS(xhci_log_virt_dev,
205 	TP_PROTO(struct xhci_virt_device *vdev),
206 	TP_ARGS(vdev),
207 	TP_STRUCT__entry(
208 		__field(void *, vdev)
209 		__field(unsigned long long, out_ctx)
210 		__field(unsigned long long, in_ctx)
211 		__field(int, devnum)
212 		__field(int, state)
213 		__field(int, speed)
214 		__field(u8, portnum)
215 		__field(u8, level)
216 		__field(int, slot_id)
217 	),
218 	TP_fast_assign(
219 		__entry->vdev = vdev;
220 		__entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
221 		__entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
222 		__entry->devnum = vdev->udev->devnum;
223 		__entry->state = vdev->udev->state;
224 		__entry->speed = vdev->udev->speed;
225 		__entry->portnum = vdev->udev->portnum;
226 		__entry->level = vdev->udev->level;
227 		__entry->slot_id = vdev->udev->slot_id;
228 	),
229 	TP_printk("vdev %p ctx %llx | %llx num %d state %d speed %d port %d level %d slot %d",
230 		__entry->vdev, __entry->in_ctx, __entry->out_ctx,
231 		__entry->devnum, __entry->state, __entry->speed,
232 		__entry->portnum, __entry->level, __entry->slot_id
233 	)
234 );
235 
236 DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device,
237 	TP_PROTO(struct xhci_virt_device *vdev),
238 	TP_ARGS(vdev)
239 );
240 
241 DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_device,
242 	TP_PROTO(struct xhci_virt_device *vdev),
243 	TP_ARGS(vdev)
244 );
245 
246 DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_addressable_virt_device,
247 	TP_PROTO(struct xhci_virt_device *vdev),
248 	TP_ARGS(vdev)
249 );
250 
251 DEFINE_EVENT(xhci_log_virt_dev, xhci_stop_device,
252 	TP_PROTO(struct xhci_virt_device *vdev),
253 	TP_ARGS(vdev)
254 );
255 
256 DECLARE_EVENT_CLASS(xhci_log_urb,
257 	TP_PROTO(struct urb *urb),
258 	TP_ARGS(urb),
259 	TP_STRUCT__entry(
260 		__field(void *, urb)
261 		__field(unsigned int, pipe)
262 		__field(unsigned int, stream)
263 		__field(int, status)
264 		__field(unsigned int, flags)
265 		__field(int, num_mapped_sgs)
266 		__field(int, num_sgs)
267 		__field(int, length)
268 		__field(int, actual)
269 		__field(int, epnum)
270 		__field(int, dir_in)
271 		__field(int, type)
272 		__field(int, slot_id)
273 	),
274 	TP_fast_assign(
275 		__entry->urb = urb;
276 		__entry->pipe = urb->pipe;
277 		__entry->stream = urb->stream_id;
278 		__entry->status = urb->status;
279 		__entry->flags = urb->transfer_flags;
280 		__entry->num_mapped_sgs = urb->num_mapped_sgs;
281 		__entry->num_sgs = urb->num_sgs;
282 		__entry->length = urb->transfer_buffer_length;
283 		__entry->actual = urb->actual_length;
284 		__entry->epnum = usb_endpoint_num(&urb->ep->desc);
285 		__entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc);
286 		__entry->type = usb_endpoint_type(&urb->ep->desc);
287 		__entry->slot_id = urb->dev->slot_id;
288 	),
289 	TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
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_ep_ctx,
318 	TP_PROTO(struct xhci_ep_ctx *ctx),
319 	TP_ARGS(ctx),
320 	TP_STRUCT__entry(
321 		__field(u32, info)
322 		__field(u32, info2)
323 		__field(u64, deq)
324 		__field(u32, tx_info)
325 		__dynamic_array(char, str, XHCI_MSG_MAX)
326 	),
327 	TP_fast_assign(
328 		__entry->info = le32_to_cpu(ctx->ep_info);
329 		__entry->info2 = le32_to_cpu(ctx->ep_info2);
330 		__entry->deq = le64_to_cpu(ctx->deq);
331 		__entry->tx_info = le32_to_cpu(ctx->tx_info);
332 	),
333 	TP_printk("%s", xhci_decode_ep_context(__get_str(str),
334 		__entry->info, __entry->info2, __entry->deq, __entry->tx_info)
335 	)
336 );
337 
338 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_stop_ep,
339 	TP_PROTO(struct xhci_ep_ctx *ctx),
340 	TP_ARGS(ctx)
341 );
342 
343 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_set_deq_ep,
344 	TP_PROTO(struct xhci_ep_ctx *ctx),
345 	TP_ARGS(ctx)
346 );
347 
348 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_reset_ep,
349 	TP_PROTO(struct xhci_ep_ctx *ctx),
350 	TP_ARGS(ctx)
351 );
352 
353 DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_config_ep,
354 	TP_PROTO(struct xhci_ep_ctx *ctx),
355 	TP_ARGS(ctx)
356 );
357 
358 DEFINE_EVENT(xhci_log_ep_ctx, xhci_add_endpoint,
359 	TP_PROTO(struct xhci_ep_ctx *ctx),
360 	TP_ARGS(ctx)
361 );
362 
363 DECLARE_EVENT_CLASS(xhci_log_slot_ctx,
364 	TP_PROTO(struct xhci_slot_ctx *ctx),
365 	TP_ARGS(ctx),
366 	TP_STRUCT__entry(
367 		__field(u32, info)
368 		__field(u32, info2)
369 		__field(u32, tt_info)
370 		__field(u32, state)
371 		__dynamic_array(char, str, XHCI_MSG_MAX)
372 	),
373 	TP_fast_assign(
374 		__entry->info = le32_to_cpu(ctx->dev_info);
375 		__entry->info2 = le32_to_cpu(ctx->dev_info2);
376 		__entry->tt_info = le64_to_cpu(ctx->tt_info);
377 		__entry->state = le32_to_cpu(ctx->dev_state);
378 	),
379 	TP_printk("%s", xhci_decode_slot_context(__get_str(str),
380 			__entry->info, __entry->info2,
381 			__entry->tt_info, __entry->state)
382 	)
383 );
384 
385 DEFINE_EVENT(xhci_log_slot_ctx, xhci_alloc_dev,
386 	TP_PROTO(struct xhci_slot_ctx *ctx),
387 	TP_ARGS(ctx)
388 );
389 
390 DEFINE_EVENT(xhci_log_slot_ctx, xhci_free_dev,
391 	TP_PROTO(struct xhci_slot_ctx *ctx),
392 	TP_ARGS(ctx)
393 );
394 
395 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_disable_slot,
396 	TP_PROTO(struct xhci_slot_ctx *ctx),
397 	TP_ARGS(ctx)
398 );
399 
400 DEFINE_EVENT(xhci_log_slot_ctx, xhci_discover_or_reset_device,
401 	TP_PROTO(struct xhci_slot_ctx *ctx),
402 	TP_ARGS(ctx)
403 );
404 
405 DEFINE_EVENT(xhci_log_slot_ctx, xhci_setup_device_slot,
406 	TP_PROTO(struct xhci_slot_ctx *ctx),
407 	TP_ARGS(ctx)
408 );
409 
410 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_addr_dev,
411 	TP_PROTO(struct xhci_slot_ctx *ctx),
412 	TP_ARGS(ctx)
413 );
414 
415 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_reset_dev,
416 	TP_PROTO(struct xhci_slot_ctx *ctx),
417 	TP_ARGS(ctx)
418 );
419 
420 DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_set_deq,
421 	TP_PROTO(struct xhci_slot_ctx *ctx),
422 	TP_ARGS(ctx)
423 );
424 
425 DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint,
426 	TP_PROTO(struct xhci_slot_ctx *ctx),
427 	TP_ARGS(ctx)
428 );
429 
430 DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx,
431 	TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
432 	TP_ARGS(ctrl_ctx),
433 	TP_STRUCT__entry(
434 		__field(u32, drop)
435 		__field(u32, add)
436 		__dynamic_array(char, str, XHCI_MSG_MAX)
437 	),
438 	TP_fast_assign(
439 		__entry->drop = le32_to_cpu(ctrl_ctx->drop_flags);
440 		__entry->add = le32_to_cpu(ctrl_ctx->add_flags);
441 	),
442 	TP_printk("%s", xhci_decode_ctrl_ctx(__get_str(str), __entry->drop, __entry->add)
443 	)
444 );
445 
446 DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_address_ctrl_ctx,
447 	TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
448 	TP_ARGS(ctrl_ctx)
449 );
450 
451 DEFINE_EVENT(xhci_log_ctrl_ctx, xhci_configure_endpoint_ctrl_ctx,
452 	TP_PROTO(struct xhci_input_control_ctx *ctrl_ctx),
453 	TP_ARGS(ctrl_ctx)
454 );
455 
456 DECLARE_EVENT_CLASS(xhci_log_ring,
457 	TP_PROTO(struct xhci_ring *ring),
458 	TP_ARGS(ring),
459 	TP_STRUCT__entry(
460 		__field(u32, type)
461 		__field(void *, ring)
462 		__field(dma_addr_t, enq)
463 		__field(dma_addr_t, deq)
464 		__field(dma_addr_t, enq_seg)
465 		__field(dma_addr_t, deq_seg)
466 		__field(unsigned int, num_segs)
467 		__field(unsigned int, stream_id)
468 		__field(unsigned int, cycle_state)
469 		__field(unsigned int, num_trbs_free)
470 		__field(unsigned int, bounce_buf_len)
471 	),
472 	TP_fast_assign(
473 		__entry->ring = ring;
474 		__entry->type = ring->type;
475 		__entry->num_segs = ring->num_segs;
476 		__entry->stream_id = ring->stream_id;
477 		__entry->enq_seg = ring->enq_seg->dma;
478 		__entry->deq_seg = ring->deq_seg->dma;
479 		__entry->cycle_state = ring->cycle_state;
480 		__entry->num_trbs_free = ring->num_trbs_free;
481 		__entry->bounce_buf_len = ring->bounce_buf_len;
482 		__entry->enq = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
483 		__entry->deq = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
484 	),
485 	TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d free_trbs %d bounce %d cycle %d",
486 			xhci_ring_type_string(__entry->type), __entry->ring,
487 			&__entry->enq, &__entry->enq_seg,
488 			&__entry->deq, &__entry->deq_seg,
489 			__entry->num_segs,
490 			__entry->stream_id,
491 			__entry->num_trbs_free,
492 			__entry->bounce_buf_len,
493 			__entry->cycle_state
494 		)
495 );
496 
497 DEFINE_EVENT(xhci_log_ring, xhci_ring_alloc,
498 	TP_PROTO(struct xhci_ring *ring),
499 	TP_ARGS(ring)
500 );
501 
502 DEFINE_EVENT(xhci_log_ring, xhci_ring_free,
503 	TP_PROTO(struct xhci_ring *ring),
504 	TP_ARGS(ring)
505 );
506 
507 DEFINE_EVENT(xhci_log_ring, xhci_ring_expansion,
508 	TP_PROTO(struct xhci_ring *ring),
509 	TP_ARGS(ring)
510 );
511 
512 DEFINE_EVENT(xhci_log_ring, xhci_inc_enq,
513 	TP_PROTO(struct xhci_ring *ring),
514 	TP_ARGS(ring)
515 );
516 
517 DEFINE_EVENT(xhci_log_ring, xhci_inc_deq,
518 	TP_PROTO(struct xhci_ring *ring),
519 	TP_ARGS(ring)
520 );
521 
522 DECLARE_EVENT_CLASS(xhci_log_portsc,
523 		    TP_PROTO(u32 portnum, u32 portsc),
524 		    TP_ARGS(portnum, portsc),
525 		    TP_STRUCT__entry(
526 				     __field(u32, portnum)
527 				     __field(u32, portsc)
528 				     __dynamic_array(char, str, XHCI_MSG_MAX)
529 				     ),
530 		    TP_fast_assign(
531 				   __entry->portnum = portnum;
532 				   __entry->portsc = portsc;
533 				   ),
534 		    TP_printk("port-%d: %s",
535 			      __entry->portnum,
536 			      xhci_decode_portsc(__get_str(str), __entry->portsc)
537 			      )
538 );
539 
540 DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status,
541 	     TP_PROTO(u32 portnum, u32 portsc),
542 	     TP_ARGS(portnum, portsc)
543 );
544 
545 DEFINE_EVENT(xhci_log_portsc, xhci_get_port_status,
546 	     TP_PROTO(u32 portnum, u32 portsc),
547 	     TP_ARGS(portnum, portsc)
548 );
549 
550 DEFINE_EVENT(xhci_log_portsc, xhci_hub_status_data,
551 	     TP_PROTO(u32 portnum, u32 portsc),
552 	     TP_ARGS(portnum, portsc)
553 );
554 
555 DECLARE_EVENT_CLASS(xhci_log_doorbell,
556 	TP_PROTO(u32 slot, u32 doorbell),
557 	TP_ARGS(slot, doorbell),
558 	TP_STRUCT__entry(
559 		__field(u32, slot)
560 		__field(u32, doorbell)
561 		__dynamic_array(char, str, XHCI_MSG_MAX)
562 	),
563 	TP_fast_assign(
564 		__entry->slot = slot;
565 		__entry->doorbell = doorbell;
566 	),
567 	TP_printk("Ring doorbell for %s",
568 		  xhci_decode_doorbell(__get_str(str), __entry->slot, __entry->doorbell)
569 	)
570 );
571 
572 DEFINE_EVENT(xhci_log_doorbell, xhci_ring_ep_doorbell,
573 	     TP_PROTO(u32 slot, u32 doorbell),
574 	     TP_ARGS(slot, doorbell)
575 );
576 
577 DEFINE_EVENT(xhci_log_doorbell, xhci_ring_host_doorbell,
578 	     TP_PROTO(u32 slot, u32 doorbell),
579 	     TP_ARGS(slot, doorbell)
580 );
581 
582 DECLARE_EVENT_CLASS(xhci_dbc_log_request,
583 	TP_PROTO(struct dbc_request *req),
584 	TP_ARGS(req),
585 	TP_STRUCT__entry(
586 		__field(struct dbc_request *, req)
587 		__field(bool, dir)
588 		__field(unsigned int, actual)
589 		__field(unsigned int, length)
590 		__field(int, status)
591 	),
592 	TP_fast_assign(
593 		__entry->req = req;
594 		__entry->dir = req->direction;
595 		__entry->actual = req->actual;
596 		__entry->length = req->length;
597 		__entry->status = req->status;
598 	),
599 	TP_printk("%s: req %p length %u/%u ==> %d",
600 		__entry->dir ? "bulk-in" : "bulk-out",
601 		__entry->req, __entry->actual,
602 		__entry->length, __entry->status
603 	)
604 );
605 
606 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_alloc_request,
607 	TP_PROTO(struct dbc_request *req),
608 	TP_ARGS(req)
609 );
610 
611 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_free_request,
612 	TP_PROTO(struct dbc_request *req),
613 	TP_ARGS(req)
614 );
615 
616 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_queue_request,
617 	TP_PROTO(struct dbc_request *req),
618 	TP_ARGS(req)
619 );
620 
621 DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_giveback_request,
622 	TP_PROTO(struct dbc_request *req),
623 	TP_ARGS(req)
624 );
625 #endif /* __XHCI_TRACE_H */
626 
627 /* this part must be outside header guard */
628 
629 #undef TRACE_INCLUDE_PATH
630 #define TRACE_INCLUDE_PATH .
631 
632 #undef TRACE_INCLUDE_FILE
633 #define TRACE_INCLUDE_FILE xhci-trace
634 
635 #include <trace/define_trace.h>
636