From a38bea9341a2da29bec00d5253ac71da8ca06bab Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Mon, 18 May 2020 12:04:18 +0530 Subject: lib: sbi_hart: Detect number of supported PMP regions It is not mandatory for a RISC-V systems to implement all PMP regions so we have to check all PMPADDRx CSRs to determine excat number of supported PMP regions. Signed-off-by: Anup Patel --- include/sbi/sbi_hart.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index ac7a067f..51c2c353 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -38,6 +38,10 @@ static inline ulong sbi_hart_expected_trap_addr(void) } void sbi_hart_delegation_dump(struct sbi_scratch *scratch); +unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch); +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, unsigned long attr); -- cgit v1.3.1