aboutsummaryrefslogtreecommitdiff
path: root/common/spl/spl.c
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2015-11-08 17:11:49 +0200
committerTom Rini <trini@konsulko.com>2015-11-18 14:50:02 -0500
commit36afd451361dd4386c5527154d94bff4c6c538da (patch)
tree0b507fa7fe6b6a110f3bd319d3d8104f5105f7c3 /common/spl/spl.c
parent83cdf6faa677ff8ff39d7852126aad3207fac021 (diff)
downloadu-boot-36afd451361dd4386c5527154d94bff4c6c538da.zip
u-boot-36afd451361dd4386c5527154d94bff4c6c538da.tar.gz
u-boot-36afd451361dd4386c5527154d94bff4c6c538da.tar.bz2
spl: change return values of spl_*_load_image()
Make spl_*_load_image() functions return a value instead of hanging if a problem is encountered. This enables main spl code to make the decision whether to hang or not, thus preparing it to support alternative boot devices. Some boot devices (namely nand and spi) do not hang on error. Instead, they return normally and SPL proceeds to boot the contents of the load address. This is considered a bug and is rectified by hanging on error for these devices as well. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Ian Campbell <ijc@hellion.org.uk> Cc: Hans De Goede <hdegoede@redhat.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Jagan Teki <jteki@openedev.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/spl/spl.c')
-rw-r--r--common/spl/spl.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 4b319d6..ff1bad2 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -132,7 +132,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
}
#ifdef CONFIG_SPL_RAM_DEVICE
-static void spl_ram_load_image(void)
+static int spl_ram_load_image(void)
{
const struct image_header *header;
@@ -145,6 +145,8 @@ static void spl_ram_load_image(void)
(CONFIG_SYS_TEXT_BASE - sizeof(struct image_header));
spl_parse_image_header(header);
+
+ return 0;
}
#endif
@@ -208,68 +210,81 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
switch (boot_device) {
#ifdef CONFIG_SPL_RAM_DEVICE
case BOOT_DEVICE_RAM:
- spl_ram_load_image();
+ if (spl_ram_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_MMC_SUPPORT
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
case BOOT_DEVICE_MMC2_2:
- spl_mmc_load_image();
+ if (spl_mmc_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_NAND_SUPPORT
case BOOT_DEVICE_NAND:
- spl_nand_load_image();
+ if (spl_nand_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_ONENAND_SUPPORT
case BOOT_DEVICE_ONENAND:
- spl_onenand_load_image();
+ if (spl_onenand_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_NOR_SUPPORT
case BOOT_DEVICE_NOR:
- spl_nor_load_image();
+ if (spl_nor_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_YMODEM_SUPPORT
case BOOT_DEVICE_UART:
- spl_ymodem_load_image();
+ if (spl_ymodem_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_SPI_SUPPORT
case BOOT_DEVICE_SPI:
- spl_spi_load_image();
+ if (spl_spi_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_ETH_SUPPORT
case BOOT_DEVICE_CPGMAC:
#ifdef CONFIG_SPL_ETH_DEVICE
- spl_net_load_image(CONFIG_SPL_ETH_DEVICE);
+ if (spl_net_load_image(CONFIG_SPL_ETH_DEVICE))
+ hang();
#else
- spl_net_load_image(NULL);
+ if (spl_net_load_image(NULL))
+ hang();
#endif
break;
#endif
#ifdef CONFIG_SPL_USBETH_SUPPORT
case BOOT_DEVICE_USBETH:
- spl_net_load_image("usb_ether");
+ if (spl_net_load_image("usb_ether"))
+ hang();
break;
#endif
#ifdef CONFIG_SPL_USB_SUPPORT
case BOOT_DEVICE_USB:
- spl_usb_load_image();
+ if (spl_usb_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_SATA_SUPPORT
case BOOT_DEVICE_SATA:
- spl_sata_load_image();
+ if (spl_sata_load_image())
+ hang();
break;
#endif
#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
case BOOT_DEVICE_BOARD:
- spl_board_load_image();
+ if (spl_board_load_image())
+ hang();
break;
#endif
default: