From 74545d49c7d1558473118fab0f74de3c5976ee9b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 29 Oct 2025 15:14:32 +0100 Subject: qfw: Add more fields and a heading to qfw list Update the command to show the size and selected file, since this is useful information at times. Add a heading so it is clear what each field refers to. Add a simple test as well. Signed-off-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- cmd/qfw.c | 6 +++++- doc/usage/cmd/qfw.rst | 27 +++++++++++++++------------ test/cmd/Makefile | 1 + test/cmd/qfw.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 test/cmd/qfw.c diff --git a/cmd/qfw.c b/cmd/qfw.c index 1b108118658..09bd7d9849d 100644 --- a/cmd/qfw.c +++ b/cmd/qfw.c @@ -22,10 +22,14 @@ static int qemu_fwcfg_cmd_list_firmware(void) if (ret) return ret; + printf(" Addr Size Sel Name\n"); + printf("---------------- -------- --- ------------\n"); for (file = qfw_file_iter_init(qfw_dev, &iter); !qfw_file_iter_end(&iter); file = qfw_file_iter_next(&iter)) { - printf("%08lx %-56s\n", file->addr, file->cfg.name); + printf("%16lx %8x %3x %-48s\n", file->addr, + be32_to_cpu(file->cfg.size), + be16_to_cpu(file->cfg.select), file->cfg.name); } return 0; diff --git a/doc/usage/cmd/qfw.rst b/doc/usage/cmd/qfw.rst index 40770acb3c0..0a65a247b44 100644 --- a/doc/usage/cmd/qfw.rst +++ b/doc/usage/cmd/qfw.rst @@ -44,18 +44,21 @@ QEMU firmware files are listed via the *qfw list* command: :: => qfw list - 00000000 bios-geometry - 00000000 bootorder - 000f0060 etc/acpi/rsdp - bed14040 etc/acpi/tables - 00000000 etc/boot-fail-wait - 00000000 etc/e820 - 00000000 etc/smbios/smbios-anchor - 00000000 etc/smbios/smbios-tables - 00000000 etc/system-states - 00000000 etc/table-loader - 00000000 etc/tpm/log - 00000000 genroms/kvmvapic.bin + Addr Size Sel Name + ---------------- -------- --- ------------ + 0 0 20 bios-geometry + 0 0 21 bootorder + 1fc6c000 14 22 etc/acpi/rsdp + 1fc6c040 20000 23 etc/acpi/tables + 0 4 24 etc/boot-fail-wait + 0 28 25 etc/e820 + 0 8 26 etc/msr_feature_control + 0 18 27 etc/smbios/smbios-anchor + 0 151 28 etc/smbios/smbios-tables + 0 6 29 etc/system-states + 0 1000 2a etc/table-loader + 0 0 2b etc/tpm/log + 0 2400 2c genroms/kvmvapic.bin Where an address is shown, it indicates where the data is available for inspection, e.g. using the :doc:`md`. diff --git a/test/cmd/Makefile b/test/cmd/Makefile index e71c80a5b2e..98731d9bdff 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o ifdef CONFIG_CMD_PCI obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o endif +obj-$(CONFIG_CMD_QFW) += qfw.o obj-$(CONFIG_CMD_SEAMA) += seama.o ifdef CONFIG_SANDBOX obj-$(CONFIG_CMD_MBR) += mbr.o diff --git a/test/cmd/qfw.c b/test/cmd/qfw.c new file mode 100644 index 00000000000..e615a82b31a --- /dev/null +++ b/test/cmd/qfw.c @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for qfw command + * + * Copyright 2025 Simon Glass + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Test 'qfw list' command */ +static int cmd_test_qfw_list(struct unit_test_state *uts) +{ + struct fw_cfg_file_iter iter; + struct fw_file *file; + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_QFW, &dev)); + + ut_assertok(run_command("qfw list", 0)); + ut_assert_nextline(" Addr Size Sel Name"); + ut_assert_nextlinen("--"); + + for (file = qfw_file_iter_init(dev, &iter); !qfw_file_iter_end(&iter); + file = qfw_file_iter_next(&iter)) { + ut_assert_nextline("%16lx %8x %3x %-48s", file->addr, + be32_to_cpu(file->cfg.size), + be16_to_cpu(file->cfg.select), + file->cfg.name); + } + ut_assert_console_end(); + + return 0; +} +CMD_TEST(cmd_test_qfw_list, UTF_CONSOLE); -- cgit v1.3.1 From 33355013ffce4fe58d552db3dd546ecf197a7a9b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 31 Oct 2025 20:59:29 +0100 Subject: qfw/acpi: do not zero out XSDT address On RISC-V QEMU provides an XSDT table. The RSDP table points to it. We must not zero out this pointer because otherwise no ACPI table can be found. Fixes: 15ca25e31ed5 ("x86: emulation: Support BLOBLIST_TABLES properly") Reviewed-by: Bin Meng Signed-off-by: Heinrich Schuchardt --- drivers/misc/qfw_acpi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/misc/qfw_acpi.c b/drivers/misc/qfw_acpi.c index c6c052ac6c3..721f42ecbc3 100644 --- a/drivers/misc/qfw_acpi.c +++ b/drivers/misc/qfw_acpi.c @@ -265,7 +265,6 @@ out: struct acpi_rsdp *rsdp = ctx->rsdp; rsdp->length = sizeof(*rsdp); - rsdp->xsdt_address = 0; rsdp->ext_checksum = table_compute_checksum((u8 *)rsdp, sizeof(*rsdp)); gd_set_acpi_start(acpi_get_rsdp_addr()); -- cgit v1.3.1 From 893871132e54f0f5bc40ad3eee0bf0388a104b76 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 31 Oct 2025 20:59:30 +0100 Subject: test: provide test for 'acpi list' command Check that some mandatory ACPI tables exist: - RSDP - RSDT or XSDT - FADT Reviewed-by: Bin Meng Signed-off-by: Heinrich Schuchardt --- test/cmd/Makefile | 3 +++ test/cmd/acpi.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test/cmd/acpi.c diff --git a/test/cmd/Makefile b/test/cmd/Makefile index 98731d9bdff..841763fec02 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -13,6 +13,9 @@ endif obj-y += exit.o obj-$(CONFIG_X86) += cpuid.o msr.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o +ifdef CONFIG_CONSOLE_RECORD +obj-$(CONFIG_CMD_ACPI) += acpi.o +endif obj-$(CONFIG_CMD_BDI) += bdinfo.o obj-$(CONFIG_COREBOOT_SYSINFO) += coreboot.o obj-$(CONFIG_CMD_FDT) += fdt.o diff --git a/test/cmd/acpi.c b/test/cmd/acpi.c new file mode 100644 index 00000000000..3669060733a --- /dev/null +++ b/test/cmd/acpi.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Tests for acpi command + */ + +#include +#include +#include + +#define HAVE_RSDP BIT(0) +#define HAVE_XSDT BIT(1) +#define HAVE_FADT BIT(2) +#define HAVE_ALL (HAVE_RSDP | HAVE_XSDT | HAVE_FADT) + +/** + * cmd_test_acpi() - test the acpi command + */ +static int cmd_test_acpi(struct unit_test_state *uts) +{ + unsigned int actual = 0; + int ret; + + /* + * Check that some mandatory ACPI tables exist: + * - RSDP + * - RSDT or XSDT + * - FADT + */ + ut_assertok(run_commandf("acpi list")); + ut_assert_nextline("Name Base Size Detail"); + ut_assert_nextline("---- ---------------- ----- ----------------------------"); + for (;;) { + ret = console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + if (ret == -ENOENT) { + ut_asserteq(HAVE_ALL, actual); + + return 0; + } + if (ret < 0) + ut_asserteq(0, ret); + + if (!strncmp("RSDP", uts->actual_str, 4)) + actual |= HAVE_RSDP; + else if (!strncmp("RSDT", uts->actual_str, 4)) + actual |= HAVE_XSDT; + else if (!strncmp("XSDT", uts->actual_str, 4)) + actual |= HAVE_XSDT; + else if (!strncmp("FACP", uts->actual_str, 4)) + actual |= HAVE_FADT; + } +} +CMD_TEST(cmd_test_acpi, UTF_CONSOLE); -- cgit v1.3.1 From 411f8f5367ca8f55faa8a9c34735e31ac665c7dc Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 12:07:02 +0100 Subject: efi: Use struct efi_gop_mode_info in struct efi_entry_gopmode Since C99 flexible array members are allowed at the end of structures. We require C11. Use struct efi_gop_mode_info in the definition of struct efi_entry_gopmode to avoid code duplication and unnecessary conversions. Reviewed-by: Bin Meng Signed-off-by: Heinrich Schuchardt --- include/efi.h | 36 +++++++++++++++++++++++------------- include/efi_api.h | 9 --------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/efi.h b/include/efi.h index f9bbb175c3a..66725b876f9 100644 --- a/include/efi.h +++ b/include/efi.h @@ -385,6 +385,28 @@ struct efi_entry_memmap { struct efi_mem_desc desc[]; }; +/** + * struct efi_gop_mode_info - graphics output mode information + */ +struct efi_gop_mode_info { + /** @version: version of the data structure (use zero) */ + u32 version; + /** @width: horizontal screen size */ + u32 width; + /** @height: vertical screen size */ + u32 height; + /** @pixel_format: enum that specifies the storage format of pixels */ + u32 pixel_format; + /** + * @pixel_bitmask: bitmasks used with PixelPixelBitMask + * + * The values which bits are used for red, green, blue, and alpha. + */ + u32 pixel_bitmask[4]; + /** @pixels_per_scanline: pixels per video memory line */ + u32 pixels_per_scanline; +}; + /** * struct efi_entry_gopmode - a GOP mode table passed to U-Boot * @@ -404,19 +426,7 @@ struct efi_entry_gopmode { */ u64 fb_size; u64 info_size; - /* - * We cannot directly use 'struct efi_gop_mode_info info[]' here as - * it causes compiler to complain: array type has incomplete element - * type 'struct efi_gop_mode_info'. - */ - struct /* efi_gop_mode_info */ { - u32 version; - u32 width; - u32 height; - u32 pixel_format; - u32 pixel_bitmask[4]; - u32 pixels_per_scanline; - } info[]; + struct efi_gop_mode_info info[]; }; /** diff --git a/include/efi_api.h b/include/efi_api.h index 77a05f752e5..d4fdd50c49e 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1490,15 +1490,6 @@ struct efi_hii_config_access_protocol { #define EFI_GOT_BGRA8 1 #define EFI_GOT_BITMASK 2 -struct efi_gop_mode_info { - u32 version; - u32 width; - u32 height; - u32 pixel_format; - u32 pixel_bitmask[4]; - u32 pixels_per_scanline; -}; - struct efi_gop_mode { u32 max_mode; u32 mode; -- cgit v1.3.1 From ad669eb7966894f2f570ded8af925fb9a052a3ca Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Mon, 27 Oct 2025 16:56:27 -0400 Subject: efi: video: fix mode info in payload mode Currently, the EFI framebuffer is non-functional in payload mode. It always reports: "No video mode configured in EFI!" This is caused by a copy-paste error that replaced "struct efi_entry_gopmode" with "struct efi_gop_mode". Fixes: 88753816cf54 ("efi: video: Move payload code into a function") Signed-off-by: Ben Wolsieffer Reviewed-by: Heinrich Schuchardt --- drivers/video/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 78d123fad4b..8ce2ef9dc67 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -104,7 +104,7 @@ static int get_mode_info(struct vesa_mode_info *vesa, u64 *fbp, static int get_mode_from_entry(struct vesa_mode_info *vesa, u64 *fbp, struct efi_gop_mode_info **infop) { - struct efi_gop_mode *mode; + struct efi_entry_gopmode *mode; int size; int ret; -- cgit v1.3.1 From 811d41221be41f5d12609305084914572cfc63b9 Mon Sep 17 00:00:00 2001 From: "Kory Maincent (TI.com)" Date: Tue, 4 Nov 2025 11:06:38 +0100 Subject: doc: bootstd: Remove extension support from TODO list Now that extension support has been added to extlinux and efi bootmeths we can remove this line from the TODO list. Signed-off-by: Kory Maincent (TI.com) Reviewed-by: Heinrich Schuchardt --- doc/develop/bootstd/overview.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst index abb616adc77..f0d420361f7 100644 --- a/doc/develop/bootstd/overview.rst +++ b/doc/develop/bootstd/overview.rst @@ -868,7 +868,6 @@ To do Some things that need to be done to completely replace the distro-boot scripts: -- implement extensions (devicetree overlays with add-on boards) - implement legacy (boot image v2) android boot flow Other ideas: -- cgit v1.3.1 From 81458bd1135b43b3ad917002ba7d93cdb59cec00 Mon Sep 17 00:00:00 2001 From: "Kory Maincent (TI.com)" Date: Tue, 4 Nov 2025 11:45:28 +0100 Subject: doc: bootstd: Describe the optional extension_overlay_addr environment Add extension_overlay_addr description to the list of environment variables that can be useful during the standard boot. Signed-off-by: Kory Maincent (TI.com) Reviewed-by: Heinrich Schuchardt --- doc/develop/bootstd/overview.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/develop/bootstd/overview.rst b/doc/develop/bootstd/overview.rst index f0d420361f7..397f6db18b4 100644 --- a/doc/develop/bootstd/overview.rst +++ b/doc/develop/bootstd/overview.rst @@ -252,6 +252,9 @@ Various environment variables are used by standard boot. These allow the board to control where things are placed when booting the OS. You should ensure that your boards sets values for these. +extension_overlay_addr (needed if extension is used) + Address at which to load the extension FDT overlays, e.g. 0x02000000 + fdtfile Name of the flattened device tree (FDT) file to load, e.g. "rockchip/rk3399-rockpro64.dtb" -- cgit v1.3.1 From d05190bd65ccd212e8540d609fb6066e2692cc6a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 12:02:40 +0100 Subject: efi_loader: correct struct efi_priv description Add a missing colon ':' to match Sphinx style. Reviewed-by: Bin Meng Signed-off-by: Heinrich Schuchardt --- include/efi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/efi.h b/include/efi.h index 66725b876f9..b98871fedad 100644 --- a/include/efi.h +++ b/include/efi.h @@ -454,7 +454,7 @@ static inline struct efi_mem_desc *efi_get_next_mem_desc( * @memmap_key: Key returned from get_memory_map() * @memmap_desc: List of memory-map records * @memmap_alloc: Amount of memory allocated for memory map list - * @memmap_size Size of memory-map list in bytes + * @memmap_size: Size of memory-map list in bytes * @memmap_desc_size: Size of an individual memory-map record, in bytes * @memmap_version: Memory-map version * -- cgit v1.3.1 From 1a30ddeda9a5120dca0a9b9c9673d24b375cdc34 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 23:27:12 +0100 Subject: efi_client: efi_store_memory_map() must return int The type efi_status_t is not compatible with the return type int. Let efi_store_memory_map() return -EFAULT instead of a truncated EFI error code. Acked-by: Ilias Apalodimas Signed-off-by: Heinrich Schuchardt --- lib/efi_client/efi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/efi_client/efi.c b/lib/efi_client/efi.c index bcb34d67465..a3a40b5549d 100644 --- a/lib/efi_client/efi.c +++ b/lib/efi_client/efi.c @@ -155,7 +155,7 @@ int efi_store_memory_map(struct efi_priv *priv) putc(' '); printhex2(ret); puts(" No memory map\n"); - return ret; + return -EFAULT; } /* * Since doing a malloc() may change the memory map and also we want to @@ -168,7 +168,7 @@ int efi_store_memory_map(struct efi_priv *priv) if (!priv->memmap_desc) { printhex2(ret); puts(" No memory for memory descriptor\n"); - return ret; + return -EFAULT; } ret = boot->get_memory_map(&priv->memmap_size, priv->memmap_desc, @@ -177,7 +177,7 @@ int efi_store_memory_map(struct efi_priv *priv) if (ret) { printhex2(ret); puts(" Can't get memory map\n"); - return ret; + return -EFAULT; } return 0; -- cgit v1.3.1 From 35e510f2af576de9abd17660da759d25a9c45e0a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 5 Nov 2025 00:29:33 +0100 Subject: efi_driver: correct formatting in efi_uc_stop() Correct indentation. Reviewed-by: Bin Meng Signed-off-by: Heinrich Schuchardt --- lib/efi_driver/efi_uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c index 7392c60f0f9..bd46c9f5539 100644 --- a/lib/efi_driver/efi_uclass.c +++ b/lib/efi_driver/efi_uclass.c @@ -227,7 +227,7 @@ static efi_status_t EFIAPI efi_uc_stop( goto out; } ret = EFI_SUCCESS; - goto out; + goto out; } /* Destroy all children */ -- cgit v1.3.1 From 59f2c5a0fa65598c911306a7873638ef516b6e6f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 5 Nov 2025 02:30:45 +0100 Subject: efi_driver: typo 'to be write' %s/to be write/to write/ Reviewed-by: Bin Meng Signed-off-by: Heinrich Schuchardt --- lib/efi_driver/efi_block_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index 070747de515..913755336b2 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -84,7 +84,7 @@ static ulong efi_bl_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, * efi_bl_write() - write to block device * * @dev: device - * @blknr: first block to be write + * @blknr: first block to write * @blkcnt: number of blocks to write * @buffer: input buffer * Return: number of blocks transferred -- cgit v1.3.1 From dbed053487610781bdf48ca687fef9e39a982cb4 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 5 Nov 2025 13:24:26 +0100 Subject: efi_driver: don't leak name in efi_bl_create_block_device() blk_create_devicef() uses a copy of parameter name. We can use a local variable. Reviewed-by: Bin Meng Reviewed-by: Ilias Apalodimas Signed-off-by: Heinrich Schuchardt --- lib/efi_driver/efi_block_device.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index 913755336b2..9ab956c7ef7 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -124,7 +124,7 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface) efi_status_t ret; int r; int devnum; - char *name; + char name[18]; /* strlen("efiblk#2147483648") + 1 */ struct efi_block_io *io = interface; struct efi_blk_plat *plat; @@ -136,9 +136,6 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface) if (devnum < 0) return EFI_OUT_OF_RESOURCES; - name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */ - if (!name) - return EFI_OUT_OF_RESOURCES; sprintf(name, "efiblk#%d", devnum); /* Create driver model udevice for the EFI block io device */ @@ -146,7 +143,6 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface) devnum, io->media->block_size, (lbaint_t)io->media->last_block, &bdev)) { ret = EFI_OUT_OF_RESOURCES; - free(name); goto err; } -- cgit v1.3.1 From 6bb374b1a1226b964db8476b2939a280c7477e4a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 4 Nov 2025 22:48:04 +0100 Subject: efi_loader: typo 'mange' in efi_net.c %s/mange/manage/ Reviewed-by: Ilias Apalodimas Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index b8a6e08ba8e..0f8a851e3f2 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -372,7 +372,7 @@ out: } /* - * efi_net_receive_filters() - mange multicast receive filters + * efi_net_receive_filters() - manage multicast receive filters * * This function implements the ReceiveFilters service of the * EFI_SIMPLE_NETWORK_PROTOCOL. See the Unified Extensible Firmware Interface -- cgit v1.3.1