lib: sbi: Use sbi_hart_count() and sbi_for_each_hartindex()

Simplify the code and improve consistency by using the new macros where
possible. sbi_hart_count() obsoletes sbi_scratch_last_hartindex().

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2025-02-20 10:42:30 -08:00
committed by Anup Patel
parent 757f7acafd
commit 949c83a799
9 changed files with 11 additions and 24 deletions

View File

@@ -326,7 +326,7 @@ static inline u32 sbi_platform_tlb_fifo_num_entries(const struct sbi_platform *p
{
if (plat && sbi_platform_ops(plat)->get_tlb_num_entries)
return sbi_platform_ops(plat)->get_tlb_num_entries();
return sbi_scratch_last_hartindex() + 1;
return sbi_hart_count();
}
/**

View File

@@ -220,9 +220,6 @@ extern u32 sbi_scratch_hart_count;
#define sbi_for_each_hartindex(__var) \
for (u32 __var = 0; __var < sbi_hart_count(); ++__var)
/** Get last HART index having a sbi_scratch pointer */
#define sbi_scratch_last_hartindex() (sbi_hart_count() - 1)
/** Check whether a particular HART index is valid or not */
#define sbi_hartindex_valid(__hartindex) ((__hartindex) < sbi_hart_count())