Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / riscv / lib / bootm.c
index f36b8702ef3d3067f034bf5dd5b55004896f6610..c4137ded834bf7e6d5c3c2a350227e8f00a9bc8b 100644 (file)
@@ -7,12 +7,17 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <dm.h>
+#include <fdt_support.h>
+#include <hang.h>
+#include <log.h>
 #include <dm/root.h>
 #include <image.h>
 #include <asm/byteorder.h>
 #include <asm/csr.h>
+#include <asm/smp.h>
 #include <dm/device.h>
 #include <dm/root.h>
 #include <u-boot/zlib.h>
@@ -23,11 +28,6 @@ __weak void board_quiesce_devices(void)
 {
 }
 
-int arch_fixup_fdt(void *blob)
-{
-       return 0;
-}
-
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *
@@ -81,6 +81,9 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
 {
        void (*kernel)(ulong hart, void *dtb);
        int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
+#ifdef CONFIG_SMP
+       int ret;
+#endif
 
        kernel = (void (*)(ulong, void *))images->ep;
 
@@ -92,12 +95,19 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
        announce_and_cleanup(fake);
 
        if (!fake) {
-               if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
+               if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
+#ifdef CONFIG_SMP
+                       ret = smp_call_function(images->ep,
+                                               (ulong)images->ft_addr, 0, 0);
+                       if (ret)
+                               hang();
+#endif
                        kernel(gd->arch.boot_hart, images->ft_addr);
+               }
        }
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[],
+int do_bootm_linux(int flag, int argc, char *const argv[],
                   bootm_headers_t *images)
 {
        /* No need for those on RISC-V */
@@ -119,7 +129,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
        return 0;
 }
 
-int do_bootm_vxworks(int flag, int argc, char * const argv[],
+int do_bootm_vxworks(int flag, int argc, char *const argv[],
                     bootm_headers_t *images)
 {
        return do_bootm_linux(flag, argc, argv, images);