spl: Plumb in the relocating loader
authorSimon Glass <sjg@chromium.org>
Thu, 16 Jan 2025 01:27:20 +0000 (18:27 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 22 Jan 2025 15:47:50 +0000 (09:47 -0600)
This is fairly easy to use. The SPL loader sets up some fields in the
spl_image_info struct and calls spl_reloc_prepare(). When SPL is ready
to do the jump it must call spl_reloc_jump() instead of jump_to_image().

Add this logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/spl/spl.c
include/spl.h

index 09e6dc2..7cfbab0 100644 (file)
@@ -826,6 +826,18 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
        }
 
        spl_board_prepare_for_boot();
+
+       if (CONFIG_IS_ENABLED(RELOC_LOADER)) {
+               int ret;
+
+               ret = spl_reloc_jump(&spl_image, jump_to_image);
+               if (ret) {
+                       if (xpl_phase() == PHASE_VPL)
+                               printf("jump failed %d\n", ret);
+                       hang();
+               }
+       }
+
        jump_to_image(&spl_image);
 }
 
index 9cfba98..7155e9c 100644 (file)
@@ -414,6 +414,7 @@ static inline void spl_load_init(struct spl_load_info *load,
        load->read = h_read;
        load->priv = priv;
        spl_set_bl_len(load, bl_len);
+       xpl_set_phase(load, IH_PHASE_NONE);
 }
 
 /*