Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iwl-devtrace.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2012 Intel Corporation. All rights reserved.
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 <[email protected]>
23  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24  *
25  *****************************************************************************/
26 
27 #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
28 #define __IWLWIFI_DEVICE_TRACE
29 
30 #include <linux/tracepoint.h>
31 #include <linux/device.h>
32 #include "iwl-trans.h"
33 
34 
35 #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
36 #undef TRACE_EVENT
37 #define TRACE_EVENT(name, proto, ...) \
38 static inline void trace_ ## name(proto) {}
39 #undef DECLARE_EVENT_CLASS
40 #define DECLARE_EVENT_CLASS(...)
41 #undef DEFINE_EVENT
42 #define DEFINE_EVENT(evt_class, name, proto, ...) \
43 static inline void trace_ ## name(proto) {}
44 #endif
45 
46 #define DEV_ENTRY __string(dev, dev_name(dev))
47 #define DEV_ASSIGN __assign_str(dev, dev_name(dev))
48 
49 #undef TRACE_SYSTEM
50 #define TRACE_SYSTEM iwlwifi_io
51 
52 TRACE_EVENT(iwlwifi_dev_ioread32,
53  TP_PROTO(const struct device *dev, u32 offs, u32 val),
54  TP_ARGS(dev, offs, val),
56  DEV_ENTRY
57  __field(u32, offs)
58  __field(u32, val)
59  ),
61  DEV_ASSIGN;
62  __entry->offs = offs;
63  __entry->val = val;
64  ),
65  TP_printk("[%s] read io[%#x] = %#x",
66  __get_str(dev), __entry->offs, __entry->val)
67 );
68 
69 TRACE_EVENT(iwlwifi_dev_iowrite8,
70  TP_PROTO(const struct device *dev, u32 offs, u8 val),
71  TP_ARGS(dev, offs, val),
73  DEV_ENTRY
74  __field(u32, offs)
75  __field(u8, val)
76  ),
78  DEV_ASSIGN;
79  __entry->offs = offs;
80  __entry->val = val;
81  ),
82  TP_printk("[%s] write io[%#x] = %#x)",
83  __get_str(dev), __entry->offs, __entry->val)
84 );
85 
86 TRACE_EVENT(iwlwifi_dev_iowrite32,
87  TP_PROTO(const struct device *dev, u32 offs, u32 val),
88  TP_ARGS(dev, offs, val),
90  DEV_ENTRY
91  __field(u32, offs)
92  __field(u32, val)
93  ),
95  DEV_ASSIGN;
96  __entry->offs = offs;
97  __entry->val = val;
98  ),
99  TP_printk("[%s] write io[%#x] = %#x)",
100  __get_str(dev), __entry->offs, __entry->val)
101 );
102 
103 TRACE_EVENT(iwlwifi_dev_irq,
104  TP_PROTO(const struct device *dev),
105  TP_ARGS(dev),
107  DEV_ENTRY
108  ),
110  DEV_ASSIGN;
111  ),
112  /* TP_printk("") doesn't compile */
113  TP_printk("%d", 0)
114 );
115 
116 TRACE_EVENT(iwlwifi_dev_ict_read,
117  TP_PROTO(const struct device *dev, u32 index, u32 value),
118  TP_ARGS(dev, index, value),
120  DEV_ENTRY
121  __field(u32, index)
122  __field(u32, value)
123  ),
125  DEV_ASSIGN;
126  __entry->index = index;
127  __entry->value = value;
128  ),
129  TP_printk("[%s] read ict[%d] = %#.8x",
130  __get_str(dev), __entry->index, __entry->value)
131 );
132 
133 #undef TRACE_SYSTEM
134 #define TRACE_SYSTEM iwlwifi_ucode
135 
136 TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
137  TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
138  TP_ARGS(dev, time, data, ev),
140  DEV_ENTRY
141 
142  __field(u32, time)
143  __field(u32, data)
144  __field(u32, ev)
145  ),
147  DEV_ASSIGN;
148  __entry->time = time;
149  __entry->data = data;
150  __entry->ev = ev;
151  ),
152  TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
153  __get_str(dev), __entry->time, __entry->data, __entry->ev)
154 );
155 
156 TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
157  TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry),
158  TP_ARGS(dev, wraps, n_entry, p_entry),
160  DEV_ENTRY
161 
162  __field(u32, wraps)
163  __field(u32, n_entry)
164  __field(u32, p_entry)
165  ),
167  DEV_ASSIGN;
168  __entry->wraps = wraps;
169  __entry->n_entry = n_entry;
170  __entry->p_entry = p_entry;
171  ),
172  TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X",
173  __get_str(dev), __entry->wraps, __entry->n_entry,
174  __entry->p_entry)
175 );
176 
177 #undef TRACE_SYSTEM
178 #define TRACE_SYSTEM iwlwifi_msg
179 
180 #define MAX_MSG_LEN 110
181 
182 DECLARE_EVENT_CLASS(iwlwifi_msg_event,
183  TP_PROTO(struct va_format *vaf),
184  TP_ARGS(vaf),
187  ),
190  MAX_MSG_LEN, vaf->fmt,
191  *vaf->va) >= MAX_MSG_LEN);
192  ),
193  TP_printk("%s", __get_str(msg))
194 );
195 
196 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
197  TP_PROTO(struct va_format *vaf),
198  TP_ARGS(vaf)
199 );
200 
201 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
202  TP_PROTO(struct va_format *vaf),
203  TP_ARGS(vaf)
204 );
205 
206 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
207  TP_PROTO(struct va_format *vaf),
208  TP_ARGS(vaf)
209 );
210 
211 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
212  TP_PROTO(struct va_format *vaf),
213  TP_ARGS(vaf)
214 );
215 
216 TRACE_EVENT(iwlwifi_dbg,
217  TP_PROTO(u32 level, bool in_interrupt, const char *function,
218  struct va_format *vaf),
219  TP_ARGS(level, in_interrupt, function, vaf),
221  __field(u32, level)
222  __field(u8, in_interrupt)
223  __string(function, function)
225  ),
227  __entry->level = level;
228  __entry->in_interrupt = in_interrupt;
229  __assign_str(function, function);
231  MAX_MSG_LEN, vaf->fmt,
232  *vaf->va) >= MAX_MSG_LEN);
233  ),
234  TP_printk("%s", (char *)__get_dynamic_array(msg))
235 );
236 
237 #undef TRACE_SYSTEM
238 #define TRACE_SYSTEM iwlwifi
239 
240 TRACE_EVENT(iwlwifi_dev_hcmd,
241  TP_PROTO(const struct device *dev,
242  struct iwl_host_cmd *cmd, u16 total_size,
243  const void *hdr, size_t hdr_len),
244  TP_ARGS(dev, cmd, total_size, hdr, hdr_len),
246  DEV_ENTRY
247  __dynamic_array(u8, hcmd, total_size)
248  __field(u32, flags)
249  ),
251  int i, offset = hdr_len;
252 
253  DEV_ASSIGN;
254  __entry->flags = cmd->flags;
255  memcpy(__get_dynamic_array(hcmd), hdr, hdr_len);
256 
257  for (i = 0; i < IWL_MAX_CMD_TFDS; i++) {
258  if (!cmd->len[i])
259  continue;
260  if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
261  continue;
262  memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
263  cmd->data[i], cmd->len[i]);
264  offset += cmd->len[i];
265  }
266  ),
267  TP_printk("[%s] hcmd %#.2x (%ssync)",
268  __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0],
269  __entry->flags & CMD_ASYNC ? "a" : "")
270 );
271 
272 TRACE_EVENT(iwlwifi_dev_rx,
273  TP_PROTO(const struct device *dev, void *rxbuf, size_t len),
274  TP_ARGS(dev, rxbuf, len),
276  DEV_ENTRY
277  __dynamic_array(u8, rxbuf, len)
278  ),
280  DEV_ASSIGN;
281  memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
282  ),
283  TP_printk("[%s] RX cmd %#.2x",
284  __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4])
285 );
286 
287 TRACE_EVENT(iwlwifi_dev_tx,
288  TP_PROTO(const struct device *dev, void *tfd, size_t tfdlen,
289  void *buf0, size_t buf0_len,
290  void *buf1, size_t buf1_len),
291  TP_ARGS(dev, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
293  DEV_ENTRY
294 
295  __field(size_t, framelen)
296  __dynamic_array(u8, tfd, tfdlen)
297 
298  /*
299  * Do not insert between or below these items,
300  * we want to keep the frame together (except
301  * for the possible padding).
302  */
303  __dynamic_array(u8, buf0, buf0_len)
304  __dynamic_array(u8, buf1, buf1_len)
305  ),
307  DEV_ASSIGN;
308  __entry->framelen = buf0_len + buf1_len;
309  memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
310  memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
311  memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
312  ),
313  TP_printk("[%s] TX %.2x (%zu bytes)",
314  __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
315  __entry->framelen)
316 );
317 
318 TRACE_EVENT(iwlwifi_dev_ucode_error,
319  TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low,
320  u32 data1, u32 data2, u32 line, u32 blink1,
321  u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
322  u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver,
323  u32 brd_ver),
324  TP_ARGS(dev, desc, tsf_low, data1, data2, line,
325  blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
326  gp3, ucode_ver, hw_ver, brd_ver),
328  DEV_ENTRY
329  __field(u32, desc)
330  __field(u32, tsf_low)
331  __field(u32, data1)
332  __field(u32, data2)
333  __field(u32, line)
334  __field(u32, blink1)
335  __field(u32, blink2)
336  __field(u32, ilink1)
337  __field(u32, ilink2)
338  __field(u32, bcon_time)
339  __field(u32, gp1)
340  __field(u32, gp2)
341  __field(u32, gp3)
342  __field(u32, ucode_ver)
343  __field(u32, hw_ver)
344  __field(u32, brd_ver)
345  ),
347  DEV_ASSIGN;
348  __entry->desc = desc;
349  __entry->tsf_low = tsf_low;
350  __entry->data1 = data1;
351  __entry->data2 = data2;
352  __entry->line = line;
353  __entry->blink1 = blink1;
354  __entry->blink2 = blink2;
355  __entry->ilink1 = ilink1;
356  __entry->ilink2 = ilink2;
357  __entry->bcon_time = bcon_time;
358  __entry->gp1 = gp1;
359  __entry->gp2 = gp2;
360  __entry->gp3 = gp3;
361  __entry->ucode_ver = ucode_ver;
362  __entry->hw_ver = hw_ver;
363  __entry->brd_ver = brd_ver;
364  ),
365  TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, "
366  "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
367  "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X "
368  "hw 0x%08X brd 0x%08X",
369  __get_str(dev), __entry->desc, __entry->tsf_low,
370  __entry->data1,
371  __entry->data2, __entry->line, __entry->blink1,
372  __entry->blink2, __entry->ilink1, __entry->ilink2,
373  __entry->bcon_time, __entry->gp1, __entry->gp2,
374  __entry->gp3, __entry->ucode_ver, __entry->hw_ver,
375  __entry->brd_ver)
376 );
377 
378 TRACE_EVENT(iwlwifi_dev_ucode_event,
379  TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
380  TP_ARGS(dev, time, data, ev),
382  DEV_ENTRY
383 
384  __field(u32, time)
385  __field(u32, data)
386  __field(u32, ev)
387  ),
389  DEV_ASSIGN;
390  __entry->time = time;
391  __entry->data = data;
392  __entry->ev = ev;
393  ),
394  TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
395  __get_str(dev), __entry->time, __entry->data, __entry->ev)
396 );
397 #endif /* __IWLWIFI_DEVICE_TRACE */
398 
399 #undef TRACE_INCLUDE_PATH
400 #define TRACE_INCLUDE_PATH .
401 #undef TRACE_INCLUDE_FILE
402 #define TRACE_INCLUDE_FILE iwl-devtrace
403 #include <trace/define_trace.h>