Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Wey-Yi Guy | 901069c | 2011-04-05 09:42:00 -0700 | [diff] [blame] | 3 | * Copyright(c) 2009 - 2011 Intel Corporation. All rights reserved. |
Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 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 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 27 | #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) |
| 28 | #define __IWLWIFI_DEVICE_TRACE |
| 29 | |
| 30 | #include <linux/tracepoint.h> |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 31 | |
Emmanuel Grumbach | 83ed901 | 2011-08-25 23:11:14 -0700 | [diff] [blame] | 32 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 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 |
| 38 | |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 39 | #define PRIV_ENTRY __field(void *, priv) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 40 | #define PRIV_ASSIGN __entry->priv = priv |
| 41 | |
| 42 | #undef TRACE_SYSTEM |
Johannes Berg | 0fd95af | 2009-11-20 12:05:02 -0800 | [diff] [blame] | 43 | #define TRACE_SYSTEM iwlwifi_io |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 44 | |
| 45 | TRACE_EVENT(iwlwifi_dev_ioread32, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 46 | TP_PROTO(void *priv, u32 offs, u32 val), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 47 | 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 Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 61 | TRACE_EVENT(iwlwifi_dev_iowrite8, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 62 | TP_PROTO(void *priv, u32 offs, u8 val), |
Ben Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 63 | 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 Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 77 | TRACE_EVENT(iwlwifi_dev_iowrite32, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 78 | TP_PROTO(void *priv, u32 offs, u32 val), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 79 | 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 Berg | 0fd95af | 2009-11-20 12:05:02 -0800 | [diff] [blame] | 93 | #undef TRACE_SYSTEM |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 94 | #define TRACE_SYSTEM iwlwifi_ucode |
| 95 | |
| 96 | TRACE_EVENT(iwlwifi_dev_ucode_cont_event, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 97 | TP_PROTO(void *priv, u32 time, u32 data, u32 ev), |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 98 | 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 | |
| 116 | TRACE_EVENT(iwlwifi_dev_ucode_wrap_event, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 117 | TP_PROTO(void *priv, u32 wraps, u32 n_entry, u32 p_entry), |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 118 | 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 Berg | 0fd95af | 2009-11-20 12:05:02 -0800 | [diff] [blame] | 138 | #define TRACE_SYSTEM iwlwifi |
| 139 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 140 | TRACE_EVENT(iwlwifi_dev_hcmd, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 141 | TP_PROTO(void *priv, u32 flags, |
Johannes Berg | 4ce7cc2 | 2011-05-13 11:57:40 -0700 | [diff] [blame] | 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), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 146 | TP_STRUCT__entry( |
| 147 | PRIV_ENTRY |
Johannes Berg | 4ce7cc2 | 2011-05-13 11:57:40 -0700 | [diff] [blame] | 148 | __dynamic_array(u8, hcmd0, len0) |
| 149 | __dynamic_array(u8, hcmd1, len1) |
| 150 | __dynamic_array(u8, hcmd2, len2) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 151 | __field(u32, flags) |
| 152 | ), |
| 153 | TP_fast_assign( |
| 154 | PRIV_ASSIGN; |
Johannes Berg | 4ce7cc2 | 2011-05-13 11:57:40 -0700 | [diff] [blame] | 155 | memcpy(__get_dynamic_array(hcmd0), hcmd0, len0); |
| 156 | memcpy(__get_dynamic_array(hcmd1), hcmd1, len1); |
| 157 | memcpy(__get_dynamic_array(hcmd2), hcmd2, len2); |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 158 | __entry->flags = flags; |
| 159 | ), |
| 160 | TP_printk("[%p] hcmd %#.2x (%ssync)", |
Johannes Berg | 4ce7cc2 | 2011-05-13 11:57:40 -0700 | [diff] [blame] | 161 | __entry->priv, ((u8 *)__get_dynamic_array(hcmd0))[0], |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 162 | __entry->flags & CMD_ASYNC ? "a" : "") |
| 163 | ); |
| 164 | |
| 165 | TRACE_EVENT(iwlwifi_dev_rx, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 166 | TP_PROTO(void *priv, void *rxbuf, size_t len), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 167 | 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 | |
| 180 | TRACE_EVENT(iwlwifi_dev_tx, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 181 | TP_PROTO(void *priv, void *tfd, size_t tfdlen, |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 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), |
| 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 Berg | e95b743 | 2010-08-06 16:00:48 +0200 | [diff] [blame] | 204 | memcpy(__get_dynamic_array(buf1), buf1, buf1_len); |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 205 | ), |
| 206 | TP_printk("[%p] TX %.2x (%zu bytes)", |
| 207 | __entry->priv, |
| 208 | ((u8 *)__get_dynamic_array(buf0))[0], |
| 209 | __entry->framelen) |
| 210 | ); |
| 211 | |
| 212 | TRACE_EVENT(iwlwifi_dev_ucode_error, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 213 | TP_PROTO(void *priv, u32 desc, u32 tsf_low, |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 214 | u32 data1, u32 data2, u32 line, u32 blink1, |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 215 | 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 Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 221 | TP_STRUCT__entry( |
| 222 | PRIV_ENTRY |
| 223 | __field(u32, desc) |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 224 | __field(u32, tsf_low) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 225 | __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 Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 232 | __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 Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 239 | ), |
| 240 | TP_fast_assign( |
| 241 | PRIV_ASSIGN; |
| 242 | __entry->desc = desc; |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 243 | __entry->tsf_low = tsf_low; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 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; |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 251 | __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 Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 258 | ), |
| 259 | TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, " |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 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, |
| 264 | __entry->data1, |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 265 | __entry->data2, __entry->line, __entry->blink1, |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 266 | __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 Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 270 | ); |
| 271 | |
| 272 | TRACE_EVENT(iwlwifi_dev_ucode_event, |
Don Fry | 5510697 | 2011-10-14 12:54:44 -0700 | [diff] [blame^] | 273 | TP_PROTO(void *priv, u32 time, u32 data, u32 ev), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 274 | 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> |