iwl-devtrace.h 7.0 KB

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