blob: c47dcd46ceaed6e1b8dd27484ab761ce9ed0c557 [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>
Simon Glassdb41d652019-12-28 10:45:07 -07008#include <hang.h>
Simon Glass691d7192020-05-10 11:40:02 -06009#include <init.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -060010#include <log.h>
Lukas Auer8c59f202019-08-21 21:14:45 +020011#include <spl.h>
12#include <asm/smp.h>
13
14DECLARE_GLOBAL_DATA_PTR;
15
16__weak void board_init_f(ulong dummy)
17{
18 int ret;
19
20 ret = spl_early_init();
21 if (ret)
22 panic("spl_early_init() failed: %d\n", ret);
23
24 arch_cpu_init_dm();
25
26 preloader_console_init();
27}
28
29void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
30{
31 typedef void __noreturn (*image_entry_riscv_t)(ulong hart, void *dtb);
32 void *fdt_blob;
33 int ret;
34
35#if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
36 fdt_blob = spl_image->fdt_addr;
37#else
38 fdt_blob = (void *)gd->fdt_blob;
39#endif
40
41 image_entry_riscv_t image_entry =
42 (image_entry_riscv_t)spl_image->entry_point;
43 invalidate_icache_all();
44
45 debug("image entry point: 0x%lX\n", spl_image->entry_point);
Bin Meng191636e2020-04-16 08:09:30 -070046#ifdef CONFIG_SPL_SMP
Lukas Auer90ae2812019-12-08 23:28:51 +010047 ret = smp_call_function(spl_image->entry_point, (ulong)fdt_blob, 0, 0);
Lukas Auer8c59f202019-08-21 21:14:45 +020048 if (ret)
49 hang();
50#endif
51 image_entry(gd->arch.boot_hart, fdt_blob);
52}