summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2026-04-30 14:55:25 +1000
committerAnup Patel <anup@brainfault.org>2026-06-10 17:55:33 +0530
commita59c8fb9fb0ee4b56268b84cf94d6a5d66ead514 (patch)
treebcdc2cd6ac9ae410de033e3e0c46316c8b4f75a9 /include
parent63350c6ea6a9ba8097b15c7159a00c428377623c (diff)
downloadopensbi-a59c8fb9fb0ee4b56268b84cf94d6a5d66ead514.tar.gz
opensbi-a59c8fb9fb0ee4b56268b84cf94d6a5d66ead514.zip
lib: sbi: Move hart PMP functions to sbi_hart_pmp.c
The sbi_hart_pmp.c looks like a good place for the hart PMP CSR access functions. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260430045528.420437-9-npiggin@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/riscv_asm.h14
-rw-r--r--include/sbi/sbi_hart_pmp.h12
2 files changed, 12 insertions, 14 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h
index 105563e3..7765edb7 100644
--- a/include/sbi/riscv_asm.h
+++ b/include/sbi/riscv_asm.h
@@ -81,8 +81,6 @@
#ifndef __ASSEMBLER__
-#include <sbi/sbi_types.h>
-
#define csr_swap(csr, val) \
({ \
register unsigned long __v = (unsigned long)(val); \
@@ -211,18 +209,6 @@ int misa_xlen(void);
/* Get RISC-V ISA string representation */
void misa_string(int xlen, char *out, unsigned int out_sz);
-/* Disable pmp entry at a given index */
-int sbi_hart_pmp_disable(unsigned int n);
-
-/* Check if the matching field is set */
-bool sbi_hart_is_pmp_enabled(unsigned int n);
-
-int sbi_hart_pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
- unsigned long log2len);
-
-int sbi_hart_pmp_get(unsigned int n, unsigned long *prot_out, unsigned long *addr_out,
- unsigned long *log2len);
-
#endif /* !__ASSEMBLER__ */
#endif
diff --git a/include/sbi/sbi_hart_pmp.h b/include/sbi/sbi_hart_pmp.h
index a7765d17..6a8b3e79 100644
--- a/include/sbi/sbi_hart_pmp.h
+++ b/include/sbi/sbi_hart_pmp.h
@@ -9,6 +9,18 @@
#include <sbi/sbi_types.h>
+/* Disable pmp entry at a given index */
+int sbi_hart_pmp_disable(unsigned int n);
+
+/* Check if the matching field is set */
+bool sbi_hart_is_pmp_enabled(unsigned int n);
+
+int sbi_hart_pmp_set(unsigned int n, unsigned long prot,
+ unsigned long addr, unsigned long log2len);
+
+int sbi_hart_pmp_get(unsigned int n, unsigned long *prot_out,
+ unsigned long *addr_out, unsigned long *log2len);
+
struct sbi_scratch;
unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch);