Lukas Auer | 396f0bd | 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> |
| 7 | #include <spl.h> |
| 8 | #include <asm/smp.h> |
| 9 | |
| 10 | DECLARE_GLOBAL_DATA_PTR; |
| 11 | |
| 12 | __weak void board_init_f(ulong dummy) |
| 13 | { |
| 14 | int ret; |
| 15 | |
| 16 | ret = spl_early_init(); |
| 17 | if (ret) |
| 18 | panic("spl_early_init() failed: %d\n", ret); |
| 19 | |
| 20 | arch_cpu_init_dm(); |
| 21 | |
| 22 | preloader_console_init(); |
| 23 | } |
| 24 | |
| 25 | void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) |
| 26 | { |
| 27 | typedef void __noreturn (*image_entry_riscv_t)(ulong hart, void *dtb); |
| 28 | void *fdt_blob; |
| 29 | int ret; |
| 30 | |
| 31 | #if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL) |
| 32 | fdt_blob = spl_image->fdt_addr; |
| 33 | #else |
| 34 | fdt_blob = (void *)gd->fdt_blob; |
| 35 | #endif |
| 36 | |
| 37 | image_entry_riscv_t image_entry = |
| 38 | (image_entry_riscv_t)spl_image->entry_point; |
| 39 | invalidate_icache_all(); |
| 40 | |
| 41 | debug("image entry point: 0x%lX\n", spl_image->entry_point); |
| 42 | #ifdef CONFIG_SMP |
| 43 | ret = smp_call_function(spl_image->entry_point, (ulong)fdt_blob, 0); |
| 44 | if (ret) |
| 45 | hang(); |
| 46 | #endif |
| 47 | image_entry(gd->arch.boot_hart, fdt_blob); |
| 48 | } |