mmc.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM mmc
  3. #if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_MMC_H
  5. #include <linux/blkdev.h>
  6. #include <linux/mmc/core.h>
  7. #include <linux/mmc/host.h>
  8. #include <linux/tracepoint.h>
  9. TRACE_EVENT(mmc_request_start,
  10. TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),
  11. TP_ARGS(host, mrq),
  12. TP_STRUCT__entry(
  13. __field(u32, cmd_opcode)
  14. __field(u32, cmd_arg)
  15. __field(unsigned int, cmd_flags)
  16. __field(unsigned int, cmd_retries)
  17. __field(u32, stop_opcode)
  18. __field(u32, stop_arg)
  19. __field(unsigned int, stop_flags)
  20. __field(unsigned int, stop_retries)
  21. __field(u32, sbc_opcode)
  22. __field(u32, sbc_arg)
  23. __field(unsigned int, sbc_flags)
  24. __field(unsigned int, sbc_retries)
  25. __field(unsigned int, blocks)
  26. __field(unsigned int, blksz)
  27. __field(unsigned int, data_flags)
  28. __field(unsigned int, can_retune)
  29. __field(unsigned int, doing_retune)
  30. __field(unsigned int, retune_now)
  31. __field(int, need_retune)
  32. __field(int, hold_retune)
  33. __field(unsigned int, retune_period)
  34. __field(struct mmc_request *, mrq)
  35. __string(name, mmc_hostname(host))
  36. ),
  37. TP_fast_assign(
  38. __entry->cmd_opcode = mrq->cmd->opcode;
  39. __entry->cmd_arg = mrq->cmd->arg;
  40. __entry->cmd_flags = mrq->cmd->flags;
  41. __entry->cmd_retries = mrq->cmd->retries;
  42. __entry->stop_opcode = mrq->stop ? mrq->stop->opcode : 0;
  43. __entry->stop_arg = mrq->stop ? mrq->stop->arg : 0;
  44. __entry->stop_flags = mrq->stop ? mrq->stop->flags : 0;
  45. __entry->stop_retries = mrq->stop ? mrq->stop->retries : 0;
  46. __entry->sbc_opcode = mrq->sbc ? mrq->sbc->opcode : 0;
  47. __entry->sbc_arg = mrq->sbc ? mrq->sbc->arg : 0;
  48. __entry->sbc_flags = mrq->sbc ? mrq->sbc->flags : 0;
  49. __entry->sbc_retries = mrq->sbc ? mrq->sbc->retries : 0;
  50. __entry->blksz = mrq->data ? mrq->data->blksz : 0;
  51. __entry->blocks = mrq->data ? mrq->data->blocks : 0;
  52. __entry->data_flags = mrq->data ? mrq->data->flags : 0;
  53. __entry->can_retune = host->can_retune;
  54. __entry->doing_retune = host->doing_retune;
  55. __entry->retune_now = host->retune_now;
  56. __entry->need_retune = host->need_retune;
  57. __entry->hold_retune = host->hold_retune;
  58. __entry->retune_period = host->retune_period;
  59. __assign_str(name, mmc_hostname(host));
  60. __entry->mrq = mrq;
  61. ),
  62. TP_printk("%s: start struct mmc_request[%p]: "
  63. "cmd_opcode=%u cmd_arg=0x%x cmd_flags=0x%x cmd_retries=%u "
  64. "stop_opcode=%u stop_arg=0x%x stop_flags=0x%x stop_retries=%u "
  65. "sbc_opcode=%u sbc_arg=0x%x sbc_flags=0x%x sbc_retires=%u "
  66. "blocks=%u block_size=%u data_flags=0x%x "
  67. "can_retune=%u doing_retune=%u retune_now=%u "
  68. "need_retune=%d hold_retune=%d retune_period=%u",
  69. __get_str(name), __entry->mrq,
  70. __entry->cmd_opcode, __entry->cmd_arg,
  71. __entry->cmd_flags, __entry->cmd_retries,
  72. __entry->stop_opcode, __entry->stop_arg,
  73. __entry->stop_flags, __entry->stop_retries,
  74. __entry->sbc_opcode, __entry->sbc_arg,
  75. __entry->sbc_flags, __entry->sbc_retries,
  76. __entry->blocks, __entry->blksz, __entry->data_flags,
  77. __entry->can_retune, __entry->doing_retune,
  78. __entry->retune_now, __entry->need_retune,
  79. __entry->hold_retune, __entry->retune_period)
  80. );
  81. TRACE_EVENT(mmc_request_done,
  82. TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),
  83. TP_ARGS(host, mrq),
  84. TP_STRUCT__entry(
  85. __field(u32, cmd_opcode)
  86. __field(int, cmd_err)
  87. __array(u32, cmd_resp, 4)
  88. __field(unsigned int, cmd_retries)
  89. __field(u32, stop_opcode)
  90. __field(int, stop_err)
  91. __array(u32, stop_resp, 4)
  92. __field(unsigned int, stop_retries)
  93. __field(u32, sbc_opcode)
  94. __field(int, sbc_err)
  95. __array(u32, sbc_resp, 4)
  96. __field(unsigned int, sbc_retries)
  97. __field(unsigned int, bytes_xfered)
  98. __field(int, data_err)
  99. __field(unsigned int, can_retune)
  100. __field(unsigned int, doing_retune)
  101. __field(unsigned int, retune_now)
  102. __field(int, need_retune)
  103. __field(int, hold_retune)
  104. __field(unsigned int, retune_period)
  105. __field(struct mmc_request *, mrq)
  106. __string(name, mmc_hostname(host))
  107. ),
  108. TP_fast_assign(
  109. __entry->cmd_opcode = mrq->cmd->opcode;
  110. __entry->cmd_err = mrq->cmd->error;
  111. memcpy(__entry->cmd_resp, mrq->cmd->resp, 4);
  112. __entry->cmd_retries = mrq->cmd->retries;
  113. __entry->stop_opcode = mrq->stop ? mrq->stop->opcode : 0;
  114. __entry->stop_err = mrq->stop ? mrq->stop->error : 0;
  115. __entry->stop_resp[0] = mrq->stop ? mrq->stop->resp[0] : 0;
  116. __entry->stop_resp[1] = mrq->stop ? mrq->stop->resp[1] : 0;
  117. __entry->stop_resp[2] = mrq->stop ? mrq->stop->resp[2] : 0;
  118. __entry->stop_resp[3] = mrq->stop ? mrq->stop->resp[3] : 0;
  119. __entry->stop_retries = mrq->stop ? mrq->stop->retries : 0;
  120. __entry->sbc_opcode = mrq->sbc ? mrq->sbc->opcode : 0;
  121. __entry->sbc_err = mrq->sbc ? mrq->sbc->error : 0;
  122. __entry->sbc_resp[0] = mrq->sbc ? mrq->sbc->resp[0] : 0;
  123. __entry->sbc_resp[1] = mrq->sbc ? mrq->sbc->resp[1] : 0;
  124. __entry->sbc_resp[2] = mrq->sbc ? mrq->sbc->resp[2] : 0;
  125. __entry->sbc_resp[3] = mrq->sbc ? mrq->sbc->resp[3] : 0;
  126. __entry->sbc_retries = mrq->sbc ? mrq->sbc->retries : 0;
  127. __entry->bytes_xfered = mrq->data ? mrq->data->bytes_xfered : 0;
  128. __entry->data_err = mrq->data ? mrq->data->error : 0;
  129. __entry->can_retune = host->can_retune;
  130. __entry->doing_retune = host->doing_retune;
  131. __entry->retune_now = host->retune_now;
  132. __entry->need_retune = host->need_retune;
  133. __entry->hold_retune = host->hold_retune;
  134. __entry->retune_period = host->retune_period;
  135. __assign_str(name, mmc_hostname(host));
  136. __entry->mrq = mrq;
  137. ),
  138. TP_printk("%s: end struct mmc_request[%p]: "
  139. "cmd_opcode=%u cmd_err=%d cmd_resp=0x%x 0x%x 0x%x 0x%x "
  140. "cmd_retries=%u stop_opcode=%u stop_err=%d "
  141. "stop_resp=0x%x 0x%x 0x%x 0x%x stop_retries=%u "
  142. "sbc_opcode=%u sbc_err=%d sbc_resp=0x%x 0x%x 0x%x 0x%x "
  143. "sbc_retries=%u bytes_xfered=%u data_err=%d "
  144. "can_retune=%u doing_retune=%u retune_now=%u need_retune=%d "
  145. "hold_retune=%d retune_period=%u",
  146. __get_str(name), __entry->mrq,
  147. __entry->cmd_opcode, __entry->cmd_err,
  148. __entry->cmd_resp[0], __entry->cmd_resp[1],
  149. __entry->cmd_resp[2], __entry->cmd_resp[3],
  150. __entry->cmd_retries,
  151. __entry->stop_opcode, __entry->stop_err,
  152. __entry->stop_resp[0], __entry->stop_resp[1],
  153. __entry->stop_resp[2], __entry->stop_resp[3],
  154. __entry->stop_retries,
  155. __entry->sbc_opcode, __entry->sbc_err,
  156. __entry->sbc_resp[0], __entry->sbc_resp[1],
  157. __entry->sbc_resp[2], __entry->sbc_resp[3],
  158. __entry->sbc_retries,
  159. __entry->bytes_xfered, __entry->data_err,
  160. __entry->can_retune, __entry->doing_retune,
  161. __entry->retune_now, __entry->need_retune,
  162. __entry->hold_retune, __entry->retune_period)
  163. );
  164. TRACE_EVENT(mmc_cmd_rw_start,
  165. TP_PROTO(unsigned int cmd, unsigned int arg, unsigned int flags),
  166. TP_ARGS(cmd, arg, flags),
  167. TP_STRUCT__entry(
  168. __field(unsigned int, cmd)
  169. __field(unsigned int, arg)
  170. __field(unsigned int, flags)
  171. ),
  172. TP_fast_assign(
  173. __entry->cmd = cmd;
  174. __entry->arg = arg;
  175. __entry->flags = flags;
  176. ),
  177. TP_printk("cmd=%u,arg=0x%08x,flags=0x%08x",
  178. __entry->cmd, __entry->arg, __entry->flags)
  179. );
  180. TRACE_EVENT(mmc_cmd_rw_end,
  181. TP_PROTO(unsigned int cmd, unsigned int status, unsigned int resp),
  182. TP_ARGS(cmd, status, resp),
  183. TP_STRUCT__entry(
  184. __field(unsigned int, cmd)
  185. __field(unsigned int, status)
  186. __field(unsigned int, resp)
  187. ),
  188. TP_fast_assign(
  189. __entry->cmd = cmd;
  190. __entry->status = status;
  191. __entry->resp = resp;
  192. ),
  193. TP_printk("cmd=%u,int_status=0x%08x,response=0x%08x",
  194. __entry->cmd, __entry->status, __entry->resp)
  195. );
  196. TRACE_EVENT(mmc_data_rw_end,
  197. TP_PROTO(unsigned int cmd, unsigned int status),
  198. TP_ARGS(cmd, status),
  199. TP_STRUCT__entry(
  200. __field(unsigned int, cmd)
  201. __field(unsigned int, status)
  202. ),
  203. TP_fast_assign(
  204. __entry->cmd = cmd;
  205. __entry->status = status;
  206. ),
  207. TP_printk("cmd=%u,int_status=0x%08x",
  208. __entry->cmd, __entry->status)
  209. );
  210. DECLARE_EVENT_CLASS(mmc_adma_class,
  211. TP_PROTO(unsigned int cmd, unsigned int len),
  212. TP_ARGS(cmd, len),
  213. TP_STRUCT__entry(
  214. __field(unsigned int, cmd)
  215. __field(unsigned int, len)
  216. ),
  217. TP_fast_assign(
  218. __entry->cmd = cmd;
  219. __entry->len = len;
  220. ),
  221. TP_printk("cmd=%u,sg_len=0x%08x", __entry->cmd, __entry->len)
  222. );
  223. DEFINE_EVENT(mmc_adma_class, mmc_adma_table_pre,
  224. TP_PROTO(unsigned int cmd, unsigned int len),
  225. TP_ARGS(cmd, len));
  226. DEFINE_EVENT(mmc_adma_class, mmc_adma_table_post,
  227. TP_PROTO(unsigned int cmd, unsigned int len),
  228. TP_ARGS(cmd, len));
  229. TRACE_EVENT(mmc_clk,
  230. TP_PROTO(char *print_info),
  231. TP_ARGS(print_info),
  232. TP_STRUCT__entry(
  233. __string(print_info, print_info)
  234. ),
  235. TP_fast_assign(
  236. __assign_str(print_info, print_info);
  237. ),
  238. TP_printk("%s",
  239. __get_str(print_info)
  240. )
  241. );
  242. DECLARE_EVENT_CLASS(mmc_pm_template,
  243. TP_PROTO(const char *dev_name, int err, s64 usecs),
  244. TP_ARGS(dev_name, err, usecs),
  245. TP_STRUCT__entry(
  246. __field(s64, usecs)
  247. __field(int, err)
  248. __string(dev_name, dev_name)
  249. ),
  250. TP_fast_assign(
  251. __entry->usecs = usecs;
  252. __entry->err = err;
  253. __assign_str(dev_name, dev_name);
  254. ),
  255. TP_printk(
  256. "took %lld usecs, %s err %d",
  257. __entry->usecs,
  258. __get_str(dev_name),
  259. __entry->err
  260. )
  261. );
  262. DEFINE_EVENT(mmc_pm_template, mmc_runtime_suspend,
  263. TP_PROTO(const char *dev_name, int err, s64 usecs),
  264. TP_ARGS(dev_name, err, usecs));
  265. DEFINE_EVENT(mmc_pm_template, mmc_runtime_resume,
  266. TP_PROTO(const char *dev_name, int err, s64 usecs),
  267. TP_ARGS(dev_name, err, usecs));
  268. DEFINE_EVENT(mmc_pm_template, mmc_suspend,
  269. TP_PROTO(const char *dev_name, int err, s64 usecs),
  270. TP_ARGS(dev_name, err, usecs));
  271. DEFINE_EVENT(mmc_pm_template, mmc_resume,
  272. TP_PROTO(const char *dev_name, int err, s64 usecs),
  273. TP_ARGS(dev_name, err, usecs));
  274. DEFINE_EVENT(mmc_pm_template, sdhci_msm_suspend,
  275. TP_PROTO(const char *dev_name, int err, s64 usecs),
  276. TP_ARGS(dev_name, err, usecs));
  277. DEFINE_EVENT(mmc_pm_template, sdhci_msm_resume,
  278. TP_PROTO(const char *dev_name, int err, s64 usecs),
  279. TP_ARGS(dev_name, err, usecs));
  280. DEFINE_EVENT(mmc_pm_template, sdhci_msm_runtime_suspend,
  281. TP_PROTO(const char *dev_name, int err, s64 usecs),
  282. TP_ARGS(dev_name, err, usecs));
  283. DEFINE_EVENT(mmc_pm_template, sdhci_msm_runtime_resume,
  284. TP_PROTO(const char *dev_name, int err, s64 usecs),
  285. TP_ARGS(dev_name, err, usecs));
  286. #endif /* if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ) */
  287. /* This part must be outside protection */
  288. #include <trace/define_trace.h>