riscv/pmp: add all region in NAPOT
This allows using 0 base and size to depict the whole region.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
diff --git a/arch/risc-v/src/common/riscv_pmp.c b/arch/risc-v/src/common/riscv_pmp.c
index 97b39b8..718cb4e 100644
--- a/arch/risc-v/src/common/riscv_pmp.c
+++ b/arch/risc-v/src/common/riscv_pmp.c
@@ -134,6 +134,13 @@
case PMPCFG_A_NAPOT:
{
+ /* Special range for the whole range */
+
+ if (base == 0 && size == 0)
+ {
+ return true;
+ }
+
/* For NAPOT, Naturally aligned power-of-two region, >= 8 bytes */
if ((base & 0x07) != 0 || size < 8 || (size & (size - 1)) != 0)