]> Git Repo - u-boot.git/blame - arch/riscv/lib/spl.c
common: Drop asm/global_data.h from common header
[u-boot.git] / arch / riscv / lib / spl.c
CommitLineData
8c59f202
LA
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2019 Fraunhofer AISEC,
4 * Lukas Auer <[email protected]>
5 */
6#include <common.h>
1eb69ae4 7#include <cpu_func.h>
db41d65a 8#include <hang.h>
691d719d 9#include <init.h>
f7ae49fc 10#include <log.h>
8c59f202 11#include <spl.h>
401d1c4f 12#include <asm/global_data.h>
8c59f202
LA
13#include <asm/smp.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
71672b78
BM
17__weak int spl_board_init_f(void)
18{
19 return 0;
20}
21
8c59f202
LA
22__weak void board_init_f(ulong dummy)
23{
24 int ret;
25
26 ret = spl_early_init();
27 if (ret)
28 panic("spl_early_init() failed: %d\n", ret);
29
30 arch_cpu_init_dm();
31
32 preloader_console_init();
71672b78
BM
33
34 ret = spl_board_init_f();
35 if (ret)
36 panic("spl_board_init_f() failed: %d\n", ret);
8c59f202
LA
37}
38
39void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
40{
41 typedef void __noreturn (*image_entry_riscv_t)(ulong hart, void *dtb);
42 void *fdt_blob;
092f15ae 43 __maybe_unused int ret;
8c59f202
LA
44
45#if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
46 fdt_blob = spl_image->fdt_addr;
47#else
48 fdt_blob = (void *)gd->fdt_blob;
49#endif
50
51 image_entry_riscv_t image_entry =
52 (image_entry_riscv_t)spl_image->entry_point;
53 invalidate_icache_all();
54
55 debug("image entry point: 0x%lX\n", spl_image->entry_point);
191636e4 56#ifdef CONFIG_SPL_SMP
90ae2814 57 ret = smp_call_function(spl_image->entry_point, (ulong)fdt_blob, 0, 0);
8c59f202
LA
58 if (ret)
59 hang();
60#endif
61 image_entry(gd->arch.boot_hart, fdt_blob);
62}
This page took 0.064453 seconds and 4 git commands to generate.