summaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_init.c
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-03-14 07:27:45 +0300
committerAnup Patel <anup@brainfault.org>2020-03-19 06:32:23 +0300
commit87a7ef7659e27cdd5ef9a639cd68cf628be3d2d3 (patch)
treeac6ddd1dad09a1521dc8c439a7b1a6eca966c9da /lib/sbi/sbi_init.c
parent3f8d754c2c7f2937b10013ea2866d7e7ebfee60b (diff)
downloadopensbi-87a7ef7659e27cdd5ef9a639cd68cf628be3d2d3.tar.xz
lib: sbi_scratch: Introduce HART id to scratch table
Instead of calling hartid_to_scratch() callback every time when we want sbi_scratch pointer from HART id, we create a table of sbi_scratch pointers and use that to get sbi_scratch pointer. As a result of HART id to scratch table, the conversion of HART id to sbi_scratch pointer is just 2-3 instructions which was 9 instructions previously. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_init.c')
-rw-r--r--lib/sbi/sbi_init.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
index 11882d6..113987c 100644
--- a/lib/sbi/sbi_init.c
+++ b/lib/sbi/sbi_init.c
@@ -146,6 +146,11 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
unsigned long *init_count;
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ /* Note: This has to be first thing in coldboot init sequence */
+ rc = sbi_scratch_init(scratch);
+ if (rc)
+ sbi_hart_hang();
+
init_count_offset = sbi_scratch_alloc_offset(__SIZEOF_POINTER__,
"INIT_COUNT");
if (!init_count_offset)