spl: Pass spl_image as a parameter to load_image() methods
authorSimon Glass <sjg@chromium.org>
Sun, 25 Sep 2016 00:20:13 +0000 (18:20 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 6 Oct 2016 19:08:52 +0000 (15:08 -0400)
Rather than having a global variable, pass the spl_image as a parameter.
This avoids BSS use, and makes it clearer what the function is actually
doing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
15 files changed:
arch/arm/mach-sunxi/board.c
arch/arm/mach-uniphier/boot-mode/spl_board.c
arch/sandbox/cpu/spl.c
common/spl/spl.c
common/spl/spl_mmc.c
common/spl/spl_nand.c
common/spl/spl_net.c
common/spl/spl_nor.c
common/spl/spl_onenand.c
common/spl/spl_sata.c
common/spl/spl_spi.c
common/spl/spl_ubi.c
common/spl/spl_usb.c
common/spl/spl_ymodem.c
include/spl.h

index 22f3e3c11656ae0a495ab64f500e8510fa538f0f..7713813a68a8e6ee99beafaff1ce358973b197b3 100644 (file)
@@ -134,7 +134,8 @@ static int gpio_init(void)
 }
 
 #ifdef CONFIG_SPL_BUILD
-static int spl_board_load_image(struct spl_boot_device *bootdev)
+static int spl_board_load_image(struct spl_image_info *spl_image,
+                               struct spl_boot_device *bootdev)
 {
        debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr);
        return_to_fel(fel_stash.sp, fel_stash.lr);
index e2b202ea1dacc3c2d324662dfb6492b93d2070db..854ab056dad4abcac5d0b976b5deb706db44f38c 100644 (file)
@@ -65,7 +65,8 @@ int uniphier_rom_get_mmc_funcptr(int (**send_cmd)(u32, u32),
        return 0;
 }
 
-static int spl_board_load_image(struct spl_boot_device *bootdev)
+static int spl_board_load_image(struct spl_image_info *spl_image,
+                               struct spl_boot_device *bootdev)
 {
        int (*send_cmd)(u32 cmd, u32 arg);
        int (*card_blockaddr)(u32 rca);
@@ -113,12 +114,12 @@ static int spl_board_load_image(struct spl_boot_device *bootdev)
                return ret;
        }
 
-       ret = spl_parse_image_header(&spl_image, (void *)CONFIG_SYS_TEXT_BASE);
+       ret = spl_parse_image_header(spl_image, (void *)CONFIG_SYS_TEXT_BASE);
        if (ret)
                return ret;
 
-       ret = (*load_image)(dev_addr, spl_image.load_addr,
-                           spl_image.size / 512);
+       ret = (*load_image)(dev_addr, spl_image->load_addr,
+                           spl_image->size / 512);
        if (ret) {
                printf("failed to load image\n");
                return ret;
index 2c45354ca0e175e6ba7091b001a382103ccd4edb..1ad7fb6c60e8641878684490e909cea1030e81cb 100644 (file)
@@ -38,7 +38,8 @@ void spl_board_announce_boot_device(void)
        printf("%s\n", fname);
 }
 
-static int spl_board_load_image(struct spl_boot_device *bootdev)
+static int spl_board_load_image(struct spl_image_info *spl_image,
+                               struct spl_boot_device *bootdev)
 {
        char fname[256];
        int ret;
index 84c80345b695c41212916e3002f2e811ec380cf5..fae3dbc7190374b7c954c47623c2fc69d903eb0d 100644 (file)
@@ -185,7 +185,8 @@ static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
        return count;
 }
 
-static int spl_ram_load_image(struct spl_boot_device *bootdev)
+static int spl_ram_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        struct image_header *header;
 
@@ -215,7 +216,7 @@ static int spl_ram_load_image(struct spl_boot_device *bootdev)
                header = (struct image_header *)
                        (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header));
 
-               spl_parse_image_header(&spl_image, header);
+               spl_parse_image_header(spl_image, header);
        }
 
        return 0;
@@ -381,7 +382,7 @@ static int spl_load_image(u32 boot_device)
        bootdev.boot_device = boot_device;
        bootdev.boot_device_name = NULL;
        if (loader)
