summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_scratch.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-03-11 16:38:08 +0300
committerAnup Patel <anup@brainfault.org>2020-03-13 09:48:07 +0300
commitf92147c2b2fd01bd32debe4d6cb0375705dceeac (patch)
treefc13e8112f70b8788a5d0352fc35f97796ecfc2e /include/sbi/sbi_scratch.h
parentbaac7e066d1d1eabffa7f40ab7414c23b38b9fae (diff)
downloadopensbi-f92147c2b2fd01bd32debe4d6cb0375705dceeac.tar.xz
include: Make sbi_hart_id_to_scratch() as macro
The sbi_hart_id_to_scratch() just forwards call to firmware specific hartid_to_scratch() callback so we make sbi_hart_id_to_scratch() as macro in sbi_scratch.h instead of regular function in sbi_hart.c. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/sbi/sbi_scratch.h')
-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 1c85562..8960c02 100644
--- a/include/sbi/sbi_scratch.h
+++ b/include/sbi/sbi_scratch.h
@@ -103,6 +103,12 @@ void sbi_scratch_free_offset(unsigned long offset);
#define sbi_scratch_thishart_offset_ptr(offset) \
((void *)sbi_scratch_thishart_ptr() + (offset))
+typedef struct sbi_scratch *(*hartid2scratch)(ulong hartid);
+
+/** Get sbi_scratch from HART id */
+#define sbi_hart_id_to_scratch(__scratch, __hartid) \
+ ((hartid2scratch)(__scratch)->hartid_to_scratch)(__hartid)
+
#endif
#endif