libata.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM libata
  3. #if !defined(_TRACE_LIBATA_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_LIBATA_H
  5. #include <linux/ata.h>
  6. #include <linux/libata.h>
  7. #include <linux/tracepoint.h>
  8. #include <linux/trace_seq.h>
  9. #define ata_opcode_name(opcode) { opcode, #opcode }
  10. #define show_opcode_name(val) \
  11. __print_symbolic(val, \
  12. ata_opcode_name(ATA_CMD_DEV_RESET), \
  13. ata_opcode_name(ATA_CMD_CHK_POWER), \
  14. ata_opcode_name(ATA_CMD_STANDBY), \
  15. ata_opcode_name(ATA_CMD_IDLE), \
  16. ata_opcode_name(ATA_CMD_EDD), \
  17. ata_opcode_name(ATA_CMD_DOWNLOAD_MICRO), \
  18. ata_opcode_name(ATA_CMD_DOWNLOAD_MICRO_DMA), \
  19. ata_opcode_name(ATA_CMD_NOP), \
  20. ata_opcode_name(ATA_CMD_FLUSH), \
  21. ata_opcode_name(ATA_CMD_FLUSH_EXT), \
  22. ata_opcode_name(ATA_CMD_ID_ATA), \
  23. ata_opcode_name(ATA_CMD_ID_ATAPI), \
  24. ata_opcode_name(ATA_CMD_SERVICE), \
  25. ata_opcode_name(ATA_CMD_READ), \
  26. ata_opcode_name(ATA_CMD_READ_EXT), \
  27. ata_opcode_name(ATA_CMD_READ_QUEUED), \
  28. ata_opcode_name(ATA_CMD_READ_STREAM_EXT), \
  29. ata_opcode_name(ATA_CMD_READ_STREAM_DMA_EXT), \
  30. ata_opcode_name(ATA_CMD_WRITE), \
  31. ata_opcode_name(ATA_CMD_WRITE_EXT), \
  32. ata_opcode_name(ATA_CMD_WRITE_QUEUED), \
  33. ata_opcode_name(ATA_CMD_WRITE_STREAM_EXT), \
  34. ata_opcode_name(ATA_CMD_WRITE_STREAM_DMA_EXT), \
  35. ata_opcode_name(ATA_CMD_WRITE_FUA_EXT), \
  36. ata_opcode_name(ATA_CMD_WRITE_QUEUED_FUA_EXT), \
  37. ata_opcode_name(ATA_CMD_FPDMA_READ), \
  38. ata_opcode_name(ATA_CMD_FPDMA_WRITE), \
  39. ata_opcode_name(ATA_CMD_FPDMA_SEND), \
  40. ata_opcode_name(ATA_CMD_FPDMA_RECV), \
  41. ata_opcode_name(ATA_CMD_PIO_READ), \
  42. ata_opcode_name(ATA_CMD_PIO_READ_EXT), \
  43. ata_opcode_name(ATA_CMD_PIO_WRITE), \
  44. ata_opcode_name(ATA_CMD_PIO_WRITE_EXT), \
  45. ata_opcode_name(ATA_CMD_READ_MULTI), \
  46. ata_opcode_name(ATA_CMD_READ_MULTI_EXT), \
  47. ata_opcode_name(ATA_CMD_WRITE_MULTI), \
  48. ata_opcode_name(ATA_CMD_WRITE_MULTI_EXT), \
  49. ata_opcode_name(ATA_CMD_WRITE_MULTI_FUA_EXT), \
  50. ata_opcode_name(ATA_CMD_SET_FEATURES), \
  51. ata_opcode_name(ATA_CMD_SET_MULTI), \
  52. ata_opcode_name(ATA_CMD_PACKET), \
  53. ata_opcode_name(ATA_CMD_VERIFY), \
  54. ata_opcode_name(ATA_CMD_VERIFY_EXT), \
  55. ata_opcode_name(ATA_CMD_WRITE_UNCORR_EXT), \
  56. ata_opcode_name(ATA_CMD_STANDBYNOW1), \
  57. ata_opcode_name(ATA_CMD_IDLEIMMEDIATE), \
  58. ata_opcode_name(ATA_CMD_SLEEP), \
  59. ata_opcode_name(ATA_CMD_INIT_DEV_PARAMS), \
  60. ata_opcode_name(ATA_CMD_READ_NATIVE_MAX), \
  61. ata_opcode_name(ATA_CMD_READ_NATIVE_MAX_EXT), \
  62. ata_opcode_name(ATA_CMD_SET_MAX), \
  63. ata_opcode_name(ATA_CMD_SET_MAX_EXT), \
  64. ata_opcode_name(ATA_CMD_READ_LOG_EXT), \
  65. ata_opcode_name(ATA_CMD_WRITE_LOG_EXT), \
  66. ata_opcode_name(ATA_CMD_READ_LOG_DMA_EXT), \
  67. ata_opcode_name(ATA_CMD_WRITE_LOG_DMA_EXT), \
  68. ata_opcode_name(ATA_CMD_TRUSTED_NONDATA), \
  69. ata_opcode_name(ATA_CMD_TRUSTED_RCV), \
  70. ata_opcode_name(ATA_CMD_TRUSTED_RCV_DMA), \
  71. ata_opcode_name(ATA_CMD_TRUSTED_SND), \
  72. ata_opcode_name(ATA_CMD_TRUSTED_SND_DMA), \
  73. ata_opcode_name(ATA_CMD_PMP_READ), \
  74. ata_opcode_name(ATA_CMD_PMP_READ_DMA), \
  75. ata_opcode_name(ATA_CMD_PMP_WRITE), \
  76. ata_opcode_name(ATA_CMD_PMP_WRITE_DMA), \
  77. ata_opcode_name(ATA_CMD_CONF_OVERLAY), \
  78. ata_opcode_name(ATA_CMD_SEC_SET_PASS), \
  79. ata_opcode_name(ATA_CMD_SEC_UNLOCK), \
  80. ata_opcode_name(ATA_CMD_SEC_ERASE_PREP), \
  81. ata_opcode_name(ATA_CMD_SEC_ERASE_UNIT), \
  82. ata_opcode_name(ATA_CMD_SEC_FREEZE_LOCK), \
  83. ata_opcode_name(ATA_CMD_SEC_DISABLE_PASS), \
  84. ata_opcode_name(ATA_CMD_CONFIG_STREAM), \
  85. ata_opcode_name(ATA_CMD_SMART), \
  86. ata_opcode_name(ATA_CMD_MEDIA_LOCK), \
  87. ata_opcode_name(ATA_CMD_MEDIA_UNLOCK), \
  88. ata_opcode_name(ATA_CMD_DSM), \
  89. ata_opcode_name(ATA_CMD_CHK_MED_CRD_TYP), \
  90. ata_opcode_name(ATA_CMD_CFA_REQ_EXT_ERR), \
  91. ata_opcode_name(ATA_CMD_CFA_WRITE_NE), \
  92. ata_opcode_name(ATA_CMD_CFA_TRANS_SECT), \
  93. ata_opcode_name(ATA_CMD_CFA_ERASE), \
  94. ata_opcode_name(ATA_CMD_CFA_WRITE_MULT_NE), \
  95. ata_opcode_name(ATA_CMD_REQ_SENSE_DATA), \
  96. ata_opcode_name(ATA_CMD_SANITIZE_DEVICE), \
  97. ata_opcode_name(ATA_CMD_RESTORE), \
  98. ata_opcode_name(ATA_CMD_READ_LONG), \
  99. ata_opcode_name(ATA_CMD_READ_LONG_ONCE), \
  100. ata_opcode_name(ATA_CMD_WRITE_LONG), \
  101. ata_opcode_name(ATA_CMD_WRITE_LONG_ONCE))
  102. #define ata_error_name(result) { result, #result }
  103. #define show_error_name(val) \
  104. __print_symbolic(val, \
  105. ata_error_name(ATA_ICRC), \
  106. ata_error_name(ATA_UNC), \
  107. ata_error_name(ATA_MC), \
  108. ata_error_name(ATA_IDNF), \
  109. ata_error_name(ATA_MCR), \
  110. ata_error_name(ATA_ABORTED), \
  111. ata_error_name(ATA_TRK0NF), \
  112. ata_error_name(ATA_AMNF))
  113. #define ata_protocol_name(proto) { proto, #proto }
  114. #define show_protocol_name(val) \
  115. __print_symbolic(val, \
  116. ata_protocol_name(ATA_PROT_UNKNOWN), \
  117. ata_protocol_name(ATA_PROT_NODATA), \
  118. ata_protocol_name(ATA_PROT_PIO), \
  119. ata_protocol_name(ATA_PROT_DMA), \
  120. ata_protocol_name(ATA_PROT_NCQ), \
  121. ata_protocol_name(ATAPI_PROT_NODATA), \
  122. ata_protocol_name(ATAPI_PROT_PIO), \
  123. ata_protocol_name(ATAPI_PROT_DMA))
  124. const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
  125. #define __parse_status(s) libata_trace_parse_status(p, s)
  126. const char *libata_trace_parse_eh_action(struct trace_seq *, unsigned int);
  127. #define __parse_eh_action(a) libata_trace_parse_eh_action(p, a)
  128. const char *libata_trace_parse_eh_err_mask(struct trace_seq *, unsigned int);
  129. #define __parse_eh_err_mask(m) libata_trace_parse_eh_err_mask(p, m)
  130. const char *libata_trace_parse_qc_flags(struct trace_seq *, unsigned int);
  131. #define __parse_qc_flags(f) libata_trace_parse_qc_flags(p, f)
  132. TRACE_EVENT(ata_qc_issue,
  133. TP_PROTO(struct ata_queued_cmd *qc),
  134. TP_ARGS(qc),
  135. TP_STRUCT__entry(
  136. __field( unsigned int, ata_port )
  137. __field( unsigned int, ata_dev )
  138. __field( unsigned int, tag )
  139. __field( unsigned char, cmd )
  140. __field( unsigned char, dev )
  141. __field( unsigned char, lbal )
  142. __field( unsigned char, lbam )
  143. __field( unsigned char, lbah )
  144. __field( unsigned char, nsect )
  145. __field( unsigned char, feature )
  146. __field( unsigned char, hob_lbal )
  147. __field( unsigned char, hob_lbam )
  148. __field( unsigned char, hob_lbah )
  149. __field( unsigned char, hob_nsect )
  150. __field( unsigned char, hob_feature )
  151. __field( unsigned char, ctl )
  152. __field( unsigned char, proto )
  153. __field( unsigned long, flags )
  154. ),
  155. TP_fast_assign(
  156. __entry->ata_port = qc->ap->print_id;
  157. __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
  158. __entry->tag = qc->tag;
  159. __entry->proto = qc->tf.protocol;
  160. __entry->cmd = qc->tf.command;
  161. __entry->dev = qc->tf.device;
  162. __entry->lbal = qc->tf.lbal;
  163. __entry->lbam = qc->tf.lbam;
  164. __entry->lbah = qc->tf.lbah;
  165. __entry->hob_lbal = qc->tf.hob_lbal;
  166. __entry->hob_lbam = qc->tf.hob_lbam;
  167. __entry->hob_lbah = qc->tf.hob_lbah;
  168. __entry->feature = qc->tf.feature;
  169. __entry->hob_feature = qc->tf.hob_feature;
  170. __entry->nsect = qc->tf.nsect;
  171. __entry->hob_nsect = qc->tf.hob_nsect;
  172. ),
  173. TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s cmd=%s " \
  174. " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
  175. __entry->ata_port, __entry->ata_dev, __entry->tag,
  176. show_protocol_name(__entry->proto),
  177. show_opcode_name(__entry->cmd),
  178. __entry->cmd, __entry->feature, __entry->nsect,
  179. __entry->lbal, __entry->lbam, __entry->lbah,
  180. __entry->hob_feature, __entry->hob_nsect,
  181. __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
  182. __entry->dev)
  183. );
  184. DECLARE_EVENT_CLASS(ata_qc_complete_template,
  185. TP_PROTO(struct ata_queued_cmd *qc),
  186. TP_ARGS(qc),
  187. TP_STRUCT__entry(
  188. __field( unsigned int, ata_port )
  189. __field( unsigned int, ata_dev )
  190. __field( unsigned int, tag )
  191. __field( unsigned char, status )
  192. __field( unsigned char, dev )
  193. __field( unsigned char, lbal )
  194. __field( unsigned char, lbam )
  195. __field( unsigned char, lbah )
  196. __field( unsigned char, nsect )
  197. __field( unsigned char, error )
  198. __field( unsigned char, hob_lbal )
  199. __field( unsigned char, hob_lbam )
  200. __field( unsigned char, hob_lbah )
  201. __field( unsigned char, hob_nsect )
  202. __field( unsigned char, hob_feature )
  203. __field( unsigned char, ctl )
  204. __field( unsigned long, flags )
  205. ),
  206. TP_fast_assign(
  207. __entry->ata_port = qc->ap->print_id;
  208. __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
  209. __entry->tag = qc->tag;
  210. __entry->status = qc->result_tf.command;
  211. __entry->dev = qc->result_tf.device;
  212. __entry->lbal = qc->result_tf.lbal;
  213. __entry->lbam = qc->result_tf.lbam;
  214. __entry->lbah = qc->result_tf.lbah;
  215. __entry->hob_lbal = qc->result_tf.hob_lbal;
  216. __entry->hob_lbam = qc->result_tf.hob_lbam;
  217. __entry->hob_lbah = qc->result_tf.hob_lbah;
  218. __entry->error = qc->result_tf.feature;
  219. __entry->hob_feature = qc->result_tf.hob_feature;
  220. __entry->nsect = qc->result_tf.nsect;
  221. __entry->hob_nsect = qc->result_tf.hob_nsect;
  222. ),
  223. TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s status=%s " \
  224. " res=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
  225. __entry->ata_port, __entry->ata_dev, __entry->tag,
  226. __parse_qc_flags(__entry->flags),
  227. __parse_status(__entry->status),
  228. __entry->status, __entry->error, __entry->nsect,
  229. __entry->lbal, __entry->lbam, __entry->lbah,
  230. __entry->hob_feature, __entry->hob_nsect,
  231. __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
  232. __entry->dev)
  233. );
  234. DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_internal,
  235. TP_PROTO(struct ata_queued_cmd *qc),
  236. TP_ARGS(qc));
  237. DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_failed,
  238. TP_PROTO(struct ata_queued_cmd *qc),
  239. TP_ARGS(qc));
  240. DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_done,
  241. TP_PROTO(struct ata_queued_cmd *qc),
  242. TP_ARGS(qc));
  243. TRACE_EVENT(ata_eh_link_autopsy,
  244. TP_PROTO(struct ata_device *dev, unsigned int eh_action, unsigned int eh_err_mask),
  245. TP_ARGS(dev, eh_action, eh_err_mask),
  246. TP_STRUCT__entry(
  247. __field( unsigned int, ata_port )
  248. __field( unsigned int, ata_dev )
  249. __field( unsigned int, eh_action )
  250. __field( unsigned int, eh_err_mask)
  251. ),
  252. TP_fast_assign(
  253. __entry->ata_port = dev->link->ap->print_id;
  254. __entry->ata_dev = dev->link->pmp + dev->devno;
  255. __entry->eh_action = eh_action;
  256. __entry->eh_err_mask = eh_err_mask;
  257. ),
  258. TP_printk("ata_port=%u ata_dev=%u eh_action=%s err_mask=%s",
  259. __entry->ata_port, __entry->ata_dev,
  260. __parse_eh_action(__entry->eh_action),
  261. __parse_eh_err_mask(__entry->eh_err_mask))
  262. );
  263. TRACE_EVENT(ata_eh_link_autopsy_qc,
  264. TP_PROTO(struct ata_queued_cmd *qc),
  265. TP_ARGS(qc),
  266. TP_STRUCT__entry(
  267. __field( unsigned int, ata_port )
  268. __field( unsigned int, ata_dev )
  269. __field( unsigned int, tag )
  270. __field( unsigned int, qc_flags )
  271. __field( unsigned int, eh_err_mask)
  272. ),
  273. TP_fast_assign(
  274. __entry->ata_port = qc->ap->print_id;
  275. __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
  276. __entry->tag = qc->tag;
  277. __entry->qc_flags = qc->flags;
  278. __entry->eh_err_mask = qc->err_mask;
  279. ),
  280. TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s err_mask=%s",
  281. __entry->ata_port, __entry->ata_dev, __entry->tag,
  282. __parse_qc_flags(__entry->qc_flags),
  283. __parse_eh_err_mask(__entry->eh_err_mask))
  284. );
  285. #endif /* _TRACE_LIBATA_H */
  286. /* This part must be outside protection */
  287. #include <trace/define_trace.h>