1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM libata
5 #if !defined(_TRACE_LIBATA_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_LIBATA_H
9 #include <linux/libata.h>
10 #include <linux/tracepoint.h>
11 #include <linux/trace_seq.h>
13 #define ata_opcode_name(opcode) { opcode, #opcode }
14 #define show_opcode_name(val) \
15 __print_symbolic(val, \
16 ata_opcode_name(ATA_CMD_DEV_RESET), \
17 ata_opcode_name(ATA_CMD_CHK_POWER), \
18 ata_opcode_name(ATA_CMD_STANDBY), \
19 ata_opcode_name(ATA_CMD_IDLE), \
20 ata_opcode_name(ATA_CMD_EDD), \
21 ata_opcode_name(ATA_CMD_DOWNLOAD_MICRO), \
22 ata_opcode_name(ATA_CMD_DOWNLOAD_MICRO_DMA), \
23 ata_opcode_name(ATA_CMD_NOP), \
24 ata_opcode_name(ATA_CMD_FLUSH), \
25 ata_opcode_name(ATA_CMD_FLUSH_EXT), \
26 ata_opcode_name(ATA_CMD_ID_ATA), \
27 ata_opcode_name(ATA_CMD_ID_ATAPI), \
28 ata_opcode_name(ATA_CMD_SERVICE), \
29 ata_opcode_name(ATA_CMD_READ), \
30 ata_opcode_name(ATA_CMD_READ_EXT), \
31 ata_opcode_name(ATA_CMD_READ_QUEUED), \
32 ata_opcode_name(ATA_CMD_READ_STREAM_EXT), \
33 ata_opcode_name(ATA_CMD_READ_STREAM_DMA_EXT), \
34 ata_opcode_name(ATA_CMD_WRITE), \
35 ata_opcode_name(ATA_CMD_WRITE_EXT), \
36 ata_opcode_name(ATA_CMD_WRITE_QUEUED), \
37 ata_opcode_name(ATA_CMD_WRITE_STREAM_EXT), \
38 ata_opcode_name(ATA_CMD_WRITE_STREAM_DMA_EXT), \
39 ata_opcode_name(ATA_CMD_WRITE_FUA_EXT), \
40 ata_opcode_name(ATA_CMD_WRITE_QUEUED_FUA_EXT), \
41 ata_opcode_name(ATA_CMD_FPDMA_READ), \
42 ata_opcode_name(ATA_CMD_FPDMA_WRITE), \
43 ata_opcode_name(ATA_CMD_NCQ_NON_DATA), \
44 ata_opcode_name(ATA_CMD_FPDMA_SEND), \
45 ata_opcode_name(ATA_CMD_FPDMA_RECV), \
46 ata_opcode_name(ATA_CMD_PIO_READ), \
47 ata_opcode_name(ATA_CMD_PIO_READ_EXT), \
48 ata_opcode_name(ATA_CMD_PIO_WRITE), \
49 ata_opcode_name(ATA_CMD_PIO_WRITE_EXT), \
50 ata_opcode_name(ATA_CMD_READ_MULTI), \
51 ata_opcode_name(ATA_CMD_READ_MULTI_EXT), \
52 ata_opcode_name(ATA_CMD_WRITE_MULTI), \
53 ata_opcode_name(ATA_CMD_WRITE_MULTI_EXT), \
54 ata_opcode_name(ATA_CMD_WRITE_MULTI_FUA_EXT), \
55 ata_opcode_name(ATA_CMD_SET_FEATURES), \
56 ata_opcode_name(ATA_CMD_SET_MULTI), \
57 ata_opcode_name(ATA_CMD_PACKET), \
58 ata_opcode_name(ATA_CMD_VERIFY), \
59 ata_opcode_name(ATA_CMD_VERIFY_EXT), \
60 ata_opcode_name(ATA_CMD_WRITE_UNCORR_EXT), \
61 ata_opcode_name(ATA_CMD_STANDBYNOW1), \
62 ata_opcode_name(ATA_CMD_IDLEIMMEDIATE), \
63 ata_opcode_name(ATA_CMD_SLEEP), \
64 ata_opcode_name(ATA_CMD_INIT_DEV_PARAMS), \
65 ata_opcode_name(ATA_CMD_READ_NATIVE_MAX), \
66 ata_opcode_name(ATA_CMD_READ_NATIVE_MAX_EXT), \
67 ata_opcode_name(ATA_CMD_SET_MAX), \
68 ata_opcode_name(ATA_CMD_SET_MAX_EXT), \
69 ata_opcode_name(ATA_CMD_READ_LOG_EXT), \
70 ata_opcode_name(ATA_CMD_WRITE_LOG_EXT), \
71 ata_opcode_name(ATA_CMD_READ_LOG_DMA_EXT), \
72 ata_opcode_name(ATA_CMD_WRITE_LOG_DMA_EXT), \
73 ata_opcode_name(ATA_CMD_TRUSTED_NONDATA), \
74 ata_opcode_name(ATA_CMD_TRUSTED_RCV), \
75 ata_opcode_name(ATA_CMD_TRUSTED_RCV_DMA), \
76 ata_opcode_name(ATA_CMD_TRUSTED_SND), \
77 ata_opcode_name(ATA_CMD_TRUSTED_SND_DMA), \
78 ata_opcode_name(ATA_CMD_PMP_READ), \
79 ata_opcode_name(ATA_CMD_PMP_READ_DMA), \
80 ata_opcode_name(ATA_CMD_PMP_WRITE), \
81 ata_opcode_name(ATA_CMD_PMP_WRITE_DMA), \
82 ata_opcode_name(ATA_CMD_CONF_OVERLAY), \
83 ata_opcode_name(ATA_CMD_SEC_SET_PASS), \
84 ata_opcode_name(ATA_CMD_SEC_UNLOCK), \
85 ata_opcode_name(ATA_CMD_SEC_ERASE_PREP), \
86 ata_opcode_name(ATA_CMD_SEC_ERASE_UNIT), \
87 ata_opcode_name(ATA_CMD_SEC_FREEZE_LOCK), \
88 ata_opcode_name(ATA_CMD_SEC_DISABLE_PASS), \
89 ata_opcode_name(ATA_CMD_CONFIG_STREAM), \
90 ata_opcode_name(ATA_CMD_SMART), \
91 ata_opcode_name(ATA_CMD_MEDIA_LOCK), \
92 ata_opcode_name(ATA_CMD_MEDIA_UNLOCK), \
93 ata_opcode_name(ATA_CMD_DSM), \
94 ata_opcode_name(ATA_CMD_CHK_MED_CRD_TYP), \
95 ata_opcode_name(ATA_CMD_CFA_REQ_EXT_ERR), \
96 ata_opcode_name(ATA_CMD_CFA_WRITE_NE), \
97 ata_opcode_name(ATA_CMD_CFA_TRANS_SECT), \
98 ata_opcode_name(ATA_CMD_CFA_ERASE), \
99 ata_opcode_name(ATA_CMD_CFA_WRITE_MULT_NE), \
100 ata_opcode_name(ATA_CMD_REQ_SENSE_DATA), \
101 ata_opcode_name(ATA_CMD_SANITIZE_DEVICE), \
102 ata_opcode_name(ATA_CMD_ZAC_MGMT_IN), \
103 ata_opcode_name(ATA_CMD_ZAC_MGMT_OUT), \
104 ata_opcode_name(ATA_CMD_RESTORE), \
105 ata_opcode_name(ATA_CMD_READ_LONG), \
106 ata_opcode_name(ATA_CMD_READ_LONG_ONCE), \
107 ata_opcode_name(ATA_CMD_WRITE_LONG), \
108 ata_opcode_name(ATA_CMD_WRITE_LONG_ONCE))
110 #define ata_error_name(result) { result, #result }
111 #define show_error_name(val) \
112 __print_symbolic(val, \
113 ata_error_name(ATA_ICRC), \
114 ata_error_name(ATA_UNC), \
115 ata_error_name(ATA_MC), \
116 ata_error_name(ATA_IDNF), \
117 ata_error_name(ATA_MCR), \
118 ata_error_name(ATA_ABORTED), \
119 ata_error_name(ATA_TRK0NF), \
120 ata_error_name(ATA_AMNF))
122 #define ata_protocol_name(proto) { proto, #proto }
123 #define show_protocol_name(val) \
124 __print_symbolic(val, \
125 ata_protocol_name(ATA_PROT_UNKNOWN), \
126 ata_protocol_name(ATA_PROT_NODATA), \
127 ata_protocol_name(ATA_PROT_PIO), \
128 ata_protocol_name(ATA_PROT_DMA), \
129 ata_protocol_name(ATA_PROT_NCQ), \
130 ata_protocol_name(ATA_PROT_NCQ_NODATA), \
131 ata_protocol_name(ATAPI_PROT_NODATA), \
132 ata_protocol_name(ATAPI_PROT_PIO), \
133 ata_protocol_name(ATAPI_PROT_DMA))
135 #define ata_class_name(class) { class, #class }
136 #define show_class_name(val) \
137 __print_symbolic(val, \
138 ata_class_name(ATA_DEV_UNKNOWN), \
139 ata_class_name(ATA_DEV_ATA), \
140 ata_class_name(ATA_DEV_ATA_UNSUP), \
141 ata_class_name(ATA_DEV_ATAPI), \
142 ata_class_name(ATA_DEV_ATAPI_UNSUP), \
143 ata_class_name(ATA_DEV_PMP), \
144 ata_class_name(ATA_DEV_PMP_UNSUP), \
145 ata_class_name(ATA_DEV_SEMB), \
146 ata_class_name(ATA_DEV_SEMB_UNSUP), \
147 ata_class_name(ATA_DEV_ZAC), \
148 ata_class_name(ATA_DEV_ZAC_UNSUP), \
149 ata_class_name(ATA_DEV_NONE))
151 #define ata_sff_hsm_state_name(state) { state, #state }
152 #define show_sff_hsm_state_name(val) \
153 __print_symbolic(val, \
154 ata_sff_hsm_state_name(HSM_ST_IDLE), \
155 ata_sff_hsm_state_name(HSM_ST_FIRST), \
156 ata_sff_hsm_state_name(HSM_ST), \
157 ata_sff_hsm_state_name(HSM_ST_LAST), \
158 ata_sff_hsm_state_name(HSM_ST_ERR))
160 const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
161 #define __parse_status(s) libata_trace_parse_status(p, s)
163 const char *libata_trace_parse_host_stat(struct trace_seq *, unsigned char);
164 #define __parse_host_stat(s) libata_trace_parse_host_stat(p, s)
166 const char *libata_trace_parse_eh_action(struct trace_seq *, unsigned int);
167 #define __parse_eh_action(a) libata_trace_parse_eh_action(p, a)
169 const char *libata_trace_parse_eh_err_mask(struct trace_seq *, unsigned int);
170 #define __parse_eh_err_mask(m) libata_trace_parse_eh_err_mask(p, m)
172 const char *libata_trace_parse_qc_flags(struct trace_seq *, unsigned int);
173 #define __parse_qc_flags(f) libata_trace_parse_qc_flags(p, f)
175 const char *libata_trace_parse_tf_flags(struct trace_seq *, unsigned int);
176 #define __parse_tf_flags(f) libata_trace_parse_tf_flags(p, f)
178 const char *libata_trace_parse_subcmd(struct trace_seq *, unsigned char,
179 unsigned char, unsigned char);
180 #define __parse_subcmd(c,f,h) libata_trace_parse_subcmd(p, c, f, h)
182 DECLARE_EVENT_CLASS(ata_qc_issue_template,
184 TP_PROTO(struct ata_queued_cmd *qc),
189 __field( unsigned int, ata_port )
190 __field( unsigned int, ata_dev )
191 __field( unsigned int, tag )
192 __field( unsigned char, cmd )
193 __field( unsigned char, dev )
194 __field( unsigned char, lbal )
195 __field( unsigned char, lbam )
196 __field( unsigned char, lbah )
197 __field( unsigned char, nsect )
198 __field( unsigned char, feature )
199 __field( unsigned char, hob_lbal )
200 __field( unsigned char, hob_lbam )
201 __field( unsigned char, hob_lbah )
202 __field( unsigned char, hob_nsect )
203 __field( unsigned char, hob_feature )
204 __field( unsigned char, ctl )
205 __field( unsigned char, proto )
206 __field( unsigned long, flags )
210 __entry->ata_port = qc->ap->print_id;
211 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
212 __entry->tag = qc->tag;
213 __entry->proto = qc->tf.protocol;
214 __entry->cmd = qc->tf.command;
215 __entry->dev = qc->tf.device;
216 __entry->lbal = qc->tf.lbal;
217 __entry->lbam = qc->tf.lbam;
218 __entry->lbah = qc->tf.lbah;
219 __entry->hob_lbal = qc->tf.hob_lbal;
220 __entry->hob_lbam = qc->tf.hob_lbam;
221 __entry->hob_lbah = qc->tf.hob_lbah;
222 __entry->feature = qc->tf.feature;
223 __entry->hob_feature = qc->tf.hob_feature;
224 __entry->nsect = qc->tf.nsect;
225 __entry->hob_nsect = qc->tf.hob_nsect;
228 TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s cmd=%s%s " \
229 " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
230 __entry->ata_port, __entry->ata_dev, __entry->tag,
231 show_protocol_name(__entry->proto),
232 show_opcode_name(__entry->cmd),
233 __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect),
234 __entry->cmd, __entry->feature, __entry->nsect,
235 __entry->lbal, __entry->lbam, __entry->lbah,
236 __entry->hob_feature, __entry->hob_nsect,
237 __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
241 DEFINE_EVENT(ata_qc_issue_template, ata_qc_prep,
242 TP_PROTO(struct ata_queued_cmd *qc),
245 DEFINE_EVENT(ata_qc_issue_template, ata_qc_issue,
246 TP_PROTO(struct ata_queued_cmd *qc),
249 DECLARE_EVENT_CLASS(ata_qc_complete_template,
251 TP_PROTO(struct ata_queued_cmd *qc),
256 __field( unsigned int, ata_port )
257 __field( unsigned int, ata_dev )
258 __field( unsigned int, tag )
259 __field( unsigned char, status )
260 __field( unsigned char, dev )
261 __field( unsigned char, lbal )
262 __field( unsigned char, lbam )
263 __field( unsigned char, lbah )
264 __field( unsigned char, nsect )
265 __field( unsigned char, error )
266 __field( unsigned char, hob_lbal )
267 __field( unsigned char, hob_lbam )
268 __field( unsigned char, hob_lbah )
269 __field( unsigned char, hob_nsect )
270 __field( unsigned char, hob_feature )
271 __field( unsigned char, ctl )
272 __field( unsigned long, flags )
276 __entry->ata_port = qc->ap->print_id;
277 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
278 __entry->tag = qc->tag;
279 __entry->status = qc->result_tf.command;
280 __entry->dev = qc->result_tf.device;
281 __entry->lbal = qc->result_tf.lbal;
282 __entry->lbam = qc->result_tf.lbam;
283 __entry->lbah = qc->result_tf.lbah;
284 __entry->hob_lbal = qc->result_tf.hob_lbal;
285 __entry->hob_lbam = qc->result_tf.hob_lbam;
286 __entry->hob_lbah = qc->result_tf.hob_lbah;
287 __entry->error = qc->result_tf.feature;
288 __entry->hob_feature = qc->result_tf.hob_feature;
289 __entry->nsect = qc->result_tf.nsect;
290 __entry->hob_nsect = qc->result_tf.hob_nsect;
291 __entry->flags = qc->flags;
294 TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s status=%s " \
295 " res=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
296 __entry->ata_port, __entry->ata_dev, __entry->tag,
297 __parse_qc_flags(__entry->flags),
298 __parse_status(__entry->status),
299 __entry->status, __entry->error, __entry->nsect,
300 __entry->lbal, __entry->lbam, __entry->lbah,
301 __entry->hob_feature, __entry->hob_nsect,
302 __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
306 DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_internal,
307 TP_PROTO(struct ata_queued_cmd *qc),
310 DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_failed,
311 TP_PROTO(struct ata_queued_cmd *qc),
314 DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_done,
315 TP_PROTO(struct ata_queued_cmd *qc),
318 TRACE_EVENT(ata_tf_load,
320 TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf),
325 __field( unsigned int, ata_port )
326 __field( unsigned char, cmd )
327 __field( unsigned char, dev )
328 __field( unsigned char, lbal )
329 __field( unsigned char, lbam )
330 __field( unsigned char, lbah )
331 __field( unsigned char, nsect )
332 __field( unsigned char, feature )
333 __field( unsigned char, hob_lbal )
334 __field( unsigned char, hob_lbam )
335 __field( unsigned char, hob_lbah )
336 __field( unsigned char, hob_nsect )
337 __field( unsigned char, hob_feature )
338 __field( unsigned char, proto )
342 __entry->ata_port = ap->print_id;
343 __entry->proto = tf->protocol;
344 __entry->cmd = tf->command;
345 __entry->dev = tf->device;
346 __entry->lbal = tf->lbal;
347 __entry->lbam = tf->lbam;
348 __entry->lbah = tf->lbah;
349 __entry->hob_lbal = tf->hob_lbal;
350 __entry->hob_lbam = tf->hob_lbam;
351 __entry->hob_lbah = tf->hob_lbah;
352 __entry->feature = tf->feature;
353 __entry->hob_feature = tf->hob_feature;
354 __entry->nsect = tf->nsect;
355 __entry->hob_nsect = tf->hob_nsect;
358 TP_printk("ata_port=%u proto=%s cmd=%s%s " \
359 " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
361 show_protocol_name(__entry->proto),
362 show_opcode_name(__entry->cmd),
363 __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect),
364 __entry->cmd, __entry->feature, __entry->nsect,
365 __entry->lbal, __entry->lbam, __entry->lbah,
366 __entry->hob_feature, __entry->hob_nsect,
367 __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
371 DECLARE_EVENT_CLASS(ata_exec_command_template,
373 TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
375 TP_ARGS(ap, tf, tag),
378 __field( unsigned int, ata_port )
379 __field( unsigned int, tag )
380 __field( unsigned char, cmd )
381 __field( unsigned char, feature )
382 __field( unsigned char, hob_nsect )
383 __field( unsigned char, proto )
387 __entry->ata_port = ap->print_id;
389 __entry->proto = tf->protocol;
390 __entry->cmd = tf->command;
391 __entry->feature = tf->feature;
392 __entry->hob_nsect = tf->hob_nsect;
395 TP_printk("ata_port=%u tag=%d proto=%s cmd=%s%s",
396 __entry->ata_port, __entry->tag,
397 show_protocol_name(__entry->proto),
398 show_opcode_name(__entry->cmd),
399 __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect))
402 DEFINE_EVENT(ata_exec_command_template, ata_exec_command,
403 TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
404 TP_ARGS(ap, tf, tag));
406 DEFINE_EVENT(ata_exec_command_template, ata_bmdma_setup,
407 TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
408 TP_ARGS(ap, tf, tag));
410 DEFINE_EVENT(ata_exec_command_template, ata_bmdma_start,
411 TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
412 TP_ARGS(ap, tf, tag));
414 DEFINE_EVENT(ata_exec_command_template, ata_bmdma_stop,
415 TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
416 TP_ARGS(ap, tf, tag));
418 TRACE_EVENT(ata_bmdma_status,
420 TP_PROTO(struct ata_port *ap, unsigned int host_stat),
422 TP_ARGS(ap, host_stat),
425 __field( unsigned int, ata_port )
426 __field( unsigned int, tag )
427 __field( unsigned char, host_stat )
431 __entry->ata_port = ap->print_id;
432 __entry->host_stat = host_stat;
435 TP_printk("ata_port=%u host_stat=%s",
437 __parse_host_stat(__entry->host_stat))
440 TRACE_EVENT(ata_eh_link_autopsy,
442 TP_PROTO(struct ata_device *dev, unsigned int eh_action, unsigned int eh_err_mask),
444 TP_ARGS(dev, eh_action, eh_err_mask),
447 __field( unsigned int, ata_port )
448 __field( unsigned int, ata_dev )
449 __field( unsigned int, eh_action )
450 __field( unsigned int, eh_err_mask)
454 __entry->ata_port = dev->link->ap->print_id;
455 __entry->ata_dev = dev->link->pmp + dev->devno;
456 __entry->eh_action = eh_action;
457 __entry->eh_err_mask = eh_err_mask;
460 TP_printk("ata_port=%u ata_dev=%u eh_action=%s err_mask=%s",
461 __entry->ata_port, __entry->ata_dev,
462 __parse_eh_action(__entry->eh_action),
463 __parse_eh_err_mask(__entry->eh_err_mask))
466 TRACE_EVENT(ata_eh_link_autopsy_qc,
468 TP_PROTO(struct ata_queued_cmd *qc),
473 __field( unsigned int, ata_port )
474 __field( unsigned int, ata_dev )
475 __field( unsigned int, tag )
476 __field( unsigned int, qc_flags )
477 __field( unsigned int, eh_err_mask)
481 __entry->ata_port = qc->ap->print_id;
482 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
483 __entry->tag = qc->tag;
484 __entry->qc_flags = qc->flags;
485 __entry->eh_err_mask = qc->err_mask;
488 TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s err_mask=%s",
489 __entry->ata_port, __entry->ata_dev, __entry->tag,
490 __parse_qc_flags(__entry->qc_flags),
491 __parse_eh_err_mask(__entry->eh_err_mask))
494 DECLARE_EVENT_CLASS(ata_eh_action_template,
496 TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
498 TP_ARGS(link, devno, eh_action),
501 __field( unsigned int, ata_port )
502 __field( unsigned int, ata_dev )
503 __field( unsigned int, eh_action )
507 __entry->ata_port = link->ap->print_id;
508 __entry->ata_dev = link->pmp + devno;
509 __entry->eh_action = eh_action;
512 TP_printk("ata_port=%u ata_dev=%u eh_action=%s",
513 __entry->ata_port, __entry->ata_dev,
514 __parse_eh_action(__entry->eh_action))
517 DEFINE_EVENT(ata_eh_action_template, ata_eh_about_to_do,
518 TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
519 TP_ARGS(link, devno, eh_action));
521 DEFINE_EVENT(ata_eh_action_template, ata_eh_done,
522 TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
523 TP_ARGS(link, devno, eh_action));
525 DECLARE_EVENT_CLASS(ata_link_reset_begin_template,
527 TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
529 TP_ARGS(link, class, deadline),
532 __field( unsigned int, ata_port )
533 __array( unsigned int, class, 2 )
534 __field( unsigned long, deadline )
538 __entry->ata_port = link->ap->print_id;
539 memcpy(__entry->class, class, 2);
540 __entry->deadline = deadline;
543 TP_printk("ata_port=%u deadline=%lu classes=[%s,%s]",
544 __entry->ata_port, __entry->deadline,
545 show_class_name(__entry->class[0]),
546 show_class_name(__entry->class[1]))
549 DEFINE_EVENT(ata_link_reset_begin_template, ata_link_hardreset_begin,
550 TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
551 TP_ARGS(link, class, deadline));
553 DEFINE_EVENT(ata_link_reset_begin_template, ata_slave_hardreset_begin,
554 TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
555 TP_ARGS(link, class, deadline));
557 DEFINE_EVENT(ata_link_reset_begin_template, ata_link_softreset_begin,
558 TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
559 TP_ARGS(link, class, deadline));
561 DECLARE_EVENT_CLASS(ata_link_reset_end_template,
563 TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
565 TP_ARGS(link, class, rc),
568 __field( unsigned int, ata_port )
569 __array( unsigned int, class, 2 )
574 __entry->ata_port = link->ap->print_id;
575 memcpy(__entry->class, class, 2);
579 TP_printk("ata_port=%u rc=%d class=[%s,%s]",
580 __entry->ata_port, __entry->rc,
581 show_class_name(__entry->class[0]),
582 show_class_name(__entry->class[1]))
585 DEFINE_EVENT(ata_link_reset_end_template, ata_link_hardreset_end,
586 TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
587 TP_ARGS(link, class, rc));
589 DEFINE_EVENT(ata_link_reset_end_template, ata_slave_hardreset_end,
590 TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
591 TP_ARGS(link, class, rc));
593 DEFINE_EVENT(ata_link_reset_end_template, ata_link_softreset_end,
594 TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
595 TP_ARGS(link, class, rc));
597 DEFINE_EVENT(ata_link_reset_end_template, ata_link_postreset,
598 TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
599 TP_ARGS(link, class, rc));
601 DEFINE_EVENT(ata_link_reset_end_template, ata_slave_postreset,
602 TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
603 TP_ARGS(link, class, rc));
605 DECLARE_EVENT_CLASS(ata_port_eh_begin_template,
607 TP_PROTO(struct ata_port *ap),
612 __field( unsigned int, ata_port )
616 __entry->ata_port = ap->print_id;
619 TP_printk("ata_port=%u", __entry->ata_port)
622 DEFINE_EVENT(ata_port_eh_begin_template, ata_std_sched_eh,
623 TP_PROTO(struct ata_port *ap),
626 DEFINE_EVENT(ata_port_eh_begin_template, ata_port_freeze,
627 TP_PROTO(struct ata_port *ap),
630 DEFINE_EVENT(ata_port_eh_begin_template, ata_port_thaw,
631 TP_PROTO(struct ata_port *ap),
634 DECLARE_EVENT_CLASS(ata_sff_hsm_template,
636 TP_PROTO(struct ata_queued_cmd *qc, unsigned char status),
641 __field( unsigned int, ata_port )
642 __field( unsigned int, ata_dev )
643 __field( unsigned int, tag )
644 __field( unsigned int, qc_flags )
645 __field( unsigned int, protocol )
646 __field( unsigned int, hsm_state )
647 __field( unsigned char, dev_state )
651 __entry->ata_port = qc->ap->print_id;
652 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
653 __entry->tag = qc->tag;
654 __entry->qc_flags = qc->flags;
655 __entry->protocol = qc->tf.protocol;
656 __entry->hsm_state = qc->ap->hsm_task_state;
657 __entry->dev_state = status;
660 TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s flags=%s task_state=%s dev_stat=0x%X",
661 __entry->ata_port, __entry->ata_dev, __entry->tag,
662 show_protocol_name(__entry->protocol),
663 __parse_qc_flags(__entry->qc_flags),
664 show_sff_hsm_state_name(__entry->hsm_state),
668 DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_state,
669 TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
672 DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_command_complete,
673 TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
676 DEFINE_EVENT(ata_sff_hsm_template, ata_sff_port_intr,
677 TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
680 DECLARE_EVENT_CLASS(ata_transfer_data_template,
682 TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
684 TP_ARGS(qc, offset, count),
687 __field( unsigned int, ata_port )
688 __field( unsigned int, ata_dev )
689 __field( unsigned int, tag )
690 __field( unsigned int, flags )
691 __field( unsigned int, offset )
692 __field( unsigned int, bytes )
696 __entry->ata_port = qc->ap->print_id;
697 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
698 __entry->tag = qc->tag;
699 __entry->flags = qc->tf.flags;
700 __entry->offset = offset;
701 __entry->bytes = count;
704 TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s offset=%u bytes=%u",
705 __entry->ata_port, __entry->ata_dev, __entry->tag,
706 __parse_tf_flags(__entry->flags),
707 __entry->offset, __entry->bytes)
710 DEFINE_EVENT(ata_transfer_data_template, ata_sff_pio_transfer_data,
711 TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
712 TP_ARGS(qc, offset, count));
714 DEFINE_EVENT(ata_transfer_data_template, atapi_pio_transfer_data,
715 TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
716 TP_ARGS(qc, offset, count));
718 DEFINE_EVENT(ata_transfer_data_template, atapi_send_cdb,
719 TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
720 TP_ARGS(qc, offset, count));
722 DECLARE_EVENT_CLASS(ata_sff_template,
724 TP_PROTO(struct ata_port *ap),
729 __field( unsigned int, ata_port )
730 __field( unsigned char, hsm_state )
734 __entry->ata_port = ap->print_id;
735 __entry->hsm_state = ap->hsm_task_state;
738 TP_printk("ata_port=%u task_state=%s",
740 show_sff_hsm_state_name(__entry->hsm_state))
743 DEFINE_EVENT(ata_sff_template, ata_sff_flush_pio_task,
744 TP_PROTO(struct ata_port *ap),
747 #endif /* _TRACE_LIBATA_H */
749 /* This part must be outside protection */
750 #include <trace/define_trace.h>