xref: /openbmc/linux/include/trace/events/libata.h (revision e7f127b2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM libata
4 
5 #if !defined(_TRACE_LIBATA_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_LIBATA_H
7 
8 #include <linux/ata.h>
9 #include <linux/libata.h>
10 #include <linux/tracepoint.h>
11 #include <linux/trace_seq.h>
12 
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))
109 
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))
121 
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))
134 
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))
150 
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))
159 
160 const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
161 #define __parse_status(s) libata_trace_parse_status(p, s)
162 
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)
165 
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)
168 
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)
171 
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)
174 
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)
177 
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)
181 
182 DECLARE_EVENT_CLASS(ata_qc_issue_template,
183 
184 	TP_PROTO(struct ata_queued_cmd *qc),
185 
186 	TP_ARGS(qc),
187 
188 	TP_STRUCT__entry(
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 )
207 	),
208 
209 	TP_fast_assign(
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;
226 	),
227 
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,
238 		  __entry->dev)
239 );
240 
241 DEFINE_EVENT(ata_qc_issue_template, ata_qc_prep,
242 	     TP_PROTO(struct ata_queued_cmd *qc),
243 	     TP_ARGS(qc));
244 
245 DEFINE_EVENT(ata_qc_issue_template, ata_qc_issue,
246 	     TP_PROTO(struct ata_queued_cmd *qc),
247 	     TP_ARGS(qc));
248 
249 DECLARE_EVENT_CLASS(ata_qc_complete_template,
250 
251 	TP_PROTO(struct ata_queued_cmd *qc),
252 
253 	TP_ARGS(qc),
254 
255 	TP_STRUCT__entry(
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 )
273 	),
274 
275 	TP_fast_assign(
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 	),
292 
293 	TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s status=%s " \
294 		  " res=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
295 		  __entry->ata_port, __entry->ata_dev, __entry->tag,
296 		  __parse_qc_flags(__entry->flags),
297 		  __parse_status(__entry->status),
298 		  __entry->status, __entry->error, __entry->nsect,
299 		  __entry->lbal, __entry->lbam, __entry->lbah,
300 		  __entry->hob_feature, __entry->hob_nsect,
301 		  __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
302 		  __entry->dev)
303 );
304 
305 DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_internal,
306 	     TP_PROTO(struct ata_queued_cmd *qc),
307 	     TP_ARGS(qc));
308 
309 DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_failed,
310 	     TP_PROTO(struct ata_queued_cmd *qc),
311 	     TP_ARGS(qc));
312 
313 DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_done,
314 	     TP_PROTO(struct ata_queued_cmd *qc),
315 	     TP_ARGS(qc));
316 
317 TRACE_EVENT(ata_tf_load,
318 
319 	TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf),
320 
321 	TP_ARGS(ap, tf),
322 
323 	TP_STRUCT__entry(
324 		__field( unsigned int,	ata_port )
325 		__field( unsigned char,	cmd	)
326 		__field( unsigned char,	dev	)
327 		__field( unsigned char,	lbal	)
328 		__field( unsigned char,	lbam	)
329 		__field( unsigned char,	lbah	)
330 		__field( unsigned char,	nsect	)
331 		__field( unsigned char,	feature	)
332 		__field( unsigned char,	hob_lbal )
333 		__field( unsigned char,	hob_lbam )
334 		__field( unsigned char,	hob_lbah )
335 		__field( unsigned char,	hob_nsect )
336 		__field( unsigned char,	hob_feature )
337 		__field( unsigned char,	proto	)
338 	),
339 
340 	TP_fast_assign(
341 		__entry->ata_port	= ap->print_id;
342 		__entry->proto		= tf->protocol;
343 		__entry->cmd		= tf->command;
344 		__entry->dev		= tf->device;
345 		__entry->lbal		= tf->lbal;
346 		__entry->lbam		= tf->lbam;
347 		__entry->lbah		= tf->lbah;
348 		__entry->hob_lbal	= tf->hob_lbal;
349 		__entry->hob_lbam	= tf->hob_lbam;
350 		__entry->hob_lbah	= tf->hob_lbah;
351 		__entry->feature	= tf->feature;
352 		__entry->hob_feature	= tf->hob_feature;
353 		__entry->nsect		= tf->nsect;
354 		__entry->hob_nsect	= tf->hob_nsect;
355 	),
356 
357 	TP_printk("ata_port=%u proto=%s cmd=%s%s " \
358 		  " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
359 		  __entry->ata_port,
360 		  show_protocol_name(__entry->proto),
361 		  show_opcode_name(__entry->cmd),
362 		  __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect),
363 		  __entry->cmd, __entry->feature, __entry->nsect,
364 		  __entry->lbal, __entry->lbam, __entry->lbah,
365 		  __entry->hob_feature, __entry->hob_nsect,
366 		  __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
367 		  __entry->dev)
368 );
369 
370 DECLARE_EVENT_CLASS(ata_exec_command_template,
371 
372 	TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
373 
374 	TP_ARGS(ap, tf, tag),
375 
376 	TP_STRUCT__entry(
377 		__field( unsigned int,	ata_port )
378 		__field( unsigned int,	tag	)
379 		__field( unsigned char,	cmd	)
380 		__field( unsigned char,	feature	)
381 		__field( unsigned char,	hob_nsect )
382 		__field( unsigned char,	proto	)
383 	),
384 
385 	TP_fast_assign(
386 		__entry->ata_port	= ap->print_id;
387 		__entry->tag		= tag;
388 		__entry->proto		= tf->protocol;
389 		__entry->cmd		= tf->command;
390 		__entry->feature	= tf->feature;
391 		__entry->hob_nsect	= tf->hob_nsect;
392 	),
393 
394 	TP_printk("ata_port=%u tag=%d proto=%s cmd=%s%s",
395 		  __entry->ata_port, __entry->tag,
396 		  show_protocol_name(__entry->proto),
397 		  show_opcode_name(__entry->cmd),
398 		  __parse_subcmd(__entry->cmd, __entry->feature, __entry->hob_nsect))
399 );
400 
401 DEFINE_EVENT(ata_exec_command_template, ata_exec_command,
402 	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
403 	     TP_ARGS(ap, tf, tag));
404 
405 DEFINE_EVENT(ata_exec_command_template, ata_bmdma_setup,
406 	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
407 	     TP_ARGS(ap, tf, tag));
408 
409 DEFINE_EVENT(ata_exec_command_template, ata_bmdma_start,
410 	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
411 	     TP_ARGS(ap, tf, tag));
412 
413 DEFINE_EVENT(ata_exec_command_template, ata_bmdma_stop,
414 	     TP_PROTO(struct ata_port *ap, const struct ata_taskfile *tf, unsigned int tag),
415 	     TP_ARGS(ap, tf, tag));
416 
417 TRACE_EVENT(ata_bmdma_status,
418 
419 	TP_PROTO(struct ata_port *ap, unsigned int host_stat),
420 
421 	TP_ARGS(ap, host_stat),
422 
423 	TP_STRUCT__entry(
424 		__field( unsigned int,	ata_port )
425 		__field( unsigned int,	tag	)
426 		__field( unsigned char,	host_stat )
427 	),
428 
429 	TP_fast_assign(
430 		__entry->ata_port	= ap->print_id;
431 		__entry->host_stat	= host_stat;
432 	),
433 
434 	TP_printk("ata_port=%u host_stat=%s",
435 		  __entry->ata_port,
436 		  __parse_host_stat(__entry->host_stat))
437 );
438 
439 TRACE_EVENT(ata_eh_link_autopsy,
440 
441 	TP_PROTO(struct ata_device *dev, unsigned int eh_action, unsigned int eh_err_mask),
442 
443 	TP_ARGS(dev, eh_action, eh_err_mask),
444 
445 	TP_STRUCT__entry(
446 		__field( unsigned int,	ata_port )
447 		__field( unsigned int,	ata_dev	)
448 		__field( unsigned int,	eh_action )
449 		__field( unsigned int,	eh_err_mask)
450 	),
451 
452 	TP_fast_assign(
453 		__entry->ata_port	= dev->link->ap->print_id;
454 		__entry->ata_dev	= dev->link->pmp + dev->devno;
455 		__entry->eh_action	= eh_action;
456 		__entry->eh_err_mask	= eh_err_mask;
457 	),
458 
459 	TP_printk("ata_port=%u ata_dev=%u eh_action=%s err_mask=%s",
460 		  __entry->ata_port, __entry->ata_dev,
461 		  __parse_eh_action(__entry->eh_action),
462 		  __parse_eh_err_mask(__entry->eh_err_mask))
463 );
464 
465 TRACE_EVENT(ata_eh_link_autopsy_qc,
466 
467 	TP_PROTO(struct ata_queued_cmd *qc),
468 
469 	TP_ARGS(qc),
470 
471 	TP_STRUCT__entry(
472 		__field( unsigned int,	ata_port )
473 		__field( unsigned int,	ata_dev	)
474 		__field( unsigned int,	tag	)
475 		__field( unsigned int,	qc_flags )
476 		__field( unsigned int,	eh_err_mask)
477 	),
478 
479 	TP_fast_assign(
480 		__entry->ata_port	= qc->ap->print_id;
481 		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
482 		__entry->tag		= qc->tag;
483 		__entry->qc_flags	= qc->flags;
484 		__entry->eh_err_mask	= qc->err_mask;
485 	),
486 
487 	TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s err_mask=%s",
488 		  __entry->ata_port, __entry->ata_dev, __entry->tag,
489 		  __parse_qc_flags(__entry->qc_flags),
490 		  __parse_eh_err_mask(__entry->eh_err_mask))
491 );
492 
493 DECLARE_EVENT_CLASS(ata_eh_action_template,
494 
495 	TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
496 
497 	TP_ARGS(link, devno, eh_action),
498 
499 	TP_STRUCT__entry(
500 		__field( unsigned int,	ata_port )
501 		__field( unsigned int,	ata_dev	)
502 		__field( unsigned int,	eh_action )
503 	),
504 
505 	TP_fast_assign(
506 		__entry->ata_port	= link->ap->print_id;
507 		__entry->ata_dev	= link->pmp + devno;
508 		__entry->eh_action	= eh_action;
509 	),
510 
511 	TP_printk("ata_port=%u ata_dev=%u eh_action=%s",
512 		  __entry->ata_port, __entry->ata_dev,
513 		  __parse_eh_action(__entry->eh_action))
514 );
515 
516 DEFINE_EVENT(ata_eh_action_template, ata_eh_about_to_do,
517 	     TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
518 	     TP_ARGS(link, devno, eh_action));
519 
520 DEFINE_EVENT(ata_eh_action_template, ata_eh_done,
521 	     TP_PROTO(struct ata_link *link, unsigned int devno, unsigned int eh_action),
522 	     TP_ARGS(link, devno, eh_action));
523 
524 DECLARE_EVENT_CLASS(ata_link_reset_begin_template,
525 
526 	TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
527 
528 	TP_ARGS(link, class, deadline),
529 
530 	TP_STRUCT__entry(
531 		__field( unsigned int,	ata_port )
532 		__array( unsigned int,	class, 2 )
533 		__field( unsigned long,	deadline )
534 	),
535 
536 	TP_fast_assign(
537 		__entry->ata_port	= link->ap->print_id;
538 		memcpy(__entry->class, class, 2);
539 		__entry->deadline	= deadline;
540 	),
541 
542 	TP_printk("ata_port=%u deadline=%lu classes=[%s,%s]",
543 		  __entry->ata_port, __entry->deadline,
544 		  show_class_name(__entry->class[0]),
545 		  show_class_name(__entry->class[1]))
546 );
547 
548 DEFINE_EVENT(ata_link_reset_begin_template, ata_link_hardreset_begin,
549 	     TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
550 	     TP_ARGS(link, class, deadline));
551 
552 DEFINE_EVENT(ata_link_reset_begin_template, ata_slave_hardreset_begin,
553 	     TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
554 	     TP_ARGS(link, class, deadline));
555 
556 DEFINE_EVENT(ata_link_reset_begin_template, ata_link_softreset_begin,
557 	     TP_PROTO(struct ata_link *link, unsigned int *class, unsigned long deadline),
558 	     TP_ARGS(link, class, deadline));
559 
560 DECLARE_EVENT_CLASS(ata_link_reset_end_template,
561 
562 	TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
563 
564 	TP_ARGS(link, class, rc),
565 
566 	TP_STRUCT__entry(
567 		__field( unsigned int,	ata_port )
568 		__array( unsigned int,	class, 2 )
569 		__field( int,		rc	)
570 	),
571 
572 	TP_fast_assign(
573 		__entry->ata_port	= link->ap->print_id;
574 		memcpy(__entry->class, class, 2);
575 		__entry->rc		= rc;
576 	),
577 
578 	TP_printk("ata_port=%u rc=%d class=[%s,%s]",
579 		  __entry->ata_port, __entry->rc,
580 		  show_class_name(__entry->class[0]),
581 		  show_class_name(__entry->class[1]))
582 );
583 
584 DEFINE_EVENT(ata_link_reset_end_template, ata_link_hardreset_end,
585 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
586 	     TP_ARGS(link, class, rc));
587 
588 DEFINE_EVENT(ata_link_reset_end_template, ata_slave_hardreset_end,
589 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
590 	     TP_ARGS(link, class, rc));
591 
592 DEFINE_EVENT(ata_link_reset_end_template, ata_link_softreset_end,
593 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
594 	     TP_ARGS(link, class, rc));
595 
596 DEFINE_EVENT(ata_link_reset_end_template, ata_link_postreset,
597 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
598 	     TP_ARGS(link, class, rc));
599 
600 DEFINE_EVENT(ata_link_reset_end_template, ata_slave_postreset,
601 	     TP_PROTO(struct ata_link *link, unsigned int *class, int rc),
602 	     TP_ARGS(link, class, rc));
603 
604 DECLARE_EVENT_CLASS(ata_port_eh_begin_template,
605 
606 	TP_PROTO(struct ata_port *ap),
607 
608 	TP_ARGS(ap),
609 
610 	TP_STRUCT__entry(
611 		__field( unsigned int,	ata_port )
612 	),
613 
614 	TP_fast_assign(
615 		__entry->ata_port	= ap->print_id;
616 	),
617 
618 	TP_printk("ata_port=%u", __entry->ata_port)
619 );
620 
621 DEFINE_EVENT(ata_port_eh_begin_template, ata_std_sched_eh,
622 	     TP_PROTO(struct ata_port *ap),
623 	     TP_ARGS(ap));
624 
625 DEFINE_EVENT(ata_port_eh_begin_template, ata_port_freeze,
626 	     TP_PROTO(struct ata_port *ap),
627 	     TP_ARGS(ap));
628 
629 DEFINE_EVENT(ata_port_eh_begin_template, ata_port_thaw,
630 	     TP_PROTO(struct ata_port *ap),
631 	     TP_ARGS(ap));
632 
633 DECLARE_EVENT_CLASS(ata_sff_hsm_template,
634 
635 	TP_PROTO(struct ata_queued_cmd *qc, unsigned char status),
636 
637 	TP_ARGS(qc, status),
638 
639 	TP_STRUCT__entry(
640 		__field( unsigned int,	ata_port )
641 		__field( unsigned int,	ata_dev	)
642 		__field( unsigned int,	tag	)
643 		__field( unsigned int,	qc_flags )
644 		__field( unsigned int,	protocol )
645 		__field( unsigned int,	hsm_state )
646 		__field( unsigned char,	dev_state )
647 	),
648 
649 	TP_fast_assign(
650 		__entry->ata_port	= qc->ap->print_id;
651 		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
652 		__entry->tag		= qc->tag;
653 		__entry->qc_flags	= qc->flags;
654 		__entry->protocol	= qc->tf.protocol;
655 		__entry->hsm_state	= qc->ap->hsm_task_state;
656 		__entry->dev_state	= status;
657 	),
658 
659 	TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s flags=%s task_state=%s dev_stat=0x%X",
660 		  __entry->ata_port, __entry->ata_dev, __entry->tag,
661 		  show_protocol_name(__entry->protocol),
662 		  __parse_qc_flags(__entry->qc_flags),
663 		  show_sff_hsm_state_name(__entry->hsm_state),
664 		  __entry->dev_state)
665 );
666 
667 DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_state,
668 	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
669 	TP_ARGS(qc, state));
670 
671 DEFINE_EVENT(ata_sff_hsm_template, ata_sff_hsm_command_complete,
672 	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
673 	TP_ARGS(qc, state));
674 
675 DEFINE_EVENT(ata_sff_hsm_template, ata_sff_port_intr,
676 	TP_PROTO(struct ata_queued_cmd *qc, unsigned char state),
677 	TP_ARGS(qc, state));
678 
679 DECLARE_EVENT_CLASS(ata_transfer_data_template,
680 
681 	TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
682 
683 	TP_ARGS(qc, offset, count),
684 
685 	TP_STRUCT__entry(
686 		__field( unsigned int,	ata_port )
687 		__field( unsigned int,	ata_dev	)
688 		__field( unsigned int,	tag	)
689 		__field( unsigned int,	flags	)
690 		__field( unsigned int,	offset	)
691 		__field( unsigned int,	bytes	)
692 	),
693 
694 	TP_fast_assign(
695 		__entry->ata_port	= qc->ap->print_id;
696 		__entry->ata_dev	= qc->dev->link->pmp + qc->dev->devno;
697 		__entry->tag		= qc->tag;
698 		__entry->flags		= qc->tf.flags;
699 		__entry->offset		= offset;
700 		__entry->bytes		= count;
701 	),
702 
703 	TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s offset=%u bytes=%u",
704 		  __entry->ata_port, __entry->ata_dev, __entry->tag,
705 		  __parse_tf_flags(__entry->flags),
706 		  __entry->offset, __entry->bytes)
707 );
708 
709 DEFINE_EVENT(ata_transfer_data_template, ata_sff_pio_transfer_data,
710 	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
711 	     TP_ARGS(qc, offset, count));
712 
713 DEFINE_EVENT(ata_transfer_data_template, atapi_pio_transfer_data,
714 	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
715 	     TP_ARGS(qc, offset, count));
716 
717 DEFINE_EVENT(ata_transfer_data_template, atapi_send_cdb,
718 	     TP_PROTO(struct ata_queued_cmd *qc, unsigned int offset, unsigned int count),
719 	     TP_ARGS(qc, offset, count));
720 
721 DECLARE_EVENT_CLASS(ata_sff_template,
722 
723 	TP_PROTO(struct ata_port *ap),
724 
725 	TP_ARGS(ap),
726 
727 	TP_STRUCT__entry(
728 		__field( unsigned int,	ata_port )
729 		__field( unsigned char,	hsm_state )
730 	),
731 
732 	TP_fast_assign(
733 		__entry->ata_port	= ap->print_id;
734 		__entry->hsm_state	= ap->hsm_task_state;
735 	),
736 
737 	TP_printk("ata_port=%u task_state=%s",
738 		  __entry->ata_port,
739 		  show_sff_hsm_state_name(__entry->hsm_state))
740 );
741 
742 DEFINE_EVENT(ata_sff_template, ata_sff_flush_pio_task,
743 	     TP_PROTO(struct ata_port *ap),
744 	     TP_ARGS(ap));
745 
746 #endif /*  _TRACE_LIBATA_H */
747 
748 /* This part must be outside protection */
749 #include <trace/define_trace.h>
750