Commit Graph

99000 Commits

Author SHA1 Message Date
Simon Glass
af47c2554d chid: Implement selection of the compatible string
Search the available CHIDs to determine the device on which U-Boot is
running. Use this to select the correct compatible string.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
a9e04b5d36 Makefile: Integrate CHID files into the build
When CONFIG_CHID is enabled, U-Boot must have access to a set of CHIDs
which it can use to identfy the hardware it is running on.

Add support for reading a hwids/compatible.hwidmap file in the board
directory and including the information in the board's devicetree.

This works by running the hwids_to_dtsi.py.py script and putting the
result in the dtsi_include_list variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
ada443accb sandbox: Provide hwid files for testing
Provide a few test devices for use with sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
bde5edd375 CI: Plumb in the hwids_to_dtsi tests
Add this to 'make tcheck' and to CI.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
7d793ccadd scripts: Add a tool to convert CHIDs to devicetree
Add a Python script to convert Hardware ID files (as produced by
'fwupd hwids') into a devicetree format suitable for use within U-Boot.

Provide a simple test as well.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
03df36da0f chid: Provide some developer docs
Describe how this feature works and provide some helpful links.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
7737e3c1d5 chid: Add subcommand for dealing with variants
Add a 'chid list' command to display the values for all CHID variants.
Also add 'chid detail' to see all details about a variant.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:25 -06:00
Simon Glass
89d735d8f2 chid: Support calculating values for each variant
Provide a table of variants which indicates which fields are included in
each. Use this to calculate the CHID for a variant. Add some tests to
cover this.

Provide a constant for the length of a uuid.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
5f70c11a08 uuid: Add a constant for the length of a UUID
This is always 16 bytes. Define a constant, so we can use that rather
than open-coding the value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
93f35ef78a chid: Provide a command to access chid features
Provide a simple command which supports showing the information which
goes into calculating a CHID. The information is obtained entirely from
SMBIOS tables at present.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
99b1335957 chid: Create a basic CHID header and smbios interface
Microsoft uses information from SMBIOS tables to determine the device
Windows is running on. This same approach has been adopted by fwupd and
other projects.

The information is used to create a list of Computer Hardware
Identifiers (CHIDs) which are used to select firmware builds, etc.

The EFI app needs to support this approach so it can map CHIDs to the
associated compatible string.

Introduce a header file for CHIDs and a function which can extract the
necessary information from the SMBIOS tables.

Further work will deal with actually calculating CHIDs.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
26dd69d4e4 efi: arm: Provide a mapping from CHIDs to compatible
The compatible string cannot be detected on the host so is not shown by
fupdtool. Add a simple text file to provide the mapping.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
8ca6dc0ca9 efi: arm: Provide CHIDs for the app
Provide some CHIDs for the app, so it can locate the compatible strings.

These are taken from Stubble commit bac4edb14be, with the original files
generated by running 'fwupdtool hwids' on each device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
8ee598e20c test: Add more SMBIOS data to sandbox
Some common smbios settings are not included with sandbox. Add these to
test.dts so the data is more meaningful.

Update smbios tests to match the new devicetree values.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
48fefafeff smbios: Add docs for the main types
Add kerneldoc documentation for SMBIOS information structure types:

- Type 0: BIOS Information
- Type 2: Baseboard Information
- Type 3: System Enclosure Information
- Type 4: Processor Information

Add an enum for the enclosure type too.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
da7175c7d0 smbios: Add comments for smbios_type1 (System Information)
Document the SMBIOS Type 1 structure so it is clear what each field
means. Update struct smbios_header also.

Co-developed-by: Claude <noreply@anthropic.com>
2025-09-04 07:08:24 -06:00
Simon Glass
79d7b6f1a6 smbios: Improve comments for entry-point structures
Add comments for smbios_entry and update those for smbios3_entry to
follow kerneldoc style.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
b6d164bceb smbios: Provide a sandbox test
Create a sandbox test for the smbios command. This checks that the
expected output is produced.

Drop the unnecessary 0x before each address, since U-Boot uses hex by
default.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
650430935d smbios: Expand the documentation
Quite a few SMBIOS features are not yet described in the documentation.
Add a new section the 'usage' and add more to the developer
documentation, including how to use the devicetree to provide values.

Add some links between usage docs, developer docs and the command.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
4e842608d6 smbios: Update smbios_get_header() to return a void *
Since each table starts with a header, it isn't very useful to have a
separate pointer for the (generic) header and another for the whole
table. Also, casting is a bit of a pain.

