summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-03-26 16:05:38 +0300
committerAnup Patel <anup@brainfault.org>2020-03-28 11:02:41 +0300
commitdd0f21c560f7139fc0c30bea1c264d8cb09144fe (patch)
treefb5ab64dec0e8a39fe0036ff6def06d5dffb0a0f /include
parent5b6957eed75ca7842861e0f6765d0f6a64408e05 (diff)
downloadopensbi-dd0f21c560f7139fc0c30bea1c264d8cb09144fe.tar.xz
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>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_scratch.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
index e848900..8086207 100644
--- a/include/sbi/sbi_scratch.h
+++ b/include/sbi/sbi_scratch.h
@@ -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