Merge tag 'u-boot-rockchip-20200501' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / arch / mips / lib / bootm.c
index 2b67905..f1db6d2 100644 (file)
@@ -1,11 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2003
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <env.h>
 #include <image.h>
 #include <fdt_support.h>
 #include <asm/addrspace.h>
@@ -80,7 +80,7 @@ static void linux_cmdline_legacy(bootm_headers_t *images)
 
        linux_cmdline_init();
 
-       bootargs = getenv("bootargs");
+       bootargs = env_get("bootargs");
        if (!bootargs)
                return;
 
@@ -202,11 +202,11 @@ static void linux_env_legacy(bootm_headers_t *images)
        sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize));
        linux_env_set("flash_size", env_buf);
 
-       cp = getenv("ethaddr");
+       cp = env_get("ethaddr");
        if (cp)
                linux_env_set("ethaddr", cp);
 
-       cp = getenv("eth1addr");
+       cp = env_get("eth1addr");
        if (cp)
                linux_env_set("eth1addr", cp);
 
@@ -216,23 +216,6 @@ static void linux_env_legacy(bootm_headers_t *images)
        }
 }
 
-static int boot_reloc_ramdisk(bootm_headers_t *images)
-{
-       ulong rd_len = images->rd_end - images->rd_start;
-
-       /*
-        * In case of legacy uImage's, relocation of ramdisk is already done
-        * by do_bootm_states() and should not repeated in 'bootm prep'.
-        */
-       if (images->state & BOOTM_STATE_RAMDISK) {
-               debug("## Ramdisk already relocated\n");
-               return 0;
-       }
-
-       return boot_ramdisk_high(&images->lmb, images->rd_start,
-               rd_len, &images->initrd_start, &images->initrd_end);
-}
-
 static int boot_reloc_fdt(bootm_headers_t *images)
 {
        /*
@@ -253,28 +236,26 @@ static int boot_reloc_fdt(bootm_headers_t *images)
 #endif
 }
 
+#if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
 int arch_fixup_fdt(void *blob)
 {
-#if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
        u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart);
        u64 mem_size = gd->ram_size;
 
        return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1);
-#else
-       return 0;
-#endif
 }
+#endif
 
 static int boot_setup_fdt(bootm_headers_t *images)
 {
+       images->initrd_start = virt_to_phys((void *)images->initrd_start);
+       images->initrd_end = virt_to_phys((void *)images->initrd_end);
        return image_setup_libfdt(images, images->ft_addr, images->ft_len,
                &images->lmb);
 }
 
 static void boot_prep_linux(bootm_headers_t *images)
 {
-       boot_reloc_ramdisk(images);
-
        if (CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && images->ft_len) {
                boot_reloc_fdt(images);
                boot_setup_fdt(images);
@@ -313,6 +294,9 @@ static void boot_jump_linux(bootm_headers_t *images)
        bootstage_report();
 #endif
 
+       if (CONFIG_IS_ENABLED(RESTORE_EXCEPTION_VECTOR_BASE))
+               trap_restore();
+
        if (images->ft_len)
                kernel(-2, (ulong)images->ft_addr, 0, 0);
        else