Update smbios_get_header() so that it returns a const void * so that it
is possible to directly assign it to the appropriate SMBIOS table's
pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
deb404a6be smbios: Correct logic in smbios_get_header()
This function skips over every second table. Fix it by dropping the
extra iterator update.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a68c0625aa ("smbios: coreboot: Update smbios_get_header() to..")
2025-09-04 07:08:24 -06:00
Simon Glass
ce6a5a6624 uuid: Refactor v5 GUID generation into BE and LE variants
Split the v5 GUID generation into separate big-endian and little-endian
functions with shared common code.

The big-endian version is used for CHIDs and standard UUID v5
operations, while the little-endian version seems to be needed for EFI
GUID compatibility.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
b5fb7fefe8 lib: Rename gen_v5_guid() to indicate it is little-endian
Normally v5 GUIDs are big-endian, so rename this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-04 07:08:24 -06:00
Simon Glass
9bdc48e838 Merge branch 'apc' into 'master'
efi: Improve integration of the app with a Shim environment

See merge request u-boot/u-boot!166
2025-09-03 17:52:39 +00:00
Simon Glass
f74db7258c sysreset: Add -c flag for explicit cold reset
Add support for reset -c flag to explicitly request cold reset.
This provides symmetry with -w (warm) and -u (firmware UI) flags.

For EFI apps, this performs EFI_RESET_COLD which does a full system
reboot without going to firmware setup interface.

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: Improve integration of the app with a Shim environment
This series collects together various small fixes and improvements which
make it easier to use the U-Boot EFI app in a bootflow which includes
Shim:

- 'Reset' back to the caller (e.g. EDK2)
- Machine reset using cold and warm reset
- Reset and enter the firmware UI
- Shim command now supports persistent debug
- Bootmenu shows the real media for each bootflow rather than just 'efi'
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:51:40 -06:00
Simon Glass
96adc477be sysreset: Add SYSRESET_TO_FIRMWARE_UI with reset -u support
Add new SYSRESET_TO_FIRMWARE_UI reset type to allow resetting directly
to firmware UI. This is implemented via the reset command's new -u flag.

For the EFI app, this sets the EFI_OS_INDICATIONS_BOOT_TO_FW_UI bit in
the OsIndications variable before performing a warm reset, causing the
firmware to boot to its setup interface.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:51:26 -06:00
Simon Glass
1ad04a7895 efi: app: Support proper reset options
At present reset just exits the U-Boot app and returns to the caller.
Add support for proper warm and cold resets, with 'hot' reset preserving
the current behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:51:26 -06:00
Simon Glass
9fdab58b86 sysreset: Support a hot reset
In some cases we may wish to return back to the program which started
U-Boot. Add the concept of a 'hot' reset, to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:51:25 -06:00
Simon Glass
a5f843f0f2 shim: Add a flag to make the setting persistent
Provide a -n flag to 'shim debug' so that the setting persists across
reboots.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:36 -06:00
Simon Glass
b304fb16d7 efi: Use the console mux by default with the EFI app
It is handy to have the pager in the app, since some output can be quite
long. Enable the console mux since the pager feature depends on it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:36 -06:00
Simon Glass
370247c724 efi: doc: Add documentation for about efidebug boot
So far this subcommand is undocumented. Provide some notes.

Also show a better error when 'efidebug boot rm' fails.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:36 -06:00
Simon Glass
2a374c390e efidebug: Support sorting with efidebug memmap
Provide a -s option to sort the memory map in order of address. Add
documentation while we are here. Also fix an errant extra line before
do_efi_show_media()

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:36 -06:00
Simon Glass
b16f6499cf efidebug: doc: Indent the media output correctly
The lines after the 'edidebug media' command are only intended three
spaces, but it should be four. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 9390344c35 ("efi: Add a uclass column to efidebug media command")
2025-09-02 08:45:36 -06:00
Simon Glass
e196abb182 boot: Drop an unwanted blank line in distro_efi_boot()
This crept in a while back, so let's drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 184fc0379d ("bootflow: bootmeth_efi: Handle fdt not available.")
2025-09-02 08:45:36 -06:00
Simon Glass
c9b4950ed5 boot: Use the new label finder in bootflow_menu_add()
Make use of bootflow_guess_label() to get the label for a menu, since it
provides more information for the EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:36 -06:00
Simon Glass
bd78e82720 boot: Move obtaining the label into a common file
The 'bootflow list' command supports looking at the EFI device-path when
available. Move this piece into a common function so it can be used
elsewhere.

