From bfd93d41cf26fb1546e1060a5f4f6ad61ba76864 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Fri, 28 Jun 2024 10:45:35 +0800 Subject: [PATCH] arch/riscv: fix PMP in sbi_start() This fixes PMP setting for open everything before going S-mode, which has been broken since pull/12398. Signed-off-by: Yanfeng Liu --- arch/risc-v/src/nuttsbi/sbi_start.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/risc-v/src/nuttsbi/sbi_start.c b/arch/risc-v/src/nuttsbi/sbi_start.c index 7bc9e0a530bc4..8b7aeb2484a18 100644 --- a/arch/risc-v/src/nuttsbi/sbi_start.c +++ b/arch/risc-v/src/nuttsbi/sbi_start.c @@ -32,6 +32,12 @@ #include "sbi_internal.h" +/**************************************************************************** + * Preprocecssor definitions + ****************************************************************************/ + +#define NAPOT_OPENALL (PMPCFG_A_NAPOT | PMPCFG_RWX_MASK) + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -119,7 +125,7 @@ void sbi_start(void) /* Open everything for PMP */ - riscv_append_pmp_region(PMPCFG_A_NAPOT | PMPCFG_RWX_MASK, 0, -1); + DEBUGASSERT(riscv_append_pmp_region(NAPOT_OPENALL, 0, 0) == 0); /* Then jump to the S-mode start function */