Skip to content

Commit f77aff6

Browse files
gamber27cp0613
authored andcommitted
Update feature.c for C925,C930
1 parent 2568fcf commit f77aff6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

feature.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,24 @@ void setup_features(void)
255255
while(1);
256256
}
257257
break;
258+
case 0x7:
259+
if (cpu_ver >= 0x0) {
260+
csr_clear(CSR_MXSTATUS, 0x1);
261+
csr_write(CSR_MISELECT,CSR_MNASTATUS);
262+
csr_write(CSR_MIREG,0x1e);
263+
} else {
264+
while(1);
265+
}
266+
break;
267+
case 0x8:
268+
if (cpu_ver >= 0x0) {
269+
csr_clear(CSR_MXSTATUS, 0x1);
270+
csr_write(CSR_MISELECT,CSR_MNASTATUS);
271+
csr_write(CSR_MIREG,0x1e);
272+
} else {
273+
while(1);
274+
}
275+
break;
258276
default:
259277
while(1);
260278
}

riscv_encoding.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define CSR_MRVBR 0x7c7
1515
#define CSR_MCOUNTERWEN 0x7c9
1616
#define CSR_MSMPR 0x7f3
17+
#define CSR_MNASTATUS 0x8000000000000210
1718

1819
/* clang-format off */
1920
#define MSTATUS_SIE _UL(0x00000002)
@@ -248,6 +249,8 @@
248249
#define CSR_MIP 0x344
249250
#define CSR_MTINST 0x34a
250251
#define CSR_MTVAL2 0x34b
252+
#define CSR_MISELECT 0x350
253+
#define CSR_MIREG 0x351
251254
#define CSR_PMPCFG0 0x3a0
252255
#define CSR_PMPCFG1 0x3a1
253256
#define CSR_PMPCFG2 0x3a2

0 commit comments

Comments
 (0)