From 283aa5c00b62f66aa66fc7c56b3732e8cc786d10 Mon Sep 17 00:00:00 2001 From: Chen Pei Date: Fri, 8 May 2026 18:04:39 +0800 Subject: [PATCH] feature: Update for C950 Signed-off-by: Chen Pei --- feature.c | 11 +++++++++++ riscv_encoding.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/feature.c b/feature.c index ec30c17..495a0bb 100644 --- a/feature.c +++ b/feature.c @@ -290,6 +290,17 @@ void setup_features(void) while(1); } break; + case 0x9: + if(cpu_ver >= 0x0) { + csr_clear(CSR_MXSTATUS, 0x1); + csr_write(CSR_MISELECT,CSR_MNASTATUS); + csr_write(CSR_MIREG,0x1e); + csr_write(CSR_MISELECT, CSR_L2_TRA_CTRL); + csr_set(CSR_MIREG2, 0x1600); + } else { + while(1); + } + break; default: while(1); } diff --git a/riscv_encoding.h b/riscv_encoding.h index d93c11c..41e52ca 100644 --- a/riscv_encoding.h +++ b/riscv_encoding.h @@ -15,6 +15,7 @@ #define CSR_MCOUNTERWEN 0x7c9 #define CSR_MSMPR 0x7f3 #define CSR_MNASTATUS 0x8000000000000210 +#define CSR_L2_TRA_CTRL 0x8000000000001600 /* clang-format off */ #define MSTATUS_SIE _UL(0x00000002) @@ -251,6 +252,7 @@ #define CSR_MTVAL2 0x34b #define CSR_MISELECT 0x350 #define CSR_MIREG 0x351 +#define CSR_MIREG2 0x352 #define CSR_PMPCFG0 0x3a0 #define CSR_PMPCFG1 0x3a1 #define CSR_PMPCFG2 0x3a2