-               return loader->load_image(&bootdev);
+               return loader->load_image(&spl_image, &bootdev);
 
 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
        puts("SPL: Unsupported Boot Device!\n");
index 5e8172e5bf9eea81bf5ea2b038874443fde62e46..6536e66ab0c268be3f5a2cc8d8b329d42061ed89 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int mmc_load_legacy(struct mmc *mmc, ulong sector,
-                          struct image_header *header)
+static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc,
+                          ulong sector, struct image_header *header)
 {
        u32 image_size_sectors;
        unsigned long count;
        int ret;
 
-       ret = spl_parse_image_header(&spl_image, header);
+       ret = spl_parse_image_header(spl_image, header);
        if (ret)
                return ret;
 
        /* convert size to sectors - round up */
-       image_size_sectors = (spl_image.size + mmc->read_bl_len - 1) /
+       image_size_sectors = (spl_image->size + mmc->read_bl_len - 1) /
                             mmc->read_bl_len;
 
        /* Read the header too to avoid extra memcpy */
        count = blk_dread(mmc_get_blk_desc(mmc), sector, image_size_sectors,
-                         (void *)(ulong)spl_image.load_addr);
+                         (void *)(ulong)spl_image->load_addr);
        debug("read %x sectors to %x\n", image_size_sectors,
-             spl_image.load_addr);
+             spl_image->load_addr);
        if (count != image_size_sectors)
                return -EIO;
 
@@ -52,7 +52,8 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
        return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
 }
 
-static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
+static int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
+                                    struct mmc *mmc, unsigned long sector)
 {
        unsigned long count;
        struct image_header *header;
@@ -81,7 +82,7 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(&load, sector, header);
        } else {
-               ret = mmc_load_legacy(mmc, sector, header);
+               ret = mmc_load_legacy(spl_image, mmc, sector, header);
        }
 
 end:
@@ -150,7 +151,8 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
 }
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
-static int mmc_load_image_raw_partition(struct mmc *mmc, int partition)
+static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
+                                       struct mmc *mmc, int partition)
 {
        disk_partition_t info;
        int err;
@@ -164,22 +166,24 @@ static int mmc_load_image_raw_partition(struct mmc *mmc, int partition)
        }
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
-       return mmc_load_image_raw_sector(mmc, info.start +
-                                        CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+       return mmc_load_image_raw_sector(spl_image, mmc,
+                       info.start + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
 #else
-       return mmc_load_image_raw_sector(mmc, info.start);
+       return mmc_load_image_raw_sector(spl_image, mmc, info.start);
 #endif
 }
 #else
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION -1
-static int mmc_load_image_raw_partition(struct mmc *mmc, int partition)
+static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
+                                       struct mmc *mmc, int partition)
 {
        return -ENOSYS;
 }
 #endif
 
 #ifdef CONFIG_SPL_OS_BOOT
-static int mmc_load_image_raw_os(struct mmc *mmc)
+static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
+                                struct mmc *mmc)
 {
        unsigned long count;
        int ret;
@@ -195,12 +199,12 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
                return -1;
        }
 
