Merge tag 'lsk-v3.10-android-14.11'
[firefly-linux-kernel-4.4.55.git] / include / trace / events / mmc.h
1 /*
2  * Copyright (C) 2013 Google, Inc.
3  *
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.
7  *
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.
12  *
13  */
14
15 #undef TRACE_SYSTEM
16 #define TRACE_SYSTEM mmc
17
18 #if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
19 #define _TRACE_MMC_H
20
21 #include <linux/tracepoint.h>
22 #include <linux/mmc/mmc.h>
23 #include <linux/mmc/core.h>
24
25 /*
26  * Unconditional logging of mmc block erase operations,
27  * including cmd, address, size
28  */
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),
32         TP_STRUCT__entry(
33                 __field(unsigned int, cmd)
34                 __field(unsigned int, addr)
35                 __field(unsigned int, size)
36         ),
37         TP_fast_assign(
38                 __entry->cmd = cmd;
39                 __entry->addr = addr;
40                 __entry->size = size;
41         ),
42         TP_printk("cmd=%u,addr=0x%08x,size=0x%08x",
43                   __entry->cmd, __entry->addr, __entry->size)
44 );
45
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));
49
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));
53
54 /*
55  * Logging of start of read or write mmc block operation,
56  * including cmd, address, size
57  */
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),
61         TP_STRUCT__entry(
62                 __field(unsigned int, cmd)
63                 __field(unsigned int, addr)
64                 __field(unsigned int, size)
65         ),
66         TP_fast_assign(
67                 __entry->cmd = cmd;
68                 __entry->addr = addr;
69                 __entry->size = data->blocks;
70         ),
71         TP_printk("cmd=%u,addr=0x%08x,size=0x%08x",
72                   __entry->cmd, __entry->addr, __entry->size)
73 );
74
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)) &&
80                       data));
81
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)) &&
87                       data));
88
89 /*
90  * Logging of start of req(sbc) and req done of mmc  operation,
91  * including cmd, args, size, resp, etc.
92  */
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),
98
99         TP_STRUCT__entry(
100             __string(host, host)
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 )
106            ),
107
108         TP_fast_assign(
109             __assign_str(host, host);
110             __entry->cmd = cmd;
111             __entry->arg = arg;
112             __entry->flags = flags;
113             __entry->blksz = blksz;
114             __entry->blks = blks;
115         ),
116
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 )
121 );
122
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)
128 );
129
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)
135 );
136
137
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,
142                 unsigned int resp4),
143         TP_ARGS(host, cmd, err, resp1, resp2, resp3, resp4),
144
145         TP_STRUCT__entry(
146             __string(host, host)
147             __field(unsigned int, cmd   )
148             __field(         int, err )
149             __field(unsigned int, resp1 )
150             __field(unsigned int, resp2 )
151             __field(unsigned int, resp3 )
152             __field(unsigned int, resp4 )
153            ),
154
155         TP_fast_assign(
156             __assign_str(host, host);
157             __entry->cmd = cmd;
158             __entry->err = err;
159             __entry->resp1 = resp1;
160             __entry->resp2 = resp2;
161             __entry->resp3 = resp3;
162             __entry->resp4 = resp4;
163         ),
164
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,
169                 __entry->resp4 )
170 );
171
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,
176                 unsigned int resp4),
177         TP_ARGS(host, cmd, err, resp1, resp2, resp3, resp4)
178 );
179 #endif /* _TRACE_MMC_H */
180
181 /* This part must be outside protection */
182 #include <trace/define_trace.h>