lib: sbi_scratch: Introduce sbi_scratch_last_hartid() API

The patch adds sbi_scratch_last_hartid() API which returns
last HART id having a scratch space. We can use this new API
to optimize places where we iterate over HART id from 0 to
SBI_HARTMASK_MAX_BITS.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Anup Patel
2020-03-26 18:35:38 +05:30
committed by Anup Patel
parent 5b6957eed7
commit dd0f21c560
4 changed files with 13 additions and 4 deletions

View File

@@ -113,6 +113,12 @@ extern struct sbi_scratch *hartid_to_scratch_table[];
#define sbi_hartid_to_scratch(__hartid) \
hartid_to_scratch_table[__hartid]
/** Last HART id having a sbi_scratch pointer */
extern u32 last_hartid_having_scratch;
/** Get last HART id having a sbi_scratch pointer */
#define sbi_scratch_last_hartid() last_hartid_having_scratch
#endif
#endif