summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2015-11-08 17:11:51 +0200
committerTom Rini <trini@konsulko.com>2015-11-18 14:50:03 -0500
commitf101e4bd37030930f19dc5108c59544b2ee25208 (patch)
tree535b01fe5553ed4b839aa4f5804e4233d6a0287e /common
parent5211b87e0c323e7474be9c817c9880f51459fbb9 (diff)
downloadblackbird-obmc-uboot-f101e4bd37030930f19dc5108c59544b2ee25208.tar.gz
blackbird-obmc-uboot-f101e4bd37030930f19dc5108c59544b2ee25208.zip
spl: add support for alternative boot device
Introduce spl_boot_list array, which defines a list of boot devices that SPL will try before hanging. By default this list will consist of only spl_boot_device(), but board_boot_order() can be overridden by board code to populate the array with custom values. 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> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 56fccca6d0..7913c527fd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -178,6 +178,23 @@ int spl_init(void)
return 0;
}
+#ifndef BOOT_DEVICE_NONE
+#define BOOT_DEVICE_NONE 0xdeadbeef
+#endif
+
+static u32 spl_boot_list[] = {
+ BOOT_DEVICE_NONE,
+ BOOT_DEVICE_NONE,
+ BOOT_DEVICE_NONE,
+ BOOT_DEVICE_NONE,
+ BOOT_DEVICE_NONE,
+};
+
+__weak void board_boot_order(u32 *spl_boot_list)
+{
+ spl_boot_list[0] = spl_boot_device();
+}
+
static int spl_load_image(u32 boot_device)
{
switch (boot_device) {
@@ -247,7 +264,7 @@ static int spl_load_image(u32 boot_device)
void board_init_r(gd_t *dummy1, ulong dummy2)
{
- u32 boot_device;
+ int i;
debug(">>spl:board_init_r()\n");
@@ -272,10 +289,18 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_board_init();
#endif
- boot_device = spl_boot_device();
- debug("boot device - %d\n", boot_device);
- if (spl_load_image(boot_device))
+ board_boot_order(spl_boot_list);
+ for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
+ spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
+ if (!spl_load_image(spl_boot_list[i]))
+ break;
+ }
+
+ if (i == ARRAY_SIZE(spl_boot_list) ||
+ spl_boot_list[i] == BOOT_DEVICE_NONE) {
+ puts("SPL: failed to boot from all boot devices\n");
hang();
+ }
switch (spl_image.os) {
case IH_OS_U_BOOT:
OpenPOWER on IntegriCloud