
From: Simon Glass <sjg@chromium.org> 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. 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 Simon Glass (19): test: Only show the timing summary if test actually run 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() bootm: Move cleanup_before_linux() to bootm.h bootm: Call cleanup_before_linux() from bootm_final() bootm: Move board_quiesce_devices(void) to bootm_final() bootm: Drop re-enabling of interrupts on error bootm: Move bootm_disable_interrupts() to bootm_final() arm: Drop announce_and_cleanup() riscv: Drop announce_and_cleanup() x86: Drop bootm_announce_and_cleanup() MAINTAINERS | 1 + arch/arc/lib/bootm.c | 2 +- arch/arm/cpu/arm11/cpu.c | 3 +- arch/arm/cpu/arm720t/cpu.c | 2 + arch/arm/cpu/arm920t/cpu.c | 3 +- arch/arm/cpu/arm926ejs/cpu.c | 3 +- arch/arm/cpu/arm946es/cpu.c | 3 +- arch/arm/cpu/armv7/cpu.c | 1 + arch/arm/cpu/armv7m/cpu.c | 1 + arch/arm/cpu/armv8/cpu.c | 1 + arch/arm/include/asm/u-boot-arm.h | 3 -- arch/arm/lib/bootm.c | 39 +------------------ arch/arm/lib/spl.c | 1 + arch/arm/mach-rockchip/spl.c | 1 + arch/riscv/cpu/andes/cpu.c | 1 + arch/riscv/cpu/ast2700/cpu.c | 1 + arch/riscv/cpu/cv1800b/cpu.c | 2 + arch/riscv/cpu/fu540/cpu.c | 1 + arch/riscv/cpu/fu740/cpu.c | 1 + arch/riscv/cpu/generic/cpu.c | 1 + arch/riscv/cpu/jh7110/cpu.c | 1 + arch/riscv/include/asm/u-boot-riscv.h | 4 -- arch/riscv/lib/boot.c | 1 + arch/riscv/lib/bootm.c | 39 +------------------ arch/sandbox/cpu/cpu.c | 1 + arch/sandbox/include/asm/u-boot-sandbox.h | 2 - arch/sh/cpu/sh4/cpu.c | 1 + arch/x86/cpu/cpu.c | 7 +++- arch/x86/include/asm/bootm.h | 2 - arch/x86/include/asm/u-boot-x86.h | 2 - arch/x86/lib/bootm.c | 25 ++---------- boot/Makefile | 2 +- boot/bootm.c | 11 ------ boot/bootm_final.c | 47 +++++++++++++++++++++++ cmd/booti.c | 6 --- configs/mt7623n_bpir2_defconfig | 1 - drivers/net/fsl-mc/mc.c | 2 +- include/bootm.h | 21 ++++++++++ include/bootstage.h | 8 ++++ lib/efi_loader/Kconfig | 10 ----- lib/efi_loader/efi_boottime.c | 35 +---------------- test/boot/bootflow.c | 6 ++- test/py/conftest.py | 3 +- 43 files changed, 128 insertions(+), 180 deletions(-) create mode 100644 boot/bootm_final.c -- 2.43.0 base-commit: 62c19a204ff8b95e63e2f9afdec0283571f9b864 branch: qemj