Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / include / trace / events / ufs.h
blobbf6f82673492ca252c6537b1bd3817e7987840ef
1 /*
2 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
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.
14 #undef TRACE_SYSTEM
15 #define TRACE_SYSTEM ufs
17 #if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ)
18 #define _TRACE_UFS_H
20 #include <linux/tracepoint.h>
22 #define UFS_LINK_STATES \
23 EM(UIC_LINK_OFF_STATE) \
24 EM(UIC_LINK_ACTIVE_STATE) \
25 EMe(UIC_LINK_HIBERN8_STATE)
27 #define UFS_PWR_MODES \
28 EM(UFS_ACTIVE_PWR_MODE) \
29 EM(UFS_SLEEP_PWR_MODE) \
30 EMe(UFS_POWERDOWN_PWR_MODE)
32 #define UFSCHD_CLK_GATING_STATES \
33 EM(CLKS_OFF) \
34 EM(CLKS_ON) \
35 EM(REQ_CLKS_OFF) \
36 EMe(REQ_CLKS_ON)
38 /* Enums require being exported to userspace, for user tool parsing */
39 #undef EM
40 #undef EMe
41 #define EM(a) TRACE_DEFINE_ENUM(a);
42 #define EMe(a) TRACE_DEFINE_ENUM(a);
44 UFS_LINK_STATES;
45 UFS_PWR_MODES;
46 UFSCHD_CLK_GATING_STATES;
49 * Now redefine the EM() and EMe() macros to map the enums to the strings
50 * that will be printed in the output.
52 #undef EM
53 #undef EMe
54 #define EM(a) { a, #a },
55 #define EMe(a) { a, #a }
57 TRACE_EVENT(ufshcd_clk_gating,
59 TP_PROTO(const char *dev_name, int state),
61 TP_ARGS(dev_name, state),
63 TP_STRUCT__entry(
64 __string(dev_name, dev_name)
65 __field(int, state)
68 TP_fast_assign(
69 __assign_str(dev_name, dev_name);
70 __entry->state = state;
73 TP_printk("%s: gating state changed to %s",
74 __get_str(dev_name),
75 __print_symbolic(__entry->state, UFSCHD_CLK_GATING_STATES))
78 TRACE_EVENT(ufshcd_clk_scaling,
80 TP_PROTO(const char *dev_name, const char *state, const char *clk,
81 u32 prev_state, u32 curr_state),
83 TP_ARGS(dev_name, state, clk, prev_state, curr_state),
85 TP_STRUCT__entry(
86 __string(dev_name, dev_name)
87 __string(state, state)
88 __string(clk, clk)
89 __field(u32, prev_state)
90 __field(u32, curr_state)
93 TP_fast_assign(
94 __assign_str(dev_name, dev_name);
95 __assign_str(state, state);
96 __assign_str(clk, clk);
97 __entry->prev_state = prev_state;
98 __entry->curr_state = curr_state;
101 TP_printk("%s: %s %s from %u to %u Hz",
102 __get_str(dev_name), __get_str(state), __get_str(clk),
103 __entry->prev_state, __entry->curr_state)
106 TRACE_EVENT(ufshcd_auto_bkops_state,
108 TP_PROTO(const char *dev_name, const char *state),
110 TP_ARGS(dev_name, state),
112 TP_STRUCT__entry(
113 __string(dev_name, dev_name)
114 __string(state, state)
117 TP_fast_assign(
118 __assign_str(dev_name, dev_name);
119 __assign_str(state, state);
122 TP_printk("%s: auto bkops - %s",
123 __get_str(dev_name), __get_str(state))
126 DECLARE_EVENT_CLASS(ufshcd_profiling_template,
127 TP_PROTO(const char *dev_name, const char *profile_info, s64 time_us,
128 int err),
130 TP_ARGS(dev_name, profile_info, time_us, err),
132 TP_STRUCT__entry(
133 __string(dev_name, dev_name)
134 __string(profile_info, profile_info)
135 __field(s64, time_us)
136 __field(int, err)
139 TP_fast_assign(
140 __assign_str(dev_name, dev_name);
141 __assign_str(profile_info, profile_info);
142 __entry->time_us = time_us;
143 __entry->err = err;
146 TP_printk("%s: %s: took %lld usecs, err %d",
147 __get_str(dev_name), __get_str(profile_info),
148 __entry->time_us, __entry->err)
151 DEFINE_EVENT(ufshcd_profiling_template, ufshcd_profile_hibern8,
152 TP_PROTO(const char *dev_name, const char *profile_info, s64 time_us,
153 int err),
154 TP_ARGS(dev_name, profile_info, time_us, err));
156 DEFINE_EVENT(ufshcd_profiling_template, ufshcd_profile_clk_gating,
157 TP_PROTO(const char *dev_name, const char *profile_info, s64 time_us,
158 int err),
159 TP_ARGS(dev_name, profile_info, time_us, err));
161 DEFINE_EVENT(ufshcd_profiling_template, ufshcd_profile_clk_scaling,
162 TP_PROTO(const char *dev_name, const char *profile_info, s64 time_us,
163 int err),
164 TP_ARGS(dev_name, profile_info, time_us, err));
166 DECLARE_EVENT_CLASS(ufshcd_template,
167 TP_PROTO(const char *dev_name, int err, s64 usecs,
168 int dev_state, int link_state),
170 TP_ARGS(dev_name, err, usecs, dev_state, link_state),
172 TP_STRUCT__entry(
173 __field(s64, usecs)
174 __field(int, err)
175 __string(dev_name, dev_name)
176 __field(int, dev_state)
177 __field(int, link_state)
180 TP_fast_assign(
181 __entry->usecs = usecs;
182 __entry->err = err;
183 __assign_str(dev_name, dev_name);
184 __entry->dev_state = dev_state;
185 __entry->link_state = link_state;
188 TP_printk(
189 "%s: took %lld usecs, dev_state: %s, link_state: %s, err %d",
190 __get_str(dev_name),
191 __entry->usecs,
192 __print_symbolic(__entry->dev_state, UFS_PWR_MODES),
193 __print_symbolic(__entry->link_state, UFS_LINK_STATES),
194 __entry->err
198 DEFINE_EVENT(ufshcd_template, ufshcd_system_suspend,
199 TP_PROTO(const char *dev_name, int err, s64 usecs,
200 int dev_state, int link_state),
201 TP_ARGS(dev_name, err, usecs, dev_state, link_state));
203 DEFINE_EVENT(ufshcd_template, ufshcd_system_resume,
204 TP_PROTO(const char *dev_name, int err, s64 usecs,
205 int dev_state, int link_state),
206 TP_ARGS(dev_name, err, usecs, dev_state, link_state));
208 DEFINE_EVENT(ufshcd_template, ufshcd_runtime_suspend,
209 TP_PROTO(const char *dev_name, int err, s64 usecs,
210 int dev_state, int link_state),
211 TP_ARGS(dev_name, err, usecs, dev_state, link_state));
213 DEFINE_EVENT(ufshcd_template, ufshcd_runtime_resume,
214 TP_PROTO(const char *dev_name, int err, s64 usecs,
215 int dev_state, int link_state),
216 TP_ARGS(dev_name, err, usecs, dev_state, link_state));
218 DEFINE_EVENT(ufshcd_template, ufshcd_init,
219 TP_PROTO(const char *dev_name, int err, s64 usecs,
220 int dev_state, int link_state),
221 TP_ARGS(dev_name, err, usecs, dev_state, link_state));
223 TRACE_EVENT(ufshcd_command,
224 TP_PROTO(const char *dev_name, const char *str, unsigned int tag,
225 u32 doorbell, int transfer_len, u32 intr, u64 lba,
226 u8 opcode),
228 TP_ARGS(dev_name, str, tag, doorbell, transfer_len, intr, lba, opcode),
230 TP_STRUCT__entry(
231 __string(dev_name, dev_name)
232 __string(str, str)
233 __field(unsigned int, tag)
234 __field(u32, doorbell)
235 __field(int, transfer_len)
236 __field(u32, intr)
237 __field(u64, lba)
238 __field(u8, opcode)
241 TP_fast_assign(
242 __assign_str(dev_name, dev_name);
243 __assign_str(str, str);
244 __entry->tag = tag;
245 __entry->doorbell = doorbell;
246 __entry->transfer_len = transfer_len;
247 __entry->intr = intr;
248 __entry->lba = lba;
249 __entry->opcode = opcode;
252 TP_printk(
253 "%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x",
254 __get_str(str), __get_str(dev_name), __entry->tag,
255 __entry->doorbell, __entry->transfer_len,
256 __entry->intr, __entry->lba, (u32)__entry->opcode
260 #endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */
262 /* This part must be outside protection */
263 #include <trace/define_trace.h>