x86: Emit a post code before booting

It is possible to benchmark U-Boot using QEMU as described here:

   https://github.com/stefano-garzarella/qemu-boot-time

On x86 devices, that script can read post codes from a perf trace. Add
a code which is emitted just before handing off to the Linux kernel.
Existing post codes can be used to determine when U-Boot starts.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-08 05:11:12 -06:00
parent f82cc0ee80
commit 78dead849f
2 changed files with 4 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
#define POST_DRAM 0x30
#define POST_LAPIC 0x31
#define POST_OS_RESUME 0x40
#define POST_BOOT 0x42
#define POST_RAM_FAILURE 0xea
#define POST_BIST_FAILURE 0xeb

View File

@@ -24,6 +24,7 @@
#include <asm/bootparam.h>
#include <asm/cpu.h>
#include <asm/byteorder.h>
#include <asm/post.h>
#include <asm/zimage.h>
#ifdef CONFIG_SYS_COREBOOT
#include <asm/arch/timestamp.h>
@@ -201,6 +202,8 @@ int boot_linux_kernel(ulong setup_base, ulong entry, bool image_64bit)
if (IS_ENABLED(CONFIG_EFI_APP))
return efi_boot(setup_base, entry, image_64bit);
post_code(POST_BOOT);
if (image_64bit) {
if (!cpu_has_64bit()) {
puts("Cannot boot 64-bit kernel on 32-bit machine\n");