]> git.sur5r.net Git - u-boot/commitdiff
spl: make image arg or fdt blob address reconfigurable
authorVikas Manocha <vikas.manocha@st.com>
Fri, 7 Apr 2017 22:38:13 +0000 (15:38 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 8 May 2017 15:38:40 +0000 (11:38 -0400)
At present fdt blob or argument address being passed to kernel is fixed at
compile time using macro CONFIG_SYS_SPL_ARGS_ADDR. FDT blob from
different media like nand, nor flash are copied to the address pointed
by the macro.
The problem is, it makes args/fdt blob compulsory to copy which is not required
in cases like for NOR Flash. This patch removes this limitation.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
arch/arm/lib/spl.c
arch/microblaze/cpu/spl.c
arch/powerpc/lib/spl.c
common/spl/spl.c
common/spl/spl_nor.c
include/spl.h

index e606d470e3809b5e8f4b529a24bd25621f096602..8ff2c5065ddeea7bb8d77b3c60bffe5474980da1 100644 (file)
@@ -44,22 +44,21 @@ void __weak board_init_f(ulong dummy)
 /*
  * This function jumps to an image with argument. Normally an FDT or ATAGS
  * image.
- * arg: Pointer to paramter image in RAM
  */
 #ifdef CONFIG_SPL_OS_BOOT
-void __noreturn jump_to_image_linux(struct spl_image_info *spl_image, void *arg)
+void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
 {
        unsigned long machid = 0xffffffff;
 #ifdef CONFIG_MACH_TYPE
        machid = CONFIG_MACH_TYPE;
 #endif
 
-       debug("Entering kernel arg pointer: 0x%p\n", arg);
+       debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);
        typedef void (*image_entry_arg_t)(int, int, void *)
                __attribute__ ((noreturn));
        image_entry_arg_t image_entry =
                (image_entry_arg_t)(uintptr_t) spl_image->entry_point;
        cleanup_before_linux();
-       image_entry(0, machid, arg);
+       image_entry(0, machid, spl_image->arg);
 }
 #endif
index 8e6d9269dac9d8f741792c042543c17d51e950c9..3d57a5a8593cb2d1c8726f4ca524d0dfd9badf91 100644 (file)
@@ -29,15 +29,15 @@ void spl_board_init(void)
 }
 
 #ifdef CONFIG_SPL_OS_BOOT
-void __noreturn jump_to_image_linux(struct spl_image_info *spl_image, void *arg)
+void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
 {
-       debug("Entering kernel arg pointer: 0x%p\n", arg);
+       debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);
        typedef void (*image_entry_arg_t)(char *, ulong, ulong)
                __attribute__ ((noreturn));
        image_entry_arg_t image_entry =
                (image_entry_arg_t)spl_image->entry_point;
 
-       image_entry(NULL, 0, (ulong)arg);
+       image_entry(NULL, 0, (ulong)spl_image->arg);
 }
 #endif /* CONFIG_SPL_OS_BOOT */
 
index 080b978799bcaa3e1ac7ec41d1c862934ab9eb5d..b93197030e3fd4d1de428313efe4a26fb7180c5e 100644 (file)
@@ -14,18 +14,18 @@ DECLARE_GLOBAL_DATA_PTR;
 /*
  * This function jumps to an image with argument. Normally an FDT or ATAGS
  * image.
- * arg: Pointer to paramter image in RAM
  */
 #ifdef CONFIG_SPL_OS_BOOT
-void __noreturn jump_to_image_linux(struct spl_image_info *spl_image, void *arg)
+void __noreturn jump_to_image_linux(struct spl_image_info *spl_image)
 {
-       debug("Entering kernel arg pointer: 0x%p\n", arg);
+       debug("Entering kernel arg pointer: 0x%p\n", spl_image->arg);
        typedef void (*image_entry_arg_t)(void *, ulong r4, ulong r5, ulong r6,
                                          ulong r7, ulong r8, ulong r9)
                __attribute__ ((noreturn));
        image_entry_arg_t image_entry =
                (image_entry_arg_t)spl_image->entry_point;
 
-       image_entry(arg, 0, 0, EPAPR_MAGIC, CONFIG_SYS_BOOTMAPSZ, 0, 0);
+       image_entry(spl_image->arg, 0, 0, EPAPR_MAGIC, CONFIG_SYS_BOOTMAPSZ,
+                   0, 0);
 }
 #endif /* CONFIG_SPL_OS_BOOT */
index a3e73b87bc6e2d19be43016193fdf67d85a80296..50828e6021812909c65aec01c1bc1d868ddf560d 100644 (file)
@@ -345,6 +345,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #endif
 
        memset(&spl_image, '\0', sizeof(spl_image));
+#ifdef CONFIG_SYS_SPL_ARGS_ADDR
+       spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+#endif
        board_boot_order(spl_boot_list);
 
        if (boot_from_devices(&spl_image, spl_boot_list,
@@ -361,8 +364,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
        case IH_OS_LINUX:
                debug("Jumping to Linux\n");
                spl_board_prepare_for_linux();
-               jump_to_image_linux(&spl_image,
-                                   (void *)CONFIG_SYS_SPL_ARGS_ADDR);
+               jump_to_image_linux(&spl_image);
 #endif
        default:
                debug("Unsupported OS image.. Jumping nevertheless..\n");
index d07ca84382468278e066f69598b6c490f3b68661..1ef8ac8b89b6332d2cd4c57390c3d58c175cb061 100644 (file)
@@ -39,13 +39,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
                                        sizeof(struct image_header)),
                               spl_image->size);
 
-                       /*
-                        * Copy DT blob (fdt) to SDRAM. Passing pointer to
-                        * flash doesn't work
-                        */
-                       memcpy((void *)CONFIG_SYS_SPL_ARGS_ADDR,
-                              (void *)(CONFIG_SYS_FDT_BASE),
-                              CONFIG_SYS_FDT_SIZE);
+                       spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
 
                        return 0;
                } else {
index 2e5b885c8d66062158a70d945fe609353e58a8be..d1638e9d7cb55d03f2722f22e6f3b6ed327dca74 100644 (file)
@@ -27,6 +27,7 @@ struct spl_image_info {
        ulong entry_point;
        u32 size;
        u32 flags;
+       void *arg;
 };
 
 /*
@@ -106,10 +107,8 @@ int spl_board_ubi_load_image(u32 boot_device);
  * This jumps into a Linux kernel using the information in @spl_image.
  *
  * @spl_image: Image description to set up
- * @arg: Argument to pass to Linux (typically a device tree pointer)
  */
-void __noreturn jump_to_image_linux(struct spl_image_info *spl_image,
-                                   void *arg);
+void __noreturn jump_to_image_linux(struct spl_image_info *spl_image);
 
 /**
  * spl_start_uboot() - Check if SPL should start the kernel or U-Boot