From 93da66b7d40605c3288ba05e70de8ef1914cdb60 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Wed, 22 Nov 2023 11:44:04 -0800 Subject: lib: sbi_hart: Store PMP granularity as log base 2 This minimizes the need to call log2roundup() to recover the log value. Signed-off-by: Samuel Holland Reviewed-by: Anup Patel --- include/sbi/sbi_hart.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 811e5f50..0aefc2be 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -73,7 +73,7 @@ struct sbi_hart_features { unsigned long extensions[BITS_TO_LONGS(SBI_HART_EXT_MAX)]; unsigned int pmp_count; unsigned int pmp_addr_bits; - unsigned long pmp_gran; + unsigned int pmp_log2gran; unsigned int mhpm_mask; unsigned int mhpm_bits; }; @@ -93,7 +93,7 @@ unsigned int sbi_hart_mhpm_mask(struct sbi_scratch *scratch); void sbi_hart_delegation_dump(struct sbi_scratch *scratch, const char *prefix, const char *suffix); unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch); -unsigned long sbi_hart_pmp_granularity(struct sbi_scratch *scratch); +unsigned int sbi_hart_pmp_log2gran(struct sbi_scratch *scratch); unsigned int sbi_hart_pmp_addrbits(struct sbi_scratch *scratch); unsigned int sbi_hart_mhpm_bits(struct sbi_scratch *scratch); int sbi_hart_pmp_configure(struct sbi_scratch *scratch); -- cgit v1.3.1