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