xref: /openbmc/linux/include/trace/events/spmi.h (revision 9b9c2cd4)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM spmi
3 
4 #if !defined(_TRACE_SPMI_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_SPMI_H
6 
7 #include <linux/spmi.h>
8 #include <linux/tracepoint.h>
9 
10 /*
11  * drivers/spmi/spmi.c
12  */
13 
14 TRACE_EVENT(spmi_write_begin,
15 	TP_PROTO(u8 opcode, u8 sid, u16 addr, u8 len, const u8 *buf),
16 	TP_ARGS(opcode, sid, addr, len, buf),
17 
18 	TP_STRUCT__entry(
19 		__field		( u8,         opcode    )
20 		__field		( u8,         sid       )
21 		__field		( u16,        addr      )
22 		__field		( u8,         len       )
23 		__dynamic_array	( u8,   buf,  len + 1   )
24 	),
25 
26 	TP_fast_assign(
27 		__entry->opcode = opcode;
28 		__entry->sid    = sid;
29 		__entry->addr   = addr;
30 		__entry->len    = len + 1;
31 		memcpy(__get_dynamic_array(buf), buf, len + 1);
32 	),
33 
34 	TP_printk("opc=%d sid=%02d addr=0x%04x len=%d buf=0x[%*phD]",
35 		  (int)__entry->opcode, (int)__entry->sid,
36 		  (int)__entry->addr, (int)__entry->len,
37 		  (int)__entry->len, __get_dynamic_array(buf))
38 );
39 
40 TRACE_EVENT(spmi_write_end,
41 	TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret),
42 	TP_ARGS(opcode, sid, addr, ret),
43 
44 	TP_STRUCT__entry(
45 		__field		( u8,         opcode    )
46 		__field		( u8,         sid       )
47 		__field		( u16,        addr      )
48 		__field		( int,        ret       )
49 	),
50 
51 	TP_fast_assign(
52 		__entry->opcode = opcode;
53 		__entry->sid    = sid;
54 		__entry->addr   = addr;
55 		__entry->ret    = ret;
56 	),
57 
58 	TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d",
59 		  (int)__entry->opcode, (int)__entry->sid,
60 		  (int)__entry->addr, __entry->ret)
61 );
62 
63 TRACE_EVENT(spmi_read_begin,
64 	TP_PROTO(u8 opcode, u8 sid, u16 addr),
65 	TP_ARGS(opcode, sid, addr),
66 
67 	TP_STRUCT__entry(
68 		__field		( u8,         opcode    )
69 		__field		( u8,         sid       )
70 		__field		( u16,        addr      )
71 	),
72 
73 	TP_fast_assign(
74 		__entry->opcode = opcode;
75 		__entry->sid    = sid;
76 		__entry->addr   = addr;
77 	),
78 
79 	TP_printk("opc=%d sid=%02d addr=0x%04x",
80 		  (int)__entry->opcode, (int)__entry->sid,
81 		  (int)__entry->addr)
82 );
83 
84 TRACE_EVENT(spmi_read_end,
85 	TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret, u8 len, const u8 *buf),
86 	TP_ARGS(opcode, sid, addr, ret, len, buf),
87 
88 	TP_STRUCT__entry(
89 		__field		( u8,         opcode    )
90 		__field		( u8,         sid       )
91 		__field		( u16,        addr      )
92 		__field		( int,        ret       )
93 		__field		( u8,         len       )
94 		__dynamic_array	( u8,   buf,  len + 1   )
95 	),
96 
97 	TP_fast_assign(
98 		__entry->opcode = opcode;
99 		__entry->sid    = sid;
100 		__entry->addr   = addr;
101 		__entry->ret    = ret;
102 		__entry->len    = len + 1;
103 		memcpy(__get_dynamic_array(buf), buf, len + 1);
104 	),
105 
106 	TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d len=%02d buf=0x[%*phD]",
107 		  (int)__entry->opcode, (int)__entry->sid,
108 		  (int)__entry->addr, __entry->ret, (int)__entry->len,
109 		  (int)__entry->len, __get_dynamic_array(buf))
110 );
111 
112 TRACE_EVENT(spmi_cmd,
113 	TP_PROTO(u8 opcode, u8 sid, int ret),
114 	TP_ARGS(opcode, sid, ret),
115 
116 	TP_STRUCT__entry(
117 		__field		( u8,         opcode    )
118 		__field		( u8,         sid       )
119 		__field		( int,        ret       )
120 	),
121 
122 	TP_fast_assign(
123 		__entry->opcode = opcode;
124 		__entry->sid    = sid;
125 		__entry->ret    = ret;
126 	),
127 
128 	TP_printk("opc=%d sid=%02d ret=%d", (int)__entry->opcode,
129 		  (int)__entry->sid, ret)
130 );
131 
132 #endif /* _TRACE_SPMI_H */
133 
134 /* This part must be outside protection */
135 #include <trace/define_trace.h>
136