mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-06-12 22:31:45 +01:00
lib: sbi: Add hart_ prefix to PMP functions
PMP functions that deal with hart PMP CSRs are given a sbi_hart_ prefix, to distinguish from RISC-V PMP encoding functions. The is_pmp_entry_mapped() function is changed a little more, to align with other PMP conventions, and made to return a bool to make it more obvious that it returns a bool and not an SBI_ return code. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260430045528.420437-8-npiggin@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
committed by
Anup Patel
parent
f7738cc1e5
commit
63350c6ea6
+7
-7
@@ -332,7 +332,7 @@ static int hart_pmp_write(pmp_t *pmp, unsigned int n)
|
||||
return SBI_OK;
|
||||
}
|
||||
|
||||
int pmp_disable(unsigned int n)
|
||||
int sbi_hart_pmp_disable(unsigned int n)
|
||||
{
|
||||
pmp_t pmp;
|
||||
int rc;
|
||||
@@ -346,18 +346,18 @@ int pmp_disable(unsigned int n)
|
||||
return hart_pmp_write(&pmp, n);
|
||||
}
|
||||
|
||||
int is_pmp_entry_mapped(unsigned long entry)
|
||||
bool sbi_hart_is_pmp_enabled(unsigned int n)
|
||||
{
|
||||
pmp_t pmp;
|
||||
|
||||
if (hart_pmp_read(&pmp, entry) != SBI_OK)
|
||||
if (hart_pmp_read(&pmp, n) != SBI_OK)
|
||||
return false;
|
||||
|
||||
return sbi_pmp_is_enabled(&pmp);
|
||||
}
|
||||
|
||||
int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
|
||||
unsigned long log2len)
|
||||
int sbi_hart_pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
|
||||
unsigned long log2len)
|
||||
{
|
||||
pmp_t pmp;
|
||||
int rc;
|
||||
@@ -369,8 +369,8 @@ int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
|
||||
return hart_pmp_write(&pmp, n);
|
||||
}
|
||||
|
||||
int pmp_get(unsigned int n, unsigned long *prot_out, unsigned long *addr_out,
|
||||
unsigned long *log2len)
|
||||
int sbi_hart_pmp_get(unsigned int n, unsigned long *prot_out, unsigned long *addr_out,
|
||||
unsigned long *log2len)
|
||||
{
|
||||
pmp_t pmp;
|
||||
int rc;
|
||||
|
||||
Reference in New Issue
Block a user