xref: /openbmc/linux/include/trace/events/scmi.h (revision 53f9cd5c)
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("[0x%02X]:[0x%02X]:[%08X]:%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("transfer_id=%d msg_id=%u protocol_id=%u seq=%u poll=%u",
57 		__entry->transfer_id, __entry->msg_id, __entry->protocol_id,
58 		__entry->seq, __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("transfer_id=%d msg_id=%u protocol_id=%u seq=%u tmo_ms=%u poll=%u",
85 		__entry->transfer_id, __entry->msg_id, __entry->protocol_id,
86 		__entry->seq, __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("transfer_id=%d msg_id=%u protocol_id=%u seq=%u status=%d",
111 		__entry->transfer_id, __entry->msg_id, __entry->protocol_id,
112 		__entry->seq, __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("transfer_id=%d msg_id=%u protocol_id=%u seq=%u msg_type=%u",
137 		__entry->transfer_id, __entry->msg_id, __entry->protocol_id,
138 		__entry->seq, __entry->msg_type)
139 );
140 
141 TRACE_EVENT(scmi_msg_dump,
142 	TP_PROTO(u8 protocol_id, u8 msg_id, unsigned char *tag, u16 seq,
143 		 int status, void *buf, size_t len),
144 	TP_ARGS(protocol_id, msg_id, tag, seq, status, buf, len),
145 
146 	TP_STRUCT__entry(
147 		__field(u8, protocol_id)
148 		__field(u8, msg_id)
149 		__array(char, tag, 5)
150 		__field(u16, seq)
151 		__field(int, status)
152 		__field(size_t, len)
153 		__dynamic_array(unsigned char, cmd, len)
154 	),
155 
156 	TP_fast_assign(
157 		__entry->protocol_id = protocol_id;
158 		__entry->msg_id = msg_id;
159 		strscpy(__entry->tag, tag, 5);
160 		__entry->seq = seq;
161 		__entry->status = status;
162 		__entry->len = len;
163 		memcpy(__get_dynamic_array(cmd), buf, __entry->len);
164 	),
165 
166 	TP_printk("pt=%02X t=%s msg_id=%02X seq=%04X s=%d pyld=%s",
167 		  __entry->protocol_id, __entry->tag, __entry->msg_id,
168 		  __entry->seq, __entry->status,
169 		__print_hex_str(__get_dynamic_array(cmd), __entry->len))
170 );
171 #endif /* _TRACE_SCMI_H */
172 
173 /* This part must be outside protection */
174 #include <trace/define_trace.h>
175