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