xref: /openbmc/linux/include/trace/events/scmi.h (revision f4356947)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM scmi
4 
5 #if !defined(_TRACE_SCMI_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_SCMI_H
7 
8 #include <linux/tracepoint.h>
9 
10 TRACE_EVENT(scmi_fc_call,
11 	TP_PROTO(u8 protocol_id, u8 msg_id, u32 res_id, u32 val1, u32 val2),
12 	TP_ARGS(protocol_id, msg_id, res_id, val1, val2),
13 
14 	TP_STRUCT__entry(
15 		__field(u8, protocol_id)
16 		__field(u8, msg_id)
17 		__field(u32, res_id)
18 		__field(u32, val1)
19 		__field(u32, val2)
20 	),
21 
22 	TP_fast_assign(
23 		__entry->protocol_id = protocol_id;
24 		__entry->msg_id = msg_id;
25 		__entry->res_id = res_id;
26 		__entry->val1 = val1;
27 		__entry->val2 = val2;
28 	),
29 
30 	TP_printk("pt=%02X msg_id=%02X res_id:%u vals=%u:%u",
31 		__entry->protocol_id, __entry->msg_id,
32 		__entry->res_id, __entry->val1, __entry->val2)
33 );
34 
35 TRACE_EVENT(scmi_xfer_begin,
36 	TP_PROTO(int transfer_id, u8 msg_id, u8 protocol_id, u16 seq,
37 		 bool poll),
38 	TP_ARGS(transfer_id, msg_id, protocol_id, seq, poll),
39 
40 	TP_STRUCT__entry(
41 		__field(int, transfer_id)
42 		__field(u8, msg_id)
43 		__field(u8, protocol_id)
44 		__field(u16, seq)
45 		__field(bool, poll)
46 	),
47 
48 	TP_fast_assign(
49 		__entry->transfer_id = transfer_id;
50 		__entry->msg_id = msg_id;
51 		__entry->protocol_id = protocol_id;
52 		__entry->seq = seq;
53 		__entry->poll = poll;
54 	),
55 
56 	TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X poll=%u",
57 		__entry->protocol_id, __entry->msg_id, __entry->seq,
58 		__entry->transfer_id, __entry->poll)
59 );
60 
61 TRACE_EVENT(scmi_xfer_response_wait,
62 	TP_PROTO(int transfer_id, u8 msg_id, u8 protocol_id, u16 seq,
63 		 u32 timeout, bool poll),
64 	TP_ARGS(transfer_id, msg_id, protocol_id, seq, timeout, poll),
65 
66 	TP_STRUCT__entry(
67 		__field(int, transfer_id)
68 		__field(u8, msg_id)
69 		__field(u8, protocol_id)
70 		__field(u16, seq)
71 		__field(u32, timeout)
72 		__field(bool, poll)
73 	),
74 
75 	TP_fast_assign(
76 		__entry->transfer_id = transfer_id;
77 		__entry->msg_id = msg_id;
78 		__entry->protocol_id = protocol_id;
79 		__entry->seq = seq;
80 		__entry->timeout = timeout;
81 		__entry->poll = poll;
82 	),
83 
84 	TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X tmo_ms=%u poll=%u",
85 		__entry->protocol_id, __entry->msg_id, __entry->seq,
86 		__entry->transfer_id, __entry->timeout, __entry->poll)
87 );
88 
89 TRACE_EVENT(scmi_xfer_end,
90 	TP_PROTO(int transfer_id, u8 msg_id, u8 protocol_id, u16 seq,
91 		 int status),
92 	TP_ARGS(transfer_id, msg_id, protocol_id, seq, status),
93 
94 	TP_STRUCT__entry(
95 		__field(int, transfer_id)
96 		__field(u8, msg_id)
97 		__field(u8, protocol_id)
98 		__field(u16, seq)
99 		__field(int, status)
100 	),
101 
102 	TP_fast_assign(
103 		__entry->transfer_id = transfer_id;
104 		__entry->msg_id = msg_id;
105 		__entry->protocol_id = protocol_id;
106 		__entry->seq = seq;
107 		__entry->status = status;
108 	),
109 
110 	TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X s=%d",
111 		__entry->protocol_id, __entry->msg_id, __entry->seq,
112 		__entry->transfer_id, __entry->status)
113 );
114 
115 TRACE_EVENT(scmi_rx_done,
116 	TP_PROTO(int transfer_id, u8 msg_id, u8 protocol_id, u16 seq,
117 		 u8 msg_type),
118 	TP_ARGS(transfer_id, msg_id, protocol_id, seq, msg_type),
119 
120 	TP_STRUCT__entry(
121 		__field(int, transfer_id)
122 		__field(u8, msg_id)
123 		__field(u8, protocol_id)
124 		__field(u16, seq)
125 		__field(u8, msg_type)
126 	),
127 
128 	TP_fast_assign(
129 		__entry->transfer_id = transfer_id;
130 		__entry->msg_id = msg_id;
131 		__entry->protocol_id = protocol_id;
132 		__entry->seq = seq;
133 		__entry->msg_type = msg_type;
134 	),
135 
136 	TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X msg_type=%u",
137 		__entry->protocol_id, __entry->msg_id, __entry->seq,
138 		__entry->transfer_id, __entry->msg_type)
139 );
140 
141 TRACE_EVENT(scmi_msg_dump,
142 	TP_PROTO(int id, u8 channel_id, u8 protocol_id, u8 msg_id,
143 		 unsigned char *tag, u16 seq, int status,
144 		 void *buf, size_t len),
145 	TP_ARGS(id, channel_id, protocol_id, msg_id, tag, seq, status,
146 		buf, len),
147 
148 	TP_STRUCT__entry(
149 		__field(int, id)
150 		__field(u8, channel_id)
151 		__field(u8, protocol_id)
152 		__field(u8, msg_id)
153 		__array(char, tag, 5)
154 		__field(u16, seq)
155 		__field(int, status)
156 		__field(size_t, len)
157 		__dynamic_array(unsigned char, cmd, len)
158 	),
159 
160 	TP_fast_assign(
161 		__entry->id = id;
162 		__entry->channel_id = channel_id;
163 		__entry->protocol_id = protocol_id;
164 		__entry->msg_id = msg_id;
165 		strscpy(__entry->tag, tag, 5);
166 		__entry->seq = seq;
167 		__entry->status = status;
168 		__entry->len = len;
169 		memcpy(__get_dynamic_array(cmd), buf, __entry->len);
170 	),
171 
172 	TP_printk("id=%d ch=%02X pt=%02X t=%s msg_id=%02X seq=%04X s=%d pyld=%s",
173 		  __entry->id, __entry->channel_id, __entry->protocol_id,
174 		  __entry->tag, __entry->msg_id, __entry->seq, __entry->status,
175 		__print_hex_str(__get_dynamic_array(cmd), __entry->len))
176 );
177 #endif /* _TRACE_SCMI_H */
178 
179 /* This part must be outside protection */
180 #include <trace/define_trace.h>
181