xref: /openbmc/linux/include/trace/events/mmc.h (revision a36954f5)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM mmc
3 
4 #if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_MMC_H
6 
7 #include <linux/blkdev.h>
8 #include <linux/mmc/core.h>
9 #include <linux/mmc/host.h>
10 #include <linux/tracepoint.h>
11 
12 TRACE_EVENT(mmc_request_start,
13 
14 	TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),
15 
16 	TP_ARGS(host, mrq),
17 
18 	TP_STRUCT__entry(
19 		__field(u32,			cmd_opcode)
20 		__field(u32,			cmd_arg)
21 		__field(unsigned int,		cmd_flags)
22 		__field(unsigned int,		cmd_retries)
23 		__field(u32,			stop_opcode)
24 		__field(u32,			stop_arg)
25 		__field(unsigned int,		stop_flags)
26 		__field(unsigned int,		stop_retries)
27 		__field(u32,			sbc_opcode)
28 		__field(u32,			sbc_arg)
29 		__field(unsigned int,		sbc_flags)
30 		__field(unsigned int,		sbc_retries)
31 		__field(unsigned int,		blocks)
32 		__field(unsigned int,		blksz)
33 		__field(unsigned int,		data_flags)
34 		__field(unsigned int,		can_retune)
35 		__field(unsigned int,		doing_retune)
36 		__field(unsigned int,		retune_now)
37 		__field(int,			need_retune)
38 		__field(int,			hold_retune)
39 		__field(unsigned int,		retune_period)
40 		__field(struct mmc_request *,	mrq)
41 		__string(name,			mmc_hostname(host))
42 	),
43 
44 	TP_fast_assign(
45 		__entry->cmd_opcode = mrq->cmd->opcode;
46 		__entry->cmd_arg = mrq->cmd->arg;
47 		__entry->cmd_flags = mrq->cmd->flags;
48 		__entry->cmd_retries = mrq->cmd->retries;
49 		__entry->stop_opcode = mrq->stop ? mrq->stop->opcode : 0;
50 		__entry->stop_arg = mrq->stop ? mrq->stop->arg : 0;
51 		__entry->stop_flags = mrq->stop ? mrq->stop->flags : 0;
52 		__entry->stop_retries = mrq->stop ? mrq->stop->retries : 0;
53 		__entry->sbc_opcode = mrq->sbc ? mrq->sbc->opcode : 0;
54 		__entry->sbc_arg = mrq->sbc ? mrq->sbc->arg : 0;
55 		__entry->sbc_flags = mrq->sbc ? mrq->sbc->flags : 0;
56 		__entry->sbc_retries = mrq->sbc ? mrq->sbc->retries : 0;
57 		__entry->blksz = mrq->data ? mrq->data->blksz : 0;
58 		__entry->blocks = mrq->data ? mrq->data->blocks : 0;
59 		__entry->data_flags = mrq->data ? mrq->data->flags : 0;
60 		__entry->can_retune = host->can_retune;
61 		__entry->doing_retune = host->doing_retune;
62 		__entry->retune_now = host->retune_now;
63 		__entry->need_retune = host->need_retune;
64 		__entry->hold_retune = host->hold_retune;
65 		__entry->retune_period = host->retune_period;
66 		__assign_str(name, mmc_hostname(host));
67 		__entry->mrq = mrq;
68 	),
69 
70 	TP_printk("%s: start struct mmc_request[%p]: "
71 		  "cmd_opcode=%u cmd_arg=0x%x cmd_flags=0x%x cmd_retries=%u "
72 		  "stop_opcode=%u stop_arg=0x%x stop_flags=0x%x stop_retries=%u "
73 		  "sbc_opcode=%u sbc_arg=0x%x sbc_flags=0x%x sbc_retires=%u "
74 		  "blocks=%u block_size=%u data_flags=0x%x "
75 		  "can_retune=%u doing_retune=%u retune_now=%u "
76 		  "need_retune=%d hold_retune=%d retune_period=%u",
77 		  __get_str(name), __entry->mrq,
78 		  __entry->cmd_opcode, __entry->cmd_arg,
79 		  __entry->cmd_flags, __entry->cmd_retries,
80 		  __entry->stop_opcode, __entry->stop_arg,
81 		  __entry->stop_flags, __entry->stop_retries,
82 		  __entry->sbc_opcode, __entry->sbc_arg,
83 		  __entry->sbc_flags, __entry->sbc_retries,
84 		  __entry->blocks, __entry->blksz, __entry->data_flags,
85 		  __entry->can_retune, __entry->doing_retune,
86 		  __entry->retune_now, __entry->need_retune,
87 		  __entry->hold_retune, __entry->retune_period)
88 );
89 
90 TRACE_EVENT(mmc_request_done,
91 
92 	TP_PROTO(struct mmc_host *host, struct mmc_request *mrq),
93 
94 	TP_ARGS(host, mrq),
95 
96 	TP_STRUCT__entry(
97 		__field(u32,			cmd_opcode)
98 		__field(int,			cmd_err)
99 		__array(u32,			cmd_resp,	4)
100 		__field(unsigned int,		cmd_retries)
101 		__field(u32,			stop_opcode)
102 		__field(int,			stop_err)
103 		__array(u32,			stop_resp,	4)
104 		__field(unsigned int,		stop_retries)
105 		__field(u32,			sbc_opcode)
106 		__field(int,			sbc_err)
107 		__array(u32,			sbc_resp,	4)
108 		__field(unsigned int,		sbc_retries)
109 		__field(unsigned int,		bytes_xfered)
110 		__field(int,			data_err)
111 		__field(unsigned int,		can_retune)
112 		__field(unsigned int,		doing_retune)
113 		__field(unsigned int,		retune_now)
114 		__field(int,			need_retune)
115 		__field(int,			hold_retune)
116 		__field(unsigned int,		retune_period)
117 		__field(struct mmc_request *,	mrq)
118 		__string(name,			mmc_hostname(host))
119 	),
120 
121 	TP_fast_assign(
122 		__entry->cmd_opcode = mrq->cmd->opcode;
123 		__entry->cmd_err = mrq->cmd->error;
124 		memcpy(__entry->cmd_resp, mrq->cmd->resp, 4);
125 		__entry->cmd_retries = mrq->cmd->retries;
126 		__entry->stop_opcode = mrq->stop ? mrq->stop->opcode : 0;
127 		__entry->stop_err = mrq->stop ? mrq->stop->error : 0;
128 		__entry->stop_resp[0] = mrq->stop ? mrq->stop->resp[0] : 0;
129 		__entry->stop_resp[1] = mrq->stop ? mrq->stop->resp[1] : 0;
130 		__entry->stop_resp[2] = mrq->stop ? mrq->stop->resp[2] : 0;
131 		__entry->stop_resp[3] = mrq->stop ? mrq->stop->resp[3] : 0;
132 		__entry->stop_retries = mrq->stop ? mrq->stop->retries : 0;
133 		__entry->sbc_opcode = mrq->sbc ? mrq->sbc->opcode : 0;
134 		__entry->sbc_err = mrq->sbc ? mrq->sbc->error : 0;
135 		__entry->sbc_resp[0] = mrq->sbc ? mrq->sbc->resp[0] : 0;
136 		__entry->sbc_resp[1] = mrq->sbc ? mrq->sbc->resp[1] : 0;
137 		__entry->sbc_resp[2] = mrq->sbc ? mrq->sbc->resp[2] : 0;
138 		__entry->sbc_resp[3] = mrq->sbc ? mrq->sbc->resp[3] : 0;
139 		__entry->sbc_retries = mrq->sbc ? mrq->sbc->retries : 0;
140 		__entry->bytes_xfered = mrq->data ? mrq->data->bytes_xfered : 0;
141 		__entry->data_err = mrq->data ? mrq->data->error : 0;
142 		__entry->can_retune = host->can_retune;
143 		__entry->doing_retune = host->doing_retune;
144 		__entry->retune_now = host->retune_now;
145 		__entry->need_retune = host->need_retune;
146 		__entry->hold_retune = host->hold_retune;
147 		__entry->retune_period = host->retune_period;
148 		__assign_str(name, mmc_hostname(host));
149 		__entry->mrq = mrq;
150 	),
151 
152 	TP_printk("%s: end struct mmc_request[%p]: "
153 		  "cmd_opcode=%u cmd_err=%d cmd_resp=0x%x 0x%x 0x%x 0x%x "
154 		  "cmd_retries=%u stop_opcode=%u stop_err=%d "
155 		  "stop_resp=0x%x 0x%x 0x%x 0x%x stop_retries=%u "
156 		  "sbc_opcode=%u sbc_err=%d sbc_resp=0x%x 0x%x 0x%x 0x%x "
157 		  "sbc_retries=%u bytes_xfered=%u data_err=%d "
158 		  "can_retune=%u doing_retune=%u retune_now=%u need_retune=%d "
159 		  "hold_retune=%d retune_period=%u",
160 		  __get_str(name), __entry->mrq,
161 		  __entry->cmd_opcode, __entry->cmd_err,
162 		  __entry->cmd_resp[0], __entry->cmd_resp[1],
163 		  __entry->cmd_resp[2], __entry->cmd_resp[3],
164 		  __entry->cmd_retries,
165 		  __entry->stop_opcode, __entry->stop_err,
166 		  __entry->stop_resp[0], __entry->stop_resp[1],
167 		  __entry->stop_resp[2], __entry->stop_resp[3],
168 		  __entry->stop_retries,
169 		  __entry->sbc_opcode, __entry->sbc_err,
170 		  __entry->sbc_resp[0], __entry->sbc_resp[1],
171 		  __entry->sbc_resp[2], __entry->sbc_resp[3],
172 		  __entry->sbc_retries,
173 		  __entry->bytes_xfered, __entry->data_err,
174 		  __entry->can_retune, __entry->doing_retune,
175 		  __entry->retune_now, __entry->need_retune,
176 		  __entry->hold_retune, __entry->retune_period)
177 );
178 
179 #endif /* _TRACE_MMC_H */
180 
181 /* This part must be outside protection */
182 #include <trace/define_trace.h>
183