summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2018-05-24 17:15:50 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-04-05 21:36:43 +0200
commitce3f458be48ac2eb86692c80887a837620c2bb6b (patch)
tree049c203dfdc57040a97f4ef0765cd49bde12feac
parentb89c939b0563cb0d4c385cd2760e1bddc63f95ea (diff)
spl: record boot_device into spl_image and call spl_perform_fixups
On some boards, we want to give the board/architecture-specific code a chance to look at where the next image has been loaded from and perform fixups before starting the next image. This is of particular importance, when we probe multiple devices for bootable payloads and boot the first one found. This change adds the following: - we record the boot_device used into the spl_image structure - we provide an extension-point for boards/architectures that can perform late fixups depending on a fully populated spl_image structure (i.e. we'll know the final boot_device and have info on the image type and operating system to be booted). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
-rw-r--r--common/spl/spl.c12
-rw-r--r--include/spl.h7
2 files changed, 18 insertions, 1 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 3f3497f8dd..6b4ed44d2c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -76,6 +76,11 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end)
}
#endif
+/* Weak default function for arch/board-specific fixups to the spl_image_info */
+void __weak spl_perform_fixups(struct spl_image_info *spl_image)
+{
+}
+
void spl_fixup_fdt(void)
{
#if defined(CONFIG_SPL_OF_LIBFDT) && defined(CONFIG_SYS_SPL_ARGS_ADDR)
@@ -352,8 +357,10 @@ static int boot_from_devices(struct spl_image_info *spl_image,
else
puts("SPL: Unsupported Boot Device!\n");
#endif
- if (loader && !spl_load_image(spl_image, loader))
+ if (loader && !spl_load_image(spl_image, loader)) {
+ spl_image->boot_device = spl_boot_list[i];
return 0;
+ }
}
return -ENODEV;
@@ -403,6 +410,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
#ifdef CONFIG_SYS_SPL_ARGS_ADDR
spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
#endif
+ spl_image.boot_device = BOOT_DEVICE_NONE;
board_boot_order(spl_boot_list);
if (boot_from_devices(&spl_image, spl_boot_list,
@@ -411,6 +419,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
hang();
}
+ spl_perform_fixups(&spl_image);
+
#ifdef CONFIG_CPU_V7M
spl_image.entry_point |= 0x1;
#endif
diff --git a/include/spl.h b/include/spl.h
index 308ce7b563..eefb6fe53c 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -28,6 +28,7 @@ struct spl_image_info {
#if CONFIG_IS_ENABLED(LOAD_FIT)
void *fdt_addr;
#endif
+ u32 boot_device;
u32 size;
u32 flags;
void *arg;
@@ -285,4 +286,10 @@ void spl_invoke_atf(struct spl_image_info *spl_image);
* can implement 'board_return_to_bootrom'.
*/
void board_return_to_bootrom(void);
+
+/**
+ * spl_perform_fixups() - arch/board-specific callback before processing
+ * the boot-payload
+ */
+void spl_perform_fixups(struct spl_image_info *spl_image);
#endif