Lukas Auer | 8c59f20 | 2019-08-21 21:14:45 +0200 | [diff] [blame] | 1 | // 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 Glass | 1eb69ae | 2019-11-14 12:57:39 -0700 | [diff] [blame] | 7 | #include <cpu_func.h> |
Simon Glass | db41d65 | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 8 | #include <hang.h> |
Lukas Auer | 8c59f20 | 2019-08-21 21:14:45 +0200 | [diff] [blame] | 9 | #include <spl.h> |
| 10 | #include <asm/smp.h> |
| 11 | |
| 12 | DECLARE_GLOBAL_DATA_PTR; |
| 13 | |
| 14 | __weak void board_init_f(ulong dummy) |
| 15 | { |
| 16 | int ret; |
| 17 | |
| 18 | ret = spl_early_init(); |
| 19 | if (ret) |
| 20 | panic("spl_early_init() failed: %d\n", ret); |
| 21 | |
| 22 | arch_cpu_init_dm(); |
| 23 | |
| 24 | preloader_console_init(); |
| 25 | } |
| 26 | |
| 27 | void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) |
| 28 | { |
| 29 | typedef void __noreturn (*image_entry_riscv_t)(ulong hart, void *dtb); |
| 30 | void *fdt_blob; |
| 31 | int ret; |
| 32 | |
| 33 | #if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL) |
| 34 | fdt_blob = spl_image->fdt_addr; |
| 35 | #else |
| 36 | fdt_blob = (void *)gd->fdt_blob; |
| 37 | #endif |
| 38 | |
| 39 | image_entry_riscv_t image_entry = |
| 40 | (image_entry_riscv_t)spl_image->entry_point; |
| 41 | invalidate_icache_all(); |
| 42 | |
| 43 | debug("image entry point: 0x%lX\n", spl_image->entry_point); |
Bin Meng | 191636e | 2020-04-16 08:09:30 -0700 | [diff] [blame] | 44 | #ifdef CONFIG_SPL_SMP |
Lukas Auer | 90ae281 | 2019-12-08 23:28:51 +0100 | [diff] [blame] | 45 | ret = smp_call_function(spl_image->entry_point, (ulong)fdt_blob, 0, 0); |
Lukas Auer | 8c59f20 | 2019-08-21 21:14:45 +0200 | [diff] [blame] | 46 | if (ret) |
| 47 | hang(); |
| 48 | #endif |
| 49 | image_entry(gd->arch.boot_hart, fdt_blob); |
| 50 | } |