]>
Commit | Line | Data |
---|---|---|
bb5d2db5 RC |
1 | /****************************************************************************** |
2 | * | |
fb4961db | 3 | * Copyright(c) 2009 - 2012 Intel Corporation. All rights reserved. |
bb5d2db5 RC |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of version 2 of the GNU General Public License as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
15 | * this program; if not, write to the Free Software Foundation, Inc., | |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | |
17 | * | |
18 | * The full GNU General Public License is included in this distribution in the | |
19 | * file called LICENSE. | |
20 | * | |
21 | * Contact Information: | |
22 | * Intel Linux Wireless <ilw@linux.intel.com> | |
23 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | |
24 | * | |
25 | *****************************************************************************/ | |
26 | ||
be1a71a1 JB |
27 | #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) |
28 | #define __IWLWIFI_DEVICE_TRACE | |
29 | ||
30 | #include <linux/tracepoint.h> | |
be1a71a1 | 31 | |
83ed9015 | 32 | |
be1a71a1 JB |
33 | #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) |
34 | #undef TRACE_EVENT | |
35 | #define TRACE_EVENT(name, proto, ...) \ | |
36 | static inline void trace_ ## name(proto) {} | |
2655e314 JB |
37 | #undef DECLARE_EVENT_CLASS |
38 | #define DECLARE_EVENT_CLASS(...) | |
39 | #undef DEFINE_EVENT | |
40 | #define DEFINE_EVENT(evt_class, name, proto, ...) \ | |
41 | static inline void trace_ ## name(proto) {} | |
be1a71a1 JB |
42 | #endif |
43 | ||
6c1011e1 JB |
44 | #define DEV_ENTRY __string(dev, dev_name(dev)) |
45 | #define DEV_ASSIGN __assign_str(dev, dev_name(dev)) | |
be1a71a1 JB |
46 | |
47 | #undef TRACE_SYSTEM | |
0fd95afc | 48 | #define TRACE_SYSTEM iwlwifi_io |
be1a71a1 JB |
49 | |
50 | TRACE_EVENT(iwlwifi_dev_ioread32, | |
6c1011e1 JB |
51 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
52 | TP_ARGS(dev, offs, val), | |
be1a71a1 | 53 | TP_STRUCT__entry( |
6c1011e1 | 54 | DEV_ENTRY |
be1a71a1 JB |
55 | __field(u32, offs) |
56 | __field(u32, val) | |
57 | ), | |
58 | TP_fast_assign( | |
6c1011e1 | 59 | DEV_ASSIGN; |
be1a71a1 JB |
60 | __entry->offs = offs; |
61 | __entry->val = val; | |
62 | ), | |
6c1011e1 JB |
63 | TP_printk("[%s] read io[%#x] = %#x", |
64 | __get_str(dev), __entry->offs, __entry->val) | |
be1a71a1 JB |
65 | ); |
66 | ||
4e03185f | 67 | TRACE_EVENT(iwlwifi_dev_iowrite8, |
6c1011e1 JB |
68 | TP_PROTO(const struct device *dev, u32 offs, u8 val), |
69 | TP_ARGS(dev, offs, val), | |
4e03185f | 70 | TP_STRUCT__entry( |
6c1011e1 | 71 | DEV_ENTRY |
4e03185f BC |
72 | __field(u32, offs) |
73 | __field(u8, val) | |
74 | ), | |
75 | TP_fast_assign( | |
6c1011e1 | 76 | DEV_ASSIGN; |
4e03185f BC |
77 | __entry->offs = offs; |
78 | __entry->val = val; | |
79 | ), | |
6c1011e1 JB |
80 | TP_printk("[%s] write io[%#x] = %#x)", |
81 | __get_str(dev), __entry->offs, __entry->val) | |
4e03185f BC |
82 | ); |
83 | ||
be1a71a1 | 84 | TRACE_EVENT(iwlwifi_dev_iowrite32, |
6c1011e1 JB |
85 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
86 | TP_ARGS(dev, offs, val), | |
be1a71a1 | 87 | TP_STRUCT__entry( |
6c1011e1 | 88 | DEV_ENTRY |
be1a71a1 JB |
89 | __field(u32, offs) |
90 | __field(u32, val) | |
91 | ), | |
92 | TP_fast_assign( | |
6c1011e1 | 93 | DEV_ASSIGN; |
be1a71a1 JB |
94 | __entry->offs = offs; |
95 | __entry->val = val; | |
96 | ), | |
6c1011e1 JB |
97 | TP_printk("[%s] write io[%#x] = %#x)", |
98 | __get_str(dev), __entry->offs, __entry->val) | |
be1a71a1 JB |
99 | ); |
100 | ||
b80667ee | 101 | TRACE_EVENT(iwlwifi_dev_irq, |
6c1011e1 JB |
102 | TP_PROTO(const struct device *dev), |
103 | TP_ARGS(dev), | |
b80667ee | 104 | TP_STRUCT__entry( |
6c1011e1 | 105 | DEV_ENTRY |
b80667ee JB |
106 | ), |
107 | TP_fast_assign( | |
6c1011e1 | 108 | DEV_ASSIGN; |
b80667ee JB |
109 | ), |
110 | /* TP_printk("") doesn't compile */ | |
111 | TP_printk("%d", 0) | |
112 | ); | |
113 | ||
114 | TRACE_EVENT(iwlwifi_dev_ict_read, | |
6c1011e1 JB |
115 | TP_PROTO(const struct device *dev, u32 index, u32 value), |
116 | TP_ARGS(dev, index, value), | |
b80667ee | 117 | TP_STRUCT__entry( |
6c1011e1 | 118 | DEV_ENTRY |
b80667ee JB |
119 | __field(u32, index) |
120 | __field(u32, value) | |
121 | ), | |
122 | TP_fast_assign( | |
6c1011e1 | 123 | DEV_ASSIGN; |
b80667ee JB |
124 | __entry->index = index; |
125 | __entry->value = value; | |
126 | ), | |
6c1011e1 JB |
127 | TP_printk("[%s] read ict[%d] = %#.8x", |
128 | __get_str(dev), __entry->index, __entry->value) | |
b80667ee JB |
129 | ); |
130 | ||
a9e1cb6a WYG |
131 | #undef TRACE_SYSTEM |
132 | #define TRACE_SYSTEM iwlwifi_ucode | |
133 | ||
134 | TRACE_EVENT(iwlwifi_dev_ucode_cont_event, | |
6c1011e1 JB |
135 | TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), |
136 | TP_ARGS(dev, time, data, ev), | |
a9e1cb6a | 137 | TP_STRUCT__entry( |
6c1011e1 | 138 | DEV_ENTRY |
a9e1cb6a WYG |
139 | |
140 | __field(u32, time) | |
141 | __field(u32, data) | |
142 | __field(u32, ev) | |
143 | ), | |
144 | TP_fast_assign( | |
6c1011e1 | 145 | DEV_ASSIGN; |
a9e1cb6a WYG |
146 | __entry->time = time; |
147 | __entry->data = data; | |
148 | __entry->ev = ev; | |
149 | ), | |
6c1011e1 JB |
150 | TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", |
151 | __get_str(dev), __entry->time, __entry->data, __entry->ev) | |
a9e1cb6a WYG |
152 | ); |
153 | ||
154 | TRACE_EVENT(iwlwifi_dev_ucode_wrap_event, | |
6c1011e1 JB |
155 | TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry), |
156 | TP_ARGS(dev, wraps, n_entry, p_entry), | |
a9e1cb6a | 157 | TP_STRUCT__entry( |
6c1011e1 | 158 | DEV_ENTRY |
a9e1cb6a WYG |
159 | |
160 | __field(u32, wraps) | |
161 | __field(u32, n_entry) | |
162 | __field(u32, p_entry) | |
163 | ), | |
164 | TP_fast_assign( | |
6c1011e1 | 165 | DEV_ASSIGN; |
a9e1cb6a WYG |
166 | __entry->wraps = wraps; |
167 | __entry->n_entry = n_entry; | |
168 | __entry->p_entry = p_entry; | |
169 | ), | |
6c1011e1 JB |
170 | TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X", |
171 | __get_str(dev), __entry->wraps, __entry->n_entry, | |
a9e1cb6a WYG |
172 | __entry->p_entry) |
173 | ); | |
174 | ||
2655e314 JB |
175 | #undef TRACE_SYSTEM |
176 | #define TRACE_SYSTEM iwlwifi_msg | |
177 | ||
178 | #define MAX_MSG_LEN 100 | |
179 | ||
180 | DECLARE_EVENT_CLASS(iwlwifi_msg_event, | |
181 | TP_PROTO(struct va_format *vaf), | |
182 | TP_ARGS(vaf), | |
183 | TP_STRUCT__entry( | |
184 | __dynamic_array(char, msg, MAX_MSG_LEN) | |
185 | ), | |
186 | TP_fast_assign( | |
187 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | |
188 | MAX_MSG_LEN, vaf->fmt, | |
189 | *vaf->va) >= MAX_MSG_LEN); | |
190 | ), | |
191 | TP_printk("%s", (char *)__get_dynamic_array(msg)) | |
192 | ); | |
193 | ||
194 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err, | |
195 | TP_PROTO(struct va_format *vaf), | |
196 | TP_ARGS(vaf) | |
197 | ); | |
198 | ||
199 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn, | |
200 | TP_PROTO(struct va_format *vaf), | |
201 | TP_ARGS(vaf) | |
202 | ); | |
203 | ||
204 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info, | |
205 | TP_PROTO(struct va_format *vaf), | |
206 | TP_ARGS(vaf) | |
207 | ); | |
208 | ||
209 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit, | |
210 | TP_PROTO(struct va_format *vaf), | |
211 | TP_ARGS(vaf) | |
212 | ); | |
213 | ||
214 | TRACE_EVENT(iwlwifi_dbg, | |
215 | TP_PROTO(u32 level, bool in_interrupt, const char *function, | |
216 | struct va_format *vaf), | |
217 | TP_ARGS(level, in_interrupt, function, vaf), | |
218 | TP_STRUCT__entry( | |
219 | __field(u32, level) | |
220 | __field(u8, in_interrupt) | |
221 | __string(function, function) | |
222 | __dynamic_array(char, msg, MAX_MSG_LEN) | |
223 | ), | |
224 | TP_fast_assign( | |
225 | __entry->level = level; | |
226 | __entry->in_interrupt = in_interrupt; | |
227 | __assign_str(function, function); | |
228 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | |
229 | MAX_MSG_LEN, vaf->fmt, | |
230 | *vaf->va) >= MAX_MSG_LEN); | |
231 | ), | |
232 | TP_printk("%s", (char *)__get_dynamic_array(msg)) | |
233 | ); | |
234 | ||
0fd95afc JB |
235 | #undef TRACE_SYSTEM |
236 | #define TRACE_SYSTEM iwlwifi | |
237 | ||
be1a71a1 | 238 | TRACE_EVENT(iwlwifi_dev_hcmd, |
6c1011e1 | 239 | TP_PROTO(const struct device *dev, u32 flags, |
4ce7cc2b JB |
240 | const void *hcmd0, size_t len0, |
241 | const void *hcmd1, size_t len1, | |
242 | const void *hcmd2, size_t len2), | |
6c1011e1 | 243 | TP_ARGS(dev, flags, hcmd0, len0, hcmd1, len1, hcmd2, len2), |
be1a71a1 | 244 | TP_STRUCT__entry( |
6c1011e1 | 245 | DEV_ENTRY |
4ce7cc2b JB |
246 | __dynamic_array(u8, hcmd0, len0) |
247 | __dynamic_array(u8, hcmd1, len1) | |
248 | __dynamic_array(u8, hcmd2, len2) | |
be1a71a1 JB |
249 | __field(u32, flags) |
250 | ), | |
251 | TP_fast_assign( | |
6c1011e1 | 252 | DEV_ASSIGN; |
4ce7cc2b JB |
253 | memcpy(__get_dynamic_array(hcmd0), hcmd0, len0); |
254 | memcpy(__get_dynamic_array(hcmd1), hcmd1, len1); | |
255 | memcpy(__get_dynamic_array(hcmd2), hcmd2, len2); | |
be1a71a1 JB |
256 | __entry->flags = flags; |
257 | ), | |
6c1011e1 JB |
258 | TP_printk("[%s] hcmd %#.2x (%ssync)", |
259 | __get_str(dev), ((u8 *)__get_dynamic_array(hcmd0))[0], | |
be1a71a1 JB |
260 | __entry->flags & CMD_ASYNC ? "a" : "") |
261 | ); | |
262 | ||
263 | TRACE_EVENT(iwlwifi_dev_rx, | |
6c1011e1 JB |
264 | TP_PROTO(const struct device *dev, void *rxbuf, size_t len), |
265 | TP_ARGS(dev, rxbuf, len), | |
be1a71a1 | 266 | TP_STRUCT__entry( |
6c1011e1 | 267 | DEV_ENTRY |
be1a71a1 JB |
268 | __dynamic_array(u8, rxbuf, len) |
269 | ), | |
270 | TP_fast_assign( | |
6c1011e1 | 271 | DEV_ASSIGN; |
be1a71a1 JB |
272 | memcpy(__get_dynamic_array(rxbuf), rxbuf, len); |
273 | ), | |
6c1011e1 JB |
274 | TP_printk("[%s] RX cmd %#.2x", |
275 | __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4]) | |
be1a71a1 JB |
276 | ); |
277 | ||
278 | TRACE_EVENT(iwlwifi_dev_tx, | |
6c1011e1 | 279 | TP_PROTO(const struct device *dev, void *tfd, size_t tfdlen, |
be1a71a1 JB |
280 | void *buf0, size_t buf0_len, |
281 | void *buf1, size_t buf1_len), | |
6c1011e1 | 282 | TP_ARGS(dev, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), |
be1a71a1 | 283 | TP_STRUCT__entry( |
6c1011e1 | 284 | DEV_ENTRY |
be1a71a1 JB |
285 | |
286 | __field(size_t, framelen) | |
287 | __dynamic_array(u8, tfd, tfdlen) | |
288 | ||
289 | /* | |
290 | * Do not insert between or below these items, | |
291 | * we want to keep the frame together (except | |
292 | * for the possible padding). | |
293 | */ | |
294 | __dynamic_array(u8, buf0, buf0_len) | |
295 | __dynamic_array(u8, buf1, buf1_len) | |
296 | ), | |
297 | TP_fast_assign( | |
6c1011e1 | 298 | DEV_ASSIGN; |
be1a71a1 JB |
299 | __entry->framelen = buf0_len + buf1_len; |
300 | memcpy(__get_dynamic_array(tfd), tfd, tfdlen); | |
301 | memcpy(__get_dynamic_array(buf0), buf0, buf0_len); | |
e95b7435 | 302 | memcpy(__get_dynamic_array(buf1), buf1, buf1_len); |
be1a71a1 | 303 | ), |
6c1011e1 JB |
304 | TP_printk("[%s] TX %.2x (%zu bytes)", |
305 | __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0], | |
be1a71a1 JB |
306 | __entry->framelen) |
307 | ); | |
308 | ||
309 | TRACE_EVENT(iwlwifi_dev_ucode_error, | |
6c1011e1 | 310 | TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low, |
be1a71a1 | 311 | u32 data1, u32 data2, u32 line, u32 blink1, |
50650547 WYG |
312 | u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time, |
313 | u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver, | |
314 | u32 brd_ver), | |
6c1011e1 | 315 | TP_ARGS(dev, desc, tsf_low, data1, data2, line, |
50650547 WYG |
316 | blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2, |
317 | gp3, ucode_ver, hw_ver, brd_ver), | |
be1a71a1 | 318 | TP_STRUCT__entry( |
6c1011e1 | 319 | DEV_ENTRY |
be1a71a1 | 320 | __field(u32, desc) |
50650547 | 321 | __field(u32, tsf_low) |
be1a71a1 JB |
322 | __field(u32, data1) |
323 | __field(u32, data2) | |
324 | __field(u32, line) | |
325 | __field(u32, blink1) | |
326 | __field(u32, blink2) | |
327 | __field(u32, ilink1) | |
328 | __field(u32, ilink2) | |
50650547 WYG |
329 | __field(u32, bcon_time) |
330 | __field(u32, gp1) | |
331 | __field(u32, gp2) | |
332 | __field(u32, gp3) | |
333 | __field(u32, ucode_ver) | |
334 | __field(u32, hw_ver) | |
335 | __field(u32, brd_ver) | |
be1a71a1 JB |
336 | ), |
337 | TP_fast_assign( | |
6c1011e1 | 338 | DEV_ASSIGN; |
be1a71a1 | 339 | __entry->desc = desc; |
50650547 | 340 | __entry->tsf_low = tsf_low; |
be1a71a1 JB |
341 | __entry->data1 = data1; |
342 | __entry->data2 = data2; | |
343 | __entry->line = line; | |
344 | __entry->blink1 = blink1; | |
345 | __entry->blink2 = blink2; | |
346 | __entry->ilink1 = ilink1; | |
347 | __entry->ilink2 = ilink2; | |
50650547 WYG |
348 | __entry->bcon_time = bcon_time; |
349 | __entry->gp1 = gp1; | |
350 | __entry->gp2 = gp2; | |
351 | __entry->gp3 = gp3; | |
352 | __entry->ucode_ver = ucode_ver; | |
353 | __entry->hw_ver = hw_ver; | |
354 | __entry->brd_ver = brd_ver; | |
be1a71a1 | 355 | ), |
6c1011e1 | 356 | TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, " |
50650547 WYG |
357 | "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X " |
358 | "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X " | |
359 | "hw 0x%08X brd 0x%08X", | |
6c1011e1 | 360 | __get_str(dev), __entry->desc, __entry->tsf_low, |
50650547 | 361 | __entry->data1, |
be1a71a1 | 362 | __entry->data2, __entry->line, __entry->blink1, |
50650547 WYG |
363 | __entry->blink2, __entry->ilink1, __entry->ilink2, |
364 | __entry->bcon_time, __entry->gp1, __entry->gp2, | |
365 | __entry->gp3, __entry->ucode_ver, __entry->hw_ver, | |
366 | __entry->brd_ver) | |
be1a71a1 JB |
367 | ); |
368 | ||
369 | TRACE_EVENT(iwlwifi_dev_ucode_event, | |
6c1011e1 JB |
370 | TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), |
371 | TP_ARGS(dev, time, data, ev), | |
be1a71a1 | 372 | TP_STRUCT__entry( |
6c1011e1 | 373 | DEV_ENTRY |
be1a71a1 JB |
374 | |
375 | __field(u32, time) | |
376 | __field(u32, data) | |
377 | __field(u32, ev) | |
378 | ), | |
379 | TP_fast_assign( | |
6c1011e1 | 380 | DEV_ASSIGN; |
be1a71a1 JB |
381 | __entry->time = time; |
382 | __entry->data = data; | |
383 | __entry->ev = ev; | |
384 | ), | |
6c1011e1 JB |
385 | TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", |
386 | __get_str(dev), __entry->time, __entry->data, __entry->ev) | |
be1a71a1 JB |
387 | ); |
388 | #endif /* __IWLWIFI_DEVICE_TRACE */ | |
389 | ||
390 | #undef TRACE_INCLUDE_PATH | |
391 | #define TRACE_INCLUDE_PATH . | |
392 | #undef TRACE_INCLUDE_FILE | |
393 | #define TRACE_INCLUDE_FILE iwl-devtrace | |
394 | #include <trace/define_trace.h> |