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
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__)
35 #define TRACE_EVENT(name, proto, ...) \
36 static inline void trace_ ## name(proto) {}
39 #define PRIV_ENTRY __field(void *, priv)
40 #define PRIV_ASSIGN __entry->priv = priv
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),
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),
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),
90 TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
94 #define TRACE_SYSTEM iwlwifi_ucode
96 TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
97 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
98 TP_ARGS(priv, time, data, ev),
108 __entry->time = time;
109 __entry->data = data;
112 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
113 __entry->priv, __entry->time, __entry->data, __entry->ev)
116 TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
117 TP_PROTO(void *priv, u32 wraps, u32 n_entry, u32 p_entry),
118 TP_ARGS(priv, wraps, n_entry, p_entry),
123 __field(u32, n_entry)
124 __field(u32, p_entry)
128 __entry->wraps = wraps;
129 __entry->n_entry = n_entry;
130 __entry->p_entry = p_entry;
132 TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
133 __entry->priv, __entry->wraps, __entry->n_entry,
138 #define TRACE_SYSTEM iwlwifi
140 TRACE_EVENT(iwlwifi_dev_hcmd,
141 TP_PROTO(void *priv, u32 flags,
142 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),
148 __dynamic_array(u8, hcmd0, len0)
149 __dynamic_array(u8, hcmd1, len1)
150 __dynamic_array(u8, hcmd2, len2)
155 memcpy(__get_dynamic_array(hcmd0), hcmd0, len0);
156 memcpy(__get_dynamic_array(hcmd1), hcmd1, len1);
157 memcpy(__get_dynamic_array(hcmd2), hcmd2, len2);
158 __entry->flags = flags;
160 TP_printk("[%p] hcmd %#.2x (%ssync)",
161 __entry->priv, ((u8 *)__get_dynamic_array(hcmd0))[0],
162 __entry->flags & CMD_ASYNC ? "a" : "")
165 TRACE_EVENT(iwlwifi_dev_rx,
166 TP_PROTO(void *priv, void *rxbuf, size_t len),
167 TP_ARGS(priv, rxbuf, len),
170 __dynamic_array(u8, rxbuf, len)
174 memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
176 TP_printk("[%p] RX cmd %#.2x",
177 __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
180 TRACE_EVENT(iwlwifi_dev_tx,
181 TP_PROTO(void *priv, void *tfd, size_t tfdlen,
182 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),
188 __field(size_t, framelen)
189 __dynamic_array(u8, tfd, tfdlen)
192 * Do not insert between or below these items,
193 * we want to keep the frame together (except
194 * for the possible padding).
196 __dynamic_array(u8, buf0, buf0_len)
197 __dynamic_array(u8, buf1, buf1_len)
201 __entry->framelen = buf0_len + buf1_len;
202 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
203 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
204 memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
206 TP_printk("[%p] TX %.2x (%zu bytes)",
208 ((u8 *)__get_dynamic_array(buf0))[0],
212 TRACE_EVENT(iwlwifi_dev_ucode_error,
213 TP_PROTO(void *priv, u32 desc, u32 tsf_low,
214 u32 data1, u32 data2, u32 line, u32 blink1,
215 u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
216 u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_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),
224 __field(u32, tsf_low)
232 __field(u32, bcon_time)
236 __field(u32, ucode_ver)
238 __field(u32, brd_ver)
242 __entry->desc = desc;
243 __entry->tsf_low = tsf_low;
244 __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;
251 __entry->bcon_time = bcon_time;
255 __entry->ucode_ver = ucode_ver;
256 __entry->hw_ver = hw_ver;
257 __entry->brd_ver = brd_ver;
259 TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
260 "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,
265 __entry->data2, __entry->line, __entry->blink1,
266 __entry->blink2, __entry->ilink1, __entry->ilink2,
267 __entry->bcon_time, __entry->gp1, __entry->gp2,
268 __entry->gp3, __entry->ucode_ver, __entry->hw_ver,
272 TRACE_EVENT(iwlwifi_dev_ucode_event,
273 TP_PROTO(void *priv, u32 time, u32 data, u32 ev),
274 TP_ARGS(priv, time, data, ev),
284 __entry->time = time;
285 __entry->data = data;
288 TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
289 __entry->priv, __entry->time, __entry->data, __entry->ev)
291 #endif /* __IWLWIFI_DEVICE_TRACE */
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>