This updates the output from 'bootflow list'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 08:45:35 -06:00
Simon Glass
2b8858b779 efi: Move loaded-image, fs and device-path GUIDs to common
Allow these to be used from the app, when EFI_LOADER is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 06:41:32 -06:00
Simon Glass
5d8c07b404 efi_loader: Drop unnecessary efi_dp_str()
This declaration already exists in efi.h so drop it from this header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 06:41:32 -06:00
Simon Glass
fe127667dc efi: Set the log category throughout lib/efi_client/
All files in this directory relate to EFI, so set the log category
consistently.

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: A few minor improvements
This series mostly tidies up the efidebug command, but includes a few
other pieces as well.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:20
2025-09-02 06:41:32 -06:00
Simon Glass
a815b91b97 efi: Allow inclusion of EFI-runtime headers
Some headers use the __efi_runtime macro in their declarations. With the
app we do not have a separate runtime sections, so define this to be
empty. This allows the headers to be included from the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 06:41:32 -06:00
Simon Glass
64c72bcea2 efi: doc: Mention some EFI commands in the app documentation
It is not obvious what commands can be used in the app. Add some links.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-02 06:41:32 -06:00
Simon Glass
a2759428a9 efi: Correct calculate_paths() when an image is used
The device path is updated if an image is used, so move the setting of
*device_pathp lower, to take account of this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 73ad2d9909 ("efi: Move efi_bootflow_run() to a common file")
2025-09-02 06:41:27 -06:00
GitLab CI
1dd869d9ba chore: Bump version for release candidate 2025.09-rc1 2025.09-rc1 c2025.09-rc1 2025-09-01 10:12:06 +00:00
Simon Glass
1ec67f521c Merge branch 'apb' into 'master'
efi: App and devicetree improvements

See merge request u-boot/u-boot!165
2025-08-28 20:31:49 +00:00
Simon Glass
56dab05ff1 efi: app: Sync EFI reserved-memory to the devicetree
Obtain EFI's view of reserved memory and ensure that everything
mentioned there is present in a devicetree reserved-memory node. This
ensures that the OS doesn't try to access memory it shouldn't.

Series-to: concept
Series-cc: heinrich
Cover-letter:
efi: App and devicetree improvements

This series improves U-Boot's EFI app support and adds new functionality
for managing devicetree reserved-memory regions.

The main focus is on enhancing memory management when running as an EFI
application. A new mechanism is introduced to sync EFI reserved-memory
regions (such as runtime services and ACPI tables) with the devicetree's
/reserved-memory nodes. This ensures that Linux doesn't inadvertently use
memory regions that EFI firmware has reserved.

The main improvements are:

- New 'fdt reserved' command to display devicetree reserved-memory regions
- New 'efi memsync' command to synchronize EFI memory map with devicetree
- Enhance EFI application support with better memory region handling
- Improve EFI debugging commands and device path handling
- Better integrate EFI boot services and devicetree setup

There are a few other minor thigns:
- Enhance efidebug commands with media device and driver information
- Expose EFI device-paths in a few places in bootstd
- Improve bootflow device reporting
- ARM-specific fixes for exception level handling

This series addresses many of the issues found in booting Linux on
Qualcomm X-Elite laptops using the EFI app.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 13:21:33 -06:00
Simon Glass
6e9071ba14 efi: app: Add a simple-framebuffer node if enabled
The EFI app cannot make the EFI GOP available to Linux directly, since
it calls exit-boot-services before booting Linux. The easiest way to
provide an early console is with the simple-framebuffer feature. Add
this node to the devicetree if the feature is enabled.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 13:21:32 -06:00
Simon Glass
8132f56189 efi: fdt: Provide a command to sync the reserve-memory node
Provide a command to sync reserved-memory with EFI's version of reserved
memory.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 13:21:32 -06:00
Simon Glass
eb85d76a42 efi: Provide a way to sync EFI reserved-memory to fdt
When booting Linux with EFI the devicetree memory-map is ignored and
Linux calls through EFI to obtain the real memory map.

When booting Linux from the EFI app, without EFI, we must pass the
reserved memory onto Linux using the devicetree.

Add a function to support this. It reads the EFI memory-map and adds any
missing regions to the reserved-memory node.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 07:00:55 -06:00
Simon Glass
0dc72120b7 fdt: Add a command to show reserved-memory regions
Add a new 'fdt reserved' subcommand that displays all reserved memory
regions defined in the device tree's /reserved-memory node. This command
provides a formatted table showing the ID, name, start address, and size
of each reserved memory region.

Avoid a conflict with the existing 'fdt resize' command. Update the docs
and add a test.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 06:55:49 -06:00
Simon Glass
ecca5cc322 fdt: Add a function to show the reserved-memory nodes
Add a new helper which lists the subnodes of the reserved-memory node.
This can be helpful when checking the devicetree before booting.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-28 06:55:49 -06:00