Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / usb / dwc3 / trace.h
1 /**
2  * trace.h - DesignWare USB3 DRD Controller Trace Support
3  *
4  * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5  *
6  * Author: Felipe Balbi <balbi@ti.com>
7  *
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.
11  *
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.
16  */
17
18 #undef TRACE_SYSTEM
19 #define TRACE_SYSTEM dwc3
20
21 #if !defined(__DWC3_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
22 #define __DWC3_TRACE_H
23
24 #include <linux/types.h>
25 #include <linux/tracepoint.h>
26 #include <asm/byteorder.h>
27 #include "core.h"
28 #include "debug.h"
29
30 DECLARE_EVENT_CLASS(dwc3_log_msg,
31         TP_PROTO(struct va_format *vaf),
32         TP_ARGS(vaf),
33         TP_STRUCT__entry(__dynamic_array(char, msg, DWC3_MSG_MAX)),
34         TP_fast_assign(
35                 vsnprintf(__get_str(msg), DWC3_MSG_MAX, vaf->fmt, *vaf->va);
36         ),
37         TP_printk("%s", __get_str(msg))
38 );
39
40 DEFINE_EVENT(dwc3_log_msg, dwc3_readl,
41         TP_PROTO(struct va_format *vaf),
42         TP_ARGS(vaf)
43 );
44
45 DEFINE_EVENT(dwc3_log_msg, dwc3_writel,
46         TP_PROTO(struct va_format *vaf),
47         TP_ARGS(vaf)
48 );
49
50 DEFINE_EVENT(dwc3_log_msg, dwc3_ep0,
51         TP_PROTO(struct va_format *vaf),
52         TP_ARGS(vaf)
53 );
54
55 DECLARE_EVENT_CLASS(dwc3_log_event,
56         TP_PROTO(u32 event),
57         TP_ARGS(event),
58         TP_STRUCT__entry(
59                 __field(u32, event)
60         ),
61         TP_fast_assign(
62                 __entry->event = event;
63         ),
64         TP_printk("event %08x\n", __entry->event)
65 );
66
67 DEFINE_EVENT(dwc3_log_event, dwc3_event,
68         TP_PROTO(u32 event),
69         TP_ARGS(event)
70 );
71
72 DECLARE_EVENT_CLASS(dwc3_log_ctrl,
73         TP_PROTO(struct usb_ctrlrequest *ctrl),
74         TP_ARGS(ctrl),
75         TP_STRUCT__entry(
76                 __field(struct usb_ctrlrequest *, ctrl)
77         ),
78         TP_fast_assign(
79                 __entry->ctrl = ctrl;
80         ),
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)
85         )
86 );
87
88 DEFINE_EVENT(dwc3_log_ctrl, dwc3_ctrl_req,
89         TP_PROTO(struct usb_ctrlrequest *ctrl),
90         TP_ARGS(ctrl)
91 );
92
93 DECLARE_EVENT_CLASS(dwc3_log_request,
94         TP_PROTO(struct dwc3_request *req),
95         TP_ARGS(req),
96         TP_STRUCT__entry(
97                 __field(struct dwc3_request *, req)
98         ),
99         TP_fast_assign(
100                 __entry->req = req;
101         ),
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
106         )
107 );
108
109 DEFINE_EVENT(dwc3_log_request, dwc3_alloc_request,
110         TP_PROTO(struct dwc3_request *req),
111         TP_ARGS(req)
112 );
113
114 DEFINE_EVENT(dwc3_log_request, dwc3_free_request,
115         TP_PROTO(struct dwc3_request *req),
116         TP_ARGS(req)
117 );
118
119 DEFINE_EVENT(dwc3_log_request, dwc3_ep_queue,
120         TP_PROTO(struct dwc3_request *req),
121         TP_ARGS(req)
122 );
123
124 DEFINE_EVENT(dwc3_log_request, dwc3_ep_dequeue,
125         TP_PROTO(struct dwc3_request *req),
126         TP_ARGS(req)
127 );
128
129 DEFINE_EVENT(dwc3_log_request, dwc3_gadget_giveback,
130         TP_PROTO(struct dwc3_request *req),
131         TP_ARGS(req)
132 );
133
134 DECLARE_EVENT_CLASS(dwc3_log_generic_cmd,
135         TP_PROTO(unsigned int cmd, u32 param),
136         TP_ARGS(cmd, param),
137         TP_STRUCT__entry(
138                 __field(unsigned int, cmd)
139                 __field(u32, param)
140         ),
141         TP_fast_assign(
142                 __entry->cmd = cmd;
143                 __entry->param = param;
144         ),
145         TP_printk("cmd '%s' [%d] param %08x\n",
146                 dwc3_gadget_generic_cmd_string(__entry->cmd),
147                 __entry->cmd, __entry->param
148         )
149 );
150
151 DEFINE_EVENT(dwc3_log_generic_cmd, dwc3_gadget_generic_cmd,
152         TP_PROTO(unsigned int cmd, u32 param),
153         TP_ARGS(cmd, param)
154 );
155
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),
160         TP_STRUCT__entry(
161                 __field(struct dwc3_ep *, dep)
162                 __field(unsigned int, cmd)
163                 __field(struct dwc3_gadget_ep_cmd_params *, params)
164         ),
165         TP_fast_assign(
166                 __entry->dep = dep;
167                 __entry->cmd = cmd;
168                 __entry->params = params;
169         ),
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
174         )
175 );
176
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)
181 );
182
183 DECLARE_EVENT_CLASS(dwc3_log_trb,
184         TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
185         TP_ARGS(dep, trb),
186         TP_STRUCT__entry(
187                 __field(struct dwc3_ep *, dep)
188                 __field(struct dwc3_trb *, trb)
189         ),
190         TP_fast_assign(
191                 __entry->dep = dep;
192                 __entry->trb = trb;
193         ),
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
197         )
198 );
199
200 DEFINE_EVENT(dwc3_log_trb, dwc3_prepare_trb,
201         TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
202         TP_ARGS(dep, trb)
203 );
204
205 DEFINE_EVENT(dwc3_log_trb, dwc3_complete_trb,
206         TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb),
207         TP_ARGS(dep, trb)
208 );
209
210 #endif /* __DWC3_TRACE_H */
211
212 /* this part has to be here */
213
214 #undef TRACE_INCLUDE_PATH
215 #define TRACE_INCLUDE_PATH .
216
217 #undef TRACE_INCLUDE_FILE
218 #define TRACE_INCLUDE_FILE trace
219
220 #include <trace/define_trace.h>