From: Simon Glass <[email protected]>

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

Changes in v3:
- Add dm: device_remove() fix for child removal with specialised flags
- Add new patch for ARC conversion
- Add new patch for ARM conversion (requested by Tom)
- Add new patch for MIPS conversion
- Add new patch for MicroBlaze conversion
- Add new patch for Nios2 conversion
- Add new patch for PowerPC conversion
- Add new patch for SH conversion
- Add new patch for Xtensa conversion
- Add new patch for bootstage stashing, needed for ARM conversion
- Add new patch for m68k conversion
- Add new patch for sandbox conversion
- Convert all remaining architectures
- Drop cleanup_before_linux() patch
- Drop the DMA comment move (now in the introductory patch)
- Drop udc_disconnect()
- Fix "the a" typo
- Introduce with all common functionality (not empty)
- Move board_quiesce_devices() into bootm_final() instead of dropping it
- Move bootstage dummies earlier in the series
- Move earlier in the series so bootm_final() can use bootstage from the start
- Put bootm_final() in bootm.c instead of a separate file
- Put in bootm.c instead of a separate file
- Squash in patches 2, 3 and 5 from v2
- Squash introductory patches so bootm_final() is introduced non-empty
- Squash with the previous riscv patches
- Update cover letter to match current series

Changes in v2:
- Drop patch 'efi: Drop EFI_GRUB_ARM32_WORKAROUND'
- Update cover message to reflect dropping the EFI patches, etc.

Simon Glass (17):
  dm: Move flags_remove() check before child removal
  dm: Remove children when parent is removed by flags
  bootstage: Add some missing dummy functions
  bootm: Create bootm_final() for pre-boot cleanup
  x86: Call bootm_final()
  riscv: Call bootm_final()
  bootm: Stash bootstage data in bootm_final()
  arm: Call bootm_final()
  arc: Call bootm_final()
  microblaze: Call bootm_final()
  mips: Call bootm_final()
  powerpc: Call bootm_final()
  m68k: Call bootm_final()
  nios2: Call bootm_final()
  sh: Call bootm_final()
  xtensa: Call bootm_final()
  sandbox: Call bootm_final()

 arch/arc/lib/bootm.c                  |  4 +---
 arch/arm/lib/bootm.c                  | 27 +--------------------
 arch/m68k/lib/bootm.c                 |  2 ++
 arch/microblaze/lib/bootm.c           |  4 +---
 arch/mips/lib/bootm.c                 |  7 +-----
 arch/nios2/lib/bootm.c                |  2 ++
 arch/powerpc/lib/bootm.c              |  7 +-----
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +------------------
 arch/sandbox/lib/bootm.c              |  2 ++
 arch/sh/lib/bootm.c                   |  2 ++
 arch/x86/lib/bootm.c                  | 14 +----------
 arch/xtensa/lib/bootm.c               |  2 ++
 boot/bootm.c                          | 23 ++++++++++++++++++
 drivers/core/device-remove.c          | 34 +++++++++++++++++----------
 include/bootm.h                       | 20 ++++++++++++++++
 include/bootstage.h                   |  8 +++++++
 17 files changed, 90 insertions(+), 93 deletions(-)

-- 
2.43.0

base-commit: f6963fc232603007c661411fb31c57f1a9678a87
branch: bootma-us3

Reply via email to