mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: sbi: clear pmpcfg.A before setting in pmp_set()
We should clear A bits in prot variable before enabling A_NA4 or A_NAPOT. Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
@@ -268,6 +268,7 @@ int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
|
||||
return SBI_ENOTSUPP;
|
||||
|
||||
/* encode PMP config */
|
||||
prot &= ~PMP_A;
|
||||
prot |= (log2len == PMP_SHIFT) ? PMP_A_NA4 : PMP_A_NAPOT;
|
||||
cfgmask = ~(0xffUL << pmpcfg_shift);
|
||||
pmpcfg = (csr_read_num(pmpcfg_csr) & cfgmask);
|
||||
|
Reference in New Issue
Block a user