spl: Add a parameter to spl_set_header_raw_uboot()
authorSimon Glass <sjg@chromium.org>
Sun, 25 Sep 2016 00:19:52 +0000 (18:19 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 6 Oct 2016 18:48:15 +0000 (14:48 -0400)
Rather than act on the global variable, pass the required struct in as a
parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/spl/spl.c
common/spl/spl_nand.c
include/spl.h

index 57b73af4a740b5011264a5b928a53fd58122994a..b664cc7b21e8624d953e496c1d8dd53b13172e34 100644 (file)
@@ -82,13 +82,13 @@ __weak void spl_board_prepare_for_boot(void)
        /* Nothing to do! */
 }
 
-void spl_set_header_raw_uboot(void)
+void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 {
-       spl_image.size = CONFIG_SYS_MONITOR_LEN;
-       spl_image.entry_point = CONFIG_SYS_UBOOT_START;
-       spl_image.load_addr = CONFIG_SYS_TEXT_BASE;
-       spl_image.os = IH_OS_U_BOOT;
-       spl_image.name = "U-Boot";
+       spl_image->size = CONFIG_SYS_MONITOR_LEN;
+       spl_image->entry_point = CONFIG_SYS_UBOOT_START;
+       spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
+       spl_image->os = IH_OS_U_BOOT;
+       spl_image->name = "U-Boot";
 }
 
 int spl_parse_image_header(const struct image_header *header)
@@ -153,7 +153,7 @@ int spl_parse_image_header(const struct image_header *header)
                /* Signature not found - assume u-boot.bin */
                debug("mkimage signature not found - ih_magic = %x\n",
                        header->ih_magic);
-               spl_set_header_raw_uboot();
+               spl_set_header_raw_uboot(&spl_image);
 #endif
        }
        return 0;
index 0e35e0fd6b1901ceec13740d5571e68035738640..8f9bd5da333bb55c8d581d1b38e35b4f330b746a 100644 (file)
@@ -20,7 +20,7 @@ int spl_nand_load_image(void)
        nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
                            CONFIG_SYS_NAND_U_BOOT_SIZE,
                            (void *)CONFIG_SYS_NAND_U_BOOT_DST);
-       spl_set_header_raw_uboot();
+       spl_set_header_raw_uboot(&spl_image);
        nand_deselect();
 
        return 0;
index a597250e7c866050aef9c3ef8245045e1ddc9b64..c0c5f780178f5836d268fd9bd099c6297422b1a8 100644 (file)
@@ -67,7 +67,18 @@ extern struct spl_image_info spl_image;
 void preloader_console_init(void);
 u32 spl_boot_device(void);
 u32 spl_boot_mode(const u32 boot_device);
-void spl_set_header_raw_uboot(void);
+
+/**
+ * spl_set_header_raw_uboot() - Set up a standard SPL image structure
+ *
+ * This sets up the given spl_image which the standard values obtained from
+ * config options: CONFIG_SYS_MONITOR_LEN, CONFIG_SYS_UBOOT_START,
+ * CONFIG_SYS_TEXT_BASE.
+ *
+ * @spl_image: Image to set up
+ */
+void spl_set_header_raw_uboot(struct spl_image_info *spl_image);
+
 int spl_parse_image_header(const struct image_header *header);
 void spl_board_prepare_for_linux(void);
 void spl_board_prepare_for_boot(void);