]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
riscv: Call bootm_final()
authorSimon Glass <simon.glass@canonical.com>
Fri, 6 Mar 2026 02:36:15 +0000 (19:36 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 18 Mar 2026 19:17:34 +0000 (13:17 -0600)
The RISC-V announce_and_cleanup() duplicates the common pre-boot
steps. Replace it with a call to bootm_final().

Move board_quiesce_devices() into bootm_final() so it is available to
all architectures. Drop the RISC-V weak definition and header
declaration since the generic one in bootm.h is used instead.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/riscv/include/asm/u-boot-riscv.h
arch/riscv/lib/bootm.c
boot/bootm.c

index 543a1688db8fc6a10766d0f66d856644fd01758a..3a8fdb57136155e4153f141ecb839b687218f86f 100644 (file)
@@ -16,7 +16,6 @@ int cleanup_before_linux(void);
 
 /* board/.../... */
 int board_init(void);
-void board_quiesce_devices(void);
 int riscv_board_reserved_mem_fixup(void *fdt);
 int riscv_fdt_copy_resv_mem_node(const void *src_fdt, void *dest_fdt);
 
index 9544907ab1ebe0d7c0f35f71ba0360c06e762e0a..69c9ca5c487188b81a467c9d7c8105a85d6c1964 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-__weak void board_quiesce_devices(void)
-{
-}
-
-/**
- * announce_and_cleanup() - Print message and prepare for kernel boot
- *
- * @fake: non-zero to do everything except actually boot
- */
-static void announce_and_cleanup(int fake)
-{
-       printf("\nStarting kernel ...%s\n\n", fake ?
-               "(fake run for tracing)" : "");
-       bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_FDT
-       bootstage_fdt_add_report();
-#endif
-#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
-       bootstage_report();
-#endif
-
-       board_quiesce_devices();
-
-       /*
-        * Call remove function of all devices with a removal flag set.
-        * This may be useful for last-stage operations, like cancelling
-        * of DMA operation or releasing device internal buffers.
-        */
-       dm_remove_devices_active();
-
-       cleanup_before_linux();
-}
-
 static void boot_prep_linux(struct bootm_headers *images)
 {
        if (CONFIG_IS_ENABLED(OF_LIBFDT) && IS_ENABLED(CONFIG_LMB) && images->ft_len) {
@@ -75,7 +42,6 @@ static void boot_prep_linux(struct bootm_headers *images)
 static void boot_jump_linux(struct bootm_headers *images, int flag)
 {
        void (*kernel)(ulong hart, void *dtb);
-       int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
 #ifdef CONFIG_SMP
        int ret;
 #endif
@@ -87,9 +53,10 @@ static void boot_jump_linux(struct bootm_headers *images, int flag)
        debug("## Transferring control to kernel (at address %08lx) ...\n",
              (ulong)kernel);
 
-       announce_and_cleanup(fake);
+       bootm_final(flag);
+       cleanup_before_linux();
 
-       if (!fake) {
+       if (!(flag & BOOTM_STATE_OS_FAKE_GO)) {
                if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) {
 #ifdef CONFIG_SMP
                        ret = smp_call_function(images->ep,
index cba10b5dce705f6b0114d6927b22ace842ca7b48..e553497192c2d2a4b832b497e18485c9a89b3554 100644 (file)
@@ -1208,6 +1208,8 @@ void bootm_final(int flag)
        if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
                bootstage_report();
 
+       board_quiesce_devices();
+
        /*
         * Call remove function of all devices with a removal flag set.
         * This may be useful for last-stage operations, like cancelling