blob: dc7577f751660dfdc744d316464b236ce01707c3 [file] [log] [blame]
Lukas Auer396f0bd2019-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 Glass63334482019-11-14 12:57:39 -07007#include <cpu_func.h>
Lukas Auer396f0bd2019-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
Lukas Auerc308e012019-12-08 23:28:51 +010044 ret = smp_call_function(spl_image->entry_point, (ulong)fdt_blob, 0, 0);
Lukas Auer396f0bd2019-08-21 21:14:45 +020045 if (ret)
46 hang();
47#endif
48 image_entry(gd->arch.boot_hart, fdt_blob);
49}