-       ret = mmc_load_image_raw_sector(mmc,
+       ret = mmc_load_image_raw_sector(spl_image, mmc,
                CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
        if (ret)
                return ret;
 
-       if (spl_image.os != IH_OS_LINUX) {
+       if (spl_image->os != IH_OS_LINUX) {
                puts("Expected Linux image is not found. Trying to start U-boot\n");
                return -ENOENT;
        }
@@ -212,14 +216,15 @@ int spl_start_uboot(void)
 {
        return 1;
 }
-static int mmc_load_image_raw_os(struct mmc *mmc)
+static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
+                                struct mmc *mmc)
 {
        return -ENOSYS;
 }
 #endif
 
 #ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
-int spl_mmc_do_fs_boot(struct mmc *mmc)
+static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 {
        int err = -ENOSYS;
 
@@ -261,13 +266,14 @@ int spl_mmc_do_fs_boot(struct mmc *mmc)
        return err;
 }
 #else
-int spl_mmc_do_fs_boot(struct mmc *mmc)
+static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 {
        return -ENOSYS;
 }
 #endif
 
-static int spl_mmc_load_image(struct spl_boot_device *bootdev)
+static int spl_mmc_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        struct mmc *mmc = NULL;
        u32 boot_mode;
@@ -312,17 +318,17 @@ static int spl_mmc_load_image(struct spl_boot_device *bootdev)
                debug("spl: mmc boot mode: raw\n");
 
                if (!spl_start_uboot()) {
-                       err = mmc_load_image_raw_os(mmc);
+                       err = mmc_load_image_raw_os(spl_image, mmc);
                        if (!err)
                                return err;
                }
 
-               err = mmc_load_image_raw_partition(mmc,
+               err = mmc_load_image_raw_partition(spl_image, mmc,
                        CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
                if (!err)
                        return err;
 #if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR)
-               err = mmc_load_image_raw_sector(mmc,
+               err = mmc_load_image_raw_sector(spl_image, mmc,
                        CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
                if (!err)
                        return err;
@@ -331,7 +337,7 @@ static int spl_mmc_load_image(struct spl_boot_device *bootdev)
        case MMCSD_MODE_FS:
                debug("spl: mmc boot mode: fs\n");
 
-               err = spl_mmc_do_fs_boot(mmc);
+               err = spl_mmc_do_fs_boot(spl_image, mmc);
                if (!err)
                        return err;
 
index ed758e518ca8adf8d8d29ebdb068c65f79f95698..5cf712e29aff64f98b1b3d3bc7a635f38c653f20 100644 (file)
 #include <fdt.h>
 
 #if defined(CONFIG_SPL_NAND_RAW_ONLY)
-int spl_nand_load_image(struct spl_boot_device *bootdev)
+int spl_nand_load_image(struct spl_image_info *spl_image,
+                       struct spl_boot_device *bootdev)
 {
        nand_init();
 
        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_image);
+       spl_set_header_raw_uboot(spl_image);
        nand_deselect();
 
        return 0;
@@ -39,7 +40,8 @@ static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
                return 0;
 }
 
-static int spl_nand_load_element(int offset, struct image_header *header)
+static int spl_nand_load_element(struct spl_image_info *spl_image,
+                                int offset, struct image_header *header)
 {
        int err;
 
@@ -59,15 +61,16 @@ static int spl_nand_load_element(int offset, struct image_header *header)
                load.read = spl_nand_fit_read;
                return spl_load_simple_fit(&load, offset, header);
        } else {
-               err = spl_parse_image_header(&spl_image, header);
+               err = spl_parse_image_header(spl_image, header);
                if (err)
                        return err;
-               return nand_spl_load_image(offset, spl_image.size,
-                                          (void *)(ulong)spl_image.load_addr);
+               return nand_spl_load_image(offset, spl_image->size,
+                                          (void *)(ulong)spl_image->load_addr);
        }
 }
 
-static int spl_nand_load_image(struct spl_boot_device *bootdev)
+static int spl_nand_load_image(struct spl_image_info *spl_image,
+                              struct spl_boot_device *bootdev)
 {
        int err;
        struct image_header *header;
@@ -107,15 +110,15 @@ static int spl_nand_load_image(struct spl_boot_device *bootdev)
                /* load linux */
                nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
                        sizeof(*header), (void *)header);
-               err = spl_parse_image_header(&spl_image, header);
+               err = spl_parse_image_header(spl_image, header);
                if (err)
                        return err;
                if (header->ih_os == IH_OS_LINUX) {
                        /* happy - was a linux */
                        err = nand_spl_load_image(
                                CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
-                               spl_image.size,
-                               (void *)spl_image.load_addr);
+                               spl_image->size,
+                               (void *)spl_image->load_addr);
                        nand_deselect();
                        return err;
                } else {
@@ -127,17 +130,19 @@ static int spl_nand_load_image(struct spl_boot_device *bootdev)
        }
 #endif
 #ifdef CONFIG_NAND_ENV_DST
-       spl_nand_load_element(CONFIG_ENV_OFFSET, header);
+       spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET, header);
 #ifdef CONFIG_ENV_OFFSET_REDUND
-       spl_nand_load_element(CONFIG_ENV_OFFSET_REDUND, header);
+       spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET_REDUND, header);
 #endif
 #endif
        /* Load u-boot */
-       err = spl_nand_load_element(CONFIG_SYS_NAND_U_BOOT_OFFS, header);
+       err = spl_nand_load_element(spl_image, CONFIG_SYS_NAND_U_BOOT_OFFS,
+                                   header);
 #ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
 #if CONFIG_SYS_NAND_U_BOOT_OFFS != CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
        if (err)
-               err = spl_nand_load_element(CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND,
+               err = spl_nand_load_element(spl_image,
+                                           CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND,
                                            header);
 #endif
 #endif
index 0cbd995d11238ac7b224c8534eebf213f700d4f7..f4b4bc483397fc6104922f56de014c5408e2435c 100644 (file)
@@ -15,7 +15,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USBETH_SUPPORT)
-static int spl_net_load_image(struct spl_boot_device *bootdev)
+static int spl_net_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        int rv;
 
@@ -35,29 +36,31 @@ static int spl_net_load_image(struct spl_boot_device *bootdev)
                printf("Problem booting with BOOTP\n");
                return rv;
        }
