Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / drivers / net / wireless / iwlwifi / iwl-devtrace.h
blob9b212a8f30bb8789bb4bd5c214e7841bd4672cf7
1 /******************************************************************************
3 * Copyright(c) 2009 - 2011 Intel Corporation. All rights reserved.
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.
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.
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
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * Intel Linux Wireless <ilw@linux.intel.com>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 *****************************************************************************/
27 #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
28 #define __IWLWIFI_DEVICE_TRACE
30 #include <linux/tracepoint.h>
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) {}
37 #endif
39 #define PRIV_ENTRY __field(void *, priv)
40 #define PRIV_ASSIGN __entry->priv = priv
42 #undef TRACE_SYSTEM
43 #define TRACE_SYSTEM iwlwifi_io
45 TRACE_EVENT(iwlwifi_dev_ioread32,
46 TP_PROTO(void *priv, u32 offs, u32 val),
47 TP_ARGS(priv, offs, val),
48 TP_STRUCT__entry(
49 PRIV_ENTRY
50 __field(u32, offs)
51 __field(u32, val)
53 TP_fast_assign(
54 PRIV_ASSIGN;
55 __entry->offs = offs;
56 __entry->val = val;
58 TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
61 TRACE_EVENT(iwlwifi_dev_iowrite8,
62 TP_PROTO(void *priv, u32 offs, u8 val),
63 TP_ARGS(priv, offs, val),
64 TP_STRUCT__entry(
65 PRIV_ENTRY
66 __field(u32, offs)
67 __field(u8, val)
69 TP_fast_assign(
70 PRIV_ASSIGN;
71 __entry->offs = offs;
72 __entry->val = val;
74 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
77 TRACE_EVENT(iwlwifi_dev_iowrite32,
78 TP_PROTO(void *priv, u32 offs, u32 val),
79 TP_ARGS(priv, offs, val),
80 TP_STRUCT__entry(
81 PRIV_ENTRY
82 __field(u32, offs)
83 __field(u32, val)
85 TP_fast_assign(
86 PRIV_ASSIGN;
87 __entry->offs = offs;
88 __entry->val = val;
90 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
93 TRACE_EVENT(iwlwifi_dev_irq,
94 TP_PROTO(void *priv),
95 TP_ARGS(priv),
96 TP_STRUCT__entry(
97 PRIV_ENTRY
99 TP_fast_assign(
100 PRIV_ASSIGN;
102 /* TP_printk("") doesn't compile */
103 TP_printk("%d", 0)
106 TRACE_EVENT(iwlwifi_dev_ict_read,
107 TP_PROTO(void *priv, u32 index, u32 value),
108 TP_ARGS(priv, index, value),
109 TP_STRUCT__entry(
110 PRIV_ENTRY
111 __field(u32, index)
112 __field(u32, value)
114 TP_fast_assign(
115 PRIV_ASSIGN;
116 __entry->index = index;
117 __entry->value = value;
119 TP_printk("read ict[%d] = %#.8x", __entry->index, __entry->value)
122 #undef TRACE_SYSTEM
123 #define TRACE_SYSTEM iwlwifi_ucode
125 TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
126 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
127 TP_ARGS(priv, time, data, ev),
128 TP_STRUCT__entry(
129 PRIV_ENTRY
131 __field(u32, time)
132 __field(u32, data)
133 __field(u32, ev)
135 TP_fast_assign(
136 PRIV_ASSIGN;
137 __entry->time = time;
138 __entry->data = data;
139 __entry->ev = ev;
141 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
142 __entry->priv, __entry->time, __entry->data, __entry->ev)
145 TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
146 TP_PROTO(void *priv, u32 wraps, u32 n_entry, u32 p_entry),
147 TP_ARGS(priv, wraps, n_entry, p_entry),
148 TP_STRUCT__entry(
149 PRIV_ENTRY
151 __field(u32, wraps)
152 __field(u32, n_entry)
153 __field(u32, p_entry)
155 TP_fast_assign(
156 PRIV_ASSIGN;
157 __entry->wraps = wraps;
158 __entry->n_entry = n_entry;
159 __entry->p_entry = p_entry;
161 TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
162 __entry->priv, __entry->wraps, __entry->n_entry,
163 __entry->p_entry)
166 #undef TRACE_SYSTEM
167 #define TRACE_SYSTEM iwlwifi
169 TRACE_EVENT(iwlwifi_dev_hcmd,
170 TP_PROTO(void *priv, u32 flags,
171 const void *hcmd0, size_t len0,
172 const void *hcmd1, size_t len1,
173 const void *hcmd2, size_t len2),
174 TP_ARGS(priv, flags, hcmd0, len0, hcmd1, len1, hcmd2, len2),
175 TP_STRUCT__entry(
176 PRIV_ENTRY
177 __dynamic_array(u8, hcmd0, len0)
178 __dynamic_array(u8, hcmd1, len1)
179 __dynamic_array(u8, hcmd2, len2)
180 __field(u32, flags)
182 TP_fast_assign(
183 PRIV_ASSIGN;
184 memcpy(__get_dynamic_array(hcmd0), hcmd0, len0);
185 memcpy(__get_dynamic_array(hcmd1), hcmd1, len1);
186 memcpy(__get_dynamic_array(hcmd2), hcmd2, len2);
187 __entry->flags = flags;
189 TP_printk("[%p] hcmd %#.2x (%ssync)",
190 __entry->priv, ((u8 *)__get_dynamic_array(hcmd0))[0],
191 __entry->flags & CMD_ASYNC ? "a" : "")
194 TRACE_EVENT(iwlwifi_dev_rx,
195 TP_PROTO(void *priv, void *rxbuf, size_t len),
196 TP_ARGS(priv, rxbuf, len),
197 TP_STRUCT__entry(
198 PRIV_ENTRY
199 __dynamic_array(u8, rxbuf, len)
201 TP_fast_assign(
202 PRIV_ASSIGN;
203 memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
205 TP_printk("[%p] RX cmd %#.2x",
206 __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
209 TRACE_EVENT(iwlwifi_dev_tx,
210 TP_PROTO(void *priv, void *tfd, size_t tfdlen,
211 void *buf0, size_t buf0_len,
212 void *buf1, size_t buf1_len),
213 TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
214 TP_STRUCT__entry(
215 PRIV_ENTRY
217 __field(size_t, framelen)
218 __dynamic_array(u8, tfd, tfdlen)
221 * Do not insert between or below these items,
222 * we want to keep the frame together (except
223 * for the possible padding).
225 __dynamic_array(u8, buf0, buf0_len)
226 __dynamic_array(u8, buf1, buf1_len)
228 TP_fast_assign(
229 PRIV_ASSIGN;
230 __entry->framelen = buf0_len + buf1_len;
231 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
232 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
233 memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
235 TP_printk("[%p] TX %.2x (%zu bytes)",
236 __entry->priv,
237 ((u8 *)__get_dynamic_array(buf0))[0],
238 __entry->framelen)
241 TRACE_EVENT(iwlwifi_dev_ucode_error,
242 TP_PROTO(void *priv, u32 desc, u32 tsf_low,
243 u32 data1, u32 data2, u32 line, u32 blink1,
244 u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
245 u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver,
246 u32 brd_ver),
247 TP_ARGS(priv, desc, tsf_low, data1, data2, line,
248 blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
249 gp3, ucode_ver, hw_ver, brd_ver),
250 TP_STRUCT__entry(
251 PRIV_ENTRY
252 __field(u32, desc)
253 __field(u32, tsf_low)
254 __field(u32, data1)
255 __field(u32, data2)
256 __field(u32, line)
257 __field(u32, blink1)
258 __field(u32, blink2)
259 __field(u32, ilink1)
260 __field(u32, ilink2)
261 __field(u32, bcon_time)
262 __field(u32, gp1)
263 __field(u32, gp2)
264 __field(u32, gp3)
265 __field(u32, ucode_ver)
266 __field(u32, hw_ver)
267 __field(u32, brd_ver)
269 TP_fast_assign(
270 PRIV_ASSIGN;
271 __entry->desc = desc;
272 __entry->tsf_low = tsf_low;
273 __entry->data1 = data1;
274 __entry->data2 = data2;
275 __entry->line = line;
276 __entry->blink1 = blink1;
277 __entry->blink2 = blink2;
278 __entry->ilink1 = ilink1;
279 __entry->ilink2 = ilink2;
280 __entry->bcon_time = bcon_time;
281 __entry->gp1 = gp1;
282 __entry->gp2 = gp2;
283 __entry->gp3 = gp3;
284 __entry->ucode_ver = ucode_ver;
285 __entry->hw_ver = hw_ver;
286 __entry->brd_ver = brd_ver;
288 TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
289 "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
290 "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X "
291 "hw 0x%08X brd 0x%08X",
292 __entry->priv, __entry->desc, __entry->tsf_low,
293 __entry->data1,
294 __entry->data2, __entry->line, __entry->blink1,
295 __entry->blink2, __entry->ilink1, __entry->ilink2,
296 __entry->bcon_time, __entry->gp1, __entry->gp2,
297 __entry->gp3, __entry->ucode_ver, __entry->hw_ver,
298 __entry->brd_ver)
301 TRACE_EVENT(iwlwifi_dev_ucode_event,
302 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
303 TP_ARGS(priv, time, data, ev),
304 TP_STRUCT__entry(
305 PRIV_ENTRY
307 __field(u32, time)
308 __field(u32, data)
309 __field(u32, ev)
311 TP_fast_assign(
312 PRIV_ASSIGN;
313 __entry->time = time;
314 __entry->data = data;
315 __entry->ev = ev;
317 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
318 __entry->priv, __entry->time, __entry->data, __entry->ev)
320 #endif /* __IWLWIFI_DEVICE_TRACE */
322 #undef TRACE_INCLUDE_PATH
323 #define TRACE_INCLUDE_PATH .
324 #undef TRACE_INCLUDE_FILE
325 #define TRACE_INCLUDE_FILE iwl-devtrace
326 #include <trace/define_trace.h>