@@ -87,7 +87,7 @@ void spl_board_init(void)
}
}
-void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
+void __noreturn jump_to_image(struct spl_image_info *spl_image)
{
const char *fname = spl_image->arg;
@@ -238,7 +238,7 @@ int spl_spi_load_image(void)
}
#ifdef CONFIG_X86_RUN_64BIT
-void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
+void __noreturn jump_to_image(struct spl_image_info *spl_image)
{
int ret;
@@ -110,7 +110,7 @@ int spl_spi_load_image(void)
return -EPERM;
}
-void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
+void __noreturn jump_to_image(struct spl_image_info *spl_image)
{
debug("Jumping to %s at %lx\n", spl_phase_name(spl_next_phase()),
(ulong)spl_image->entry_point);
@@ -394,13 +394,33 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
{
- typedef void __noreturn (*image_entry_noargs_t)(void);
+ jump_to_image(spl_image);
+}
+
+__weak void __noreturn jump_to_image(struct spl_image_info *spl_image)
+{
+ typedef void __noreturn (*image_entry_t)(ulong bloblist,
+ ulong dtb_offset);
+ ulong bloblist = 0;
+ ulong dtb_offset = 0;
- image_entry_noargs_t image_entry =
- (image_entry_noargs_t)spl_image->entry_point;
+ image_entry_t image_entry = (image_entry_t)spl_image->entry_point;
debug("image entry point: 0x%lx\n", spl_image->entry_point);
- image_entry();
+
+ if (CONFIG_IS_ENABLED(PASSAGE_OUT)) {
+ const void *fdt;
+
+ bloblist = bloblist_get_base();
+ fdt = bloblist_find(BLOBLISTT_CONTROL_DTB, 0);
+ if (fdt)
+ dtb_offset = (ulong)fdt - (ulong)gd_bloblist();
+
+ log_debug("passage: sending bloblist at %lx, dtb offset %lx\n",
+ bloblist, dtb_offset);
+ }
+
+ image_entry(bloblist, dtb_offset);
}
#if CONFIG_IS_ENABLED(HANDOFF)
@@ -862,7 +882,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
#endif
spl_board_prepare_for_boot();
- jump_to_image_no_args(&spl_image);
+ jump_to_image(&spl_image);
}
/*
@@ -541,6 +541,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
#define gd_set_multi_dtb_fit(_dtb)
#endif
+#if CONFIG_IS_ENABLED(BLOBLIST)
+#define gd_bloblist() gd->bloblist
+#else
+#define gd_bloblist() NULL
+#endif
+
/**
* enum gd_flags - global data flags
*
@@ -581,6 +581,19 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
int spl_load_image_fat_os(struct spl_image_info *spl_image,
struct blk_desc *block_dev, int partition);
+/**
+ * jump_to_image() - Jump to image, using standard passage if enabled
+ *
+ * This sets the machine registers correctly if standard passage is enabled for
+ * output. This allows the target image to read the info using the standard
+ * passage protocol
+ *
+ * This is a weak function, so may be overriddden
+ *
+ * @spl_image: Image to jump to
+ */
+void __noreturn jump_to_image(struct spl_image_info *spl_image);
+
void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image);
/* SPL EXT image functions */
Update the jump routine to support passing three parameters instead of one. The two new parameters are the bloblist address and the offset from there to the devicetree. Add an accessor for gd->bloblist to avoid needing #ifdefs in the C code. Note that this renames jump_to_image_no_args() to jump_to_image(), so will not work on boards which have overridden that weak function. This can be tided up by maintainers as they enable the standard passage. Fix up a few that definitely need a tweak. Signed-off-by: Simon Glass <sjg@chromium.org> --- arch/sandbox/cpu/spl.c | 2 +- arch/x86/lib/spl.c | 2 +- arch/x86/lib/tpl.c | 2 +- common/spl/spl.c | 30 +++++++++++++++++++++++++----- include/asm-generic/global_data.h | 6 ++++++ include/spl.h | 13 +++++++++++++ 6 files changed, 47 insertions(+), 8 deletions(-)