Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.
EFT_LOADER has its own special code, regardless of which arch is being booted. It is quite hard to know what actually happens in the final milliseconds before the OS boot. This series attempts to clean up U-Boot in this area. The basic approach is to create a new bootm_final() function which is called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic. RISC-V, x86 and ARM are converted over to use this new function. For consistency, EFI loader is converted as well. A noteable change is that EFI_LOADER now does bootstage processing before boot, if enabled, thus producing a report. There is also a patch to drop EFI_GRUB_ARM32_WORKAROUND, as discussed recently on the mailing list. Future work could take this a little further: - Drop board_quiesce_devices() and rely on driver model for that - Similarly with udc_disconnect() - cleanup_before_linux() could use more details as to what it is supposed to do, to reduce the number of arch-specific variations Note: This is the first 10 patches for an 18-part series from the Concept tree, as requested. The patches after that complete the cleanup on ARM and RISC-V. Simon Glass (10): boot: Create a function for final pre-boot steps efi: Make use of bootm_final() bootm: Add a message when booting bootstage: Add some missing dummy functions bootm: Do bootstage processing in bootm_final() x86: Call bootm_final() riscv: Drop board_quiesce_devices() riscv: Call bootm_final() efi: Drop EFI_GRUB_ARM32_WORKAROUND x86: Add cleanup_before_linux() MAINTAINERS | 1 + arch/riscv/include/asm/u-boot-riscv.h | 1 - arch/riscv/lib/bootm.c | 24 +------------------ arch/x86/cpu/cpu.c | 5 ++++ arch/x86/lib/bootm.c | 14 +---------- boot/Makefile | 2 +- boot/bootm_final.c | 34 +++++++++++++++++++++++++++ configs/mt7623n_bpir2_defconfig | 1 - include/bootm.h | 17 ++++++++++++++ include/bootstage.h | 8 +++++++ lib/efi_loader/Kconfig | 10 -------- lib/efi_loader/efi_boottime.c | 30 +---------------------- test/boot/bootflow.c | 2 +- 13 files changed, 70 insertions(+), 79 deletions(-) create mode 100644 boot/bootm_final.c -- 2.43.0 base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7 branch: bootma-us

