13 Commits

Author SHA1 Message Date
Simon Glass
bfcb0a6dd6 bootm: Update FPDT boot times before handing off to OS
Update the FPDT boot performance record's ebs_entry and ebs_exit
fields in bootm_final() to record the time when we're about to
hand off to the operating system.

The timing is recorded just before we start the kernel, after all
device cleanup and before interrupts are disabled, which corresponds
to the ExitBootServices phase in UEFI.

If EFI is used to boot, a further update could be made, but that is
left for later.

Avoid including asm/acpi_table.h on platforms without ACPI. Ad a special
case for the QEMU RISC-V ACPI board.

Series-changes: 2
- Depend on ACPIGEN instead of GENERATE_ACPI_TABLE
- Avoid including asm/acpi_table.h on platforms without ACPI

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-23 19:36:12 +01:00
Simon Glass
ddb78711fd boot: Pass flags to the bootm_final event
For a fake go, we should tell the event not to actually do anything
irreversable, so pass the flag along.

Move the enum into a separate event_decl.h header file since otherwise
we must include bootm.h which causes a breakage with qemu-ppce500

We also don't want to pull event.h into the tools build, since it uses
types like u8 which are not available outside U-Boot

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-19 17:36:44 -06:00
Simon Glass
6916ad7d21 boot: Emit an event just before starting the OS
In some cases a board may wish to do some final processing before
starting the OS. An example is the EFI app, which may wish to call
exit-boot-services.

Add an event to permit this.

Series-to: concept
Cover-letter:
boot: Allow lmb-allocation of compression buffer with booti
ARM 'booti' images (as created by Linux 'make Image') typically need to
be compressed. At present the decompression buffer is described by a
pair of environment variables: kernel_comp_addr_r and kernel_comp_size

This is quite inflexible, since the buffer size and location must be
pre-set in the environment, before the OS size is known.

For the EFI app, it is quite difficult to work with a fixed buffer. It
is not in control of the memory map so it may be that the requested
buffer address is not available.

This series updates the boot implementation to allow the variables to
be omitted, with lmb allocations done in this case. This resolves the
problem in the EFI app, with kernels which come from extlinux.conf

When the EFI app loads another app, a similar problem is present, but
with the EFI bootmeth, also resolved in this series.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-11 10:06:11 -06:00
Simon Glass
9571da723b arm: Drop announce_and_cleanup()
Now that ARM's announce_and_cleanup() function includes the same steps
as bootm_final(), just use the latter.

Move over part of a comment which seems useful.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:24:03 -06:00
Simon Glass
6da757f538 bootm: Move bootm_disable_interrupts() to bootm_final()
Move disabling of interrupts to bootm_final() so it is done for bootm
and EFI boot paths. Drop the now-duplicate calls.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:22:33 -06:00
Simon Glass
ec4efd7f0f bootm: Move board_quiesce_devices(void) to bootm_final()
This function is called just before boot, so move it from EFI into the
common bootm_final() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:18:52 -06:00
Simon Glass
490dbf1968 bootm: Call cleanup_before_linux() from bootm_final()
Add this call to the bootm_final() function, dropping it from RISC-V

Add a flag to ensure that cleanup_before_linux() is not called when
booting an EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:18:52 -06:00
Simon Glass
a1ae8de12c riscv: Call bootm_final()
Make use of this function, adding some pieces needed by RISC-V

Drop the udc_disconnect() from EFI_LOADER since it is now done in
bootm_final()

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:14:47 -06:00
Simon Glass
c3b0c2979e x86: Call bootm_final()
The x86 code in bootm_announce_and_cleanup() is very similar to the new
bootm_final() function, so just use the latter. Move over a useful
comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:14:47 -06:00
Simon Glass
bd57096c36 bootm: Do bootstage processing in bootm_final()
Mark kernel start before booting. If enabled, show a bootstage report.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:13:03 -06:00
Simon Glass
1490f70f9d bootm: Add a message when booting
Add a message about starting the kernel. For EFI this will be printed
when boot-services are exited.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 16:07:03 -06:00
Simon Glass
148240871e efi: Make use of bootm_final()
Call this function from the EFI code. Add the required call to
dm_remove_devices_active() there.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 15:59:38 +02:00
Simon Glass
ed1c8186cf boot: Create a function for final pre-boot steps
There are various functions which announce that booting is imminent and
do related preparation. Most of these are arch-specific.

In practice, most archs do the a similar thing. It would be better to
have a common function, with perhaps some events for things that are
really arch- and board-specific.

Create a new function for this. For now, nothing uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-12 15:59:38 +02:00