diff options
author | Hannes Reinecke <hare@suse.de> | 2015-03-27 11:46:38 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2015-03-27 11:59:22 -0400 |
commit | 255c03d15a29a3ccb7a40d247f02bf38ba3f3592 (patch) | |
tree | f5e7b15d1d04622a464a5eb3d22f5cd171af56f0 | |
parent | a1524f226a02aa6edebd90ae0752e97cfd78b159 (diff) |
libata: Add tracepoints
Add some tracepoints for ata_qc_issue, ata_qc_complete, and
ata_eh_link_autopsy.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | drivers/ata/Makefile | 3 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 8 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 4 | ||||
-rw-r--r-- | drivers/ata/libata-trace.c | 151 | ||||
-rw-r--r-- | include/trace/events/libata.h | 325 |
5 files changed, 488 insertions, 3 deletions
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index ae41107afc1f..b67e995179a9 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -111,7 +111,8 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o | |||
111 | # Should be last libata driver | 111 | # Should be last libata driver |
112 | obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o | 112 | obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o |
113 | 113 | ||
114 | libata-y := libata-core.o libata-scsi.o libata-eh.o libata-transport.o | 114 | libata-y := libata-core.o libata-scsi.o libata-eh.o \ |
115 | libata-transport.o libata-trace.o | ||
115 | libata-$(CONFIG_ATA_SFF) += libata-sff.o | 116 | libata-$(CONFIG_ATA_SFF) += libata-sff.o |
116 | libata-$(CONFIG_SATA_PMP) += libata-pmp.o | 117 | libata-$(CONFIG_SATA_PMP) += libata-pmp.o |
117 | libata-$(CONFIG_ATA_ACPI) += libata-acpi.o | 118 | libata-$(CONFIG_ATA_ACPI) += libata-acpi.o |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index ff57367f5f0c..be1722a4163a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -70,6 +70,9 @@ | |||
70 | #include <linux/pm_runtime.h> | 70 | #include <linux/pm_runtime.h> |
71 | #include <linux/platform_device.h> | 71 | #include <linux/platform_device.h> |
72 | 72 | ||
73 | #define CREATE_TRACE_POINTS | ||
74 | #include <trace/events/libata.h> | ||
75 | |||
73 | #include "libata.h" | 76 | #include "libata.h" |
74 | #include "libata-transport.h" | 77 | #include "libata-transport.h" |
75 | 78 | ||
@@ -4904,6 +4907,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
4904 | */ | 4907 | */ |
4905 | if (unlikely(ata_tag_internal(qc->tag))) { | 4908 | if (unlikely(ata_tag_internal(qc->tag))) { |
4906 | fill_result_tf(qc); | 4909 | fill_result_tf(qc); |
4910 | trace_ata_qc_complete_internal(qc); | ||
4907 | __ata_qc_complete(qc); | 4911 | __ata_qc_complete(qc); |
4908 | return; | 4912 | return; |
4909 | } | 4913 | } |
@@ -4914,6 +4918,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
4914 | */ | 4918 | */ |
4915 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { | 4919 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { |
4916 | fill_result_tf(qc); | 4920 | fill_result_tf(qc); |
4921 | trace_ata_qc_complete_failed(qc); | ||
4917 | ata_qc_schedule_eh(qc); | 4922 | ata_qc_schedule_eh(qc); |
4918 | return; | 4923 | return; |
4919 | } | 4924 | } |
@@ -4924,6 +4929,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
4924 | if (qc->flags & ATA_QCFLAG_RESULT_TF) | 4929 | if (qc->flags & ATA_QCFLAG_RESULT_TF) |
4925 | fill_result_tf(qc); | 4930 | fill_result_tf(qc); |
4926 | 4931 | ||
4932 | trace_ata_qc_complete_done(qc); | ||
4927 | /* Some commands need post-processing after successful | 4933 | /* Some commands need post-processing after successful |
4928 | * completion. | 4934 | * completion. |
4929 | */ | 4935 | */ |
@@ -5071,7 +5077,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
5071 | } | 5077 | } |
5072 | 5078 | ||
5073 | ap->ops->qc_prep(qc); | 5079 | ap->ops->qc_prep(qc); |
5074 | 5080 | trace_ata_qc_issue(qc); | |
5075 | qc->err_mask |= ap->ops->qc_issue(qc); | 5081 | qc->err_mask |= ap->ops->qc_issue(qc); |
5076 | if (unlikely(qc->err_mask)) | 5082 | if (unlikely(qc->err_mask)) |
5077 | goto err; | 5083 | goto err; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 77ef43e320ea..07f41be38fbe 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -46,6 +46,7 @@ | |||
46 | 46 | ||
47 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
48 | 48 | ||
49 | #include <trace/events/libata.h> | ||
49 | #include "libata.h" | 50 | #include "libata.h" |
50 | 51 | ||
51 | enum { | 52 | enum { |
@@ -2291,6 +2292,7 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
2291 | all_err_mask |= qc->err_mask; | 2292 | all_err_mask |= qc->err_mask; |
2292 | if (qc->flags & ATA_QCFLAG_IO) | 2293 | if (qc->flags & ATA_QCFLAG_IO) |
2293 | eflags |= ATA_EFLAG_IS_IO; | 2294 | eflags |= ATA_EFLAG_IS_IO; |
2295 | trace_ata_eh_link_autopsy_qc(qc); | ||
2294 | } | 2296 | } |
2295 | 2297 | ||
2296 | /* enforce default EH actions */ | 2298 | /* enforce default EH actions */ |
@@ -2325,7 +2327,7 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
2325 | eflags |= ATA_EFLAG_DUBIOUS_XFER; | 2327 | eflags |= ATA_EFLAG_DUBIOUS_XFER; |
2326 | ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask); | 2328 | ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask); |
2327 | } | 2329 | } |
2328 | 2330 | trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask); | |
2329 | DPRINTK("EXIT\n"); | 2331 | DPRINTK("EXIT\n"); |
2330 | } | 2332 | } |
2331 | 2333 | ||
diff --git a/drivers/ata/libata-trace.c b/drivers/ata/libata-trace.c new file mode 100644 index 000000000000..fd30b8c10cf5 --- /dev/null +++ b/drivers/ata/libata-trace.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * libata-trace.c - trace functions for libata | ||
3 | * | ||
4 | * Copyright 2015 Hannes Reinecke | ||
5 | * Copyright 2015 SUSE Linux GmbH | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2, or (at your option) | ||
10 | * any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; see the file COPYING. If not, write to | ||
19 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/trace_seq.h> | ||
24 | #include <trace/events/libata.h> | ||
25 | |||
26 | const char * | ||
27 | libata_trace_parse_status(struct trace_seq *p, unsigned char status) | ||
28 | { | ||
29 | const char *ret = trace_seq_buffer_ptr(p); | ||
30 | |||
31 | trace_seq_printf(p, "{ "); | ||
32 | if (status & ATA_BUSY) | ||
33 | trace_seq_printf(p, "BUSY "); | ||
34 | if (status & ATA_DRDY) | ||
35 | trace_seq_printf(p, "DRDY "); | ||
36 | if (status & ATA_DF) | ||
37 | trace_seq_printf(p, "DF "); | ||
38 | if (status & ATA_DSC) | ||
39 | trace_seq_printf(p, "DSC "); | ||
40 | if (status & ATA_DRQ) | ||
41 | trace_seq_printf(p, "DRQ "); | ||
42 | if (status & ATA_CORR) | ||
43 | trace_seq_printf(p, "CORR "); | ||
44 | if (status & ATA_SENSE) | ||
45 | trace_seq_printf(p, "SENSE "); | ||
46 | if (status & ATA_ERR) | ||
47 | trace_seq_printf(p, "ERR "); | ||
48 | trace_seq_putc(p, '}'); | ||
49 | trace_seq_putc(p, 0); | ||
50 | |||
51 | return ret; | ||
52 | } | ||
53 | |||
54 | const char * | ||
55 | libata_trace_parse_eh_action(struct trace_seq *p, unsigned int eh_action) | ||
56 | { | ||
57 | const char *ret = trace_seq_buffer_ptr(p); | ||
58 | |||
59 | trace_seq_printf(p, "%x", eh_action); | ||
60 | if (eh_action) { | ||
61 | trace_seq_printf(p, "{ "); | ||
62 | if (eh_action & ATA_EH_REVALIDATE) | ||
63 | trace_seq_printf(p, "REVALIDATE "); | ||
64 | if (eh_action & (ATA_EH_SOFTRESET | ATA_EH_HARDRESET)) | ||
65 | trace_seq_printf(p, "RESET "); | ||
66 | else if (eh_action & ATA_EH_SOFTRESET) | ||
67 | trace_seq_printf(p, "SOFTRESET "); | ||
68 | else if (eh_action & ATA_EH_HARDRESET) | ||
69 | trace_seq_printf(p, "HARDRESET "); | ||
70 | if (eh_action & ATA_EH_ENABLE_LINK) | ||
71 | trace_seq_printf(p, "ENABLE_LINK "); | ||
72 | if (eh_action & ATA_EH_PARK) | ||
73 | trace_seq_printf(p, "PARK "); | ||
74 | trace_seq_putc(p, '}'); | ||
75 | } | ||
76 | trace_seq_putc(p, 0); | ||
77 | |||
78 | return ret; | ||
79 | } | ||
80 | |||
81 | const char * | ||
82 | libata_trace_parse_eh_err_mask(struct trace_seq *p, unsigned int eh_err_mask) | ||
83 | { | ||
84 | const char *ret = trace_seq_buffer_ptr(p); | ||
85 | |||
86 | trace_seq_printf(p, "%x", eh_err_mask); | ||
87 | if (eh_err_mask) { | ||
88 | trace_seq_printf(p, "{ "); | ||
89 | if (eh_err_mask & AC_ERR_DEV) | ||
90 | trace_seq_printf(p, "DEV "); | ||
91 | if (eh_err_mask & AC_ERR_HSM) | ||
92 | trace_seq_printf(p, "HSM "); | ||
93 | if (eh_err_mask & AC_ERR_TIMEOUT) | ||
94 | trace_seq_printf(p, "TIMEOUT "); | ||
95 | if (eh_err_mask & AC_ERR_MEDIA) | ||
96 | trace_seq_printf(p, "MEDIA "); | ||
97 | if (eh_err_mask & AC_ERR_ATA_BUS) | ||
98 | trace_seq_printf(p, "ATA_BUS "); | ||
99 | if (eh_err_mask & AC_ERR_HOST_BUS) | ||
100 | trace_seq_printf(p, "HOST_BUS "); | ||
101 | if (eh_err_mask & AC_ERR_SYSTEM) | ||
102 | trace_seq_printf(p, "SYSTEM "); | ||
103 | if (eh_err_mask & AC_ERR_INVALID) | ||
104 | trace_seq_printf(p, "INVALID "); | ||
105 | if (eh_err_mask & AC_ERR_OTHER) | ||
106 | trace_seq_printf(p, "OTHER "); | ||
107 | if (eh_err_mask & AC_ERR_NODEV_HINT) | ||
108 | trace_seq_printf(p, "NODEV_HINT "); | ||
109 | if (eh_err_mask & AC_ERR_NCQ) | ||
110 | trace_seq_printf(p, "NCQ "); | ||
111 | trace_seq_putc(p, '}'); | ||
112 | } | ||
113 | trace_seq_putc(p, 0); | ||
114 | |||
115 | return ret; | ||
116 | } | ||
117 | |||
118 | const char * | ||
119 | libata_trace_parse_qc_flags(struct trace_seq *p, unsigned int qc_flags) | ||
120 | { | ||
121 | const char *ret = trace_seq_buffer_ptr(p); | ||
122 | |||
123 | trace_seq_printf(p, "%x", qc_flags); | ||
124 | if (qc_flags) { | ||
125 | trace_seq_printf(p, "{ "); | ||
126 | if (qc_flags & ATA_QCFLAG_ACTIVE) | ||
127 | trace_seq_printf(p, "ACTIVE "); | ||
128 | if (qc_flags & ATA_QCFLAG_DMAMAP) | ||
129 | trace_seq_printf(p, "DMAMAP "); | ||
130 | if (qc_flags & ATA_QCFLAG_IO) | ||
131 | trace_seq_printf(p, "IO "); | ||
132 | if (qc_flags & ATA_QCFLAG_RESULT_TF) | ||
133 | trace_seq_printf(p, "RESULT_TF "); | ||
134 | if (qc_flags & ATA_QCFLAG_CLEAR_EXCL) | ||
135 | trace_seq_printf(p, "CLEAR_EXCL "); | ||
136 | if (qc_flags & ATA_QCFLAG_QUIET) | ||
137 | trace_seq_printf(p, "QUIET "); | ||
138 | if (qc_flags & ATA_QCFLAG_RETRY) | ||
139 | trace_seq_printf(p, "RETRY "); | ||
140 | if (qc_flags & ATA_QCFLAG_FAILED) | ||
141 | trace_seq_printf(p, "FAILED "); | ||
142 | if (qc_flags & ATA_QCFLAG_SENSE_VALID) | ||
143 | trace_seq_printf(p, "SENSE_VALID "); | ||
144 | if (qc_flags & ATA_QCFLAG_EH_SCHEDULED) | ||
145 | trace_seq_printf(p, "EH_SCHEDULED "); | ||
146 | trace_seq_putc(p, '}'); | ||
147 | } | ||
148 | trace_seq_putc(p, 0); | ||
149 | |||
150 | return ret; | ||
151 | } | ||
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h new file mode 100644 index 000000000000..8b0fbd93082c --- /dev/null +++ b/include/trace/events/libata.h | |||
@@ -0,0 +1,325 @@ | |||
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), \ | ||
42 | ata_opcode_name(ATA_CMD_FPDMA_SEND), \ | ||
43 | ata_opcode_name(ATA_CMD_FPDMA_RECV), \ | ||
44 | ata_opcode_name(ATA_CMD_PIO_READ), \ | ||
45 | ata_opcode_name(ATA_CMD_PIO_READ_EXT), \ | ||
46 | ata_opcode_name(ATA_CMD_PIO_WRITE), \ | ||
47 | ata_opcode_name(ATA_CMD_PIO_WRITE_EXT), \ | ||
48 | ata_opcode_name(ATA_CMD_READ_MULTI), \ | ||
49 | ata_opcode_name(ATA_CMD_READ_MULTI_EXT), \ | ||
50 | ata_opcode_name(ATA_CMD_WRITE_MULTI), \ | ||
51 | ata_opcode_name(ATA_CMD_WRITE_MULTI_EXT), \ | ||
52 | ata_opcode_name(ATA_CMD_WRITE_MULTI_FUA_EXT), \ | ||
53 | ata_opcode_name(ATA_CMD_SET_FEATURES), \ | ||
54 | ata_opcode_name(ATA_CMD_SET_MULTI), \ | ||
55 | ata_opcode_name(ATA_CMD_PACKET), \ | ||
56 | ata_opcode_name(ATA_CMD_VERIFY), \ | ||
57 | ata_opcode_name(ATA_CMD_VERIFY_EXT), \ | ||
58 | ata_opcode_name(ATA_CMD_WRITE_UNCORR_EXT), \ | ||
59 | ata_opcode_name(ATA_CMD_STANDBYNOW1), \ | ||
60 | ata_opcode_name(ATA_CMD_IDLEIMMEDIATE), \ | ||
61 | ata_opcode_name(ATA_CMD_SLEEP), \ | ||
62 | ata_opcode_name(ATA_CMD_INIT_DEV_PARAMS), \ | ||
63 | ata_opcode_name(ATA_CMD_READ_NATIVE_MAX), \ | ||
64 | ata_opcode_name(ATA_CMD_READ_NATIVE_MAX_EXT), \ | ||
65 | ata_opcode_name(ATA_CMD_SET_MAX), \ | ||
66 | ata_opcode_name(ATA_CMD_SET_MAX_EXT), \ | ||
67 | ata_opcode_name(ATA_CMD_READ_LOG_EXT), \ | ||
68 | ata_opcode_name(ATA_CMD_WRITE_LOG_EXT), \ | ||
69 | ata_opcode_name(ATA_CMD_READ_LOG_DMA_EXT), \ | ||
70 | ata_opcode_name(ATA_CMD_WRITE_LOG_DMA_EXT), \ | ||
71 | ata_opcode_name(ATA_CMD_TRUSTED_NONDATA), \ | ||
72 | ata_opcode_name(ATA_CMD_TRUSTED_RCV), \ | ||
73 | ata_opcode_name(ATA_CMD_TRUSTED_RCV_DMA), \ | ||
74 | ata_opcode_name(ATA_CMD_TRUSTED_SND), \ | ||
75 | ata_opcode_name(ATA_CMD_TRUSTED_SND_DMA), \ | ||
76 | ata_opcode_name(ATA_CMD_PMP_READ), \ | ||
77 | ata_opcode_name(ATA_CMD_PMP_READ_DMA), \ | ||
78 | ata_opcode_name(ATA_CMD_PMP_WRITE), \ | ||
79 | ata_opcode_name(ATA_CMD_PMP_WRITE_DMA), \ | ||
80 | ata_opcode_name(ATA_CMD_CONF_OVERLAY), \ | ||
81 | ata_opcode_name(ATA_CMD_SEC_SET_PASS), \ | ||
82 | ata_opcode_name(ATA_CMD_SEC_UNLOCK), \ | ||
83 | ata_opcode_name(ATA_CMD_SEC_ERASE_PREP), \ | ||
84 | ata_opcode_name(ATA_CMD_SEC_ERASE_UNIT), \ | ||
85 | ata_opcode_name(ATA_CMD_SEC_FREEZE_LOCK), \ | ||
86 | ata_opcode_name(ATA_CMD_SEC_DISABLE_PASS), \ | ||
87 | ata_opcode_name(ATA_CMD_CONFIG_STREAM), \ | ||
88 | ata_opcode_name(ATA_CMD_SMART), \ | ||
89 | ata_opcode_name(ATA_CMD_MEDIA_LOCK), \ | ||
90 | ata_opcode_name(ATA_CMD_MEDIA_UNLOCK), \ | ||
91 | ata_opcode_name(ATA_CMD_DSM), \ | ||
92 | ata_opcode_name(ATA_CMD_CHK_MED_CRD_TYP), \ | ||
93 | ata_opcode_name(ATA_CMD_CFA_REQ_EXT_ERR), \ | ||
94 | ata_opcode_name(ATA_CMD_CFA_WRITE_NE), \ | ||
95 | ata_opcode_name(ATA_CMD_CFA_TRANS_SECT), \ | ||
96 | ata_opcode_name(ATA_CMD_CFA_ERASE), \ | ||
97 | ata_opcode_name(ATA_CMD_CFA_WRITE_MULT_NE), \ | ||
98 | ata_opcode_name(ATA_CMD_REQ_SENSE_DATA), \ | ||
99 | ata_opcode_name(ATA_CMD_SANITIZE_DEVICE), \ | ||
100 | ata_opcode_name(ATA_CMD_RESTORE), \ | ||
101 | ata_opcode_name(ATA_CMD_READ_LONG), \ | ||
102 | ata_opcode_name(ATA_CMD_READ_LONG_ONCE), \ | ||
103 | ata_opcode_name(ATA_CMD_WRITE_LONG), \ | ||
104 | ata_opcode_name(ATA_CMD_WRITE_LONG_ONCE)) | ||
105 | |||
106 | #define ata_error_name(result) { result, #result } | ||
107 | #define show_error_name(val) \ | ||
108 | __print_symbolic(val, \ | ||
109 | ata_error_name(ATA_ICRC), \ | ||
110 | ata_error_name(ATA_UNC), \ | ||
111 | ata_error_name(ATA_MC), \ | ||
112 | ata_error_name(ATA_IDNF), \ | ||
113 | ata_error_name(ATA_MCR), \ | ||
114 | ata_error_name(ATA_ABORTED), \ | ||
115 | ata_error_name(ATA_TRK0NF), \ | ||
116 | ata_error_name(ATA_AMNF)) | ||
117 | |||
118 | #define ata_protocol_name(proto) { proto, #proto } | ||
119 | #define show_protocol_name(val) \ | ||
120 | __print_symbolic(val, \ | ||
121 | ata_protocol_name(ATA_PROT_UNKNOWN), \ | ||
122 | ata_protocol_name(ATA_PROT_NODATA), \ | ||
123 | ata_protocol_name(ATA_PROT_PIO), \ | ||
124 | ata_protocol_name(ATA_PROT_DMA), \ | ||
125 | ata_protocol_name(ATA_PROT_NCQ), \ | ||
126 | ata_protocol_name(ATAPI_PROT_NODATA), \ | ||
127 | ata_protocol_name(ATAPI_PROT_PIO), \ | ||
128 | ata_protocol_name(ATAPI_PROT_DMA)) | ||
129 | |||
130 | const char *libata_trace_parse_status(struct trace_seq*, unsigned char); | ||
131 | #define __parse_status(s) libata_trace_parse_status(p, s) | ||
132 | |||
133 | const char *libata_trace_parse_eh_action(struct trace_seq *, unsigned int); | ||
134 | #define __parse_eh_action(a) libata_trace_parse_eh_action(p, a) | ||
135 | |||
136 | const char *libata_trace_parse_eh_err_mask(struct trace_seq *, unsigned int); | ||
137 | #define __parse_eh_err_mask(m) libata_trace_parse_eh_err_mask(p, m) | ||
138 | |||
139 | const char *libata_trace_parse_qc_flags(struct trace_seq *, unsigned int); | ||
140 | #define __parse_qc_flags(f) libata_trace_parse_qc_flags(p, f) | ||
141 | |||
142 | TRACE_EVENT(ata_qc_issue, | ||
143 | |||
144 | TP_PROTO(struct ata_queued_cmd *qc), | ||
145 | |||
146 | TP_ARGS(qc), | ||
147 | |||
148 | TP_STRUCT__entry( | ||
149 | __field( unsigned int, ata_port ) | ||
150 | __field( unsigned int, ata_dev ) | ||
151 | __field( unsigned int, tag ) | ||
152 | __field( unsigned char, cmd ) | ||
153 | __field( unsigned char, dev ) | ||
154 | __field( unsigned char, lbal ) | ||
155 | __field( unsigned char, lbam ) | ||
156 | __field( unsigned char, lbah ) | ||
157 | __field( unsigned char, nsect ) | ||
158 | __field( unsigned char, feature ) | ||
159 | __field( unsigned char, hob_lbal ) | ||
160 | __field( unsigned char, hob_lbam ) | ||
161 | __field( unsigned char, hob_lbah ) | ||
162 | __field( unsigned char, hob_nsect ) | ||
163 | __field( unsigned char, hob_feature ) | ||
164 | __field( unsigned char, ctl ) | ||
165 | __field( unsigned char, proto ) | ||
166 | __field( unsigned long, flags ) | ||
167 | ), | ||
168 | |||
169 | TP_fast_assign( | ||
170 | __entry->ata_port = qc->ap->print_id; | ||
171 | __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno; | ||
172 | __entry->tag = qc->tag; | ||
173 | __entry->proto = qc->tf.protocol; | ||
174 | __entry->cmd = qc->tf.command; | ||
175 | __entry->dev = qc->tf.device; | ||
176 | __entry->lbal = qc->tf.lbal; | ||
177 | __entry->lbam = qc->tf.lbam; | ||
178 | __entry->lbah = qc->tf.lbah; | ||
179 | __entry->hob_lbal = qc->tf.hob_lbal; | ||
180 | __entry->hob_lbam = qc->tf.hob_lbam; | ||
181 | __entry->hob_lbah = qc->tf.hob_lbah; | ||
182 | __entry->feature = qc->tf.feature; | ||
183 | __entry->hob_feature = qc->tf.hob_feature; | ||
184 | __entry->nsect = qc->tf.nsect; | ||
185 | __entry->hob_nsect = qc->tf.hob_nsect; | ||
186 | ), | ||
187 | |||
188 | TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s cmd=%s " \ | ||
189 | " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)", | ||
190 | __entry->ata_port, __entry->ata_dev, __entry->tag, | ||
191 | show_protocol_name(__entry->proto), | ||
192 | show_opcode_name(__entry->cmd), | ||
193 | __entry->cmd, __entry->feature, __entry->nsect, | ||
194 | __entry->lbal, __entry->lbam, __entry->lbah, | ||
195 | __entry->hob_feature, __entry->hob_nsect, | ||
196 | __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah, | ||
197 | __entry->dev) | ||
198 | ); | ||
199 | |||
200 | DECLARE_EVENT_CLASS(ata_qc_complete_template, | ||
201 | |||
202 | TP_PROTO(struct ata_queued_cmd *qc), | ||
203 | |||
204 | TP_ARGS(qc), | ||
205 | |||
206 | TP_STRUCT__entry( | ||
207 | __field( unsigned int, ata_port ) | ||
208 | __field( unsigned int, ata_dev ) | ||
209 | __field( unsigned int, tag ) | ||
210 | __field( unsigned char, status ) | ||
211 | __field( unsigned char, dev ) | ||
212 | __field( unsigned char, lbal ) | ||
213 | __field( unsigned char, lbam ) | ||
214 | __field( unsigned char, lbah ) | ||
215 | __field( unsigned char, nsect ) | ||
216 | __field( unsigned char, error ) | ||
217 | __field( unsigned char, hob_lbal ) | ||
218 | __field( unsigned char, hob_lbam ) | ||
219 | __field( unsigned char, hob_lbah ) | ||
220 | __field( unsigned char, hob_nsect ) | ||
221 | __field( unsigned char, hob_feature ) | ||
222 | __field( unsigned char, ctl ) | ||
223 | __field( unsigned long, flags ) | ||
224 | ), | ||
225 | |||
226 | TP_fast_assign( | ||
227 | __entry->ata_port = qc->ap->print_id; | ||
228 | __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno; | ||
229 | __entry->tag = qc->tag; | ||
230 | __entry->status = qc->result_tf.command; | ||
231 | __entry->dev = qc->result_tf.device; | ||
232 | __entry->lbal = qc->result_tf.lbal; | ||
233 | __entry->lbam = qc->result_tf.lbam; | ||
234 | __entry->lbah = qc->result_tf.lbah; | ||
235 | __entry->hob_lbal = qc->result_tf.hob_lbal; | ||
236 | __entry->hob_lbam = qc->result_tf.hob_lbam; | ||
237 | __entry->hob_lbah = qc->result_tf.hob_lbah; | ||
238 | __entry->error = qc->result_tf.feature; | ||
239 | __entry->hob_feature = qc->result_tf.hob_feature; | ||
240 | __entry->nsect = qc->result_tf.nsect; | ||
241 | __entry->hob_nsect = qc->result_tf.hob_nsect; | ||
242 | ), | ||
243 | |||
244 | TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s status=%s " \ | ||
245 | " res=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)", | ||
246 | __entry->ata_port, __entry->ata_dev, __entry->tag, | ||
247 | __parse_qc_flags(__entry->flags), | ||
248 | __parse_status(__entry->status), | ||
249 | __entry->status, __entry->error, __entry->nsect, | ||
250 | __entry->lbal, __entry->lbam, __entry->lbah, | ||
251 | __entry->hob_feature, __entry->hob_nsect, | ||
252 | __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah, | ||
253 | __entry->dev) | ||
254 | ); | ||
255 | |||
256 | DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_internal, | ||
257 | TP_PROTO(struct ata_queued_cmd *qc), | ||
258 | TP_ARGS(qc)); | ||
259 | |||
260 | DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_failed, | ||
261 | TP_PROTO(struct ata_queued_cmd *qc), | ||
262 | TP_ARGS(qc)); | ||
263 | |||
264 | DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_done, | ||
265 | TP_PROTO(struct ata_queued_cmd *qc), | ||
266 | TP_ARGS(qc)); | ||
267 | |||
268 | TRACE_EVENT(ata_eh_link_autopsy, | ||
269 | |||
270 | TP_PROTO(struct ata_device *dev, unsigned int eh_action, unsigned int eh_err_mask), | ||
271 | |||
272 | TP_ARGS(dev, eh_action, eh_err_mask), | ||
273 | |||
274 | TP_STRUCT__entry( | ||
275 | __field( unsigned int, ata_port ) | ||
276 | __field( unsigned int, ata_dev ) | ||
277 | __field( unsigned int, eh_action ) | ||
278 | __field( unsigned int, eh_err_mask) | ||
279 | ), | ||
280 | |||
281 | TP_fast_assign( | ||
282 | __entry->ata_port = dev->link->ap->print_id; | ||
283 | __entry->ata_dev = dev->link->pmp + dev->devno; | ||
284 | __entry->eh_action = eh_action; | ||
285 | __entry->eh_err_mask = eh_err_mask; | ||
286 | ), | ||
287 | |||
288 | TP_printk("ata_port=%u ata_dev=%u eh_action=%s err_mask=%s", | ||
289 | __entry->ata_port, __entry->ata_dev, | ||
290 | __parse_eh_action(__entry->eh_action), | ||
291 | __parse_eh_err_mask(__entry->eh_err_mask)) | ||
292 | ); | ||
293 | |||
294 | TRACE_EVENT(ata_eh_link_autopsy_qc, | ||
295 | |||
296 | TP_PROTO(struct ata_queued_cmd *qc), | ||
297 | |||
298 | TP_ARGS(qc), | ||
299 | |||
300 | TP_STRUCT__entry( | ||
301 | __field( unsigned int, ata_port ) | ||
302 | __field( unsigned int, ata_dev ) | ||
303 | __field( unsigned int, tag ) | ||
304 | __field( unsigned int, qc_flags ) | ||
305 | __field( unsigned int, eh_err_mask) | ||
306 | ), | ||
307 | |||
308 | TP_fast_assign( | ||
309 | __entry->ata_port = qc->ap->print_id; | ||
310 | __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno; | ||
311 | __entry->tag = qc->tag; | ||
312 | __entry->qc_flags = qc->flags; | ||
313 | __entry->eh_err_mask = qc->err_mask; | ||
314 | ), | ||
315 | |||
316 | TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s err_mask=%s", | ||
317 | __entry->ata_port, __entry->ata_dev, __entry->tag, | ||
318 | __parse_qc_flags(__entry->qc_flags), | ||
319 | __parse_eh_err_mask(__entry->eh_err_mask)) | ||
320 | ); | ||
321 | |||
322 | #endif /* _TRACE_LIBATA_H */ | ||
323 | |||
324 | /* This part must be outside protection */ | ||
325 | #include <trace/define_trace.h> | ||