spl: Pass spl_image as a parameter to load_image() methods

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>
This commit is contained in:
Simon Glass
2016-09-24 18:20:13 -06:00
committed by Tom Rini
parent 97d9df0a91
commit 2a2ee2ac35
15 changed files with 110 additions and 82 deletions

View 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);

View 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;