xref: /openbmc/u-boot/arch/riscv/include/asm/encoding.h (revision 39671564)
183d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
26020faf6SRick Chen /*
36020faf6SRick Chen  * Copyright (c) 2017 Microsemi Corporation.
46020faf6SRick Chen  * Padmarao Begari, Microsemi Corporation <padmarao.begari@microsemi.com>
56020faf6SRick Chen  */
66020faf6SRick Chen 
76020faf6SRick Chen #ifndef RISCV_CSR_ENCODING_H
86020faf6SRick Chen #define RISCV_CSR_ENCODING_H
96020faf6SRick Chen 
10d2db2a8fSAnup Patel #ifdef CONFIG_RISCV_SMODE
11d2db2a8fSAnup Patel #define MODE_PREFIX(__suffix)	s##__suffix
12d2db2a8fSAnup Patel #else
13d2db2a8fSAnup Patel #define MODE_PREFIX(__suffix)	m##__suffix
14d2db2a8fSAnup Patel #endif
15d2db2a8fSAnup Patel 
166020faf6SRick Chen #define MSTATUS_UIE	0x00000001
176020faf6SRick Chen #define MSTATUS_SIE	0x00000002
186020faf6SRick Chen #define MSTATUS_HIE	0x00000004
196020faf6SRick Chen #define MSTATUS_MIE	0x00000008
206020faf6SRick Chen #define MSTATUS_UPIE	0x00000010
216020faf6SRick Chen #define MSTATUS_SPIE	0x00000020
226020faf6SRick Chen #define MSTATUS_HPIE	0x00000040
236020faf6SRick Chen #define MSTATUS_MPIE	0x00000080
246020faf6SRick Chen #define MSTATUS_SPP	0x00000100
256020faf6SRick Chen #define MSTATUS_HPP	0x00000600
266020faf6SRick Chen #define MSTATUS_MPP	0x00001800
276020faf6SRick Chen #define MSTATUS_FS	0x00006000
286020faf6SRick Chen #define MSTATUS_XS	0x00018000
296020faf6SRick Chen #define MSTATUS_MPRV	0x00020000
306020faf6SRick Chen #define MSTATUS_PUM	0x00040000
316020faf6SRick Chen #define MSTATUS_VM	0x1F000000
326020faf6SRick Chen #define MSTATUS32_SD	0x80000000
336020faf6SRick Chen #define MSTATUS64_SD	0x8000000000000000
346020faf6SRick Chen 
356020faf6SRick Chen #define MCAUSE32_CAUSE	0x7FFFFFFF
366020faf6SRick Chen #define MCAUSE64_CAUSE	0x7FFFFFFFFFFFFFFF
376020faf6SRick Chen #define MCAUSE32_INT	0x80000000
386020faf6SRick Chen #define MCAUSE64_INT	0x8000000000000000
396020faf6SRick Chen 
406020faf6SRick Chen #define SSTATUS_UIE	0x00000001
416020faf6SRick Chen #define SSTATUS_SIE	0x00000002
426020faf6SRick Chen #define SSTATUS_UPIE	0x00000010
436020faf6SRick Chen #define SSTATUS_SPIE	0x00000020
446020faf6SRick Chen #define SSTATUS_SPP	0x00000100
456020faf6SRick Chen #define SSTATUS_FS	0x00006000
466020faf6SRick Chen #define SSTATUS_XS	0x00018000
476020faf6SRick Chen #define SSTATUS_PUM	0x00040000
486020faf6SRick Chen #define SSTATUS32_SD	0x80000000
496020faf6SRick Chen #define SSTATUS64_SD	0x8000000000000000
506020faf6SRick Chen 
516020faf6SRick Chen #define MIP_SSIP	BIT(IRQ_S_SOFT)
526020faf6SRick Chen #define MIP_HSIP	BIT(IRQ_H_SOFT)
536020faf6SRick Chen #define MIP_MSIP	BIT(IRQ_M_SOFT)
546020faf6SRick Chen #define MIP_STIP	BIT(IRQ_S_TIMER)
556020faf6SRick Chen #define MIP_HTIP	BIT(IRQ_H_TIMER)
566020faf6SRick Chen #define MIP_MTIP	BIT(IRQ_M_TIMER)
576020faf6SRick Chen #define MIP_SEIP	BIT(IRQ_S_EXT)
586020faf6SRick Chen #define MIP_HEIP	BIT(IRQ_H_EXT)
596020faf6SRick Chen #define MIP_MEIP	BIT(IRQ_M_EXT)
606020faf6SRick Chen 
616020faf6SRick Chen #define SIP_SSIP	MIP_SSIP
626020faf6SRick Chen #define SIP_STIP	MIP_STIP
636020faf6SRick Chen 
646020faf6SRick Chen #define PRV_U	0
656020faf6SRick Chen #define PRV_S	1
666020faf6SRick Chen #define PRV_H	2
676020faf6SRick Chen #define PRV_M	3
686020faf6SRick Chen 
696020faf6SRick Chen #define VM_MBARE	0
706020faf6SRick Chen #define VM_MBB		1
716020faf6SRick Chen #define VM_MBBID	2
726020faf6SRick Chen #define VM_SV32		8
736020faf6SRick Chen #define VM_SV39		9
746020faf6SRick Chen #define VM_SV48		10
756020faf6SRick Chen 
766020faf6SRick Chen #define IRQ_S_SOFT	1
776020faf6SRick Chen #define IRQ_H_SOFT	2
786020faf6SRick Chen #define IRQ_M_SOFT	3
796020faf6SRick Chen #define IRQ_S_TIMER	5
806020faf6SRick Chen #define IRQ_H_TIMER	6
816020faf6SRick Chen #define IRQ_M_TIMER	7
826020faf6SRick Chen #define IRQ_S_EXT	9
836020faf6SRick Chen #define IRQ_H_EXT	10
846020faf6SRick Chen #define IRQ_M_EXT	11
856020faf6SRick Chen #define IRQ_COP		12
866020faf6SRick Chen #define IRQ_HOST	13
876020faf6SRick Chen 
88*39671564SBin Meng #define CAUSE_MISALIGNED_FETCH		0
89*39671564SBin Meng #define CAUSE_FETCH_ACCESS		1
90*39671564SBin Meng #define CAUSE_ILLEGAL_INSTRUCTION	2
91*39671564SBin Meng #define CAUSE_BREAKPOINT		3
92*39671564SBin Meng #define CAUSE_MISALIGNED_LOAD		4
93*39671564SBin Meng #define CAUSE_LOAD_ACCESS		5
94*39671564SBin Meng #define CAUSE_MISALIGNED_STORE		6
95*39671564SBin Meng #define CAUSE_STORE_ACCESS		7
96*39671564SBin Meng #define CAUSE_USER_ECALL		8
97*39671564SBin Meng #define CAUSE_SUPERVISOR_ECALL		9
98*39671564SBin Meng #define CAUSE_MACHINE_ECALL		11
99*39671564SBin Meng #define CAUSE_FETCH_PAGE_FAULT		12
100*39671564SBin Meng #define CAUSE_LOAD_PAGE_FAULT		13
101*39671564SBin Meng #define CAUSE_STORE_PAGE_FAULT		15
102*39671564SBin Meng 
1036020faf6SRick Chen #define DEFAULT_RSTVEC		0x00001000
1046020faf6SRick Chen #define DEFAULT_NMIVEC		0x00001004
1056020faf6SRick Chen #define DEFAULT_MTVEC		0x00001010
1066020faf6SRick Chen #define CONFIG_STRING_ADDR	0x0000100C
1076020faf6SRick Chen #define EXT_IO_BASE		0x40000000
1086020faf6SRick Chen #define DRAM_BASE		0x80000000
1096020faf6SRick Chen 
1106020faf6SRick Chen // page table entry (PTE) fields
1116020faf6SRick Chen #define PTE_V		0x001 // Valid
1126020faf6SRick Chen #define PTE_TYPE	0x01E // Type
1136020faf6SRick Chen #define PTE_R		0x020 // Referenced
1146020faf6SRick Chen #define PTE_D		0x040 // Dirty
1156020faf6SRick Chen #define PTE_SOFT	0x380 // Reserved for Software
1166020faf6SRick Chen 
1176020faf6SRick Chen #define PTE_TYPE_TABLE		0x00
1186020faf6SRick Chen #define PTE_TYPE_TABLE_GLOBAL	0x02
1196020faf6SRick Chen #define PTE_TYPE_URX_SR		0x04
1206020faf6SRick Chen #define PTE_TYPE_URWX_SRW	0x06
1216020faf6SRick Chen #define PTE_TYPE_UR_SR		0x08
1226020faf6SRick Chen #define PTE_TYPE_URW_SRW	0x0A
1236020faf6SRick Chen #define PTE_TYPE_URX_SRX	0x0C
1246020faf6SRick Chen #define PTE_TYPE_URWX_SRWX0x0E
1256020faf6SRick Chen #define PTE_TYPE_SR		0x10
1266020faf6SRick Chen #define PTE_TYPE_SRW		0x12
1276020faf6SRick Chen #define PTE_TYPE_SRX		0x14
1286020faf6SRick Chen #define PTE_TYPE_SRWX		0x16
1296020faf6SRick Chen #define PTE_TYPE_SR_GLOBAL	0x18
1306020faf6SRick Chen #define PTE_TYPE_SRW_GLOBAL	0x1A
1316020faf6SRick Chen #define PTE_TYPE_SRX_GLOBAL	0x1C
1326020faf6SRick Chen #define PTE_TYPE_SRWX_GLOBAL	0x1E
1336020faf6SRick Chen 
1346020faf6SRick Chen #define PTE_PPN_SHIFT	10
1356020faf6SRick Chen 
1366020faf6SRick Chen #define PTE_TABLE(PTE)	((0x0000000AU >> ((PTE) & 0x1F)) & 1)
1376020faf6SRick Chen #define PTE_UR(PTE)	((0x0000AAA0U >> ((PTE) & 0x1F)) & 1)
1386020faf6SRick Chen #define PTE_UW(PTE)	((0x00008880U >> ((PTE) & 0x1F)) & 1)
1396020faf6SRick Chen #define PTE_UX(PTE)	((0x0000A0A0U >> ((PTE) & 0x1F)) & 1)
1406020faf6SRick Chen #define PTE_SR(PTE)	((0xAAAAAAA0U >> ((PTE) & 0x1F)) & 1)
1416020faf6SRick Chen #define PTE_SW(PTE)	((0x88888880U >> ((PTE) & 0x1F)) & 1)
1426020faf6SRick Chen #define PTE_SX(PTE)	((0xA0A0A000U >> ((PTE) & 0x1F)) & 1)
1436020faf6SRick Chen 
144bc0818a6SRick Chen #define PTE_CHECK_PERM(_PTE, _SUPERVISOR, STORE, FETCH) \
145bc0818a6SRick Chen 	typeof(_PTE) (PTE) = (_PTE); \
146bc0818a6SRick Chen 	typeof(_SUPERVISOR) (SUPERVISOR) = (_SUPERVISOR); \
1476020faf6SRick Chen 	((STORE) ? ((SUPERVISOR) ? PTE_SW(PTE) : PTE_UW(PTE)) : \
1486020faf6SRick Chen 	(FETCH) ? ((SUPERVISOR) ? PTE_SX(PTE) : PTE_UX(PTE)) : \
1496020faf6SRick Chen 	((SUPERVISOR) ? PTE_SR(PTE) : PTE_UR(PTE)))
1506020faf6SRick Chen 
1516020faf6SRick Chen #ifdef __riscv
152e5ea1e58SBin Meng 
1536020faf6SRick Chen #ifdef CONFIG_64BIT
1546020faf6SRick Chen # define MSTATUS_SD MSTATUS64_SD
1556020faf6SRick Chen # define SSTATUS_SD SSTATUS64_SD
1566020faf6SRick Chen # define MCAUSE_INT MCAUSE64_INT
1576020faf6SRick Chen # define MCAUSE_CAUSE MCAUSE64_CAUSE
1586020faf6SRick Chen # define RISCV_PGLEVEL_BITS 9
1596020faf6SRick Chen #else
1606020faf6SRick Chen # define MSTATUS_SD MSTATUS32_SD
1616020faf6SRick Chen # define SSTATUS_SD SSTATUS32_SD
1626020faf6SRick Chen # define RISCV_PGLEVEL_BITS 10
1636020faf6SRick Chen # define MCAUSE_INT MCAUSE32_INT
1646020faf6SRick Chen # define MCAUSE_CAUSE MCAUSE32_CAUSE
1656020faf6SRick Chen #endif
166e5ea1e58SBin Meng 
1676020faf6SRick Chen #define RISCV_PGSHIFT 12
1686020faf6SRick Chen #define RISCV_PGSIZE BIT(RISCV_PGSHIFT)
1696020faf6SRick Chen 
170ea53f1c7SBin Meng /* CSR numbers */
171ea53f1c7SBin Meng #define CSR_FFLAGS		0x1
172ea53f1c7SBin Meng #define CSR_FRM			0x2
173ea53f1c7SBin Meng #define CSR_FCSR		0x3
174ea53f1c7SBin Meng 
175ea53f1c7SBin Meng #define CSR_SSTATUS		0x100
176ea53f1c7SBin Meng #define CSR_SEDELEG		0x102
177ea53f1c7SBin Meng #define CSR_SIDELEG		0x103
178ea53f1c7SBin Meng #define CSR_SIE			0x104
179ea53f1c7SBin Meng #define CSR_STVEC		0x105
180ea53f1c7SBin Meng #define CSR_SCOUNTEREN		0x106
181ea53f1c7SBin Meng #define CSR_SSCRATCH		0x140
182ea53f1c7SBin Meng #define CSR_SEPC		0x141
183ea53f1c7SBin Meng #define CSR_SCAUSE		0x142
184ea53f1c7SBin Meng #define CSR_STVAL		0x143
185ea53f1c7SBin Meng #define CSR_SIP			0x144
186ea53f1c7SBin Meng #define CSR_SATP		0x180
187ea53f1c7SBin Meng 
188ea53f1c7SBin Meng #define CSR_MSTATUS		0x300
189ea53f1c7SBin Meng #define CSR_MISA		0x301
190ea53f1c7SBin Meng #define CSR_MEDELEG		0x302
191ea53f1c7SBin Meng #define CSR_MIDELEG		0x303
192ea53f1c7SBin Meng #define CSR_MIE			0x304
193ea53f1c7SBin Meng #define CSR_MTVEC		0x305
194ea53f1c7SBin Meng #define CSR_MCOUNTEREN		0x306
195ea53f1c7SBin Meng #define CSR_MHPMEVENT3		0x323
196ea53f1c7SBin Meng #define CSR_MHPMEVENT4		0x324
197ea53f1c7SBin Meng #define CSR_MHPMEVENT5		0x325
198ea53f1c7SBin Meng #define CSR_MHPMEVENT6		0x326
199ea53f1c7SBin Meng #define CSR_MHPMEVENT7		0x327
200ea53f1c7SBin Meng #define CSR_MHPMEVENT8		0x328
201ea53f1c7SBin Meng #define CSR_MHPMEVENT9		0x329
202ea53f1c7SBin Meng #define CSR_MHPMEVENT10		0x32a
203ea53f1c7SBin Meng #define CSR_MHPMEVENT11		0x32b
204ea53f1c7SBin Meng #define CSR_MHPMEVENT12		0x32c
205ea53f1c7SBin Meng #define CSR_MHPMEVENT13		0x32d
206ea53f1c7SBin Meng #define CSR_MHPMEVENT14		0x32e
207ea53f1c7SBin Meng #define CSR_MHPMEVENT15		0x32f
208ea53f1c7SBin Meng #define CSR_MHPMEVENT16		0x330
209ea53f1c7SBin Meng #define CSR_MHPMEVENT17		0x331
210ea53f1c7SBin Meng #define CSR_MHPMEVENT18		0x332
211ea53f1c7SBin Meng #define CSR_MHPMEVENT19		0x333
212ea53f1c7SBin Meng #define CSR_MHPMEVENT20		0x334
213ea53f1c7SBin Meng #define CSR_MHPMEVENT21		0x335
214ea53f1c7SBin Meng #define CSR_MHPMEVENT22		0x336
215ea53f1c7SBin Meng #define CSR_MHPMEVENT23		0x337
216ea53f1c7SBin Meng #define CSR_MHPMEVENT24		0x338
217ea53f1c7SBin Meng #define CSR_MHPMEVENT25		0x339
218ea53f1c7SBin Meng #define CSR_MHPMEVENT26		0x33a
219ea53f1c7SBin Meng #define CSR_MHPMEVENT27		0x33b
220ea53f1c7SBin Meng #define CSR_MHPMEVENT28		0x33c
221ea53f1c7SBin Meng #define CSR_MHPMEVENT29		0x33d
222ea53f1c7SBin Meng #define CSR_MHPMEVENT30		0x33e
223ea53f1c7SBin Meng #define CSR_MHPMEVENT31		0x33f
224ea53f1c7SBin Meng #define CSR_MSCRATCH		0x340
225ea53f1c7SBin Meng #define CSR_MEPC		0x341
226ea53f1c7SBin Meng #define CSR_MCAUSE		0x342
227ea53f1c7SBin Meng #define CSR_MTVAL		0x343
228ea53f1c7SBin Meng #define CSR_MIP			0x344
229ea53f1c7SBin Meng #define CSR_PMPCFG0		0x3a0
230ea53f1c7SBin Meng #define CSR_PMPCFG1		0x3a1
231ea53f1c7SBin Meng #define CSR_PMPCFG2		0x3a2
232ea53f1c7SBin Meng #define CSR_PMPCFG3		0x3a3
233ea53f1c7SBin Meng #define CSR_PMPADDR0		0x3b0
234ea53f1c7SBin Meng #define CSR_PMPADDR1		0x3b1
235ea53f1c7SBin Meng #define CSR_PMPADDR2		0x3b2
236ea53f1c7SBin Meng #define CSR_PMPADDR3		0x3b3
237ea53f1c7SBin Meng #define CSR_PMPADDR4		0x3b4
238ea53f1c7SBin Meng #define CSR_PMPADDR5		0x3b5
239ea53f1c7SBin Meng #define CSR_PMPADDR6		0x3b6
240ea53f1c7SBin Meng #define CSR_PMPADDR7		0x3b7
241ea53f1c7SBin Meng #define CSR_PMPADDR8		0x3b8
242ea53f1c7SBin Meng #define CSR_PMPADDR9		0x3b9
243ea53f1c7SBin Meng #define CSR_PMPADDR10		0x3ba
244ea53f1c7SBin Meng #define CSR_PMPADDR11		0x3bb
245ea53f1c7SBin Meng #define CSR_PMPADDR12		0x3bc
246ea53f1c7SBin Meng #define CSR_PMPADDR13		0x3bd
247ea53f1c7SBin Meng #define CSR_PMPADDR14		0x3be
248ea53f1c7SBin Meng #define CSR_PMPADDR15		0x3bf
249ea53f1c7SBin Meng 
250ea53f1c7SBin Meng #define CSR_TSELECT		0x7a0
251ea53f1c7SBin Meng #define CSR_TDATA1		0x7a1
252ea53f1c7SBin Meng #define CSR_TDATA2		0x7a2
253ea53f1c7SBin Meng #define CSR_TDATA3		0x7a3
254ea53f1c7SBin Meng #define CSR_DCSR		0x7b0
255ea53f1c7SBin Meng #define CSR_DPC			0x7b1
256ea53f1c7SBin Meng #define CSR_DSCRATCH		0x7b2
257ea53f1c7SBin Meng 
258ea53f1c7SBin Meng #define CSR_MCYCLE		0xb00
259ea53f1c7SBin Meng #define CSR_MINSTRET		0xb02
260ea53f1c7SBin Meng #define CSR_MHPMCOUNTER3	0xb03
261ea53f1c7SBin Meng #define CSR_MHPMCOUNTER4	0xb04
262ea53f1c7SBin Meng #define CSR_MHPMCOUNTER5	0xb05
263ea53f1c7SBin Meng #define CSR_MHPMCOUNTER6	0xb06
264ea53f1c7SBin Meng #define CSR_MHPMCOUNTER7	0xb07
265ea53f1c7SBin Meng #define CSR_MHPMCOUNTER8	0xb08
266ea53f1c7SBin Meng #define CSR_MHPMCOUNTER9	0xb09
267ea53f1c7SBin Meng #define CSR_MHPMCOUNTER10	0xb0a
268ea53f1c7SBin Meng #define CSR_MHPMCOUNTER11	0xb0b
269ea53f1c7SBin Meng #define CSR_MHPMCOUNTER12	0xb0c
270ea53f1c7SBin Meng #define CSR_MHPMCOUNTER13	0xb0d
271ea53f1c7SBin Meng #define CSR_MHPMCOUNTER14	0xb0e
272ea53f1c7SBin Meng #define CSR_MHPMCOUNTER15	0xb0f
273ea53f1c7SBin Meng #define CSR_MHPMCOUNTER16	0xb10
274ea53f1c7SBin Meng #define CSR_MHPMCOUNTER17	0xb11
275ea53f1c7SBin Meng #define CSR_MHPMCOUNTER18	0xb12
276ea53f1c7SBin Meng #define CSR_MHPMCOUNTER19	0xb13
277ea53f1c7SBin Meng #define CSR_MHPMCOUNTER20	0xb14
278ea53f1c7SBin Meng #define CSR_MHPMCOUNTER21	0xb15
279ea53f1c7SBin Meng #define CSR_MHPMCOUNTER22	0xb16
280ea53f1c7SBin Meng #define CSR_MHPMCOUNTER23	0xb17
281ea53f1c7SBin Meng #define CSR_MHPMCOUNTER24	0xb18
282ea53f1c7SBin Meng #define CSR_MHPMCOUNTER25	0xb19
283ea53f1c7SBin Meng #define CSR_MHPMCOUNTER26	0xb1a
284ea53f1c7SBin Meng #define CSR_MHPMCOUNTER27	0xb1b
285ea53f1c7SBin Meng #define CSR_MHPMCOUNTER28	0xb1c
286ea53f1c7SBin Meng #define CSR_MHPMCOUNTER29	0xb1d
287ea53f1c7SBin Meng #define CSR_MHPMCOUNTER30	0xb1e
288ea53f1c7SBin Meng #define CSR_MHPMCOUNTER31	0xb1f
289ea53f1c7SBin Meng #define CSR_MCYCLEH		0xb80
290ea53f1c7SBin Meng #define CSR_MINSTRETH		0xb82
291ea53f1c7SBin Meng #define CSR_MHPMCOUNTER3H	0xb83
292ea53f1c7SBin Meng #define CSR_MHPMCOUNTER4H	0xb84
293ea53f1c7SBin Meng #define CSR_MHPMCOUNTER5H	0xb85
294ea53f1c7SBin Meng #define CSR_MHPMCOUNTER6H	0xb86
295ea53f1c7SBin Meng #define CSR_MHPMCOUNTER7H	0xb87
296ea53f1c7SBin Meng #define CSR_MHPMCOUNTER8H	0xb88
297ea53f1c7SBin Meng #define CSR_MHPMCOUNTER9H	0xb89
298ea53f1c7SBin Meng #define CSR_MHPMCOUNTER10H	0xb8a
299ea53f1c7SBin Meng #define CSR_MHPMCOUNTER11H	0xb8b
300ea53f1c7SBin Meng #define CSR_MHPMCOUNTER12H	0xb8c
301ea53f1c7SBin Meng #define CSR_MHPMCOUNTER13H	0xb8d
302ea53f1c7SBin Meng #define CSR_MHPMCOUNTER14H	0xb8e
303ea53f1c7SBin Meng #define CSR_MHPMCOUNTER15H	0xb8f
304ea53f1c7SBin Meng #define CSR_MHPMCOUNTER16H	0xb90
305ea53f1c7SBin Meng #define CSR_MHPMCOUNTER17H	0xb91
306ea53f1c7SBin Meng #define CSR_MHPMCOUNTER18H	0xb92
307ea53f1c7SBin Meng #define CSR_MHPMCOUNTER19H	0xb93
308ea53f1c7SBin Meng #define CSR_MHPMCOUNTER20H	0xb94
309ea53f1c7SBin Meng #define CSR_MHPMCOUNTER21H	0xb95
310ea53f1c7SBin Meng #define CSR_MHPMCOUNTER22H	0xb96
311ea53f1c7SBin Meng #define CSR_MHPMCOUNTER23H	0xb97
312ea53f1c7SBin Meng #define CSR_MHPMCOUNTER24H	0xb98
313ea53f1c7SBin Meng #define CSR_MHPMCOUNTER25H	0xb99
314ea53f1c7SBin Meng #define CSR_MHPMCOUNTER26H	0xb9a
315ea53f1c7SBin Meng #define CSR_MHPMCOUNTER27H	0xb9b
316ea53f1c7SBin Meng #define CSR_MHPMCOUNTER28H	0xb9c
317ea53f1c7SBin Meng #define CSR_MHPMCOUNTER29H	0xb9d
318ea53f1c7SBin Meng #define CSR_MHPMCOUNTER30H	0xb9e
319ea53f1c7SBin Meng #define CSR_MHPMCOUNTER31H	0xb9f
320ea53f1c7SBin Meng 
321ea53f1c7SBin Meng #define CSR_CYCLE		0xc00
322ea53f1c7SBin Meng #define CSR_TIME		0xc01
323ea53f1c7SBin Meng #define CSR_INSTRET		0xc02
324ea53f1c7SBin Meng #define CSR_HPMCOUNTER3		0xc03
325ea53f1c7SBin Meng #define CSR_HPMCOUNTER4		0xc04
326ea53f1c7SBin Meng #define CSR_HPMCOUNTER5		0xc05
327ea53f1c7SBin Meng #define CSR_HPMCOUNTER6		0xc06
328ea53f1c7SBin Meng #define CSR_HPMCOUNTER7		0xc07
329ea53f1c7SBin Meng #define CSR_HPMCOUNTER8		0xc08
330ea53f1c7SBin Meng #define CSR_HPMCOUNTER9		0xc09
331ea53f1c7SBin Meng #define CSR_HPMCOUNTER10	0xc0a
332ea53f1c7SBin Meng #define CSR_HPMCOUNTER11	0xc0b
333ea53f1c7SBin Meng #define CSR_HPMCOUNTER12	0xc0c
334ea53f1c7SBin Meng #define CSR_HPMCOUNTER13	0xc0d
335ea53f1c7SBin Meng #define CSR_HPMCOUNTER14	0xc0e
336ea53f1c7SBin Meng #define CSR_HPMCOUNTER15	0xc0f
337ea53f1c7SBin Meng #define CSR_HPMCOUNTER16	0xc10
338ea53f1c7SBin Meng #define CSR_HPMCOUNTER17	0xc11
339ea53f1c7SBin Meng #define CSR_HPMCOUNTER18	0xc12
340ea53f1c7SBin Meng #define CSR_HPMCOUNTER19	0xc13
341ea53f1c7SBin Meng #define CSR_HPMCOUNTER20	0xc14
342ea53f1c7SBin Meng #define CSR_HPMCOUNTER21	0xc15
343ea53f1c7SBin Meng #define CSR_HPMCOUNTER22	0xc16
344ea53f1c7SBin Meng #define CSR_HPMCOUNTER23	0xc17
345ea53f1c7SBin Meng #define CSR_HPMCOUNTER24	0xc18
346ea53f1c7SBin Meng #define CSR_HPMCOUNTER25	0xc19
347ea53f1c7SBin Meng #define CSR_HPMCOUNTER26	0xc1a
348ea53f1c7SBin Meng #define CSR_HPMCOUNTER27	0xc1b
349ea53f1c7SBin Meng #define CSR_HPMCOUNTER28	0xc1c
350ea53f1c7SBin Meng #define CSR_HPMCOUNTER29	0xc1d
351ea53f1c7SBin Meng #define CSR_HPMCOUNTER30	0xc1e
352ea53f1c7SBin Meng #define CSR_HPMCOUNTER31	0xc1f
353ea53f1c7SBin Meng #define CSR_CYCLEH		0xc80
354ea53f1c7SBin Meng #define CSR_TIMEH		0xc81
355ea53f1c7SBin Meng #define CSR_INSTRETH		0xc82
356ea53f1c7SBin Meng #define CSR_HPMCOUNTER3H	0xc83
357ea53f1c7SBin Meng #define CSR_HPMCOUNTER4H	0xc84
358ea53f1c7SBin Meng #define CSR_HPMCOUNTER5H	0xc85
359ea53f1c7SBin Meng #define CSR_HPMCOUNTER6H	0xc86
360ea53f1c7SBin Meng #define CSR_HPMCOUNTER7H	0xc87
361ea53f1c7SBin Meng #define CSR_HPMCOUNTER8H	0xc88
362ea53f1c7SBin Meng #define CSR_HPMCOUNTER9H	0xc89
363ea53f1c7SBin Meng #define CSR_HPMCOUNTER10H	0xc8a
364ea53f1c7SBin Meng #define CSR_HPMCOUNTER11H	0xc8b
365ea53f1c7SBin Meng #define CSR_HPMCOUNTER12H	0xc8c
366ea53f1c7SBin Meng #define CSR_HPMCOUNTER13H	0xc8d
367ea53f1c7SBin Meng #define CSR_HPMCOUNTER14H	0xc8e
368ea53f1c7SBin Meng #define CSR_HPMCOUNTER15H	0xc8f
369ea53f1c7SBin Meng #define CSR_HPMCOUNTER16H	0xc90
370ea53f1c7SBin Meng #define CSR_HPMCOUNTER17H	0xc91
371ea53f1c7SBin Meng #define CSR_HPMCOUNTER18H	0xc92
372ea53f1c7SBin Meng #define CSR_HPMCOUNTER19H	0xc93
373ea53f1c7SBin Meng #define CSR_HPMCOUNTER20H	0xc94
374ea53f1c7SBin Meng #define CSR_HPMCOUNTER21H	0xc95
375ea53f1c7SBin Meng #define CSR_HPMCOUNTER22H	0xc96
376ea53f1c7SBin Meng #define CSR_HPMCOUNTER23H	0xc97
377ea53f1c7SBin Meng #define CSR_HPMCOUNTER24H	0xc98
378ea53f1c7SBin Meng #define CSR_HPMCOUNTER25H	0xc99
379ea53f1c7SBin Meng #define CSR_HPMCOUNTER26H	0xc9a
380ea53f1c7SBin Meng #define CSR_HPMCOUNTER27H	0xc9b
381ea53f1c7SBin Meng #define CSR_HPMCOUNTER28H	0xc9c
382ea53f1c7SBin Meng #define CSR_HPMCOUNTER29H	0xc9d
383ea53f1c7SBin Meng #define CSR_HPMCOUNTER30H	0xc9e
384ea53f1c7SBin Meng #define CSR_HPMCOUNTER31H	0xc9f
385ea53f1c7SBin Meng 
386ea53f1c7SBin Meng #define CSR_MVENDORID		0xf11
387ea53f1c7SBin Meng #define CSR_MARCHID		0xf12
388ea53f1c7SBin Meng #define CSR_MIMPID		0xf13
389ea53f1c7SBin Meng #define CSR_MHARTID		0xf14
390ea53f1c7SBin Meng 
391e5ea1e58SBin Meng #endif /* __riscv */
3926020faf6SRick Chen 
393e5ea1e58SBin Meng #endif /* RISCV_CSR_ENCODING_H */
394