xref: /openbmc/linux/include/trace/events/fsi.h (revision 479965a2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #undef TRACE_SYSTEM
4 #define TRACE_SYSTEM fsi
5 
6 #if !defined(_TRACE_FSI_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_FSI_H
8 
9 #include <linux/tracepoint.h>
10 
11 TRACE_EVENT(fsi_master_read,
12 	TP_PROTO(const struct fsi_master *master, int link, int id,
13 			uint32_t addr, size_t size),
14 	TP_ARGS(master, link, id, addr, size),
15 	TP_STRUCT__entry(
16 		__field(int,	master_idx)
17 		__field(int,	link)
18 		__field(int,	id)
19 		__field(__u32,	addr)
20 		__field(size_t,	size)
21 	),
22 	TP_fast_assign(
23 		__entry->master_idx = master->idx;
24 		__entry->link = link;
25 		__entry->id = id;
26 		__entry->addr = addr;
27 		__entry->size = size;
28 	),
29 	TP_printk("fsi%d:%02d:%02d %08x[%zu]",
30 		__entry->master_idx,
31 		__entry->link,
32 		__entry->id,
33 		__entry->addr,
34 		__entry->size
35 	)
36 );
37 
38 TRACE_EVENT(fsi_master_write,
39 	TP_PROTO(const struct fsi_master *master, int link, int id,
40 			uint32_t addr, size_t size, const void *data),
41 	TP_ARGS(master, link, id, addr, size, data),
42 	TP_STRUCT__entry(
43 		__field(int,	master_idx)
44 		__field(int,	link)
45 		__field(int,	id)
46 		__field(__u32,	addr)
47 		__field(size_t,	size)
48 		__field(__u32,	data)
49 	),
50 	TP_fast_assign(
51 		__entry->master_idx = master->idx;
52 		__entry->link = link;
53 		__entry->id = id;
54 		__entry->addr = addr;
55 		__entry->size = size;
56 		__entry->data = 0;
57 		memcpy(&__entry->data, data, size);
58 	),
59 	TP_printk("fsi%d:%02d:%02d %08x[%zu] <= {%*ph}",
60 		__entry->master_idx,
61 		__entry->link,
62 		__entry->id,
63 		__entry->addr,
64 		__entry->size,
65 		(int)__entry->size, &__entry->data
66 	)
67 );
68 
69 TRACE_EVENT(fsi_master_rw_result,
70 	TP_PROTO(const struct fsi_master *master, int link, int id,
71 			uint32_t addr, size_t size,
72 			bool write, const void *data, int ret),
73 	TP_ARGS(master, link, id, addr, size, write, data, ret),
74 	TP_STRUCT__entry(
75 		__field(int,	master_idx)
76 		__field(int,	link)
77 		__field(int,	id)
78 		__field(__u32,	addr)
79 		__field(size_t,	size)
80 		__field(bool,	write)
81 		__field(__u32,	data)
82 		__field(int,	ret)
83 	),
84 	TP_fast_assign(
85 		__entry->master_idx = master->idx;
86 		__entry->link = link;
87 		__entry->id = id;
88 		__entry->addr = addr;
89 		__entry->size = size;
90 		__entry->write = write;
91 		__entry->data = 0;
92 		__entry->ret = ret;
93 		if (__entry->write || !__entry->ret)
94 			memcpy(&__entry->data, data, size);
95 	),
96 	TP_printk("fsi%d:%02d:%02d %08x[%zu] %s {%*ph} ret %d",
97 		__entry->master_idx,
98 		__entry->link,
99 		__entry->id,
100 		__entry->addr,
101 		__entry->size,
102 		__entry->write ? "<=" : "=>",
103 		(int)__entry->size, &__entry->data,
104 		__entry->ret
105 	)
106 );
107 
108 TRACE_EVENT(fsi_master_break,
109 	TP_PROTO(const struct fsi_master *master, int link),
110 	TP_ARGS(master, link),
111 	TP_STRUCT__entry(
112 		__field(int,	master_idx)
113 		__field(int,	link)
114 	),
115 	TP_fast_assign(
116 		__entry->master_idx = master->idx;
117 		__entry->link = link;
118 	),
119 	TP_printk("fsi%d:%d",
120 		__entry->master_idx,
121 		__entry->link
122 	)
123 );
124 
125 TRACE_EVENT(fsi_master_scan,
126 	TP_PROTO(const struct fsi_master *master, bool scan),
127 	TP_ARGS(master, scan),
128 	TP_STRUCT__entry(
129 		__field(int,	master_idx)
130 		__field(int,	n_links)
131 		__field(bool,	scan)
132 	),
133 	TP_fast_assign(
134 		__entry->master_idx = master->idx;
135 		__entry->n_links = master->n_links;
136 		__entry->scan = scan;
137 	),
138 	TP_printk("fsi%d (%d links) %s", __entry->master_idx, __entry->n_links,
139 		  __entry->scan ? "scan" : "unscan")
140 );
141 
142 TRACE_EVENT(fsi_master_unregister,
143 	TP_PROTO(const struct fsi_master *master),
144 	TP_ARGS(master),
145 	TP_STRUCT__entry(
146 		__field(int,	master_idx)
147 		__field(int,	n_links)
148 	),
149 	TP_fast_assign(
150 		__entry->master_idx = master->idx;
151 		__entry->n_links = master->n_links;
152 	),
153 	TP_printk("fsi%d (%d links)", __entry->master_idx, __entry->n_links)
154 );
155 
156 TRACE_EVENT(fsi_slave_init,
157 	TP_PROTO(const struct fsi_slave *slave),
158 	TP_ARGS(slave),
159 	TP_STRUCT__entry(
160 		__field(int,	master_idx)
161 		__field(int,	master_n_links)
162 		__field(int,	idx)
163 		__field(int,	link)
164 		__field(int,	chip_id)
165 		__field(__u32,	cfam_id)
166 		__field(__u32,	size)
167 	),
168 	TP_fast_assign(
169 		__entry->master_idx = slave->master->idx;
170 		__entry->master_n_links = slave->master->n_links;
171 		__entry->idx = slave->cdev_idx;
172 		__entry->link = slave->link;
173 		__entry->chip_id = slave->chip_id;
174 		__entry->cfam_id = slave->cfam_id;
175 		__entry->size = slave->size;
176 	),
177 	TP_printk("fsi%d: idx:%d link:%d/%d cid:%d cfam:%08x %08x",
178 		__entry->master_idx,
179 		__entry->idx,
180 		__entry->link,
181 		__entry->master_n_links,
182 		__entry->chip_id,
183 		__entry->cfam_id,
184 		__entry->size
185 	)
186 );
187 
188 TRACE_EVENT(fsi_slave_invalid_cfam,
189 	TP_PROTO(const struct fsi_master *master, int link, uint32_t cfam_id),
190 	TP_ARGS(master, link, cfam_id),
191 	TP_STRUCT__entry(
192 		__field(int,	master_idx)
193 		__field(int,	master_n_links)
194 		__field(int,	link)
195 		__field(__u32,	cfam_id)
196 	),
197 	TP_fast_assign(
198 		__entry->master_idx = master->idx;
199 		__entry->master_n_links = master->n_links;
200 		__entry->link = link;
201 		__entry->cfam_id = cfam_id;
202 	),
203 	TP_printk("fsi%d: cfam:%08x link:%d/%d",
204 		__entry->master_idx,
205 		__entry->cfam_id,
206 		__entry->link,
207 		__entry->master_n_links
208 	)
209 );
210 
211 TRACE_EVENT(fsi_dev_init,
212 	TP_PROTO(const struct fsi_device *dev),
213 	TP_ARGS(dev),
214 	TP_STRUCT__entry(
215 		__field(int,	master_idx)
216 		__field(int,	link)
217 		__field(int,	type)
218 		__field(int,	unit)
219 		__field(int,	version)
220 		__field(__u32,	addr)
221 		__field(__u32,	size)
222 	),
223 	TP_fast_assign(
224 		__entry->master_idx = dev->slave->master->idx;
225 		__entry->link = dev->slave->link;
226 		__entry->type = dev->engine_type;
227 		__entry->unit = dev->unit;
228 		__entry->version = dev->version;
229 		__entry->addr = dev->addr;
230 		__entry->size = dev->size;
231 	),
232 	TP_printk("fsi%d: slv%d: t:%02x u:%02x v:%02x %08x@%08x",
233 		__entry->master_idx,
234 		__entry->link,
235 		__entry->type,
236 		__entry->unit,
237 		__entry->version,
238 		__entry->size,
239 		__entry->addr
240 	)
241 );
242 
243 #endif /* _TRACE_FSI_H */
244 
245 #include <trace/define_trace.h>
246