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>
unsigned long next_addr, unsigned long next_mode,
bool next_virt);
-struct sbi_scratch *sbi_hart_id_to_scratch(struct sbi_scratch *scratch,
- u32 hartid);
-
u32 sbi_current_hartid(void);
#endif
#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
__asm__ __volatile__("mret" : : "r"(a0), "r"(a1));
__builtin_unreachable();
}
-
-typedef struct sbi_scratch *(*h2s)(ulong hartid);
-
-struct sbi_scratch *sbi_hart_id_to_scratch(struct sbi_scratch *scratch,
- u32 hartid)
-{
- return ((h2s)scratch->hartid_to_scratch)(hartid);
-}