1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Trace events for the ChromeOS Embedded Controller
5 * Copyright 2019 Google LLC.
9 #define TRACE_SYSTEM cros_ec
11 #if !defined(_CROS_EC_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
12 #define _CROS_EC_TRACE_H_
14 #include <linux/bits.h>
15 #include <linux/types.h>
16 #include <linux/platform_data/cros_ec_commands.h>
17 #include <linux/platform_data/cros_ec_proto.h>
19 #include <linux/tracepoint.h>
21 TRACE_EVENT(cros_ec_request_start
,
22 TP_PROTO(struct cros_ec_command
*cmd
),
25 __field(uint32_t, version
)
26 __field(uint32_t, offset
)
27 __field(uint32_t, command
)
28 __field(uint32_t, outsize
)
29 __field(uint32_t, insize
)
32 __entry
->version
= cmd
->version
;
33 __entry
->offset
= cmd
->command
/ EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX
);
34 __entry
->command
= cmd
->command
% EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX
);
35 __entry
->outsize
= cmd
->outsize
;
36 __entry
->insize
= cmd
->insize
;
38 TP_printk("version: %u, offset: %d, command: %s, outsize: %u, insize: %u",
39 __entry
->version
, __entry
->offset
,
40 __print_symbolic(__entry
->command
, EC_CMDS
),
41 __entry
->outsize
, __entry
->insize
)
44 TRACE_EVENT(cros_ec_request_done
,
45 TP_PROTO(struct cros_ec_command
*cmd
, int retval
),
48 __field(uint32_t, version
)
49 __field(uint32_t, offset
)
50 __field(uint32_t, command
)
51 __field(uint32_t, outsize
)
52 __field(uint32_t, insize
)
53 __field(uint32_t, result
)
57 __entry
->version
= cmd
->version
;
58 __entry
->offset
= cmd
->command
/ EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX
);
59 __entry
->command
= cmd
->command
% EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX
);
60 __entry
->outsize
= cmd
->outsize
;
61 __entry
->insize
= cmd
->insize
;
62 __entry
->result
= cmd
->result
;
63 __entry
->retval
= retval
;
65 TP_printk("version: %u, offset: %d, command: %s, outsize: %u, insize: %u, ec result: %s, retval: %u",
66 __entry
->version
, __entry
->offset
,
67 __print_symbolic(__entry
->command
, EC_CMDS
),
68 __entry
->outsize
, __entry
->insize
,
69 __print_symbolic(__entry
->result
, EC_RESULT
),
73 #endif /* _CROS_EC_TRACE_H_ */
75 /* this part must be outside header guard */
77 #undef TRACE_INCLUDE_PATH
78 #define TRACE_INCLUDE_PATH .
80 #undef TRACE_INCLUDE_FILE
81 #define TRACE_INCLUDE_FILE cros_ec_trace
83 #include <trace/define_trace.h>