summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayuresh Chitale <mchitale@ventanamicro.com>2022-04-11 06:04:17 +0300
committerAnup Patel <anup@brainfault.org>2022-04-11 06:04:17 +0300
commit3383d6a4d1461bb029b21fa53417382e34ae4906 (patch)
tree4d58aa3375bdaba9f0b1f3e23b2a72f4272b0505
parentd44568a0f2e6301d3ad77a48370b0bfef4bfe5a0 (diff)
downloadopensbi-3383d6a4d1461bb029b21fa53417382e34ae4906.tar.xz
lib: irqchip/imsic: configure mstateen
When mstateen registers are implemented, the AIA related configurations need to be done in mstateen for the IMSIC initialization to succeed. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
-rw-r--r--lib/sbi/sbi_hart.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index b0edf38..7b602c3 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -98,6 +98,12 @@ static void mstatus_init(struct sbi_scratch *scratch)
mstateen_val |= SMSTATEEN0_HSENVCFG;
else
mstateen_val &= ~SMSTATEEN0_HSENVCFG;
+ if (sbi_hart_has_feature(scratch, SBI_HART_HAS_AIA))
+ mstateen_val |= (SMSTATEEN0_AIA | SMSTATEEN0_SVSLCT |
+ SMSTATEEN0_IMSIC);
+ else
+ mstateen_val &= ~(SMSTATEEN0_AIA | SMSTATEEN0_SVSLCT |
+ SMSTATEEN0_IMSIC);
csr_write(CSR_MSTATEEN0, mstateen_val);
#if __riscv_xlen == 32
csr_write(CSR_MSTATEEN0H, mstateen_val >> 32);