blob: 917b3f0e0c44c89b49fddbb56d4cd09360d47b99 [file] [log] [blame]
Baolin Wang7962fc32016-03-31 11:16:27 +08001#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
12TRACE_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
90TRACE_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
Venkat Gopalakrishnana71fbae2014-06-09 14:00:31 -0700179TRACE_EVENT(mmc_cmd_rw_start,
180 TP_PROTO(unsigned int cmd, unsigned int arg, unsigned int flags),
181 TP_ARGS(cmd, arg, flags),
182 TP_STRUCT__entry(
183 __field(unsigned int, cmd)
184 __field(unsigned int, arg)
185 __field(unsigned int, flags)
186 ),
187 TP_fast_assign(
188 __entry->cmd = cmd;
189 __entry->arg = arg;
190 __entry->flags = flags;
191 ),
192 TP_printk("cmd=%u,arg=0x%08x,flags=0x%08x",
193 __entry->cmd, __entry->arg, __entry->flags)
194);
195
196TRACE_EVENT(mmc_cmd_rw_end,
197 TP_PROTO(unsigned int cmd, unsigned int status, unsigned int resp),
198 TP_ARGS(cmd, status, resp),
199 TP_STRUCT__entry(
200 __field(unsigned int, cmd)
201 __field(unsigned int, status)
202 __field(unsigned int, resp)
203 ),
204 TP_fast_assign(
205 __entry->cmd = cmd;
206 __entry->status = status;
207 __entry->resp = resp;
208 ),
209 TP_printk("cmd=%u,int_status=0x%08x,response=0x%08x",
210 __entry->cmd, __entry->status, __entry->resp)
211);
212
213TRACE_EVENT(mmc_data_rw_end,
214 TP_PROTO(unsigned int cmd, unsigned int status),
215 TP_ARGS(cmd, status),
216 TP_STRUCT__entry(
217 __field(unsigned int, cmd)
218 __field(unsigned int, status)
219 ),
220 TP_fast_assign(
221 __entry->cmd = cmd;
222 __entry->status = status;
223 ),
224 TP_printk("cmd=%u,int_status=0x%08x",
225 __entry->cmd, __entry->status)
226);
227
228DECLARE_EVENT_CLASS(mmc_adma_class,
229 TP_PROTO(unsigned int cmd, unsigned int len),
230 TP_ARGS(cmd, len),
231 TP_STRUCT__entry(
232 __field(unsigned int, cmd)
233 __field(unsigned int, len)
234 ),
235 TP_fast_assign(
236 __entry->cmd = cmd;
237 __entry->len = len;
238 ),
239 TP_printk("cmd=%u,sg_len=0x%08x", __entry->cmd, __entry->len)
240);
241
242DEFINE_EVENT(mmc_adma_class, mmc_adma_table_pre,
243 TP_PROTO(unsigned int cmd, unsigned int len),
244 TP_ARGS(cmd, len));
245
246DEFINE_EVENT(mmc_adma_class, mmc_adma_table_post,
247 TP_PROTO(unsigned int cmd, unsigned int len),
248 TP_ARGS(cmd, len));
249
Sujit Reddy Thumma14ec3cc2013-02-14 08:13:52 +0530250TRACE_EVENT(mmc_clk,
251 TP_PROTO(char *print_info),
252
253 TP_ARGS(print_info),
254
255 TP_STRUCT__entry(
256 __string(print_info, print_info)
257 ),
258
259 TP_fast_assign(
260 __assign_str(print_info, print_info);
261 ),
262
263 TP_printk("%s",
264 __get_str(print_info)
265 )
266);
267
Konstantin Dorfman892f84e2015-02-12 13:37:56 +0200268DECLARE_EVENT_CLASS(mmc_pm_template,
269 TP_PROTO(const char *dev_name, int err, s64 usecs),
270
271 TP_ARGS(dev_name, err, usecs),
272
273 TP_STRUCT__entry(
274 __field(s64, usecs)
275 __field(int, err)
276 __string(dev_name, dev_name)
277 ),
278
279 TP_fast_assign(
280 __entry->usecs = usecs;
281 __entry->err = err;
282 __assign_str(dev_name, dev_name);
283 ),
284
285 TP_printk(
286 "took %lld usecs, %s err %d",
287 __entry->usecs,
288 __get_str(dev_name),
289 __entry->err
290 )
291);
292
293DEFINE_EVENT(mmc_pm_template, mmc_runtime_suspend,
294 TP_PROTO(const char *dev_name, int err, s64 usecs),
295 TP_ARGS(dev_name, err, usecs));
296
297DEFINE_EVENT(mmc_pm_template, mmc_runtime_resume,
298 TP_PROTO(const char *dev_name, int err, s64 usecs),
299 TP_ARGS(dev_name, err, usecs));
300
301DEFINE_EVENT(mmc_pm_template, mmc_suspend,
302 TP_PROTO(const char *dev_name, int err, s64 usecs),
303 TP_ARGS(dev_name, err, usecs));
304
305DEFINE_EVENT(mmc_pm_template, mmc_resume,
306 TP_PROTO(const char *dev_name, int err, s64 usecs),
307 TP_ARGS(dev_name, err, usecs));
308
Konstantin Dorfmanddab0cc2015-02-25 16:23:50 +0200309DEFINE_EVENT(mmc_pm_template, sdhci_msm_suspend,
310 TP_PROTO(const char *dev_name, int err, s64 usecs),
311 TP_ARGS(dev_name, err, usecs));
312
313DEFINE_EVENT(mmc_pm_template, sdhci_msm_resume,
314 TP_PROTO(const char *dev_name, int err, s64 usecs),
315 TP_ARGS(dev_name, err, usecs));
316
317DEFINE_EVENT(mmc_pm_template, sdhci_msm_runtime_suspend,
318 TP_PROTO(const char *dev_name, int err, s64 usecs),
319 TP_ARGS(dev_name, err, usecs));
320
321DEFINE_EVENT(mmc_pm_template, sdhci_msm_runtime_resume,
322 TP_PROTO(const char *dev_name, int err, s64 usecs),
323 TP_ARGS(dev_name, err, usecs));
Sujit Reddy Thumma14ec3cc2013-02-14 08:13:52 +0530324#endif /* if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ) */
Baolin Wang7962fc32016-03-31 11:16:27 +0800325
326/* This part must be outside protection */
327#include <trace/define_trace.h>