diff options
author | Pali Rohár <pali@kernel.org> | 2022-01-14 16:31:38 +0300 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2022-01-20 13:35:29 +0300 |
commit | 2e0429bcc1a9cf2c3b4cc0e8af7199f031a3b8e9 (patch) | |
tree | acf9804cf808bcacfec4984a8fbf63898fae28fe /common/spl | |
parent | 66f874855cc6e750e979a9e08bb96d0da38d534f (diff) | |
download | u-boot-2e0429bcc1a9cf2c3b4cc0e8af7199f031a3b8e9.tar.xz |
SPL: Add struct spl_boot_device parameter into spl_parse_board_header()
Add parameter spl_boot_device to spl_parse_board_header(), which allows
the implementations to see from which device we are booting and do
boot-device-specific checks of the image header.
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common/spl')
-rw-r--r-- | common/spl/spl.c | 4 | ||||
-rw-r--r-- | common/spl/spl_ext.c | 9 | ||||
-rw-r--r-- | common/spl/spl_fat.c | 11 | ||||
-rw-r--r-- | common/spl/spl_legacy.c | 3 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 43 | ||||
-rw-r--r-- | common/spl/spl_nand.c | 13 | ||||
-rw-r--r-- | common/spl/spl_net.c | 2 | ||||
-rw-r--r-- | common/spl/spl_nor.c | 4 | ||||
-rw-r--r-- | common/spl/spl_onenand.c | 2 | ||||
-rw-r--r-- | common/spl/spl_ram.c | 2 | ||||
-rw-r--r-- | common/spl/spl_sata.c | 9 | ||||
-rw-r--r-- | common/spl/spl_sdp.c | 2 | ||||
-rw-r--r-- | common/spl/spl_spi.c | 9 | ||||
-rw-r--r-- | common/spl/spl_ubi.c | 4 | ||||
-rw-r--r-- | common/spl/spl_usb.c | 4 | ||||
-rw-r--r-- | common/spl/spl_xip.c | 4 | ||||
-rw-r--r-- | common/spl/spl_ymodem.c | 4 |
17 files changed, 76 insertions, 53 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c index c5360f30ae..653e71f00c 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -312,6 +312,7 @@ static int spl_load_fit_image(struct spl_image_info *spl_image, #endif __weak int spl_parse_board_header(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev, const void *image_header, size_t size) { return -EINVAL; @@ -326,6 +327,7 @@ __weak int spl_parse_legacy_header(struct spl_image_info *spl_image, } int spl_parse_image_header(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev, const struct image_header *header) { #if CONFIG_IS_ENABLED(LOAD_FIT_FULL) @@ -369,7 +371,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image, } #endif - if (!spl_parse_board_header(spl_image, (const void *)header, sizeof(*header))) + if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header))) return 0; #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index 6a28fe9bdb..ebd914c492 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -10,6 +10,7 @@ #include <image.h> int spl_load_image_ext(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename) { @@ -46,7 +47,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image, goto end; } - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err < 0) { puts("spl: ext: failed to parse image header\n"); goto end; @@ -66,6 +67,7 @@ end: #if CONFIG_IS_ENABLED(OS_BOOT) int spl_load_image_ext_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { int err; @@ -103,7 +105,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image, } file = env_get("falcon_image_file"); if (file) { - err = spl_load_image_ext(spl_image, block_dev, + err = spl_load_image_ext(spl_image, bootdev, block_dev, partition, file); if (err != 0) { puts("spl: falling back to default\n"); @@ -134,11 +136,12 @@ defaults: return -1; } - return spl_load_image_ext(spl_image, block_dev, partition, + return spl_load_image_ext(spl_image, bootdev, block_dev, partition, CONFIG_SPL_FS_LOAD_KERNEL_NAME); } #else int spl_load_image_ext_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { return -ENOSYS; diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index 576c2e876a..5b270541fc 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -55,6 +55,7 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, } int spl_load_image_fat(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename) { @@ -76,7 +77,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0); if (err <= 0) goto end; - err = spl_parse_image_header(spl_image, + err = spl_parse_image_header(spl_image, bootdev, (struct image_header *)CONFIG_SYS_LOAD_ADDR); if (err == -EAGAIN) return err; @@ -94,7 +95,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, return spl_load_simple_fit(spl_image, &load, 0, header); } else { - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) goto end; @@ -114,6 +115,7 @@ end: #if CONFIG_IS_ENABLED(OS_BOOT) int spl_load_image_fat_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { int err; @@ -134,7 +136,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image, } file = env_get("falcon_image_file"); if (file) { - err = spl_load_image_fat(spl_image, block_dev, + err = spl_load_image_fat(spl_image, bootdev, block_dev, partition, file); if (err != 0) { puts("spl: falling back to default\n"); @@ -160,11 +162,12 @@ defaults: return -1; } - return spl_load_image_fat(spl_image, block_dev, partition, + return spl_load_image_fat(spl_image, bootdev, block_dev, partition, CONFIG_SPL_FS_LOAD_KERNEL_NAME); } #else int spl_load_image_fat_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { return -ENOSYS; diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index 82d0326806..2ec7154423 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -76,6 +76,7 @@ static inline int spl_image_get_comp(const struct image_header *hdr) } int spl_load_legacy_img(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct spl_load_info *load, ulong header) { __maybe_unused SizeT lzma_len; @@ -87,7 +88,7 @@ int spl_load_legacy_img(struct spl_image_info *spl_image, /* Read header into local struct */ load->read(load, header, sizeof(hdr), &hdr); - ret = spl_parse_image_header(spl_image, &hdr); + ret = spl_parse_image_header(spl_image, bootdev, &hdr); if (ret) return ret; diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index e1a7d25bd0..d550da2d97 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -17,7 +17,9 @@ #include <mmc.h> #include <image.h> -static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc, +static int mmc_load_legacy(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct mmc *mmc, ulong sector, struct image_header *header) { u32 image_offset_sectors; @@ -26,7 +28,7 @@ static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc, u32 image_offset; int ret; - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; @@ -77,6 +79,7 @@ static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part) static __maybe_unused int mmc_load_image_raw_sector(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc, unsigned long sector) { unsigned long count; @@ -116,7 +119,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, ret = spl_load_imx_container(spl_image, &load, sector); } else { - ret = mmc_load_legacy(spl_image, mmc, sector, header); + ret = mmc_load_legacy(spl_image, bootdev, mmc, sector, header); } end: @@ -181,6 +184,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc, int partition, unsigned long sector) { @@ -211,15 +215,16 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, } #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR - return mmc_load_image_raw_sector(spl_image, mmc, info.start + sector); + return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start + sector); #else - return mmc_load_image_raw_sector(spl_image, mmc, info.start); + return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start); #endif } #endif #if CONFIG_IS_ENABLED(OS_BOOT) static int mmc_load_image_raw_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc) { int ret; @@ -239,7 +244,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, } #endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */ - ret = mmc_load_image_raw_sector(spl_image, mmc, + ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc, CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR); if (ret) return ret; @@ -257,6 +262,7 @@ int spl_start_uboot(void) return 1; } static int mmc_load_image_raw_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc) { return -ENOSYS; @@ -264,20 +270,22 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, #endif #ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION -static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, +static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct mmc *mmc, const char *filename) { int err = -ENOSYS; #ifdef CONFIG_SPL_FS_FAT if (!spl_start_uboot()) { - err = spl_load_image_fat_os(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); if (!err) return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_fat(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, filename); if (!err) @@ -286,13 +294,13 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, #endif #ifdef CONFIG_SPL_FS_EXT4 if (!spl_start_uboot()) { - err = spl_load_image_ext_os(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); if (!err) return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_ext(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, filename); if (!err) @@ -307,7 +315,9 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, return err; } #else -static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, +static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct mmc *mmc, const char *filename) { return -ENOSYS; @@ -410,7 +420,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, debug("spl: mmc boot mode: raw\n"); if (!spl_start_uboot()) { - err = mmc_load_image_raw_os(spl_image, mmc); + err = mmc_load_image_raw_os(spl_image, bootdev, mmc); if (!err) return err; } @@ -418,13 +428,14 @@ int spl_mmc_load(struct spl_image_info *spl_image, raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect); #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION - err = mmc_load_image_raw_partition(spl_image, mmc, raw_part, + err = mmc_load_image_raw_partition(spl_image, bootdev, + mmc, raw_part, raw_sect); if (!err) return err; #endif #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR - err = mmc_load_image_raw_sector(spl_image, mmc, + err = mmc_load_image_raw_sector(spl_image, bootdev, mmc, raw_sect + spl_mmc_raw_uboot_offset(part)); if (!err) return err; @@ -433,7 +444,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, case MMCSD_MODE_FS: debug("spl: mmc boot mode: fs\n"); - err = spl_mmc_do_fs_boot(spl_image, mmc, filename); + err = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename); if (!err) return err; diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index 8ae7d04fa6..fc61b447a5 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -65,6 +65,7 @@ struct mtd_info * __weak nand_get_mtd(void) } static int spl_nand_load_element(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, int offset, struct image_header *header) { struct mtd_info *mtd = nand_get_mtd(); @@ -96,7 +97,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, load.read = spl_nand_fit_read; return spl_load_imx_container(spl_image, &load, offset / bl_len); } else { - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; return nand_spl_load_image(offset, spl_image->size, @@ -145,7 +146,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, /* 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, bootdev, header); if (err) return err; if (header->ih_os == IH_OS_LINUX) { @@ -165,18 +166,18 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, } #endif #ifdef CONFIG_NAND_ENV_DST - spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET, header); + spl_nand_load_element(spl_image, bootdev, CONFIG_ENV_OFFSET, header); #ifdef CONFIG_ENV_OFFSET_REDUND - spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET_REDUND, header); + spl_nand_load_element(spl_image, bootdev, CONFIG_ENV_OFFSET_REDUND, header); #endif #endif /* Load u-boot */ - err = spl_nand_load_element(spl_image, spl_nand_get_uboot_raw_page(), + err = spl_nand_load_element(spl_image, bootdev, spl_nand_get_uboot_raw_page(), 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(spl_image, + err = spl_nand_load_element(spl_image, bootdev, CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND, header); #endif diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c index d23b395ab9..a853e6aead 100644 --- a/common/spl/spl_net.c +++ b/common/spl/spl_net.c @@ -58,7 +58,7 @@ static int spl_net_load_image(struct spl_image_info *spl_image, } else { debug("Legacy image\n"); - rv = spl_parse_image_header(spl_image, header); + rv = spl_parse_image_header(spl_image, bootdev, header); if (rv) return rv; diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 68c12413fa..0f4fff8493 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -66,7 +66,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, /* happy - was a Linux */ int ret; - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; @@ -113,7 +113,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, if (IS_ENABLED(CONFIG_SPL_LEGACY_IMAGE_SUPPORT)) { load.bl_len = 1; load.read = spl_nor_load_read; - return spl_load_legacy_img(spl_image, &load, + return spl_load_legacy_img(spl_image, bootdev, &load, spl_nor_get_uboot_base()); } diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c index 93cbf47e82..f80769a027 100644 --- a/common/spl/spl_onenand.c +++ b/common/spl/spl_onenand.c @@ -27,7 +27,7 @@ static int spl_onenand_load_image(struct spl_image_info *spl_image, /* 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, bootdev, header); if (ret) return ret; onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c index df9f3a4d00..3f7f7accc1 100644 --- a/common/spl/spl_ram.c +++ b/common/spl/spl_ram.c @@ -70,7 +70,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, } header = (struct image_header *)map_sysmem(u_boot_pos, 0); - spl_parse_image_header(spl_image, header); + spl_parse_image_header(spl_image, bootdev, header); } return 0; diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index e9f6c5f050..1f3a144cdf 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -31,6 +31,7 @@ #endif static int spl_sata_load_image_raw(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *stor_dev, unsigned long sector) { struct image_header *header; @@ -45,7 +46,7 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image, if (count == 0) return -EIO; - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; @@ -90,18 +91,18 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, #if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || - spl_load_image_fat_os(spl_image, stor_dev, + spl_load_image_fat_os(spl_image, bootdev, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) #endif { err = -ENOSYS; if (IS_ENABLED(CONFIG_SPL_FS_FAT)) { - err = spl_load_image_fat(spl_image, stor_dev, + err = spl_load_image_fat(spl_image, bootdev, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); } else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) { - err = spl_sata_load_image_raw(spl_image, stor_dev, + err = spl_sata_load_image_raw(spl_image, bootdev, stor_dev, CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR); } } diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index ae9c09883a..36c31aff09 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -39,7 +39,7 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, * or it loads a FIT image and returns it to be handled by the SPL * code. */ - ret = spl_sdp_handle(controller_index, spl_image); + ret = spl_sdp_handle(controller_index, spl_image, bootdev); debug("SDP ended\n"); usb_gadget_release(controller_index); diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 4e20a23dea..cf3f7ef4c0 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -24,6 +24,7 @@ * the kernel and then device tree. */ static int spi_load_image_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct spi_flash *flash, struct image_header *header) { @@ -36,7 +37,7 @@ static int spi_load_image_os(struct spl_image_info *spl_image, if (image_get_magic(header) != IH_MAGIC) return -1; - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; @@ -108,7 +109,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, } #if CONFIG_IS_ENABLED(OS_BOOT) - if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header)) + if (spl_start_uboot() || spi_load_image_os(spl_image, bootdev, flash, header)) #endif { /* Load u-boot, mkimage header is 64 bytes. */ @@ -127,7 +128,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, (void *)CONFIG_SYS_LOAD_ADDR); if (err) return err; - err = spl_parse_image_header(spl_image, + err = spl_parse_image_header(spl_image, bootdev, (struct image_header *)CONFIG_SYS_LOAD_ADDR); } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) { @@ -154,7 +155,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, err = spl_load_imx_container(spl_image, &load, payload_offs); } else { - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; err = spi_flash_read(flash, payload_offs + spl_image->offset, diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c index 2f2d74a02d..bdf5cc4c38 100644 --- a/common/spl/spl_ubi.c +++ b/common/spl/spl_ubi.c @@ -55,7 +55,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image, 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, bootdev, header); puts("Linux loaded.\n"); goto out; } @@ -75,7 +75,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image, ret = ubispl_load_volumes(&info, volumes, 1); if (!ret) - spl_parse_image_header(spl_image, header); + spl_parse_image_header(spl_image, bootdev, header); out: #ifdef CONFIG_SPL_NAND_SUPPORT if (bootdev->boot_device == BOOT_DEVICE_NAND) diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index 67d503026c..ccf01c8276 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -49,10 +49,10 @@ int spl_usb_load(struct spl_image_info *spl_image, #if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || - spl_load_image_fat_os(spl_image, stor_dev, partition)) + spl_load_image_fat_os(spl_image, bootdev, stor_dev, partition)) #endif { - err = spl_load_image_fat(spl_image, stor_dev, partition, filename); + err = spl_load_image_fat(spl_image, bootdev, stor_dev, partition, filename); } if (err) { diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c index ba4af38a3e..33863fe7d4 100644 --- a/common/spl/spl_xip.c +++ b/common/spl/spl_xip.c @@ -24,7 +24,7 @@ static int spl_xip(struct spl_image_info *spl_image, return 0; } #endif - return(spl_parse_image_header(spl_image, (const struct image_header *) - CONFIG_SYS_UBOOT_BASE)); + return(spl_parse_image_header(spl_image, bootdev, + (const struct image_header *)CONFIG_SYS_UBOOT_BASE)); } SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip); diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index e979f780ad..047df74856 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -112,7 +112,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image, addr += res; } - ret = spl_parse_image_header(spl_image, ih); + ret = spl_parse_image_header(spl_image, bootdev, ih); if (ret) return ret; } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && @@ -135,7 +135,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image, size += res; } else { ih = (struct image_header *)buf; - ret = spl_parse_image_header(spl_image, ih); + ret = spl_parse_image_header(spl_image, bootdev, ih); if (ret) goto end_stream; #ifdef CONFIG_SPL_GZIP |