mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-05-23 14:21:32 +01:00
include: sbi: Add sbi_scratch_hartindex() macro
Add helper macro to extract hart index from scratch pointer. This can be used to check whether scratch pointer belongs to a particular hart or not. Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Link: https://lore.kernel.org/r/20260425104048.2335262-2-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -171,9 +171,11 @@ do { \
|
||||
= (__type)(__ptr); \
|
||||
} while (0)
|
||||
|
||||
/** Get the hart index of a particular sbi_scratch */
|
||||
#define sbi_scratch_hartindex(__scratch) ((__scratch)->hartindex)
|
||||
|
||||
/** Get the hart index of the current hart */
|
||||
#define current_hartindex() \
|
||||
(sbi_scratch_thishart_ptr()->hartindex)
|
||||
#define current_hartindex() sbi_scratch_hartindex(sbi_scratch_thishart_ptr())
|
||||
|
||||
/** Number of harts managed by this OpenSBI instance */
|
||||
extern u32 sbi_scratch_hart_count;
|
||||
|
||||
Reference in New Issue
Block a user