11 Commits

Author SHA1 Message Date
Simon Glass
eb2dc2bac8 qfw: Silence the message when opt/u-boot/bootcmd is not found
Currently qfw_locate_file() always prints error messages when it can't
find a file. This causes unwanted error output in qemu_get_bootcmd()
when the optional "opt/u-boot/bootcmd" file doesn't exist.

Adjust qfw_locate_file() to be silent, with a new qfw_locate_file_msg()
that shows messages.

This allows callers to choose whether missing files should generate
error messages.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-25 18:19:23 +01:00
Simon Glass
9c3919f31e acpi: qfw: Add FPDT support for QEMU builds
QEMU creates ACPI tables but doesn't include FPDT (Firmware Performance
Data Table). Add FPDT generation in qfw_acpi.c following the same
pattern as BGRT.

Move the acpi_write_fpdt() function from acpi_table.c to acpi_extra.c so
that is available even when CONFIG_ACPIGEN is disabled.

This allows QEMU x86_64 builds to provide firmware boot timing
information to the operating system.

Disable this for qemu-riscv64_smode_acpi as it is near the code-size
limit.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-25 18:19:08 +01:00
Simon Glass
1997712001 qfw: Export qfw_locate_file() for external use
Export the qfw_locate_file() function to allow other modules to locate
files in the QEMU firmware config without loading them into memory.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-10-07 06:13:49 -06:00
Simon Glass
f614197115 emulation: Add the BGRT on the end of the QEMU tables
It is useful to show a boot logo when starting up. Add the BGRT table
after the QEMU-provided tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Cover-letter:
emulation: Improve ACPI support for qemu-x86_64
When running under QEMU U-Boot obtains its ACPI tables from QEMU, since
it has the require information. This works well in most cases.

QEMU also provides SMBIOS tables, but U-Boot doesn't currently use those
on x86. This creates problems if a VM environment is expecting to see
particular values (e.g. those which it passed to QEMU!) when booting. So
this series switches QEMU on x86 to use those SMBIOS tables.

Finally, there is a facility in EFI for showing a boot logo, via a BGRT
table. QEMU does not provide this itself, so this series augments the
ACPI tables with a new BGRT table containing a suitable logo.
END
2025-07-12 07:57:47 +02:00
Simon Glass
6d2aabd2cc emulation: Drop computing the ACPI checksum
QEMU provides a table indicating the checksums to be calculated. U-Boot
already handles this, so we don't need to compute the checksums at the
end. Drop this unnecessary code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-11 21:12:11 +02:00
Simon Glass
ff86c28784 emulation: Simplify write_acpi_tables()
Update this function to make use of the new support for reading qfw
files, this simplifying it considerably.

Fix up the header order while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-11 21:12:11 +02:00
Simon Glass
28b764aafe emulation: Tidy up reading of the DMA flag
The existing code reads a single byte into a 32-bit variable. It works
fine but is a bit confusing. There is no need to read only one byte, so
update it to read the whole 32 bits.

Series-to: u-boot
Cover-letter:
emulation: Expand qfw and virtio commands
This series adds various features to the qfw command, mostly targeting
x86-specific features:

- commands to show the E820, ACPI-loader, etc. provided by QMEU
- unit tests for the qfw command
- virtio subcommand to list the devices

The bdinfo command contains some useful printing function which could be
used more generally in U-Boot. This series moves those into the lib/
directory and renames them to be more generic.

Various clean-ups are included, such as documentation for the virtio
fw_cfg selectors.

This series includes some minor test/ fixes noticed when creating this
series.

It also brings in a few qconfig patches which didn't make it into the
main U-Boot tree.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 23:33:26 +02:00
Simon Glass
92ad9c9554 emulation: Add more functions to access qfw files
Provide a few more functions to allow accessing arbitrary files easily.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 23:26:02 +02:00
Simon Glass
87161abea6 emulation: Move common qfw file in with other code
This file provide common functions related to QFW, so move it into
driver/qfw with the other code.

Series-to: concept
Cover-letter:
emulation: Restructure the Kconfig
At present ARM and x86 use differently named symbols to mean similar
things. For x86, board/emulation/Kconfig contains the targets, but ARM
has them in a different file. While ARM uses ARCH_QEMU to mean QEMU,
x86 uses VENDOR_EMULATION.

This series adjusts the Kconfig for emulation targets on x86 and ARM, to
improve consistency.

A new arch-neutral MACH_QEMU is introduced. This is enabled for all
ARM/x86 emulation targets. Furture work could add this for other archs
too.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 05:22:09 +02:00
Simon Glass
f00c74d474 emulation: Rename the uclass file to qfw-uclass.c
The qfw.c file mostly contains the uclass implementation, so rename it
to fit with other uclass files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 05:22:09 +02:00
Simon Glass
20959f5c4a emulation: Move QFW drivers to drivers/qfw
There seems to be enough QFW code now to have its own directory. Move
the files there before adding more.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-07-09 05:22:09 +02:00