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