1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
/*
* musb_trace.h - MUSB Controller Trace Support
*
* Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
*
* Author: Bin Liu <b-liu@ti.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM musb
#if !defined(__MUSB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define __MUSB_TRACE_H
#include <linux/types.h>
#include <linux/tracepoint.h>
#include <linux/usb.h>
#include "musb_core.h"
#define MUSB_MSG_MAX 500
TRACE_EVENT(musb_log,
TP_PROTO(struct musb *musb, struct va_format *vaf),
TP_ARGS(musb, vaf),
TP_STRUCT__entry(
__string(name, dev_name(musb->controller))
__dynamic_array(char, msg, MUSB_MSG_MAX)
),
TP_fast_assign(
__assign_str(name, dev_name(musb->controller));
vsnprintf(__get_str(msg), MUSB_MSG_MAX, vaf->fmt, *vaf->va);
),
TP_printk("%s: %s", __get_str(name), __get_str(msg))
);
DECLARE_EVENT_CLASS(musb_regb,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
TP_ARGS(caller, addr, offset, data),
TP_STRUCT__entry(
__field(void *, caller)
__field(const void *, addr)
__field(unsigned int, offset)
__field(u8, data)
),
TP_fast_assign(
__entry->caller = caller;
__entry->addr = addr;
__entry->offset = offset;
__entry->data = data;
),
TP_printk("%pS: %p + %04x: %02x",
__entry->caller, __entry->addr, __entry->offset, __entry->data)
);
DEFINE_EVENT(musb_regb, musb_readb,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
TP_ARGS(caller, addr, offset, data)
);
DEFINE_EVENT(musb_regb, musb_writeb,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u8 data),
TP_ARGS(caller, addr, offset, data)
);
DECLARE_EVENT_CLASS(musb_regw,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
TP_ARGS(caller, addr, offset, data),
TP_STRUCT__entry(
__field(void *, caller)
__field(const void *, addr)
__field(unsigned int, offset)
__field(u16, data)
),
TP_fast_assign(
__entry->caller = caller;
__entry->addr = addr;
__entry->offset = offset;
__entry->data = data;
),
TP_printk("%pS: %p + %04x: %04x",
__entry->caller, __entry->addr, __entry->offset, __entry->data)
);
DEFINE_EVENT(musb_regw, musb_readw,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
TP_ARGS(caller, addr, offset, data)
);
DEFINE_EVENT(musb_regw, musb_writew,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u16 data),
TP_ARGS(caller, addr, offset, data)
);
DECLARE_EVENT_CLASS(musb_regl,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
TP_ARGS(caller, addr, offset, data),
TP_STRUCT__entry(
__field(void *, caller)
__field(const void *, addr)
__field(unsigned int, offset)
__field(u32, data)
),
TP_fast_assign(
__entry->caller = caller;
__entry->addr = addr;
__entry->offset = offset;
__entry->data = data;
),
TP_printk("%pS: %p + %04x: %08x",
__entry->caller, __entry->addr, __entry->offset, __entry->data)
);
DEFINE_EVENT(musb_regl, musb_readl,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
TP_ARGS(caller, addr, offset, data)
);
DEFINE_EVENT(musb_regl, musb_writel,
TP_PROTO(void *caller, const void *addr, unsigned int offset, u32 data),
TP_ARGS(caller, addr, offset, data)
);
TRACE_EVENT(musb_isr,
TP_PROTO(struct musb *musb),
TP_ARGS(musb),
TP_STRUCT__entry(
__string(name, dev_name(musb->controller))
__field(u8, int_usb)
__field(u16, int_tx)
__field(u16, int_rx)
),
TP_fast_assign(
__assign_str(name, dev_name(musb->controller));
__entry->int_usb = musb->int_usb;
__entry->int_tx = musb->int_tx;
__entry->int_rx = musb->int_rx;
),
TP_printk("%s: usb %02x, tx %04x, rx %04x",
__get_str(name), __entry->int_usb,
__entry->int_tx, __entry->int_rx
)
);
DECLARE_EVENT_CLASS(musb_urb,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb),
TP_STRUCT__entry(
__string(name, dev_name(musb->controller))
__field(struct urb *, urb)
__field(unsigned int, pipe)
__field(int, status)
__field(unsigned int, flag)
__field(u32, buf_len)
__field(u32, actual_len)
),
TP_fast_assign(
__assign_str(name, dev_name(musb->controller));
__entry->urb = urb;
__entry->pipe = urb->pipe;
__entry->status = urb->status;
__entry->flag = urb->transfer_flags;
__entry->buf_len = urb->transfer_buffer_length;
__entry->actual_len = urb->actual_length;
),
TP_printk("%s: %p, dev%d ep%d%s, flag 0x%x, len %d/%d, status %d",
__get_str(name), __entry->urb,
usb_pipedevice(__entry->pipe),
usb_pipeendpoint(__entry->pipe),
usb_pipein(__entry->pipe) ? "in" : "out",
__entry->flag,
__entry->actual_len, __entry->buf_len,
__entry->status
)
);
DEFINE_EVENT(musb_urb, musb_urb_start,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb)
);
DEFINE_EVENT(musb_urb, musb_urb_gb,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb)
);
DEFINE_EVENT(musb_urb, musb_urb_rx,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb)
);
DEFINE_EVENT(musb_urb, musb_urb_tx,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb)
);
DEFINE_EVENT(musb_urb, musb_urb_enq,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb)
);
DEFINE_EVENT(musb_urb, musb_urb_deq,
TP_PROTO(struct musb *musb, struct urb *urb),
TP_ARGS(musb, urb)
);
DECLARE_EVENT_CLASS(musb_req,
TP_PROTO(struct musb_request *req),
TP_ARGS(req),
TP_STRUCT__entry(
__field(struct usb_request *, req)
__field(u8, is_tx)
__field(u8, epnum)
__field(int, status)
__field(unsigned int, buf_len)
__field(unsigned int, actual_len)
__field(unsigned int, zero)
__field(unsigned int, short_not_ok)
__field(unsigned int, no_interrupt)
),
TP_fast_assign(
__entry->req = &req->request;
__entry->is_tx = req->tx;
__entry->epnum = req->epnum;
__entry->status = req->request.status;
__entry->buf_len = req->request.length;
__entry->actual_len = req->request.actual;
__entry->zero = req->request.zero;
__entry->short_not_ok = req->request.short_not_ok;
__entry->no_interrupt = req->request.no_interrupt;
),
TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d",
__entry->req, __entry->epnum,
__entry->is_tx ? "tx/IN" : "rx/OUT",
__entry->zero ? "Z" : "z",
__entry->short_not_ok ? "S" : "s",
__entry->no_interrupt ? "I" : "i",
__entry->actual_len, __entry->buf_len,
__entry->status
)
);
DEFINE_EVENT(musb_req, musb_req_gb,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_tx,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_rx,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_alloc,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_free,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_start,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_enq,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
DEFINE_EVENT(musb_req, musb_req_deq,
TP_PROTO(struct musb_request *req),
TP_ARGS(req)
);
#endif /* __MUSB_TRACE_H */
/* this part has to be here */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE musb_trace
#include <trace/define_trace.h>
|