xref: /openbmc/linux/include/trace/events/fsi.h (revision 7671f967)
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_slave_init,
126 	TP_PROTO(const struct fsi_slave *slave),
127 	TP_ARGS(slave),
128 	TP_STRUCT__entry(
129 		__field(int,	master_idx)
130 		__field(int,	master_n_links)
131 		__field(int,	idx)
132 		__field(int,	link)
133 		__field(int,	chip_id)
134 		__field(__u32,	cfam_id)
135 		__field(__u32,	size)
136 	),
137 	TP_fast_assign(
138 		__entry->master_idx = slave->master->idx;
139 		__entry->master_n_links = slave->master->n_links;
140 		__entry->idx = slave->cdev_idx;
141 		__entry->link = slave->link;
142 		__entry->chip_id = slave->chip_id;
143 		__entry->cfam_id = slave->cfam_id;
144 		__entry->size = slave->size;
145 	),
146 	TP_printk("fsi%d: idx:%d link:%d/%d cid:%d cfam:%08x %08x",
147 		__entry->master_idx,
148 		__entry->idx,
149 		__entry->link,
150 		__entry->master_n_links,
151 		__entry->chip_id,
152 		__entry->cfam_id,
153 		__entry->size
154 	)
155 );
156 
157 TRACE_EVENT(fsi_slave_invalid_cfam,
158 	TP_PROTO(const struct fsi_master *master, int link, uint32_t cfam_id),
159 	TP_ARGS(master, link, cfam_id),
160 	TP_STRUCT__entry(
161 		__field(int,	master_idx)
162 		__field(int,	master_n_links)
163 		__field(int,	link)
164 		__field(__u32,	cfam_id)
165 	),
166 	TP_fast_assign(
167 		__entry->master_idx = master->idx;
168 		__entry->master_n_links = master->n_links;
169 		__entry->link = link;
170 		__entry->cfam_id = cfam_id;
171 	),
172 	TP_printk("fsi%d: cfam:%08x link:%d/%d",
173 		__entry->master_idx,
174 		__entry->cfam_id,
175 		__entry->link,
176 		__entry->master_n_links
177 	)
178 );
179 
180 TRACE_EVENT(fsi_dev_init,
181 	TP_PROTO(const struct fsi_device *dev),
182 	TP_ARGS(dev),
183 	TP_STRUCT__entry(
184 		__field(int,	master_idx)
185 		__field(int,	link)
186 		__field(int,	type)
187 		__field(int,	unit)
188 		__field(int,	version)
189 		__field(__u32,	addr)
190 		__field(__u32,	size)
191 	),
192 	TP_fast_assign(
193 		__entry->master_idx = dev->slave->master->idx;
194 		__entry->link = dev->slave->link;
195 		__entry->type = dev->engine_type;
196 		__entry->unit = dev->unit;
197 		__entry->version = dev->version;
198 		__entry->addr = dev->addr;
199 		__entry->size = dev->size;
200 	),
201 	TP_printk("fsi%d: slv%d: t:%02x u:%02x v:%02x %08x@%08x",
202 		__entry->master_idx,
203 		__entry->link,
204 		__entry->type,
205 		__entry->unit,
206 		__entry->version,
207 		__entry->size,
208 		__entry->addr
209 	)
210 );
211 
212 #endif /* _TRACE_FSI_H */
213 
214 #include <trace/define_trace.h>
215