lib: sbi: Replace sbi_hart_pmp_xyz() and sbi_hart_map/unmap_addr()

The sbi_hart_pmp_xyz() and sbi_hart_map/unmap_addr() functions can
now be replaced by various sbi_hart_protection_xyz() functions.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20251209135235.423391-5-apatel@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Anup Patel
2025-12-09 19:22:34 +05:30
committed by Anup Patel
parent b6da690ffb
commit 42139bb9b7
9 changed files with 58 additions and 83 deletions

View File

@@ -561,39 +561,7 @@ static int sbi_hart_oldpmp_configure(struct sbi_scratch *scratch)
return 0;
}
int sbi_hart_map_saddr(unsigned long addr, unsigned long size)
{
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
/* If Smepmp is not supported no special mapping is required */
if (!sbi_hart_has_extension(scratch, SBI_HART_EXT_SMEPMP))
return SBI_OK;
return sbi_hart_smepmp_map_range(scratch, addr, size);
}
int sbi_hart_unmap_saddr(void)
{
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
if (!sbi_hart_has_extension(scratch, SBI_HART_EXT_SMEPMP))
return SBI_OK;
return sbi_hart_smepmp_unmap_range(scratch, 0, 0);
}
int sbi_hart_pmp_configure(struct sbi_scratch *scratch)
{
if (!sbi_hart_pmp_count(scratch))
return 0;
if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMEPMP))
return sbi_hart_smepmp_configure(scratch);
else
return sbi_hart_oldpmp_configure(scratch);
}
void sbi_hart_pmp_unconfigure(struct sbi_scratch *scratch)
static void sbi_hart_pmp_unconfigure(struct sbi_scratch *scratch)
{
int i, pmp_count = sbi_hart_pmp_count(scratch);