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:
Nicholas Piggin
2026-04-30 14:55:24 +10:00
committed by Anup Patel
parent f7738cc1e5
commit 63350c6ea6
4 changed files with 42 additions and 40 deletions
+8 -6
View File
@@ -81,6 +81,8 @@
#ifndef __ASSEMBLER__
#include <sbi/sbi_types.h>
#define csr_swap(csr, val) \
({ \
register unsigned long __v = (unsigned long)(val); \
@@ -210,16 +212,16 @@ int misa_xlen(void);
void misa_string(int xlen, char *out, unsigned int out_sz);
/* Disable pmp entry at a given index */
int pmp_disable(unsigned int n);
int sbi_hart_pmp_disable(unsigned int n);
/* Check if the matching field is set */
int is_pmp_entry_mapped(unsigned long entry);
bool sbi_hart_is_pmp_enabled(unsigned int n);
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);
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);
#endif /* !__ASSEMBLER__ */