-       return spl_parse_image_header(&spl_image,
+       return spl_parse_image_header(spl_image,
                                      (struct image_header *)load_addr);
 }
 #endif
 
 #ifdef CONFIG_SPL_ETH_SUPPORT
-int spl_net_load_image_cpgmac(struct spl_boot_device *bootdev)
+int spl_net_load_image_cpgmac(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
 #ifdef CONFIG_SPL_ETH_DEVICE
        bootdev->boot_device_name = CONFIG_SPL_ETH_DEVICE;
 #endif
 
-       return spl_net_load_image(bootdev);
+       return spl_net_load_image(spl_image, bootdev);
 }
 SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_CPGMAC, spl_net_load_image_cpgmac);
 #endif
 
 #ifdef CONFIG_SPL_USBETH_SUPPORT
-int spl_net_load_image_usb(struct spl_boot_device *bootdev)
+int spl_net_load_image_usb(struct spl_image_info *spl_image,
+                          struct spl_boot_device *bootdev)
 {
        bootdev->boot_device_name = "usb_ether";
 
-       return spl_net_load_image(bootdev);
+       return spl_net_load_image(spl_image, bootdev);
 }
 SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
 #endif
index b55fcc5cdb75ec11ff3c04bc502b17493139cf84..6bfa399bacef083ab5ff6c83eec70b140d2918ae 100644 (file)
@@ -7,14 +7,15 @@
 #include <common.h>
 #include <spl.h>
 
-static int spl_nor_load_image(struct spl_boot_device *bootdev)
+static int spl_nor_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        int ret;
        /*
         * Loading of the payload to SDRAM is done with skipping of
         * the mkimage header in this SPL NOR driver
         */
