2 * trace.h - DesignWare USB3 DRD Controller Trace Support
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
6 * Author: Felipe Balbi <balbi@ti.com>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 of
10 * the License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
19 #define TRACE_SYSTEM dwc3
21 #if !defined(__DWC3_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
22 #define __DWC3_TRACE_H
24 #include <linux/types.h>
25 #include <linux/tracepoint.h>
26 #include <asm/byteorder.h>
30 DECLARE_EVENT_CLASS(dwc3_log_msg
,
31 TP_PROTO(struct va_format
*vaf
),
33 TP_STRUCT__entry(__dynamic_array(char, msg
, DWC3_MSG_MAX
)),
35 vsnprintf(__get_str(msg
), DWC3_MSG_MAX
, vaf
->fmt
, *vaf
->va
);
37 TP_printk("%s", __get_str(msg
))
40 DEFINE_EVENT(dwc3_log_msg
, dwc3_readl
,
41 TP_PROTO(struct va_format
*vaf
),
45 DEFINE_EVENT(dwc3_log_msg
, dwc3_writel
,
46 TP_PROTO(struct va_format
*vaf
),
50 DEFINE_EVENT(dwc3_log_msg
, dwc3_gadget
,
51 TP_PROTO(struct va_format
*vaf
),
55 DEFINE_EVENT(dwc3_log_msg
, dwc3_core
,
56 TP_PROTO(struct va_format
*vaf
),
60 DEFINE_EVENT(dwc3_log_msg
, dwc3_ep0
,
61 TP_PROTO(struct va_format
*vaf
),
65 DECLARE_EVENT_CLASS(dwc3_log_event
,
72 __entry
->event
= event
;
74 TP_printk("event %08x", __entry
->event
)
77 DEFINE_EVENT(dwc3_log_event
, dwc3_event
,
82 DECLARE_EVENT_CLASS(dwc3_log_ctrl
,
83 TP_PROTO(struct usb_ctrlrequest
*ctrl
),
86 __field(__u8
, bRequestType
)
87 __field(__u8
, bRequest
)
88 __field(__le16
, wValue
)
89 __field(__le16
, wIndex
)
90 __field(__le16
, wLength
)
93 __entry
->bRequestType
= ctrl
->bRequestType
;
94 __entry
->bRequest
= ctrl
->bRequest
;
95 __entry
->wValue
= ctrl
->wValue
;
96 __entry
->wIndex
= ctrl
->wIndex
;
97 __entry
->wLength
= ctrl
->wLength
;
99 TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
100 __entry
->bRequestType
, __entry
->bRequest
,
101 le16_to_cpu(__entry
->wValue
), le16_to_cpu(__entry
->wIndex
),
102 le16_to_cpu(__entry
->wLength
)
106 DEFINE_EVENT(dwc3_log_ctrl
, dwc3_ctrl_req
,
107 TP_PROTO(struct usb_ctrlrequest
*ctrl
),
111 DECLARE_EVENT_CLASS(dwc3_log_request
,
112 TP_PROTO(struct dwc3_request
*req
),
115 __dynamic_array(char, name
, DWC3_MSG_MAX
)
116 __field(struct dwc3_request
*, req
)
117 __field(unsigned, actual
)
118 __field(unsigned, length
)
122 snprintf(__get_str(name
), DWC3_MSG_MAX
, "%s", req
->dep
->name
);
124 __entry
->actual
= req
->request
.actual
;
125 __entry
->length
= req
->request
.length
;
126 __entry
->status
= req
->request
.status
;
128 TP_printk("%s: req %p length %u/%u ==> %d",
129 __get_str(name
), __entry
->req
, __entry
->actual
, __entry
->length
,
134 DEFINE_EVENT(dwc3_log_request
, dwc3_alloc_request
,
135 TP_PROTO(struct dwc3_request
*req
),
139 DEFINE_EVENT(dwc3_log_request
, dwc3_free_request
,
140 TP_PROTO(struct dwc3_request
*req
),
144 DEFINE_EVENT(dwc3_log_request
, dwc3_ep_queue
,
145 TP_PROTO(struct dwc3_request
*req
),
149 DEFINE_EVENT(dwc3_log_request
, dwc3_ep_dequeue
,
150 TP_PROTO(struct dwc3_request
*req
),
154 DEFINE_EVENT(dwc3_log_request
, dwc3_gadget_giveback
,
155 TP_PROTO(struct dwc3_request
*req
),
159 DECLARE_EVENT_CLASS(dwc3_log_generic_cmd
,
160 TP_PROTO(unsigned int cmd
, u32 param
),
163 __field(unsigned int, cmd
)
168 __entry
->param
= param
;
170 TP_printk("cmd '%s' [%d] param %08x",
171 dwc3_gadget_generic_cmd_string(__entry
->cmd
),
172 __entry
->cmd
, __entry
->param
176 DEFINE_EVENT(dwc3_log_generic_cmd
, dwc3_gadget_generic_cmd
,
177 TP_PROTO(unsigned int cmd
, u32 param
),
181 DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd
,
182 TP_PROTO(struct dwc3_ep
*dep
, unsigned int cmd
,
183 struct dwc3_gadget_ep_cmd_params
*params
),
184 TP_ARGS(dep
, cmd
, params
),
186 __dynamic_array(char, name
, DWC3_MSG_MAX
)
187 __field(unsigned int, cmd
)
193 snprintf(__get_str(name
), DWC3_MSG_MAX
, "%s", dep
->name
);
195 __entry
->param0
= params
->param0
;
196 __entry
->param1
= params
->param1
;
197 __entry
->param2
= params
->param2
;
199 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x",
200 __get_str(name
), dwc3_gadget_ep_cmd_string(__entry
->cmd
),
201 __entry
->cmd
, __entry
->param0
,
202 __entry
->param1
, __entry
->param2
206 DEFINE_EVENT(dwc3_log_gadget_ep_cmd
, dwc3_gadget_ep_cmd
,
207 TP_PROTO(struct dwc3_ep
*dep
, unsigned int cmd
,
208 struct dwc3_gadget_ep_cmd_params
*params
),
209 TP_ARGS(dep
, cmd
, params
)
212 DECLARE_EVENT_CLASS(dwc3_log_trb
,
213 TP_PROTO(struct dwc3_ep
*dep
, struct dwc3_trb
*trb
),
216 __dynamic_array(char, name
, DWC3_MSG_MAX
)
217 __field(struct dwc3_trb
*, trb
)
224 snprintf(__get_str(name
), DWC3_MSG_MAX
, "%s", dep
->name
);
226 __entry
->bpl
= trb
->bpl
;
227 __entry
->bph
= trb
->bph
;
228 __entry
->size
= trb
->size
;
229 __entry
->ctrl
= trb
->ctrl
;
231 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x",
232 __get_str(name
), __entry
->trb
, __entry
->bph
, __entry
->bpl
,
233 __entry
->size
, __entry
->ctrl
237 DEFINE_EVENT(dwc3_log_trb
, dwc3_prepare_trb
,
238 TP_PROTO(struct dwc3_ep
*dep
, struct dwc3_trb
*trb
),
242 DEFINE_EVENT(dwc3_log_trb
, dwc3_complete_trb
,
243 TP_PROTO(struct dwc3_ep
*dep
, struct dwc3_trb
*trb
),
247 #endif /* __DWC3_TRACE_H */
249 /* this part has to be here */
251 #undef TRACE_INCLUDE_PATH
252 #define TRACE_INCLUDE_PATH .
254 #undef TRACE_INCLUDE_FILE
255 #define TRACE_INCLUDE_FILE trace
257 #include <trace/define_trace.h>