summaryrefslogtreecommitdiff
path: root/include/sbi
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-09-07 13:20:33 +0300
committerAnup Patel <anup@brainfault.org>2020-09-16 06:35:25 +0300
commit7ccf6bf54c2d7db6331f3fa319ef4e7019108c28 (patch)
tree2e54824ef04c5c3dfcfd475e16c24f89e07112f9 /include/sbi
parent6734304f8c759c782cab12ecfd6c20fb23b8ee44 (diff)
downloadopensbi-7ccf6bf54c2d7db6331f3fa319ef4e7019108c28.tar.xz
lib: sbi: Allow specifying mode in sbi_hart_pmp_check_addr() API
We extend sbi_hart_pmp_check_addr() API so that users can specify privilege mode of the address for checking PMP access permissions. To achieve this, we end-up converting "unsigned long *size" parameter to "unsigned long *log2len" for pmp_get() implementation so that we can deal with regions of "1UL << __riscv_xlen" size in a special case in sbi_hart_pmp_check_addr() implementation. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi')
-rw-r--r--include/sbi/riscv_asm.h2
-rw-r--r--include/sbi/sbi_hart.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h
index 6e093ca..10f31a7 100644
--- a/include/sbi/riscv_asm.h
+++ b/include/sbi/riscv_asm.h
@@ -180,7 +180,7 @@ int 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 *size);
+ unsigned long *log2len);
#endif /* !__ASSEMBLY__ */
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index 1e1eb67..0ba68f0 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -42,7 +42,8 @@ int sbi_hart_pmp_get(struct sbi_scratch *scratch, unsigned int n,
unsigned long *prot_out, unsigned long *addr_out,
unsigned long *size);
void sbi_hart_pmp_dump(struct sbi_scratch *scratch);
-int sbi_hart_pmp_check_addr(struct sbi_scratch *scratch, unsigned long daddr,
+int sbi_hart_pmp_check_addr(struct sbi_scratch *scratch,
+ unsigned long daddr, unsigned long mode,
unsigned long attr);
bool sbi_hart_has_feature(struct sbi_scratch *scratch, unsigned long feature);
void sbi_hart_get_features_str(struct sbi_scratch *scratch,