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_ep0,
51 TP_PROTO(struct va_format *vaf),
55 DECLARE_EVENT_CLASS(dwc3_log_event,
62 __entry->event = event;
64 TP_printk("event %08x\n", __entry->event)
67 DEFINE_EVENT(dwc3_log_event, dwc3_event,
72 DECLARE_EVENT_CLASS(dwc3_log_ctrl,
73 TP_PROTO(struct usb_ctrlrequest *ctrl),
76 __field(__u8, bRequestType)
77 __field(__u8, bRequest)
78 __field(__le16, wValue)
79 __field(__le16, wIndex)
80 __field(__le16, wLength)
83 __entry->bRequestType = ctrl->bRequestType;
84 __entry->bRequest = ctrl->bRequest;
85 __entry->wValue = ctrl->wValue;
86 __entry->wIndex = ctrl->wIndex;
87 __entry->wLength = ctrl->wLength;
89 TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
90 __entry->bRequestType, __entry->bRequest,
91 le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex),
92 le16_to_cpu(__entry->wLength)
96 DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
97 TP_PROTO(struct usb_ctrlrequest *ctrl),
101 DECLARE_EVENT_CLASS(dwc3_log_request,
102 TP_PROTO(struct dwc3_request *req),
105 __dynamic_array(char, name, DWC3_MSG_MAX)
106 __field(struct dwc3_request *, req)
107 __field(unsigned, actual)
108 __field(unsigned, length)
112 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name);
114 __entry->actual = req->request.actual;
115 __entry->length = req->request.length;
116 __entry->status = req->request.status;
118 TP_printk("%s: req %p length %u/%u ==> %d",
119 __get_str(name), __entry->req, __entry->actual, __entry->length,
124 DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
125 TP_PROTO(struct dwc3_request *req),
129 DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
130 TP_PROTO(struct dwc3_request *req),
134 DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
135 TP_PROTO(struct dwc3_request *req),
139 DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
140 TP_PROTO(struct dwc3_request *req),
144 DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
145 TP_PROTO(struct dwc3_request *req),
149 DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
150 TP_PROTO(unsigned int cmd, u32 param),
153 __field(unsigned int, cmd)
158 __entry->param = param;
160 TP_printk("cmd '%s' [%d] param %08x\n",
161 dwc3_gadget_generic_cmd_string(__entry->cmd),
162 __entry->cmd, __entry->param
166 DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
167 TP_PROTO(unsigned int cmd, u32 param),
171 DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
172 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
173 struct dwc3_gadget_ep_cmd_params *params),
174 TP_ARGS(dep, cmd, params),
176 __dynamic_array(char, name, DWC3_MSG_MAX)
177 __field(unsigned int, cmd)
178 __field(struct dwc3_gadget_ep_cmd_params *, params)
181 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
183 __entry->params = params;
185 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n",
186 __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
187 __entry->cmd, __entry->params->param0,
188 __entry->params->param1, __entry->params->param2
192 DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
193 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
194 struct dwc3_gadget_ep_cmd_params *params),
195 TP_ARGS(dep, cmd, params)
198 DECLARE_EVENT_CLASS(dwc3_log_trb,
199 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
202 __dynamic_array(char, name, DWC3_MSG_MAX)
203 __field(struct dwc3_trb *, trb)
210 snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name);
212 __entry->bpl = trb->bpl;
213 __entry->bph = trb->bph;
214 __entry->size = trb->size;
215 __entry->ctrl = trb->ctrl;
217 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n",
218 __get_str(name), __entry->trb, __entry->bph, __entry->bpl,
219 __entry->size, __entry->ctrl
223 DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
224 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
228 DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
229 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
233 #endif /* __DWC3_TRACE_H */
235 /* this part has to be here */
237 #undef TRACE_INCLUDE_PATH
238 #define TRACE_INCLUDE_PATH .
240 #undef TRACE_INCLUDE_FILE
241 #define TRACE_INCLUDE_FILE trace
243 #include <trace/define_trace.h>