xref: /openbmc/linux/tools/perf/util/perf_regs.h (revision ca138a7a)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_REGS_H
3 #define __PERF_REGS_H
4 
5 #include <linux/types.h>
6 #include <linux/compiler.h>
7 
8 struct regs_dump;
9 
10 struct sample_reg {
11 	const char *name;
12 	uint64_t mask;
13 };
14 #define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
15 #define SMPL_REG2(n, b) { .name = #n, .mask = 3ULL << (b) }
16 #define SMPL_REG_END { .name = NULL }
17 
18 extern const struct sample_reg sample_reg_masks[];
19 
20 enum {
21 	SDT_ARG_VALID = 0,
22 	SDT_ARG_SKIP,
23 };
24 
25 int arch_sdt_arg_parse_op(char *old_op, char **new_op);
26 
27 #ifdef HAVE_PERF_REGS_SUPPORT
28 #include <perf_regs.h>
29 
30 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
31 
32 #else
33 #define PERF_REGS_MASK	0
34 #define PERF_REGS_MAX	0
35 
36 static inline const char *perf_reg_name(int id __maybe_unused)
37 {
38 	return NULL;
39 }
40 
41 static inline int perf_reg_value(u64 *valp __maybe_unused,
42 				 struct regs_dump *regs __maybe_unused,
43 				 int id __maybe_unused)
44 {
45 	return 0;
46 }
47 #endif /* HAVE_PERF_REGS_SUPPORT */
48 #endif /* __PERF_REGS_H */
49