summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-03-18 18:36:50 -0600
committerTom Rini <[email protected]>2026-03-18 18:36:50 -0600
commiteb00c710508d09b2a3b9aca75dd18280f1304703 (patch)
treef91864725bde06d16a7243e0a539b28b03c0f125 /boot
parent28608c808774a39ec47d31353b141db547136e58 (diff)
parentdc88ac7681084b2aff8c3c4e1bb3e861451489a3 (diff)
Merge patch series "bootm: Clean up arch-specific, pre-OS clean-up"
Simon Glass <[email protected]> says: Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type. It is quite hard to know what actually happens in the final milliseconds before the OS boot. This series attempts to start cleaning up U-Boot in this area. The basic intent is to create a new bootm_final() function which can be called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic. All architectures are converted over to use this new function. board_quiesce_devices() is moved into bootm_final() so that all archs benefit from it. This series fixes a bug in device_remove() is fixed where removing a parent with specialised flags (e.g. DM_REMOVE_ACTIVE_ALL) could leave children activated, since they do not match the flags. This fixes is needed to avoid bootm_final() causing test failures on sandbox. Future work could take this a little further: - Convert EFI loader to use the same function - Improve comments for cleanup_before_linux() across architectures - Support fake-run tracing on all archs Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'boot')
-rw-r--r--boot/bootm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/boot/bootm.c b/boot/bootm.c
index 280efb26e90..4836d6b2d41 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -7,6 +7,7 @@
#ifndef USE_HOSTCC
#include <bootm.h>
#include <bootstage.h>
+#include <dm/root.h>
#include <cli.h>
#include <command.h>
#include <cpu_func.h>
@@ -1194,6 +1195,30 @@ void __weak switch_to_non_secure_mode(void)
{
}
+void bootm_final(int flag)
+{
+ printf("\nStarting kernel ...%s\n\n",
+ (flag & BOOTM_STATE_OS_FAKE_GO) ?
+ " (fake run for tracing)" : "");
+
+ bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+ if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT))
+ bootstage_fdt_add_report();
+ bootstage_stash_default();
+ 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
+ * of DMA operation or releasing device internal buffers.
+ */
+ dm_remove_devices_active();
+}
+
#else /* USE_HOSTCC */
#if defined(CONFIG_FIT_SIGNATURE)