1 // SPDX-License-Identifier: GPL-2.0
2 
3 #ifdef HAVE_PERF_REGS_SUPPORT
4 
5 #include "../perf_regs.h"
6 #include "../../arch/csky/include/uapi/asm/perf_regs.h"
7 
8 const char *__perf_reg_name_csky(int id)
9 {
10 	switch (id) {
11 	case PERF_REG_CSKY_A0:
12 		return "a0";
13 	case PERF_REG_CSKY_A1:
14 		return "a1";
15 	case PERF_REG_CSKY_A2:
16 		return "a2";
17 	case PERF_REG_CSKY_A3:
18 		return "a3";
19 	case PERF_REG_CSKY_REGS0:
20 		return "regs0";
21 	case PERF_REG_CSKY_REGS1:
22 		return "regs1";
23 	case PERF_REG_CSKY_REGS2:
24 		return "regs2";
25 	case PERF_REG_CSKY_REGS3:
26 		return "regs3";
27 	case PERF_REG_CSKY_REGS4:
28 		return "regs4";
29 	case PERF_REG_CSKY_REGS5:
30 		return "regs5";
31 	case PERF_REG_CSKY_REGS6:
32 		return "regs6";
33 	case PERF_REG_CSKY_REGS7:
34 		return "regs7";
35 	case PERF_REG_CSKY_REGS8:
36 		return "regs8";
37 	case PERF_REG_CSKY_REGS9:
38 		return "regs9";
39 	case PERF_REG_CSKY_SP:
40 		return "sp";
41 	case PERF_REG_CSKY_LR:
42 		return "lr";
43 	case PERF_REG_CSKY_PC:
44 		return "pc";
45 #if defined(__CSKYABIV2__)
46 	case PERF_REG_CSKY_EXREGS0:
47 		return "exregs0";
48 	case PERF_REG_CSKY_EXREGS1:
49 		return "exregs1";
50 	case PERF_REG_CSKY_EXREGS2:
51 		return "exregs2";
52 	case PERF_REG_CSKY_EXREGS3:
53 		return "exregs3";
54 	case PERF_REG_CSKY_EXREGS4:
55 		return "exregs4";
56 	case PERF_REG_CSKY_EXREGS5:
57 		return "exregs5";
58 	case PERF_REG_CSKY_EXREGS6:
59 		return "exregs6";
60 	case PERF_REG_CSKY_EXREGS7:
61 		return "exregs7";
62 	case PERF_REG_CSKY_EXREGS8:
63 		return "exregs8";
64 	case PERF_REG_CSKY_EXREGS9:
65 		return "exregs9";
66 	case PERF_REG_CSKY_EXREGS10:
67 		return "exregs10";
68 	case PERF_REG_CSKY_EXREGS11:
69 		return "exregs11";
70 	case PERF_REG_CSKY_EXREGS12:
71 		return "exregs12";
72 	case PERF_REG_CSKY_EXREGS13:
73 		return "exregs13";
74 	case PERF_REG_CSKY_EXREGS14:
75 		return "exregs14";
76 	case PERF_REG_CSKY_TLS:
77 		return "tls";
78 	case PERF_REG_CSKY_HI:
79 		return "hi";
80 	case PERF_REG_CSKY_LO:
81 		return "lo";
82 #endif
83 	default:
84 		return NULL;
85 	}
86 
87 	return NULL;
88 }
89 
90 uint64_t __perf_reg_ip_csky(void)
91 {
92 	return PERF_REG_CSKY_PC;
93 }
94 
95 uint64_t __perf_reg_sp_csky(void)
96 {
97 	return PERF_REG_CSKY_SP;
98 }
99 
100 #endif
101