-       spl_image.flags |= SPL_COPY_PAYLOAD_ONLY;
+       spl_image->flags |= SPL_COPY_PAYLOAD_ONLY;
 
 #ifdef CONFIG_SPL_OS_BOOT
        if (!spl_start_uboot()) {
@@ -29,14 +30,14 @@ static int spl_nor_load_image(struct spl_boot_device *bootdev)
                if (image_get_os(header) == IH_OS_LINUX) {
                        /* happy - was a Linux */
 
-                       ret = spl_parse_image_header(&spl_image, header);
+                       ret = spl_parse_image_header(spl_image, header);
                        if (ret)
                                return ret;
 
-                       memcpy((void *)spl_image.load_addr,
+                       memcpy((void *)spl_image->load_addr,
                               (void *)(CONFIG_SYS_OS_BASE +
                                        sizeof(struct image_header)),
-                              spl_image.size);
+                              spl_image->size);
 
                        /*
                         * Copy DT blob (fdt) to SDRAM. Passing pointer to
@@ -59,14 +60,14 @@ static int spl_nor_load_image(struct spl_boot_device *bootdev)
         * Load real U-Boot from its location in NOR flash to its
         * defined location in SDRAM
         */
-       ret = spl_parse_image_header(&spl_image,
+       ret = spl_parse_image_header(spl_image,
                        (const struct image_header *)CONFIG_SYS_UBOOT_BASE);
        if (ret)
                return ret;
 
-       memcpy((void *)(unsigned long)spl_image.load_addr,
+       memcpy((void *)(unsigned long)spl_image->load_addr,
               (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)),
-              spl_image.size);
+              spl_image->size);
 
        return 0;
 }
index 361a1b34dbe2ac02a45e2ad979010bc9115a60a7..f076e2c7c8846902c526ad3481c0d923e98af5bd 100644 (file)
@@ -14,7 +14,8 @@
 #include <asm/io.h>
 #include <onenand_uboot.h>
 
-static int spl_onenand_load_image(struct spl_boot_device *bootdev)
+static int spl_onenand_load_image(struct spl_image_info *spl_image,
+                                 struct spl_boot_device *bootdev)
 {
        struct image_header *header;
        int ret;
@@ -26,11 +27,11 @@ static int spl_onenand_load_image(struct spl_boot_device *bootdev)
        /* Load u-boot */
        onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
                CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
-       ret = spl_parse_image_header(&spl_image, header);
+       ret = spl_parse_image_header(spl_image, header);
        if (ret)
                return ret;
        onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
-               spl_image.size, (void *)spl_image.load_addr);
+               spl_image->size, (void *)spl_image->load_addr);
 
        return 0;
 }
index 1a21c051a10b38c8f08e53142f464cd26c610b36..19b5ba519987164f931485815ad09b78da0dddf8 100644 (file)
@@ -20,7 +20,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int spl_sata_load_image(struct spl_boot_device *bootdev)
+static int spl_sata_load_image(struct spl_image_info *spl_image,
+                              struct spl_boot_device *bootdev)
 {
        int err;
        struct blk_desc *stor_dev;
index b9294f201ee65fa3c4b5cedc185364835704f656..4bf3d659675fd65396e4343579fc2991c379f35c 100644 (file)
@@ -20,7 +20,8 @@
  * Load the kernel, check for a valid header we can parse, and if found load
  * the kernel and then device tree.
  */
-static int spi_load_image_os(struct spi_flash *flash,
+static int spi_load_image_os(struct spl_image_info *spl_image,
+                            struct spi_flash *flash,
                             struct image_header *header)
 {
        int err;
@@ -32,12 +33,12 @@ static int spi_load_image_os(struct spi_flash *flash,
        if (image_get_magic(header) != IH_MAGIC)
                return -1;
 
-       err = spl_parse_image_header(&spl_image, header);
+       err = spl_parse_image_header(spl_image, header);
        if (err)
                return err;
 
        spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS,
-                      spl_image.size, (void *)spl_image.load_addr);
+                      spl_image->size, (void *)spl_image->load_addr);
 
        /* Read device tree. */
        spi_flash_read(flash, CONFIG_SYS_SPI_ARGS_OFFS,
@@ -65,7 +66,8 @@ static ulong spl_spi_fit_read(struct spl_load_info *load, ulong sector,
  * configured and available since this code loads the main U-Boot image
  * from SPI into SDRAM and starts it from there.
  */
-static int spl_spi_load_image(struct spl_boot_device *bootdev)
+static int spl_spi_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        int err = 0;
        struct spi_flash *flash;
@@ -88,7 +90,7 @@ static int spl_spi_load_image(struct spl_boot_device *bootdev)
        header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
 
 #ifdef CONFIG_SPL_OS_BOOT
-       if (spl_start_uboot() || spi_load_image_os(flash, header))
+       if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header))
 #endif
        {
                /* Load u-boot, mkimage header is 64 bytes. */
@@ -110,12 +112,12 @@ static int spl_spi_load_image(struct spl_boot_device *bootdev)
                                                  CONFIG_SYS_SPI_U_BOOT_OFFS,
                                                  header);
                } else {
-                       err = spl_parse_image_header(&spl_image, header);
+                       err = spl_parse_image_header(spl_image, header);
                        if (err)
                                return err;
                        err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS,
-                                            spl_image.size,
-                                            (void *)spl_image.load_addr);
+                                            spl_image->size,
+                                            (void *)spl_image->load_addr);
                }
        }
 
