1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Cadence CDNSP DRD Driver.
4 * Trace support header file
6 * Copyright (C) 2020 Cadence.
8 * Author: Pawel Laszczak <pawell@cadence.com>
13 #define TRACE_SYSTEM cdnsp-dev
16 * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
17 * legitimate C variable. It is not exported to user space.
19 #undef TRACE_SYSTEM_VAR
20 #define TRACE_SYSTEM_VAR cdnsp_dev
22 #if !defined(__CDNSP_DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
23 #define __CDNSP_DEV_TRACE_H
25 #include <linux/tracepoint.h>
26 #include "cdnsp-gadget.h"
27 #include "cdnsp-debug.h"
30 * There is limitation for single buffer size in TRACEPOINT subsystem.
31 * By default TRACE_BUF_SIZE is 1024, so no all data will be logged.
32 * To show more data this must be increased. In most cases the default
33 * value is sufficient.
35 #define CDNSP_MSG_MAX 500
37 DECLARE_EVENT_CLASS(cdnsp_log_ep
,
38 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
39 TP_ARGS(pep
, stream_id
),
41 __string(name
, pep
->name
)
42 __field(unsigned int, state
)
43 __field(u32
, stream_id
)
45 __field(unsigned int, num_streams
)
46 __field(int, td_count
)
47 __field(u8
, first_prime_det
)
48 __field(u8
, drbls_count
)
52 __entry
->state
= pep
->ep_state
;
53 __entry
->stream_id
= stream_id
;
54 __entry
->enabled
= pep
->ep_state
& EP_HAS_STREAMS
;
55 __entry
->num_streams
= pep
->stream_info
.num_streams
;
56 __entry
->td_count
= pep
->stream_info
.td_count
;
57 __entry
->first_prime_det
= pep
->stream_info
.first_prime_det
;
58 __entry
->drbls_count
= pep
->stream_info
.drbls_count
;
60 TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d "
61 "tds %d, first prime: %d drbls %d",
62 __get_str(name
), __entry
->stream_id
, __entry
->state
,
63 __entry
->enabled
, __entry
->num_streams
, __entry
->td_count
,
64 __entry
->first_prime_det
, __entry
->drbls_count
)
67 DEFINE_EVENT(cdnsp_log_ep
, cdnsp_tr_drbl
,
68 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
69 TP_ARGS(pep
, stream_id
)
72 DEFINE_EVENT(cdnsp_log_ep
, cdnsp_wait_for_prime
,
73 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
74 TP_ARGS(pep
, stream_id
)
77 DEFINE_EVENT(cdnsp_log_ep
, cdnsp_ep_list_empty_with_skip
,
78 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
79 TP_ARGS(pep
, stream_id
)
82 DEFINE_EVENT(cdnsp_log_ep
, cdnsp_ep_enable_end
,
83 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
84 TP_ARGS(pep
, stream_id
)
87 DEFINE_EVENT(cdnsp_log_ep
, cdnsp_ep_disable_end
,
88 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
89 TP_ARGS(pep
, stream_id
)
92 DEFINE_EVENT(cdnsp_log_ep
, cdnsp_ep_busy_try_halt_again
,
93 TP_PROTO(struct cdnsp_ep
*pep
, u32 stream_id
),
94 TP_ARGS(pep
, stream_id
)
97 DECLARE_EVENT_CLASS(cdnsp_log_enable_disable
,
106 TP_printk("%s", __entry
->set
? "enabled" : "disabled")
109 DEFINE_EVENT(cdnsp_log_enable_disable
, cdnsp_pullup
,
114 DEFINE_EVENT(cdnsp_log_enable_disable
, cdnsp_u1
,
119 DEFINE_EVENT(cdnsp_log_enable_disable
, cdnsp_u2
,
124 DEFINE_EVENT(cdnsp_log_enable_disable
, cdnsp_lpm
,
129 DEFINE_EVENT(cdnsp_log_enable_disable
, cdnsp_may_wakeup
,
134 DECLARE_EVENT_CLASS(cdnsp_log_simple
,
143 TP_printk("%s", __get_str(text
))
146 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_exit
,
151 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_init
,
156 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_slot_id
,
161 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_no_room_on_ring
,
166 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_ep0_status_stage
,
171 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_ep0_request
,
176 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_ep0_set_config
,
181 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_ep0_halted
,
186 DEFINE_EVENT(cdnsp_log_simple
, cdnsp_ep_halt
,
191 TRACE_EVENT(cdnsp_looking_trb_in_td
,
192 TP_PROTO(dma_addr_t suspect
, dma_addr_t trb_start
, dma_addr_t trb_end
,
193 dma_addr_t curr_seg
, dma_addr_t end_seg
),
194 TP_ARGS(suspect
, trb_start
, trb_end
, curr_seg
, end_seg
),
196 __field(dma_addr_t
, suspect
)
197 __field(dma_addr_t
, trb_start
)
198 __field(dma_addr_t
, trb_end
)
199 __field(dma_addr_t
, curr_seg
)
200 __field(dma_addr_t
, end_seg
)
203 __entry
->suspect
= suspect
;
204 __entry
->trb_start
= trb_start
;
205 __entry
->trb_end
= trb_end
;
206 __entry
->curr_seg
= curr_seg
;
207 __entry
->end_seg
= end_seg
;
209 TP_printk("DMA: suspect event: %pad, trb-start: %pad, trb-end %pad, "
210 "seg-start %pad, seg-end %pad",
211 &__entry
->suspect
, &__entry
->trb_start
, &__entry
->trb_end
,
212 &__entry
->curr_seg
, &__entry
->end_seg
)
215 TRACE_EVENT(cdnsp_port_info
,
216 TP_PROTO(__le32 __iomem
*addr
, u32 offset
, u32 count
, u32 rev
),
217 TP_ARGS(addr
, offset
, count
, rev
),
219 __field(__le32 __iomem
*, addr
)
225 __entry
->addr
= addr
;
226 __entry
->offset
= offset
;
227 __entry
->count
= count
;
230 TP_printk("Ext Cap %p, port offset = %u, count = %u, rev = 0x%x",
231 __entry
->addr
, __entry
->offset
, __entry
->count
, __entry
->rev
)
234 DECLARE_EVENT_CLASS(cdnsp_log_deq_state
,
235 TP_PROTO(struct cdnsp_dequeue_state
*state
),
238 __field(int, new_cycle_state
)
239 __field(struct cdnsp_segment
*, new_deq_seg
)
240 __field(dma_addr_t
, deq_seg_dma
)
241 __field(union cdnsp_trb
*, new_deq_ptr
)
242 __field(dma_addr_t
, deq_ptr_dma
)
245 __entry
->new_cycle_state
= state
->new_cycle_state
;
246 __entry
->new_deq_seg
= state
->new_deq_seg
;
247 __entry
->deq_seg_dma
= state
->new_deq_seg
->dma
;
248 __entry
->new_deq_ptr
= state
->new_deq_ptr
,
249 __entry
->deq_ptr_dma
= cdnsp_trb_virt_to_dma(state
->new_deq_seg
,
252 TP_printk("New cycle state = 0x%x, New dequeue segment = %p (0x%pad dma), "
253 "New dequeue pointer = %p (0x%pad dma)",
254 __entry
->new_cycle_state
, __entry
->new_deq_seg
,
255 &__entry
->deq_seg_dma
, __entry
->new_deq_ptr
,
256 &__entry
->deq_ptr_dma
260 DEFINE_EVENT(cdnsp_log_deq_state
, cdnsp_new_deq_state
,
261 TP_PROTO(struct cdnsp_dequeue_state
*state
),
265 DECLARE_EVENT_CLASS(cdnsp_log_ctrl
,
266 TP_PROTO(struct usb_ctrlrequest
*ctrl
),
269 __field(u8
, bRequestType
)
270 __field(u8
, bRequest
)
273 __field(u16
, wLength
)
276 __entry
->bRequestType
= ctrl
->bRequestType
;
277 __entry
->bRequest
= ctrl
->bRequest
;
278 __entry
->wValue
= le16_to_cpu(ctrl
->wValue
);
279 __entry
->wIndex
= le16_to_cpu(ctrl
->wIndex
);
280 __entry
->wLength
= le16_to_cpu(ctrl
->wLength
);
282 TP_printk("%s", usb_decode_ctrl(__get_buf(CDNSP_MSG_MAX
), CDNSP_MSG_MAX
,
283 __entry
->bRequestType
,
284 __entry
->bRequest
, __entry
->wValue
,
285 __entry
->wIndex
, __entry
->wLength
)
289 DEFINE_EVENT(cdnsp_log_ctrl
, cdnsp_ctrl_req
,
290 TP_PROTO(struct usb_ctrlrequest
*ctrl
),
294 DECLARE_EVENT_CLASS(cdnsp_log_bounce
,
295 TP_PROTO(struct cdnsp_request
*preq
, u32 new_buf_len
, u32 offset
,
296 dma_addr_t dma
, unsigned int unalign
),
297 TP_ARGS(preq
, new_buf_len
, offset
, dma
, unalign
),
299 __string(name
, preq
->pep
->name
)
300 __field(u32
, new_buf_len
)
302 __field(dma_addr_t
, dma
)
303 __field(unsigned int, unalign
)
307 __entry
->new_buf_len
= new_buf_len
;
308 __entry
->offset
= offset
;
310 __entry
->unalign
= unalign
;
312 TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d",
313 __get_str(name
), __entry
->new_buf_len
,
314 __entry
->offset
, &__entry
->dma
, __entry
->unalign
318 DEFINE_EVENT(cdnsp_log_bounce
, cdnsp_bounce_align_td_split
,
319 TP_PROTO(struct cdnsp_request
*preq
, u32 new_buf_len
, u32 offset
,
320 dma_addr_t dma
, unsigned int unalign
),
321 TP_ARGS(preq
, new_buf_len
, offset
, dma
, unalign
)
324 DEFINE_EVENT(cdnsp_log_bounce
, cdnsp_bounce_map
,
325 TP_PROTO(struct cdnsp_request
*preq
, u32 new_buf_len
, u32 offset
,
326 dma_addr_t dma
, unsigned int unalign
),
327 TP_ARGS(preq
, new_buf_len
, offset
, dma
, unalign
)
330 DEFINE_EVENT(cdnsp_log_bounce
, cdnsp_bounce_unmap
,
331 TP_PROTO(struct cdnsp_request
*preq
, u32 new_buf_len
, u32 offset
,
332 dma_addr_t dma
, unsigned int unalign
),
333 TP_ARGS(preq
, new_buf_len
, offset
, dma
, unalign
)
336 DECLARE_EVENT_CLASS(cdnsp_log_trb
,
337 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
345 __field(union cdnsp_trb
*, trb
)
346 __field(dma_addr_t
, trb_dma
)
349 __entry
->type
= ring
->type
;
350 __entry
->field0
= le32_to_cpu(trb
->field
[0]);
351 __entry
->field1
= le32_to_cpu(trb
->field
[1]);
352 __entry
->field2
= le32_to_cpu(trb
->field
[2]);
353 __entry
->field3
= le32_to_cpu(trb
->field
[3]);
354 __entry
->trb
= (union cdnsp_trb
*)trb
;
355 __entry
->trb_dma
= cdnsp_trb_virt_to_dma(ring
->deq_seg
,
356 (union cdnsp_trb
*)trb
);
359 TP_printk("%s: %s trb: %p(%pad)", cdnsp_ring_type_string(__entry
->type
),
360 cdnsp_decode_trb(__get_buf(CDNSP_MSG_MAX
), CDNSP_MSG_MAX
,
361 __entry
->field0
, __entry
->field1
,
362 __entry
->field2
, __entry
->field3
),
363 __entry
->trb
, &__entry
->trb_dma
367 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_handle_event
,
368 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
372 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_trb_without_td
,
373 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
377 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_handle_command
,
378 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
382 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_handle_transfer
,
383 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
387 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_queue_trb
,
388 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
392 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_cmd_wait_for_compl
,
393 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
397 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_cmd_timeout
,
398 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
402 DEFINE_EVENT(cdnsp_log_trb
, cdnsp_defered_event
,
403 TP_PROTO(struct cdnsp_ring
*ring
, struct cdnsp_generic_trb
*trb
),
407 DECLARE_EVENT_CLASS(cdnsp_log_pdev
,
408 TP_PROTO(struct cdnsp_device
*pdev
),
411 __field(struct cdnsp_device
*, pdev
)
412 __field(struct usb_gadget
*, gadget
)
413 __field(dma_addr_t
, out_ctx
)
414 __field(dma_addr_t
, in_ctx
)
415 __field(u8
, port_num
)
418 __entry
->pdev
= pdev
;
419 __entry
->gadget
= &pdev
->gadget
;
420 __entry
->in_ctx
= pdev
->in_ctx
.dma
;
421 __entry
->out_ctx
= pdev
->out_ctx
.dma
;
422 __entry
->port_num
= pdev
->active_port
?
423 pdev
->active_port
->port_num
: 0xFF;
425 TP_printk("pdev %p gadget %p ctx %pad | %pad, port %d ",
426 __entry
->pdev
, __entry
->gadget
, &__entry
->in_ctx
,
427 &__entry
->out_ctx
, __entry
->port_num
431 DEFINE_EVENT(cdnsp_log_pdev
, cdnsp_alloc_priv_device
,
432 TP_PROTO(struct cdnsp_device
*vdev
),
436 DEFINE_EVENT(cdnsp_log_pdev
, cdnsp_free_priv_device
,
437 TP_PROTO(struct cdnsp_device
*vdev
),
441 DEFINE_EVENT(cdnsp_log_pdev
, cdnsp_setup_device
,
442 TP_PROTO(struct cdnsp_device
*vdev
),
446 DEFINE_EVENT(cdnsp_log_pdev
, cdnsp_setup_addressable_priv_device
,
447 TP_PROTO(struct cdnsp_device
*vdev
),
451 DECLARE_EVENT_CLASS(cdnsp_log_request
,
452 TP_PROTO(struct cdnsp_request
*req
),
455 __string(name
, req
->pep
->name
)
456 __field(struct usb_request
*, request
)
457 __field(struct cdnsp_request
*, preq
)
459 __field(unsigned int, actual
)
460 __field(unsigned int, length
)
462 __field(dma_addr_t
, dma
)
463 __field(unsigned int, stream_id
)
464 __field(unsigned int, zero
)
465 __field(unsigned int, short_not_ok
)
466 __field(unsigned int, no_interrupt
)
467 __field(struct scatterlist
*, sg
)
468 __field(unsigned int, num_sgs
)
469 __field(unsigned int, num_mapped_sgs
)
474 __entry
->request
= &req
->request
;
476 __entry
->buf
= req
->request
.buf
;
477 __entry
->actual
= req
->request
.actual
;
478 __entry
->length
= req
->request
.length
;
479 __entry
->status
= req
->request
.status
;
480 __entry
->dma
= req
->request
.dma
;
481 __entry
->stream_id
= req
->request
.stream_id
;
482 __entry
->zero
= req
->request
.zero
;
483 __entry
->short_not_ok
= req
->request
.short_not_ok
;
484 __entry
->no_interrupt
= req
->request
.no_interrupt
;
485 __entry
->sg
= req
->request
.sg
;
486 __entry
->num_sgs
= req
->request
.num_sgs
;
487 __entry
->num_mapped_sgs
= req
->request
.num_mapped_sgs
;
489 TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, "
490 "buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d,"
492 __get_str(name
), __entry
->request
, __entry
->preq
,
493 __entry
->buf
, __entry
->actual
, __entry
->length
,
494 __entry
->status
, &__entry
->dma
,
495 __entry
->stream_id
, __entry
->zero
? "Z" : "z",
496 __entry
->short_not_ok
? "S" : "s",
497 __entry
->no_interrupt
? "I" : "i",
498 __entry
->sg
, __entry
->num_sgs
, __entry
->num_mapped_sgs
502 DEFINE_EVENT(cdnsp_log_request
, cdnsp_request_enqueue
,
503 TP_PROTO(struct cdnsp_request
*req
),
507 DEFINE_EVENT(cdnsp_log_request
, cdnsp_request_enqueue_busy
,
508 TP_PROTO(struct cdnsp_request
*req
),
512 DEFINE_EVENT(cdnsp_log_request
, cdnsp_request_enqueue_error
,
513 TP_PROTO(struct cdnsp_request
*req
),
517 DEFINE_EVENT(cdnsp_log_request
, cdnsp_request_dequeue
,
518 TP_PROTO(struct cdnsp_request
*req
),
522 DEFINE_EVENT(cdnsp_log_request
, cdnsp_request_giveback
,
523 TP_PROTO(struct cdnsp_request
*req
),
527 DEFINE_EVENT(cdnsp_log_request
, cdnsp_alloc_request
,
528 TP_PROTO(struct cdnsp_request
*req
),
532 DEFINE_EVENT(cdnsp_log_request
, cdnsp_free_request
,
533 TP_PROTO(struct cdnsp_request
*req
),
537 DECLARE_EVENT_CLASS(cdnsp_log_ep_ctx
,
538 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
544 __field(u32
, tx_info
)
547 __entry
->info
= le32_to_cpu(ctx
->ep_info
);
548 __entry
->info2
= le32_to_cpu(ctx
->ep_info2
);
549 __entry
->deq
= le64_to_cpu(ctx
->deq
);
550 __entry
->tx_info
= le32_to_cpu(ctx
->tx_info
);
552 TP_printk("%s", cdnsp_decode_ep_context(__get_buf(CDNSP_MSG_MAX
), CDNSP_MSG_MAX
,
553 __entry
->info
, __entry
->info2
,
554 __entry
->deq
, __entry
->tx_info
)
558 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_ep_disabled
,
559 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
563 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_ep_stopped_or_disabled
,
564 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
568 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_remove_request
,
569 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
573 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_handle_cmd_stop_ep
,
574 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
578 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_handle_cmd_flush_ep
,
579 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
583 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_handle_cmd_set_deq_ep
,
584 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
588 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_handle_cmd_reset_ep
,
589 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
593 DEFINE_EVENT(cdnsp_log_ep_ctx
, cdnsp_handle_cmd_config_ep
,
594 TP_PROTO(struct cdnsp_ep_ctx
*ctx
),
598 DECLARE_EVENT_CLASS(cdnsp_log_slot_ctx
,
599 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
604 __field(u32
, int_target
)
608 __entry
->info
= le32_to_cpu(ctx
->dev_info
);
609 __entry
->info2
= le32_to_cpu(ctx
->dev_port
);
610 __entry
->int_target
= le32_to_cpu(ctx
->int_target
);
611 __entry
->state
= le32_to_cpu(ctx
->dev_state
);
613 TP_printk("%s", cdnsp_decode_slot_context(__entry
->info
,
620 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_slot_already_in_default
,
621 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
625 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_handle_cmd_enable_slot
,
626 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
630 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_handle_cmd_disable_slot
,
631 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
635 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_reset_device
,
636 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
640 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_setup_device_slot
,
641 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
645 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_handle_cmd_addr_dev
,
646 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
650 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_handle_cmd_reset_dev
,
651 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
655 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_handle_cmd_set_deq
,
656 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
660 DEFINE_EVENT(cdnsp_log_slot_ctx
, cdnsp_configure_endpoint
,
661 TP_PROTO(struct cdnsp_slot_ctx
*ctx
),
665 DECLARE_EVENT_CLASS(cdnsp_log_td_info
,
666 TP_PROTO(struct cdnsp_request
*preq
),
669 __string(name
, preq
->pep
->name
)
670 __field(struct usb_request
*, request
)
671 __field(struct cdnsp_request
*, preq
)
672 __field(union cdnsp_trb
*, first_trb
)
673 __field(union cdnsp_trb
*, last_trb
)
674 __field(dma_addr_t
, trb_dma
)
678 __entry
->request
= &preq
->request
;
679 __entry
->preq
= preq
;
680 __entry
->first_trb
= preq
->td
.first_trb
;
681 __entry
->last_trb
= preq
->td
.last_trb
;
682 __entry
->trb_dma
= cdnsp_trb_virt_to_dma(preq
->td
.start_seg
,
685 TP_printk("%s req/preq: %p/%p, first trb %p[vir]/%pad(dma), last trb %p",
686 __get_str(name
), __entry
->request
, __entry
->preq
,
687 __entry
->first_trb
, &__entry
->trb_dma
,
692 DEFINE_EVENT(cdnsp_log_td_info
, cdnsp_remove_request_td
,
693 TP_PROTO(struct cdnsp_request
*preq
),
697 DECLARE_EVENT_CLASS(cdnsp_log_ring
,
698 TP_PROTO(struct cdnsp_ring
*ring
),
702 __field(void *, ring
)
703 __field(dma_addr_t
, enq
)
704 __field(dma_addr_t
, deq
)
705 __field(dma_addr_t
, enq_seg
)
706 __field(dma_addr_t
, deq_seg
)
707 __field(unsigned int, num_segs
)
708 __field(unsigned int, stream_id
)
709 __field(unsigned int, cycle_state
)
710 __field(unsigned int, num_trbs_free
)
711 __field(unsigned int, bounce_buf_len
)
714 __entry
->ring
= ring
;
715 __entry
->type
= ring
->type
;
716 __entry
->num_segs
= ring
->num_segs
;
717 __entry
->stream_id
= ring
->stream_id
;
718 __entry
->enq_seg
= ring
->enq_seg
->dma
;
719 __entry
->deq_seg
= ring
->deq_seg
->dma
;
720 __entry
->cycle_state
= ring
->cycle_state
;
721 __entry
->num_trbs_free
= ring
->num_trbs_free
;
722 __entry
->bounce_buf_len
= ring
->bounce_buf_len
;
723 __entry
->enq
= cdnsp_trb_virt_to_dma(ring
->enq_seg
,
725 __entry
->deq
= cdnsp_trb_virt_to_dma(ring
->deq_seg
,
728 TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d"
729 " free_trbs %d bounce %d cycle %d",
730 cdnsp_ring_type_string(__entry
->type
), __entry
->ring
,
731 &__entry
->enq
, &__entry
->enq_seg
,
732 &__entry
->deq
, &__entry
->deq_seg
,
735 __entry
->num_trbs_free
,
736 __entry
->bounce_buf_len
,
741 DEFINE_EVENT(cdnsp_log_ring
, cdnsp_ring_alloc
,
742 TP_PROTO(struct cdnsp_ring
*ring
),
746 DEFINE_EVENT(cdnsp_log_ring
, cdnsp_ring_free
,
747 TP_PROTO(struct cdnsp_ring
*ring
),
751 DEFINE_EVENT(cdnsp_log_ring
, cdnsp_set_stream_ring
,
752 TP_PROTO(struct cdnsp_ring
*ring
),
756 DEFINE_EVENT(cdnsp_log_ring
, cdnsp_ring_expansion
,
757 TP_PROTO(struct cdnsp_ring
*ring
),
761 DEFINE_EVENT(cdnsp_log_ring
, cdnsp_inc_enq
,
762 TP_PROTO(struct cdnsp_ring
*ring
),
766 DEFINE_EVENT(cdnsp_log_ring
, cdnsp_inc_deq
,
767 TP_PROTO(struct cdnsp_ring
*ring
),
771 DECLARE_EVENT_CLASS(cdnsp_log_portsc
,
772 TP_PROTO(u32 portnum
, u32 portsc
),
773 TP_ARGS(portnum
, portsc
),
775 __field(u32
, portnum
)
779 __entry
->portnum
= portnum
;
780 __entry
->portsc
= portsc
;
782 TP_printk("port-%d: %s",
784 cdnsp_decode_portsc(__get_buf(CDNSP_MSG_MAX
), CDNSP_MSG_MAX
,
789 DEFINE_EVENT(cdnsp_log_portsc
, cdnsp_handle_port_status
,
790 TP_PROTO(u32 portnum
, u32 portsc
),
791 TP_ARGS(portnum
, portsc
)
794 DEFINE_EVENT(cdnsp_log_portsc
, cdnsp_link_state_changed
,
795 TP_PROTO(u32 portnum
, u32 portsc
),
796 TP_ARGS(portnum
, portsc
)
799 TRACE_EVENT(cdnsp_stream_number
,
800 TP_PROTO(struct cdnsp_ep
*pep
, int num_stream_ctxs
, int num_streams
),
801 TP_ARGS(pep
, num_stream_ctxs
, num_streams
),
803 __string(name
, pep
->name
)
804 __field(int, num_stream_ctxs
)
805 __field(int, num_streams
)
808 __entry
->num_stream_ctxs
= num_stream_ctxs
;
809 __entry
->num_streams
= num_streams
;
811 TP_printk("%s Need %u stream ctx entries for %u stream IDs.",
812 __get_str(name
), __entry
->num_stream_ctxs
,
813 __entry
->num_streams
)
816 #endif /* __CDNSP_TRACE_H */
818 /* this part must be outside header guard */
820 #undef TRACE_INCLUDE_PATH
821 #define TRACE_INCLUDE_PATH .
823 #undef TRACE_INCLUDE_FILE
824 #define TRACE_INCLUDE_FILE cdnsp-trace
826 #include <trace/define_trace.h>