2 * trace.h - DesignWare USB3 DRD Controller Trace Support
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.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(struct usb_ctrlrequest *, ctrl)
81 TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d",
82 __entry->ctrl->bRequestType, __entry->ctrl->bRequest,
83 le16_to_cpu(__entry->ctrl->wValue), le16_to_cpu(__entry->ctrl->wIndex),
84 le16_to_cpu(__entry->ctrl->wLength)
88 DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
89 TP_PROTO(struct usb_ctrlrequest *ctrl),
93 DECLARE_EVENT_CLASS(dwc3_log_request,
94 TP_PROTO(struct dwc3_request *req),
97 __field(struct dwc3_request *, req)
102 TP_printk("%s: req %p length %u/%u ==> %d",
103 __entry->req->dep->name, __entry->req,
104 __entry->req->request.actual, __entry->req->request.length,
105 __entry->req->request.status
109 DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
110 TP_PROTO(struct dwc3_request *req),
114 DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
115 TP_PROTO(struct dwc3_request *req),
119 DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
120 TP_PROTO(struct dwc3_request *req),
124 DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
125 TP_PROTO(struct dwc3_request *req),
129 DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
130 TP_PROTO(struct dwc3_request *req),
134 DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
135 TP_PROTO(unsigned int cmd, u32 param),
138 __field(unsigned int, cmd)
143 __entry->param = param;
145 TP_printk("cmd '%s' [%d] param %08x\n",
146 dwc3_gadget_generic_cmd_string(__entry->cmd),
147 __entry->cmd, __entry->param
151 DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
152 TP_PROTO(unsigned int cmd, u32 param),
156 DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
157 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
158 struct dwc3_gadget_ep_cmd_params *params),
159 TP_ARGS(dep, cmd, params),
161 __field(struct dwc3_ep *, dep)
162 __field(unsigned int, cmd)
163 __field(struct dwc3_gadget_ep_cmd_params *, params)
168 __entry->params = params;
170 TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n",
171 __entry->dep->name, dwc3_gadget_ep_cmd_string(__entry->cmd),
172 __entry->cmd, __entry->params->param0,
173 __entry->params->param1, __entry->params->param2
177 DEFINE_EVENT(dwc3_log_gadget_ep_cmd, dwc3_gadget_ep_cmd,
178 TP_PROTO(struct dwc3_ep *dep, unsigned int cmd,
179 struct dwc3_gadget_ep_cmd_params *params),
180 TP_ARGS(dep, cmd, params)
183 DECLARE_EVENT_CLASS(dwc3_log_trb,
184 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
187 __field(struct dwc3_ep *, dep)
188 __field(struct dwc3_trb *, trb)
194 TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n",
195 __entry->dep->name, __entry->trb, __entry->trb->bph,
196 __entry->trb->bpl, __entry->trb->size, __entry->trb->ctrl
200 DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
201 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
205 DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
206 TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
210 #endif /* __DWC3_TRACE_H */
212 /* this part has to be here */
214 #undef TRACE_INCLUDE_PATH
215 #define TRACE_INCLUDE_PATH .
217 #undef TRACE_INCLUDE_FILE
218 #define TRACE_INCLUDE_FILE trace
220 #include <trace/define_trace.h>