mirror of
https://github.com/riscv-software-src/opensbi
synced 2025-10-17 14:18:17 +01:00
lib: sbi: Fix PMP address bits detection
We should ensure that pmpcfg0.pmp0cfg is set to zero before using pmpaddr0 CSR for detecting implemented PMP address bits. Fixes: bf21632860b4 ("lib: sbi: Detect PMP granularity and number of address bits") Signed-off-by: Vasan VS <vasan.vs@gmail.com> Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Dong Du <Dd_nirvana@sjtu.edu.cn>
This commit is contained in:
parent
b8845e4204
commit
31fe5a7a3d
@ -338,6 +338,10 @@ static unsigned long hart_pmp_get_allowed_addr(void)
|
||||
unsigned long val = 0;
|
||||
struct sbi_trap_info trap = {0};
|
||||
|
||||
csr_write_allowed(CSR_PMPCFG0, (ulong)&trap, 0);
|
||||
if (trap.cause)
|
||||
return 0;
|
||||
|
||||
csr_write_allowed(CSR_PMPADDR0, (ulong)&trap, PMP_ADDR_MASK);
|
||||
if (!trap.cause) {
|
||||
val = csr_read_allowed(CSR_PMPADDR0, (ulong)&trap);
|
||||
|
Loading…
x
Reference in New Issue
Block a user