Commit | Line | Data |
---|---|---|
9f36eaed | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2ca39464 SM |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM i2c | |
4 | ||
5 | #if !defined(LTTNG_TRACE_I2C_H) || defined(TRACE_HEADER_MULTI_READ) | |
6 | #define LTTNG_TRACE_I2C_H | |
7 | ||
8 | #include <probes/lttng-tracepoint-event.h> | |
9 | ||
10 | /* | |
11 | * __i2c_transfer() write request | |
12 | */ | |
13 | LTTNG_TRACEPOINT_EVENT_CODE(i2c_write, | |
14 | ||
15 | TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg, | |
16 | int num), | |
17 | ||
18 | TP_ARGS(adap, msg, num), | |
19 | ||
20 | TP_locvar( | |
21 | int extract_sensitive_payload; | |
22 | ), | |
23 | ||
24 | TP_code_pre( | |
25 | tp_locvar->extract_sensitive_payload = | |
57ccbfa6 | 26 | LTTNG_READ_ONCE(extract_sensitive_payload); |
2ca39464 SM |
27 | ), |
28 | ||
29 | TP_FIELDS( | |
30 | ctf_integer(int, adapter_nr, adap->nr) | |
31 | ctf_integer(__u16, msg_nr, num) | |
32 | ctf_integer(__u16, addr, msg->addr) | |
33 | ctf_integer(__u16, flags, msg->flags) | |
34 | ctf_integer(__u16, len, msg->len) | |
35 | ctf_sequence_hex(__u8, buf, | |
36 | tp_locvar->extract_sensitive_payload ? | |
37 | msg->buf : NULL, | |
38 | __u16, | |
39 | tp_locvar->extract_sensitive_payload ? | |
40 | msg->len : 0) | |
41 | ), | |
42 | ||
43 | TP_code_post() | |
44 | ) | |
45 | ||
46 | /* | |
47 | * __i2c_transfer() read request | |
48 | */ | |
49 | LTTNG_TRACEPOINT_EVENT(i2c_read, | |
50 | ||
51 | TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg, | |
52 | int num), | |
53 | ||
54 | TP_ARGS(adap, msg, num), | |
55 | ||
56 | TP_FIELDS( | |
57 | ctf_integer(int, adapter_nr, adap->nr) | |
58 | ctf_integer(__u16, msg_nr, num) | |
59 | ctf_integer(__u16, addr, msg->addr) | |
60 | ctf_integer(__u16, flags, msg->flags) | |
61 | ctf_integer(__u16, len, msg->len) | |
62 | ) | |
63 | ) | |
64 | ||
65 | /* | |
66 | * __i2c_transfer() read reply | |
67 | */ | |
68 | LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply, | |
69 | ||
70 | TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg, | |
71 | int num), | |
72 | ||
73 | TP_ARGS(adap, msg, num), | |
74 | ||
75 | TP_locvar( | |
76 | int extract_sensitive_payload; | |
77 | ), | |
78 | ||
79 | TP_code_pre( | |
80 | tp_locvar->extract_sensitive_payload = | |
57ccbfa6 | 81 | LTTNG_READ_ONCE(extract_sensitive_payload); |
2ca39464 SM |
82 | ), |
83 | ||
84 | TP_FIELDS( | |
85 | ctf_integer(int, adapter_nr, adap->nr) | |
86 | ctf_integer(__u16, msg_nr, num) | |
87 | ctf_integer(__u16, addr, msg->addr) | |
88 | ctf_integer(__u16, flags, msg->flags) | |
89 | ctf_integer(__u16, len, msg->len) | |
90 | ctf_sequence_hex(__u8, buf, | |
91 | tp_locvar->extract_sensitive_payload ? | |
92 | msg->buf : NULL, | |
93 | __u16, | |
94 | tp_locvar->extract_sensitive_payload ? | |
95 | msg->len : 0) | |
96 | ), | |
97 | ||
98 | TP_code_post() | |
99 | ) | |
100 | ||
101 | /* | |
102 | * __i2c_transfer() result | |
103 | */ | |
104 | LTTNG_TRACEPOINT_EVENT(i2c_result, | |
105 | ||
106 | TP_PROTO(const struct i2c_adapter *adap, int num, int ret), | |
107 | ||
108 | TP_ARGS(adap, num, ret), | |
109 | ||
110 | TP_FIELDS( | |
111 | ctf_integer(int, adapter_nr, adap->nr) | |
112 | ctf_integer(__u16, nr_msgs, num) | |
113 | ctf_integer(__s16, ret, ret) | |
114 | ) | |
115 | ) | |
116 | ||
117 | #endif /* LTTNG_TRACE_I2C_H */ | |
118 | ||
119 | /* This part must be outside protection */ | |
120 | #include <probes/define_trace.h> |