index 3ef00aa0b08744ffb2905f71ebf0080df26b4141..c03910bb40809fa39462cf11d9b8a868f86101c7 100644 (file)
@@ -12,7 +12,8 @@
 #include <ubispl.h>
 #include <spl.h>
 
-int spl_ubi_load_image(struct spl_boot_device *bootdev)
+int spl_ubi_load_image(struct spl_image_info *spl_image,
+                      struct spl_boot_device *bootdev)
 {
        struct image_header *header;
        struct ubispl_info info;
@@ -54,7 +55,7 @@ int spl_ubi_load_image(struct spl_boot_device *bootdev)
                ret = ubispl_load_volumes(&info, volumes, 2);
                if (!ret) {
                        header = (struct image_header *)volumes[0].load_addr;
-                       spl_parse_image_header(&spl_image, header);
+                       spl_parse_image_header(spl_image, header);
                        puts("Linux loaded.\n");
                        goto out;
                }
@@ -68,7 +69,7 @@ int spl_ubi_load_image(struct spl_boot_device *bootdev)
 
        ret = ubispl_load_volumes(&info, volumes, 1);
        if (!ret)
-               spl_parse_image_header(&spl_image, header);
+               spl_parse_image_header(spl_image, header);
 out:
 #ifdef CONFIG_SPL_NAND_SUPPORT
        if (bootdev->boot_device == BOOT_DEVICE_NAND)
index 2bc321ac5bda397f489082b4b01596581d1f5680..aaa4f8103fa430474a05514ef726b0a9bbe40851 100644 (file)
@@ -22,7 +22,8 @@ DECLARE_GLOBAL_DATA_PTR;
 static int usb_stor_curr_dev = -1; /* current device */
 #endif
 
-static int spl_usb_load_image(struct spl_boot_device *bootdev)
+static int spl_usb_load_image(struct spl_image_info *spl_image,
+                             struct spl_boot_device *bootdev)
 {
        int err;
        struct blk_desc *stor_dev;
index 168b9511d9e60975d36b0c0bc0381070aaa84df7..8fbf8958a13409934b8bd05899f4bcdf7179972b 100644 (file)
@@ -68,7 +68,8 @@ static ulong ymodem_read_fit(struct spl_load_info *load, ulong offset,
        return size;
 }
 
-static int spl_ymodem_load_image(struct spl_boot_device *bootdev)
+static int spl_ymodem_load_image(struct spl_image_info *spl_image,
+                                struct spl_boot_device *bootdev)
 {
        int size = 0;
        int err;
@@ -108,12 +109,12 @@ static int spl_ymodem_load_image(struct spl_boot_device *bootdev)
                while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0)
                        size += res;
        } else {
-               spl_parse_image_header(&spl_image, (struct image_header *)buf);
-               ret = spl_parse_image_header(&spl_image,
+               spl_parse_image_header(spl_image, (struct image_header *)buf);
+               ret = spl_parse_image_header(spl_image,
                                             (struct image_header *)buf);
                if (ret)
                        return ret;
-               addr = spl_image.load_addr;
+               addr = spl_image->load_addr;
                memcpy((void *)addr, buf, res);
                size += res;
                addr += res;
index 895240d28e028fc0ddc645a0d077e2110e563513..dd1d6099ce23959c230d43938c9e92e314ac8461 100644 (file)
@@ -160,9 +160,11 @@ struct spl_image_loader {
        /**
         * load_image() - Load an SPL image
         *
+        * @spl_image: place to put image information
         * @bootdev: describes the boot device to load from
         */
-       int (*load_image)(struct spl_boot_device *bootdev);
+       int (*load_image)(struct spl_image_info *spl_image,
+                         struct spl_boot_device *bootdev);
 };
 
 /* Declare an SPL image loader */