2 * Copyright (C) 2013 Google, Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
16 #define TRACE_SYSTEM mmc
18 #if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
21 #include <linux/tracepoint.h>
22 #include <linux/mmc/mmc.h>
23 #include <linux/mmc/core.h>
26 * Unconditional logging of mmc block erase operations,
27 * including cmd, address, size
29 DECLARE_EVENT_CLASS(mmc_blk_erase_class,
30 TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size),
31 TP_ARGS(cmd, addr, size),
33 __field(unsigned int, cmd)
34 __field(unsigned int, addr)
35 __field(unsigned int, size)
42 TP_printk("cmd=%u,addr=0x%08x,size=0x%08x",
43 __entry->cmd, __entry->addr, __entry->size)
46 DEFINE_EVENT(mmc_blk_erase_class, mmc_blk_erase_start,
47 TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size),
48 TP_ARGS(cmd, addr, size));
50 DEFINE_EVENT(mmc_blk_erase_class, mmc_blk_erase_end,
51 TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size),
52 TP_ARGS(cmd, addr, size));
55 * Logging of start of read or write mmc block operation,
56 * including cmd, address, size
58 DECLARE_EVENT_CLASS(mmc_blk_rw_class,
59 TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data),
60 TP_ARGS(cmd, addr, data),
62 __field(unsigned int, cmd)
63 __field(unsigned int, addr)
64 __field(unsigned int, size)
69 __entry->size = data->blocks;
71 TP_printk("cmd=%u,addr=0x%08x,size=0x%08x",
72 __entry->cmd, __entry->addr, __entry->size)
75 DEFINE_EVENT_CONDITION(mmc_blk_rw_class, mmc_blk_rw_start,
76 TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data),
77 TP_ARGS(cmd, addr, data),
78 TP_CONDITION(((cmd == MMC_READ_MULTIPLE_BLOCK) ||
79 (cmd == MMC_WRITE_MULTIPLE_BLOCK)) &&
82 DEFINE_EVENT_CONDITION(mmc_blk_rw_class, mmc_blk_rw_end,
83 TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data),
84 TP_ARGS(cmd, addr, data),
85 TP_CONDITION(((cmd == MMC_READ_MULTIPLE_BLOCK) ||
86 (cmd == MMC_WRITE_MULTIPLE_BLOCK)) &&
90 * Logging of start of req(sbc) and req done of mmc operation,
91 * including cmd, args, size, resp, etc.
93 DECLARE_EVENT_CLASS(start_req,
94 TP_PROTO(const char * host, unsigned int cmd,
95 unsigned int arg, unsigned int flags,
96 unsigned int blksz, unsigned int blks),
97 TP_ARGS(host, cmd, arg, flags, blksz, blks),
101 __field(unsigned int, cmd )
102 __field(unsigned int, arg )
103 __field(unsigned int, flags )
104 __field(unsigned int, blksz )
105 __field(unsigned int, blks )
109 __assign_str(host, host);
112 __entry->flags = flags;
113 __entry->blksz = blksz;
114 __entry->blks = blks;
117 TP_printk("host=%s CMD%u arg=%08x flags=%08x blksz=%05x blks=%03x",
118 __get_str(host), __entry->cmd,
119 __entry->arg, __entry->flags,
120 __entry->blksz, __entry->blks )
123 DEFINE_EVENT(start_req, mmc_start_req_cmd,
124 TP_PROTO(const char *host, unsigned int cmd,
125 unsigned int arg, unsigned int flags,
126 unsigned int blksz, unsigned int blks),
127 TP_ARGS(host, cmd, arg, flags, blksz, blks)
130 DEFINE_EVENT(start_req, mmc_start_req_sbc,
131 TP_PROTO(const char *host, unsigned int cmd,
132 unsigned int arg, unsigned int flags,
133 unsigned int blksz, unsigned int blks),
134 TP_ARGS(host, cmd, arg, flags, blksz, blks)
138 DECLARE_EVENT_CLASS(req_done,
139 TP_PROTO(const char *host, unsigned int cmd,
140 int err, unsigned int resp1,
141 unsigned int resp2, unsigned int resp3,
143 TP_ARGS(host, cmd, err, resp1, resp2, resp3, resp4),
147 __field(unsigned int, cmd )
149 __field(unsigned int, resp1 )
150 __field(unsigned int, resp2 )
151 __field(unsigned int, resp3 )
152 __field(unsigned int, resp4 )
156 __assign_str(host, host);
159 __entry->resp1 = resp1;
160 __entry->resp2 = resp2;
161 __entry->resp3 = resp3;
162 __entry->resp4 = resp4;
165 TP_printk("host=%s CMD%u err=%08x resp1=%08x resp2=%08x resp3=%08x resp4=%08x",
166 __get_str(host), __entry->cmd,
167 __entry->err, __entry->resp1,
168 __entry->resp2, __entry->resp3,
172 DEFINE_EVENT(req_done, mmc_req_done,
173 TP_PROTO(const char *host, unsigned int cmd,
174 int err, unsigned int resp1,
175 unsigned int resp2, unsigned int resp3,
177 TP_ARGS(host, cmd, err, resp1, resp2, resp3, resp4)
179 #endif /* _TRACE_MMC_H */
181 /* This part must be outside protection */
182 #include <trace/define_trace.h>