blob: f9d3319ecad5b9f6cb1c9f32bae83f59cc2f4a90 [file] [log] [blame]
Reinette Chatrebb5d2db2010-01-15 13:42:59 -08001/******************************************************************************
2 *
Wey-Yi Guy901069c2011-04-05 09:42:00 -07003 * Copyright(c) 2009 - 2011 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) {}
37#endif
38
Don Fry55106972011-10-14 12:54:44 -070039#define PRIV_ENTRY __field(void *, priv)
Johannes Bergbe1a71a2009-10-02 13:44:02 -070040#define PRIV_ASSIGN __entry->priv = priv
41
42#undef TRACE_SYSTEM
Johannes Berg0fd95af2009-11-20 12:05:02 -080043#define TRACE_SYSTEM iwlwifi_io
Johannes Bergbe1a71a2009-10-02 13:44:02 -070044
45TRACE_EVENT(iwlwifi_dev_ioread32,
Don Fry55106972011-10-14 12:54:44 -070046 TP_PROTO(void *priv, u32 offs, u32 val),
Johannes Bergbe1a71a2009-10-02 13:44:02 -070047 TP_ARGS(priv, offs, val),
48 TP_STRUCT__entry(
49 PRIV_ENTRY
50 __field(u32, offs)
51 __field(u32, val)
52 ),
53 TP_fast_assign(
54 PRIV_ASSIGN;
55 __entry->offs = offs;
56 __entry->val = val;
57 ),
58 TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
59);
60
Ben Cahill4e031852009-11-20 12:04:52 -080061TRACE_EVENT(iwlwifi_dev_iowrite8,
Don Fry55106972011-10-14 12:54:44 -070062 TP_PROTO(void *priv, u32 offs, u8 val),
Ben Cahill4e031852009-11-20 12:04:52 -080063 TP_ARGS(priv, offs, val),
64 TP_STRUCT__entry(
65 PRIV_ENTRY
66 __field(u32, offs)
67 __field(u8, val)
68 ),
69 TP_fast_assign(
70 PRIV_ASSIGN;
71 __entry->offs = offs;
72 __entry->val = val;
73 ),
74 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
75);
76
Johannes Bergbe1a71a2009-10-02 13:44:02 -070077TRACE_EVENT(iwlwifi_dev_iowrite32,
Don Fry55106972011-10-14 12:54:44 -070078 TP_PROTO(void *priv, u32 offs, u32 val),
Johannes Bergbe1a71a2009-10-02 13:44:02 -070079 TP_ARGS(priv, offs, val),
80 TP_STRUCT__entry(
81 PRIV_ENTRY
82 __field(u32, offs)
83 __field(u32, val)
84 ),
85 TP_fast_assign(
86 PRIV_ASSIGN;
87 __entry->offs = offs;
88 __entry->val = val;
89 ),
90 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
91);
92
Johannes Berg0fd95af2009-11-20 12:05:02 -080093#undef TRACE_SYSTEM
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -080094#define TRACE_SYSTEM iwlwifi_ucode
95
96TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
Don Fry55106972011-10-14 12:54:44 -070097 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -080098 TP_ARGS(priv, time, data, ev),
99 TP_STRUCT__entry(
100 PRIV_ENTRY
101
102 __field(u32, time)
103 __field(u32, data)
104 __field(u32, ev)
105 ),
106 TP_fast_assign(
107 PRIV_ASSIGN;
108 __entry->time = time;
109 __entry->data = data;
110 __entry->ev = ev;
111 ),
112 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
113 __entry->priv, __entry->time, __entry->data, __entry->ev)
114);
115
116TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
Don Fry55106972011-10-14 12:54:44 -0700117 TP_PROTO(void *priv, u32 wraps, u32 n_entry, u32 p_entry),
Wey-Yi Guya9e1cb62009-12-10 14:37:26 -0800118 TP_ARGS(priv, wraps, n_entry, p_entry),
119 TP_STRUCT__entry(
120 PRIV_ENTRY
121
122 __field(u32, wraps)
123 __field(u32, n_entry)
124 __field(u32, p_entry)
125 ),
126 TP_fast_assign(
127 PRIV_ASSIGN;
128 __entry->wraps = wraps;
129 __entry->n_entry = n_entry;
130 __entry->p_entry = p_entry;
131 ),
132 TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
133 __entry->priv, __entry->wraps, __entry->n_entry,
134 __entry->p_entry)
135);
136
137#undef TRACE_SYSTEM
Johannes Berg0fd95af2009-11-20 12:05:02 -0800138#define TRACE_SYSTEM iwlwifi
139
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700140TRACE_EVENT(iwlwifi_dev_hcmd,
Don Fry55106972011-10-14 12:54:44 -0700141 TP_PROTO(void *priv, u32 flags,
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700142 const void *hcmd0, size_t len0,
143 const void *hcmd1, size_t len1,
144 const void *hcmd2, size_t len2),
145 TP_ARGS(priv, flags, hcmd0, len0, hcmd1, len1, hcmd2, len2),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700146 TP_STRUCT__entry(
147 PRIV_ENTRY
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700148 __dynamic_array(u8, hcmd0, len0)
149 __dynamic_array(u8, hcmd1, len1)
150 __dynamic_array(u8, hcmd2, len2)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700151 __field(u32, flags)
152 ),
153 TP_fast_assign(
154 PRIV_ASSIGN;
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700155 memcpy(__get_dynamic_array(hcmd0), hcmd0, len0);
156 memcpy(__get_dynamic_array(hcmd1), hcmd1, len1);
157 memcpy(__get_dynamic_array(hcmd2), hcmd2, len2);
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700158 __entry->flags = flags;
159 ),
160 TP_printk("[%p] hcmd %#.2x (%ssync)",
Johannes Berg4ce7cc22011-05-13 11:57:40 -0700161 __entry->priv, ((u8 *)__get_dynamic_array(hcmd0))[0],
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700162 __entry->flags & CMD_ASYNC ? "a" : "")
163);
164
165TRACE_EVENT(iwlwifi_dev_rx,
Don Fry55106972011-10-14 12:54:44 -0700166 TP_PROTO(void *priv, void *rxbuf, size_t len),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700167 TP_ARGS(priv, rxbuf, len),
168 TP_STRUCT__entry(
169 PRIV_ENTRY
170 __dynamic_array(u8, rxbuf, len)
171 ),
172 TP_fast_assign(
173 PRIV_ASSIGN;
174 memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
175 ),
176 TP_printk("[%p] RX cmd %#.2x",
177 __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
178);
179
180TRACE_EVENT(iwlwifi_dev_tx,
Don Fry55106972011-10-14 12:54:44 -0700181 TP_PROTO(void *priv, void *tfd, size_t tfdlen,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700182 void *buf0, size_t buf0_len,
183 void *buf1, size_t buf1_len),
184 TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
185 TP_STRUCT__entry(
186 PRIV_ENTRY
187
188 __field(size_t, framelen)
189 __dynamic_array(u8, tfd, tfdlen)
190
191 /*
192 * Do not insert between or below these items,
193 * we want to keep the frame together (except
194 * for the possible padding).
195 */
196 __dynamic_array(u8, buf0, buf0_len)
197 __dynamic_array(u8, buf1, buf1_len)
198 ),
199 TP_fast_assign(
200 PRIV_ASSIGN;
201 __entry->framelen = buf0_len + buf1_len;
202 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
203 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
Johannes Berge95b7432010-08-06 16:00:48 +0200204 memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700205 ),
206 TP_printk("[%p] TX %.2x (%zu bytes)",
207 __entry->priv,
208 ((u8 *)__get_dynamic_array(buf0))[0],
209 __entry->framelen)
210);
211
212TRACE_EVENT(iwlwifi_dev_ucode_error,
Don Fry55106972011-10-14 12:54:44 -0700213 TP_PROTO(void *priv, u32 desc, u32 tsf_low,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700214 u32 data1, u32 data2, u32 line, u32 blink1,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700215 u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
216 u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver,
217 u32 brd_ver),
218 TP_ARGS(priv, desc, tsf_low, data1, data2, line,
219 blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
220 gp3, ucode_ver, hw_ver, brd_ver),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700221 TP_STRUCT__entry(
222 PRIV_ENTRY
223 __field(u32, desc)
Wey-Yi Guy50650542011-05-04 16:56:52 -0700224 __field(u32, tsf_low)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700225 __field(u32, data1)
226 __field(u32, data2)
227 __field(u32, line)
228 __field(u32, blink1)
229 __field(u32, blink2)
230 __field(u32, ilink1)
231 __field(u32, ilink2)
Wey-Yi Guy50650542011-05-04 16:56:52 -0700232 __field(u32, bcon_time)
233 __field(u32, gp1)
234 __field(u32, gp2)
235 __field(u32, gp3)
236 __field(u32, ucode_ver)
237 __field(u32, hw_ver)
238 __field(u32, brd_ver)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700239 ),
240 TP_fast_assign(
241 PRIV_ASSIGN;
242 __entry->desc = desc;
Wey-Yi Guy50650542011-05-04 16:56:52 -0700243 __entry->tsf_low = tsf_low;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700244 __entry->data1 = data1;
245 __entry->data2 = data2;
246 __entry->line = line;
247 __entry->blink1 = blink1;
248 __entry->blink2 = blink2;
249 __entry->ilink1 = ilink1;
250 __entry->ilink2 = ilink2;
Wey-Yi Guy50650542011-05-04 16:56:52 -0700251 __entry->bcon_time = bcon_time;
252 __entry->gp1 = gp1;
253 __entry->gp2 = gp2;
254 __entry->gp3 = gp3;
255 __entry->ucode_ver = ucode_ver;
256 __entry->hw_ver = hw_ver;
257 __entry->brd_ver = brd_ver;
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700258 ),
259 TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
Wey-Yi Guy50650542011-05-04 16:56:52 -0700260 "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
261 "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X "
262 "hw 0x%08X brd 0x%08X",
263 __entry->priv, __entry->desc, __entry->tsf_low,
264 __entry->data1,
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700265 __entry->data2, __entry->line, __entry->blink1,
Wey-Yi Guy50650542011-05-04 16:56:52 -0700266 __entry->blink2, __entry->ilink1, __entry->ilink2,
267 __entry->bcon_time, __entry->gp1, __entry->gp2,
268 __entry->gp3, __entry->ucode_ver, __entry->hw_ver,
269 __entry->brd_ver)
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700270);
271
272TRACE_EVENT(iwlwifi_dev_ucode_event,
Don Fry55106972011-10-14 12:54:44 -0700273 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
Johannes Bergbe1a71a2009-10-02 13:44:02 -0700274 TP_ARGS(priv, time, data, ev),
275 TP_STRUCT__entry(
276 PRIV_ENTRY
277
278 __field(u32, time)
279 __field(u32, data)
280 __field(u32, ev)
281 ),
282 TP_fast_assign(
283 PRIV_ASSIGN;
284 __entry->time = time;
285 __entry->data = data;
286 __entry->ev = ev;
287 ),
288 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
289 __entry->priv, __entry->time, __entry->data, __entry->ev)
290);
291#endif /* __IWLWIFI_DEVICE_TRACE */
292
293#undef TRACE_INCLUDE_PATH
294#define TRACE_INCLUDE_PATH .
295#undef TRACE_INCLUDE_FILE
296#define TRACE_INCLUDE_FILE iwl-devtrace
297#include <trace/define_trace.h>