blob: 96e62338cec0a9ce489d35a85ef0b20abff76c57 [file] [log] [blame]
Reinette Chatrebb5d2db2010-01-15 13:42:59 -08001/******************************************************************************
2 *
Wey-Yi Guyfb4961d2012-01-06 13:16:33 -08003 * Copyright(c) 2009 - 2012 Intel Corporation. All rights reserved.
Reinette Chatrebb5d2db2010-01-15 13:42:59 -08004 *
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
Johannes Bergbe1a71a2009-10-02 13:44:02 -070027#if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
28#define __IWLWIFI_DEVICE_TRACE
29
30#include <linux/tracepoint.h>
Johannes Bergbe1a71a2009-10-02 13:44:02 -070031
Emmanuel Grumbach83ed9012011-08-25 23:11:14 -070032
Johannes Bergbe1a71a2009-10-02 13:44:02 -070033#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
34#undef TRACE_EVENT
35#define TRACE_EVENT(name, proto, ...) \
36static inline void trace_ ## name(proto) {}
Johannes Berg2655e312012-01-31 21:08:37 -080037#undef DECLARE_EVENT_CLASS
38#define DECLARE_EVENT_CLASS(...)
39#undef DEFINE_EVENT
40#define DEFINE_EVENT(evt_class, name, proto, ...) \
41static inline void trace_ ## name(proto) {}
Johannes Bergbe1a71a2009-10-02 13:44:02 -070042#endif
43
Don Fry55106972011-10-14 12:54:44 -070044#define PRIV_ENTRY __field(void *, priv)
Johannes Bergbe1a71a2009-10-02 13:44:02 -070045#define PRIV_ASSIGN __entry->priv = priv
46
47#undef TRACE_SYSTEM
Johannes Berg0fd95af2009-11-20 12:05:02 -080048#define TRACE_SYSTEM iwlwifi_io
Johannes Bergbe1a71a2009-10-02 13:44:02 -070049
50TRACE_EVENT(iwlwifi_dev_ioread32,
Don Fry55106972011-10-14 12:54:44 -070051 TP_PROTO(void *priv, u32 offs, u32 val),
Johannes Bergbe1a71a2009-10-02 13:44:02 -070052 TP_ARGS(priv, offs, val),
53 TP_STRUCT__entry(
54 PRIV_ENTRY
55 __field(u32, offs)
56 __field(u32, val)
57 ),
58 TP_fast_assign(
59 PRIV_ASSIGN;
60 __entry->offs = offs;
61 __entry->val = val;
62 ),
63 TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
64);
65
Ben Cahill4e031852009-11-20 12:04:52 -080066TRACE_EVENT(iwlwifi_dev_iowrite8,
Don Fry55106972011-10-14 12:54:44 -070067 TP_PROTO(void *priv, u32 offs, u8 val),
Ben Cahill4e031852009-11-20 12:04:52 -080068 TP_ARGS(priv, offs, val),
69 TP_STRUCT__entry(
70 PRIV_ENTRY
71 __field(u32, offs)
72 __field(u8, val)
73 ),
74 TP_fast_assign(
75 PRIV_ASSIGN;
76 __entry->offs = offs;
77 __entry->val = val;
78 ),
79 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
80);
81
Johannes Bergbe1a71a2009-10-02 13:44:02 -070082TRACE_EVENT(iwlwifi_dev_iowrite32,
Don Fry55106972011-10-14 12:54:44 -070083 TP_PROTO(void *priv, u32 offs, u32 val),
Johannes Bergbe1a71a2009-10-02 13:44:02 -070084 TP_ARGS(priv, offs, val),
85 TP_STRUCT__entry(
86 PRIV_ENTRY
87 __field(u32, offs)
88 __field(u32, val)
89 ),
90 TP_fast_assign(
91 PRIV_ASSIGN;
92 __entry->offs = offs;
93 __entry->val = val;
94 ),
95 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
96);
97
Johannes Bergb80667e2011-12-09 07:26:13 -080098TRACE_EVENT(iwlwifi_dev_irq,
99 TP_PROTO(void *priv),
100 TP_ARGS(priv),
101 TP_STRUCT__entry(
102 PRIV_ENTRY
103 ),
104 TP_fast_assign(
105 PRIV_ASSIGN;
106 ),
107 /* TP_printk("") doesn't compile */
108 TP_printk("%d", 0)
109);
110
111TRACE_EVENT(iwlwifi_dev_ict_read,
112 TP_PROTO(void *priv, u32 index, u32 value),
113 TP_ARGS(priv, index, value),
114 TP_STRUCT__entry(
115 PRIV_ENTRY
116 __field(u32, index)
117 __field(u32, value)
118 ),
119 TP_fast_assign(
120 PRIV_ASSIGN;
121 __entry->index = index;
122 __entry->value = value;
123 ),
124 TP_printk("read ict[%d] = %#.8x", __entry->index, __entry->value)
125);
126
Johannes Berg0fd95af2009-11-20 12:05:02 -0800127#undef TRACE_SYSTEM
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800128#define TRACE_SYSTEM iwlwifi_ucode
129
130TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
Don Fry55106972011-10-14 12:54:44 -0700131 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800132 TP_ARGS(priv, time, data, ev),
133 TP_STRUCT__entry(
134 PRIV_ENTRY
135
136 __field(u32, time)
137 __field(u32, data)
138 __field(u32, ev)
139 ),
140 TP_fast_assign(
141 PRIV_ASSIGN;
142 __entry->time = time;
143 __entry->data = data;
144 __entry->ev = ev;
145 ),
146 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
147 __entry->priv, __entry->time, __entry->data, __entry->ev)
148);
149
150TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
Don Fry55106972011-10-14 12:54:44 -0700151 TP_PROTO(void *priv, u32 wraps, u32 n_entry, u32 p_entry),
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800152 TP_ARGS(priv, wraps, n_entry, p_entry),
153 TP_STRUCT__entry(
154 PRIV_ENTRY
155
156 __field(u32, wraps)
157 __field(u32, n_entry)
158 __field(u32, p_entry)
159 ),
160 TP_fast_assign(
161 PRIV_ASSIGN;
162 __entry->wraps = wraps;
163 __entry->n_entry = n_entry;
164 __entry->p_entry = p_entry;
165 ),
166 TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
167 __entry->priv, __entry->wraps, __entry->n_entry,
168 __entry->p_entry)
169);
170
171#undef TRACE_SYSTEM
Johannes Berg2655e312012-01-31 21:08:37 -0800172#define TRACE_SYSTEM iwlwifi_msg
173
174#define MAX_MSG_LEN 100
175
176DECLARE_EVENT_CLASS(iwlwifi_msg_event,
177 TP_PROTO(struct va_format *vaf),
178 TP_ARGS(vaf),
179 TP_STRUCT__entry(
180 __dynamic_array(char, msg, MAX_MSG_LEN)
181 ),
182 TP_fast_assign(
183 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
184 MAX_MSG_LEN, vaf->fmt,
185 *vaf->va) >= MAX_MSG_LEN);
186 ),
187 TP_printk("%s", (char *)__get_dynamic_array(msg))
188);
189
190DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
191 TP_PROTO(struct va_format *vaf),
192 TP_ARGS(vaf)
193);
194
195DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
196 TP_PROTO(struct va_format *vaf),
197 TP_ARGS(vaf)
198);
199
200DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
201 TP_PROTO(struct va_format *vaf),
202 TP_ARGS(vaf)
203);
204
205DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
206 TP_PROTO(struct va_format *vaf),
207 TP_ARGS(vaf)
208);
209
210TRACE_EVENT(iwlwifi_dbg,
211 TP_PROTO(u32 level, bool in_interrupt, const char *function,
212 struct va_format *vaf),
213 TP_ARGS(level, in_interrupt, function, vaf),
214 TP_STRUCT__entry(
215 __field(u32, level)
216 __field(u8, in_interrupt)
217 __string(function, function)
218 __dynamic_array(char, msg, MAX_MSG_LEN)
219 ),
220 TP_fast_assign(
221 __entry->level = level;
222 __entry->in_interrupt = in_interrupt;
223 __assign_str(function, function);
224 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
225 MAX_MSG_LEN, vaf->fmt,
226 *vaf->va) >= MAX_MSG_LEN);
227 ),
228 TP_printk("%s", (char *)__get_dynamic_array(msg))
229);
230
231#undef TRACE_SYSTEM
Johannes Berg0fd95af2009-11-20 12:05:02 -0800232#define TRACE_SYSTEM iwlwifi
233
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700234TRACE_EVENT(iwlwifi_dev_hcmd,
Don Fry55106972011-10-14 12:54:44 -0700235 TP_PROTO(void *priv, u32 flags,
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700236 const void *hcmd0, size_t len0,
237 const void *hcmd1, size_t len1,
238 const void *hcmd2, size_t len2),
239 TP_ARGS(priv, flags, hcmd0, len0, hcmd1, len1, hcmd2, len2),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700240 TP_STRUCT__entry(
241 PRIV_ENTRY
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700242 __dynamic_array(u8, hcmd0, len0)
243 __dynamic_array(u8, hcmd1, len1)
244 __dynamic_array(u8, hcmd2, len2)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700245 __field(u32, flags)
246 ),
247 TP_fast_assign(
248 PRIV_ASSIGN;
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700249 memcpy(__get_dynamic_array(hcmd0), hcmd0, len0);
250 memcpy(__get_dynamic_array(hcmd1), hcmd1, len1);
251 memcpy(__get_dynamic_array(hcmd2), hcmd2, len2);
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700252 __entry->flags = flags;
253 ),
254 TP_printk("[%p] hcmd %#.2x (%ssync)",
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700255 __entry->priv, ((u8 *)__get_dynamic_array(hcmd0))[0],
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700256 __entry->flags & CMD_ASYNC ? "a" : "")
257);
258
259TRACE_EVENT(iwlwifi_dev_rx,
Don Fry55106972011-10-14 12:54:44 -0700260 TP_PROTO(void *priv, void *rxbuf, size_t len),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700261 TP_ARGS(priv, rxbuf, len),
262 TP_STRUCT__entry(
263 PRIV_ENTRY
264 __dynamic_array(u8, rxbuf, len)
265 ),
266 TP_fast_assign(
267 PRIV_ASSIGN;
268 memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
269 ),
270 TP_printk("[%p] RX cmd %#.2x",
271 __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
272);
273
274TRACE_EVENT(iwlwifi_dev_tx,
Don Fry55106972011-10-14 12:54:44 -0700275 TP_PROTO(void *priv, void *tfd, size_t tfdlen,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700276 void *buf0, size_t buf0_len,
277 void *buf1, size_t buf1_len),
278 TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
279 TP_STRUCT__entry(
280 PRIV_ENTRY
281
282 __field(size_t, framelen)
283 __dynamic_array(u8, tfd, tfdlen)
284
285 /*
286 * Do not insert between or below these items,
287 * we want to keep the frame together (except
288 * for the possible padding).
289 */
290 __dynamic_array(u8, buf0, buf0_len)
291 __dynamic_array(u8, buf1, buf1_len)
292 ),
293 TP_fast_assign(
294 PRIV_ASSIGN;
295 __entry->framelen = buf0_len + buf1_len;
296 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
297 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
Johannes Berge95b7432010-08-06 16:00:48 +0200298 memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700299 ),
300 TP_printk("[%p] TX %.2x (%zu bytes)",
301 __entry->priv,
302 ((u8 *)__get_dynamic_array(buf0))[0],
303 __entry->framelen)
304);
305
306TRACE_EVENT(iwlwifi_dev_ucode_error,
Don Fry55106972011-10-14 12:54:44 -0700307 TP_PROTO(void *priv, u32 desc, u32 tsf_low,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700308 u32 data1, u32 data2, u32 line, u32 blink1,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700309 u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
310 u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver,
311 u32 brd_ver),
312 TP_ARGS(priv, desc, tsf_low, data1, data2, line,
313 blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
314 gp3, ucode_ver, hw_ver, brd_ver),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700315 TP_STRUCT__entry(
316 PRIV_ENTRY
317 __field(u32, desc)
Wey-Yi Guy50650542011-05-04 16:56:52 -0700318 __field(u32, tsf_low)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700319 __field(u32, data1)
320 __field(u32, data2)
321 __field(u32, line)
322 __field(u32, blink1)
323 __field(u32, blink2)
324 __field(u32, ilink1)
325 __field(u32, ilink2)
Wey-Yi Guy50650542011-05-04 16:56:52 -0700326 __field(u32, bcon_time)
327 __field(u32, gp1)
328 __field(u32, gp2)
329 __field(u32, gp3)
330 __field(u32, ucode_ver)
331 __field(u32, hw_ver)
332 __field(u32, brd_ver)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700333 ),
334 TP_fast_assign(
335 PRIV_ASSIGN;
336 __entry->desc = desc;
Wey-Yi Guy50650542011-05-04 16:56:52 -0700337 __entry->tsf_low = tsf_low;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700338 __entry->data1 = data1;
339 __entry->data2 = data2;
340 __entry->line = line;
341 __entry->blink1 = blink1;
342 __entry->blink2 = blink2;
343 __entry->ilink1 = ilink1;
344 __entry->ilink2 = ilink2;
Wey-Yi Guy50650542011-05-04 16:56:52 -0700345 __entry->bcon_time = bcon_time;
346 __entry->gp1 = gp1;
347 __entry->gp2 = gp2;
348 __entry->gp3 = gp3;
349 __entry->ucode_ver = ucode_ver;
350 __entry->hw_ver = hw_ver;
351 __entry->brd_ver = brd_ver;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700352 ),
353 TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
Wey-Yi Guy50650542011-05-04 16:56:52 -0700354 "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
355 "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X "
356 "hw 0x%08X brd 0x%08X",
357 __entry->priv, __entry->desc, __entry->tsf_low,
358 __entry->data1,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700359 __entry->data2, __entry->line, __entry->blink1,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700360 __entry->blink2, __entry->ilink1, __entry->ilink2,
361 __entry->bcon_time, __entry->gp1, __entry->gp2,
362 __entry->gp3, __entry->ucode_ver, __entry->hw_ver,
363 __entry->brd_ver)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700364);
365
366TRACE_EVENT(iwlwifi_dev_ucode_event,
Don Fry55106972011-10-14 12:54:44 -0700367 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700368 TP_ARGS(priv, time, data, ev),
369 TP_STRUCT__entry(
370 PRIV_ENTRY
371
372 __field(u32, time)
373 __field(u32, data)
374 __field(u32, ev)
375 ),
376 TP_fast_assign(
377 PRIV_ASSIGN;
378 __entry->time = time;
379 __entry->data = data;
380 __entry->ev = ev;
381 ),
382 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
383 __entry->priv, __entry->time, __entry->data, __entry->ev)
384);
385#endif /* __IWLWIFI_DEVICE_TRACE */
386
387#undef TRACE_INCLUDE_PATH
388#define TRACE_INCLUDE_PATH .
389#undef TRACE_INCLUDE_FILE
390#define TRACE_INCLUDE_FILE iwl-devtrace
391#include <trace/define_trace.h>