spl.c 1.1 KB

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