xref: /linux/tools/perf/util/perf-regs-arch/perf_regs_powerpc.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include "../perf_regs.h"
4 #include "../../../arch/powerpc/include/uapi/asm/perf_regs.h"
5 
6 const char *__perf_reg_name_powerpc(int id)
7 {
8 	switch (id) {
9 	case PERF_REG_POWERPC_R0:
10 		return "r0";
11 	case PERF_REG_POWERPC_R1:
12 		return "r1";
13 	case PERF_REG_POWERPC_R2:
14 		return "r2";
15 	case PERF_REG_POWERPC_R3:
16 		return "r3";
17 	case PERF_REG_POWERPC_R4:
18 		return "r4";
19 	case PERF_REG_POWERPC_R5:
20 		return "r5";
21 	case PERF_REG_POWERPC_R6:
22 		return "r6";
23 	case PERF_REG_POWERPC_R7:
24 		return "r7";
25 	case PERF_REG_POWERPC_R8:
26 		return "r8";
27 	case PERF_REG_POWERPC_R9:
28 		return "r9";
29 	case PERF_REG_POWERPC_R10:
30 		return "r10";
31 	case PERF_REG_POWERPC_R11:
32 		return "r11";
33 	case PERF_REG_POWERPC_R12:
34 		return "r12";
35 	case PERF_REG_POWERPC_R13:
36 		return "r13";
37 	case PERF_REG_POWERPC_R14:
38 		return "r14";
39 	case PERF_REG_POWERPC_R15:
40 		return "r15";
41 	case PERF_REG_POWERPC_R16:
42 		return "r16";
43 	case PERF_REG_POWERPC_R17:
44 		return "r17";
45 	case PERF_REG_POWERPC_R18:
46 		return "r18";
47 	case PERF_REG_POWERPC_R19:
48 		return "r19";
49 	case PERF_REG_POWERPC_R20:
50 		return "r20";
51 	case PERF_REG_POWERPC_R21:
52 		return "r21";
53 	case PERF_REG_POWERPC_R22:
54 		return "r22";
55 	case PERF_REG_POWERPC_R23:
56 		return "r23";
57 	case PERF_REG_POWERPC_R24:
58 		return "r24";
59 	case PERF_REG_POWERPC_R25:
60 		return "r25";
61 	case PERF_REG_POWERPC_R26:
62 		return "r26";
63 	case PERF_REG_POWERPC_R27:
64 		return "r27";
65 	case PERF_REG_POWERPC_R28:
66 		return "r28";
67 	case PERF_REG_POWERPC_R29:
68 		return "r29";
69 	case PERF_REG_POWERPC_R30:
70 		return "r30";
71 	case PERF_REG_POWERPC_R31:
72 		return "r31";
73 	case PERF_REG_POWERPC_NIP:
74 		return "nip";
75 	case PERF_REG_POWERPC_MSR:
76 		return "msr";
77 	case PERF_REG_POWERPC_ORIG_R3:
78 		return "orig_r3";
79 	case PERF_REG_POWERPC_CTR:
80 		return "ctr";
81 	case PERF_REG_POWERPC_LINK:
82 		return "link";
83 	case PERF_REG_POWERPC_XER:
84 		return "xer";
85 	case PERF_REG_POWERPC_CCR:
86 		return "ccr";
87 	case PERF_REG_POWERPC_SOFTE:
88 		return "softe";
89 	case PERF_REG_POWERPC_TRAP:
90 		return "trap";
91 	case PERF_REG_POWERPC_DAR:
92 		return "dar";
93 	case PERF_REG_POWERPC_DSISR:
94 		return "dsisr";
95 	case PERF_REG_POWERPC_SIER:
96 		return "sier";
97 	case PERF_REG_POWERPC_MMCRA:
98 		return "mmcra";
99 	case PERF_REG_POWERPC_MMCR0:
100 		return "mmcr0";
101 	case PERF_REG_POWERPC_MMCR1:
102 		return "mmcr1";
103 	case PERF_REG_POWERPC_MMCR2:
104 		return "mmcr2";
105 	case PERF_REG_POWERPC_MMCR3:
106 		return "mmcr3";
107 	case PERF_REG_POWERPC_SIER2:
108 		return "sier2";
109 	case PERF_REG_POWERPC_SIER3:
110 		return "sier3";
111 	case PERF_REG_POWERPC_PMC1:
112 		return "pmc1";
113 	case PERF_REG_POWERPC_PMC2:
114 		return "pmc2";
115 	case PERF_REG_POWERPC_PMC3:
116 		return "pmc3";
117 	case PERF_REG_POWERPC_PMC4:
118 		return "pmc4";
119 	case PERF_REG_POWERPC_PMC5:
120 		return "pmc5";
121 	case PERF_REG_POWERPC_PMC6:
122 		return "pmc6";
123 	case PERF_REG_POWERPC_SDAR:
124 		return "sdar";
125 	case PERF_REG_POWERPC_SIAR:
126 		return "siar";
127 	default:
128 		break;
129 	}
130 	return NULL;
131 }
132 
133 uint64_t __perf_reg_ip_powerpc(void)
134 {
135 	return PERF_REG_POWERPC_NIP;
136 }
137 
138 uint64_t __perf_reg_sp_powerpc(void)
139 {
140 	return PERF_REG_POWERPC_R1;
141 }
142