summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <[email protected]>2026-04-25 16:10:45 +0530
committerAnup Patel <[email protected]>2026-05-09 13:11:13 +0530
commitd8c7dc9cb038369b1ac92d3306476df6375e3037 (patch)
treefb80dbb18d50063fd8358d37a3317bd74811a3c7 /include
parentf34cf05347325515527ea9fdb658cf8063354aea (diff)
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 <[email protected]> Reviewed-by: Nicholas Piggin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_scratch.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
index a6edeb2d..06097c8a 100644
--- a/include/sbi/sbi_scratch.h
+++ b/include/sbi/sbi_scratch.h
@@ -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;