Merge branch 'linus' into cont_syslog
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-devtrace.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2010 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 <ilw@linux.intel.com>
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
32 #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
33 #undef TRACE_EVENT
34 #define TRACE_EVENT(name, proto, ...) \
35 static inline void trace_ ## name(proto) {}
36 #endif
37
38 #define PRIV_ENTRY      __field(struct iwl_priv *, priv)
39 #define PRIV_ASSIGN     __entry->priv = priv
40
41 #undef TRACE_SYSTEM
42 #define TRACE_SYSTEM iwlwifi_io
43
44 TRACE_EVENT(iwlwifi_dev_ioread32,
45         TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
46         TP_ARGS(priv, offs, val),
47         TP_STRUCT__entry(
48                 PRIV_ENTRY
49                 __field(u32, offs)
50                 __field(u32, val)
51         ),
52         TP_fast_assign(
53                 PRIV_ASSIGN;
54                 __entry->offs = offs;
55                 __entry->val = val;
56         ),
57         TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
58 );
59
60 TRACE_EVENT(iwlwifi_dev_iowrite8,
61         TP_PROTO(struct iwl_priv *priv, u32 offs, u8 val),
62         TP_ARGS(priv, offs, val),
63         TP_STRUCT__entry(
64                 PRIV_ENTRY
65                 __field(u32, offs)
66                 __field(u8, val)
67         ),
68         TP_fast_assign(
69                 PRIV_ASSIGN;
70                 __entry->offs = offs;
71                 __entry->val = val;
72         ),
73         TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
74 );
75
76 TRACE_EVENT(iwlwifi_dev_iowrite32,
77         TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
78         TP_ARGS(priv, offs, val),
79         TP_STRUCT__entry(
80                 PRIV_ENTRY
81                 __field(u32, offs)
82                 __field(u32, val)
83         ),
84         TP_fast_assign(
85                 PRIV_ASSIGN;
86                 __entry->offs = offs;
87                 __entry->val = val;
88         ),
89         TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
90 );
91
92 #undef TRACE_SYSTEM
93 #define TRACE_SYSTEM iwlwifi_ucode
94
95 TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
96         TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
97         TP_ARGS(priv, time, data, ev),
98         TP_STRUCT__entry(
99                 PRIV_ENTRY
100
101                 __field(u32, time)
102                 __field(u32, data)
103                 __field(u32, ev)
104         ),
105         TP_fast_assign(
106                 PRIV_ASSIGN;
107                 __entry->time = time;
108                 __entry->data = data;
109                 __entry->ev = ev;
110         ),
111         TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
112                   __entry->priv, __entry->time, __entry->data, __entry->ev)
113 );
114
115 TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
116         TP_PROTO(struct iwl_priv *priv, u32 wraps, u32 n_entry, u32 p_entry),
117         TP_ARGS(priv, wraps, n_entry, p_entry),
118         TP_STRUCT__entry(
119                 PRIV_ENTRY
120
121                 __field(u32, wraps)
122                 __field(u32, n_entry)
123                 __field(u32, p_entry)
124         ),
125         TP_fast_assign(
126                 PRIV_ASSIGN;
127                 __entry->wraps = wraps;
128                 __entry->n_entry = n_entry;
129                 __entry->p_entry = p_entry;
130         ),
131         TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
132                   __entry->priv, __entry->wraps, __entry->n_entry,
133                   __entry->p_entry)
134 );
135
136 #undef TRACE_SYSTEM
137 #define TRACE_SYSTEM iwlwifi
138
139 TRACE_EVENT(iwlwifi_dev_hcmd,
140         TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags),
141         TP_ARGS(priv, hcmd, len, flags),
142         TP_STRUCT__entry(
143                 PRIV_ENTRY
144                 __dynamic_array(u8, hcmd, len)
145                 __field(u32, flags)
146         ),
147         TP_fast_assign(
148                 PRIV_ASSIGN;
149                 memcpy(__get_dynamic_array(hcmd), hcmd, len);
150                 __entry->flags = flags;
151         ),
152         TP_printk("[%p] hcmd %#.2x (%ssync)",
153                   __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0],
154                   __entry->flags & CMD_ASYNC ? "a" : "")
155 );
156
157 TRACE_EVENT(iwlwifi_dev_rx,
158         TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len),
159         TP_ARGS(priv, rxbuf, len),
160         TP_STRUCT__entry(
161                 PRIV_ENTRY
162                 __dynamic_array(u8, rxbuf, len)
163         ),
164         TP_fast_assign(
165                 PRIV_ASSIGN;
166                 memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
167         ),
168         TP_printk("[%p] RX cmd %#.2x",
169                   __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
170 );
171
172 TRACE_EVENT(iwlwifi_dev_tx,
173         TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen,
174                  void *buf0, size_t buf0_len,
175                  void *buf1, size_t buf1_len),
176         TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
177         TP_STRUCT__entry(
178                 PRIV_ENTRY
179
180                 __field(size_t, framelen)
181                 __dynamic_array(u8, tfd, tfdlen)
182
183                 /*
184                  * Do not insert between or below these items,
185                  * we want to keep the frame together (except
186                  * for the possible padding).
187                  */
188                 __dynamic_array(u8, buf0, buf0_len)
189                 __dynamic_array(u8, buf1, buf1_len)
190         ),
191         TP_fast_assign(
192                 PRIV_ASSIGN;
193                 __entry->framelen = buf0_len + buf1_len;
194                 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
195                 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
196                 memcpy(__get_dynamic_array(buf1), buf1, buf0_len);
197         ),
198         TP_printk("[%p] TX %.2x (%zu bytes)",
199                   __entry->priv,
200                   ((u8 *)__get_dynamic_array(buf0))[0],
201                   __entry->framelen)
202 );
203
204 TRACE_EVENT(iwlwifi_dev_ucode_error,
205         TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time,
206                  u32 data1, u32 data2, u32 line, u32 blink1,
207                  u32 blink2, u32 ilink1, u32 ilink2),
208         TP_ARGS(priv, desc, time, data1, data2, line,
209                 blink1, blink2, ilink1, ilink2),
210         TP_STRUCT__entry(
211                 PRIV_ENTRY
212                 __field(u32, desc)
213                 __field(u32, time)
214                 __field(u32, data1)
215                 __field(u32, data2)
216                 __field(u32, line)
217                 __field(u32, blink1)
218                 __field(u32, blink2)
219                 __field(u32, ilink1)
220                 __field(u32, ilink2)
221         ),
222         TP_fast_assign(
223                 PRIV_ASSIGN;
224                 __entry->desc = desc;
225                 __entry->time = time;
226                 __entry->data1 = data1;
227                 __entry->data2 = data2;
228                 __entry->line = line;
229                 __entry->blink1 = blink1;
230                 __entry->blink2 = blink2;
231                 __entry->ilink1 = ilink1;
232                 __entry->ilink2 = ilink2;
233         ),
234         TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
235                   "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X",
236                   __entry->priv, __entry->desc, __entry->time, __entry->data1,
237                   __entry->data2, __entry->line, __entry->blink1,
238                   __entry->blink2, __entry->ilink1, __entry->ilink2)
239 );
240
241 TRACE_EVENT(iwlwifi_dev_ucode_event,
242         TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
243         TP_ARGS(priv, time, data, ev),
244         TP_STRUCT__entry(
245                 PRIV_ENTRY
246
247                 __field(u32, time)
248                 __field(u32, data)
249                 __field(u32, ev)
250         ),
251         TP_fast_assign(
252                 PRIV_ASSIGN;
253                 __entry->time = time;
254                 __entry->data = data;
255                 __entry->ev = ev;
256         ),
257         TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
258                   __entry->priv, __entry->time, __entry->data, __entry->ev)
259 );
260 #endif /* __IWLWIFI_DEVICE_TRACE */
261
262 #undef TRACE_INCLUDE_PATH
263 #define TRACE_INCLUDE_PATH .
264 #undef TRACE_INCLUDE_FILE
265 #define TRACE_INCLUDE_FILE iwl-devtrace
266 #include <trace/define_trace.h>