blob: a544df0a2b1a648005cb49eeb93bdf59f8de405f [file] [log] [blame]
Lukas Auer8c59f202019-08-21 21:14:45 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2019 Fraunhofer AISEC,
4 * Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 */
6#include <common.h>
Simon Glass1eb69ae2019-11-14 12:57:39 -07007#include <cpu_func.h>
Lukas Auer8c59f202019-08-21 21:14:45 +02008#include <spl.h>
9#include <asm/smp.h>
10
11DECLARE_GLOBAL_DATA_PTR;
12
13__weak void board_init_f(ulong dummy)
14{
15 int ret;
16
17 ret = spl_early_init();
18 if (ret)
19 panic("spl_early_init() failed: %d\n", ret);
20
21 arch_cpu_init_dm();
22
23 preloader_console_init();
24}
25
26void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
27{
28 typedef void __noreturn (*image_entry_riscv_t)(ulong hart, void *dtb);
29 void *fdt_blob;
30 int ret;
31
32#if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
33 fdt_blob = spl_image->fdt_addr;
34#else
35 fdt_blob = (void *)gd->fdt_blob;
36#endif
37
38 image_entry_riscv_t image_entry =
39 (image_entry_riscv_t)spl_image->entry_point;
40 invalidate_icache_all();
41
42 debug("image entry point: 0x%lX\n", spl_image->entry_point);
43#ifdef CONFIG_SMP
44 ret = smp_call_function(spl_image->entry_point, (ulong)fdt_blob, 0);
45 if (ret)
46 hang();
47#endif
48 image_entry(gd->arch.boot_hart, fdt_blob);
49}