2 * xHCI host controller driver
4 * Copyright (C) 2013 Xenia Ragiadakou
6 * Author: Xenia Ragiadakou
7 * Email : burzalodowa@gmail.com
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
15 #define TRACE_SYSTEM xhci-hcd
17 #if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
18 #define __XHCI_TRACE_H
20 #include <linux/tracepoint.h>
23 #define XHCI_MSG_MAX 500
25 DECLARE_EVENT_CLASS(xhci_log_msg
,
26 TP_PROTO(struct va_format
*vaf
),
28 TP_STRUCT__entry(__dynamic_array(char, msg
, XHCI_MSG_MAX
)),
30 vsnprintf(__get_str(msg
), XHCI_MSG_MAX
, vaf
->fmt
, *vaf
->va
);
32 TP_printk("%s", __get_str(msg
))
35 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_address
,
36 TP_PROTO(struct va_format
*vaf
),
40 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_context_change
,
41 TP_PROTO(struct va_format
*vaf
),
45 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_quirks
,
46 TP_PROTO(struct va_format
*vaf
),
50 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_reset_ep
,
51 TP_PROTO(struct va_format
*vaf
),
55 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_cancel_urb
,
56 TP_PROTO(struct va_format
*vaf
),
60 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_init
,
61 TP_PROTO(struct va_format
*vaf
),
65 DEFINE_EVENT(xhci_log_msg
, xhci_dbg_ring_expansion
,
66 TP_PROTO(struct va_format
*vaf
),
70 DECLARE_EVENT_CLASS(xhci_log_ctx
,
71 TP_PROTO(struct xhci_hcd
*xhci
, struct xhci_container_ctx
*ctx
,
73 TP_ARGS(xhci
, ctx
, ep_num
),
76 __field(unsigned, ctx_type
)
77 __field(dma_addr_t
, ctx_dma
)
79 __field(unsigned, ctx_ep_num
)
81 __dynamic_array(u32
, ctx_data
,
82 ((HCC_64BYTE_CONTEXT(xhci
->hcc_params
) + 1) * 8) *
83 ((ctx
->type
== XHCI_CTX_TYPE_INPUT
) + ep_num
+ 1))
86 struct usb_device
*udev
;
88 udev
= to_usb_device(xhci_to_hcd(xhci
)->self
.controller
);
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
->slot_id
= udev
->slot_id
;
94 __entry
->ctx_ep_num
= ep_num
;
95 memcpy(__get_dynamic_array(ctx_data
), ctx
->bytes
,
96 ((HCC_64BYTE_CONTEXT(xhci
->hcc_params
) + 1) * 32) *
97 ((ctx
->type
== XHCI_CTX_TYPE_INPUT
) + ep_num
+ 1));
99 TP_printk("\nctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p",
100 __entry
->ctx_64
, __entry
->ctx_type
,
101 (unsigned long long) __entry
->ctx_dma
, __entry
->ctx_va
105 DEFINE_EVENT(xhci_log_ctx
, xhci_address_ctx
,
106 TP_PROTO(struct xhci_hcd
*xhci
, struct xhci_container_ctx
*ctx
,
107 unsigned int ep_num
),
108 TP_ARGS(xhci
, ctx
, ep_num
)
111 DECLARE_EVENT_CLASS(xhci_log_event
,
112 TP_PROTO(void *trb_va
, struct xhci_generic_trb
*ev
),
119 __dynamic_array(u8
, trb
, sizeof(struct xhci_generic_trb
))
122 __entry
->va
= trb_va
;
123 __entry
->dma
= ((u64
)le32_to_cpu(ev
->field
[1])) << 32 |
124 le32_to_cpu(ev
->field
[0]);
125 __entry
->status
= le32_to_cpu(ev
->field
[2]);
126 __entry
->flags
= le32_to_cpu(ev
->field
[3]);
127 memcpy(__get_dynamic_array(trb
), trb_va
,
128 sizeof(struct xhci_generic_trb
));
130 TP_printk("\ntrb_dma=@%llx, trb_va=@%p, status=%08x, flags=%08x",
131 (unsigned long long) __entry
->dma
, __entry
->va
,
132 __entry
->status
, __entry
->flags
136 DEFINE_EVENT(xhci_log_event
, xhci_cmd_completion
,
137 TP_PROTO(void *trb_va
, struct xhci_generic_trb
*ev
),
141 #endif /* __XHCI_TRACE_H */
143 /* this part must be outside header guard */
145 #undef TRACE_INCLUDE_PATH
146 #define TRACE_INCLUDE_PATH .
148 #undef TRACE_INCLUDE_FILE
149 #define TRACE_INCLUDE_FILE xhci-trace
151 #include <trace/define_trace.h>