This patch series implements support for the EFI_PARTITION_INFO_PROTOCOL, to provide cached partition information for GPT partition types.
The EFI specification mentions that the protocol can understand legacy MBR partition types, but that's for backward compatibility and not implemented by this series. It can be added as a follow-up if needed, to make it fully compliant with the spec. Patch #1 moves the logic to get a GPT partition table entry to a helper part_get_gpt_pte() function. Patch #2 exposes that helper function to be used by the efi_loader. Patch #3 implements the actual protocol support using the mentioned helper to get the GPT partitions table entries. Patch #4 extends the existing block io EFI selftest to also check for some cached data provided by the partition info protocol. This is a v2 of the series, the first version can be found here: https://lists.denx.de/pipermail/u-boot/2025-June/592237.html The EFI_PARTITION_INFO_PROTOCOL implementation is added unconditionally, because the u-boot-size-test.sh reports the code increase is negligible: ./u-boot-size-test.sh qemu_arm64_lwip --all ... 01: Merge tag 'u-boot-dfu-20250616' of https://source.denx.de/u-boot/custodians/u-boot-dfu 02: disk: efi: Move logic to get a GPT entry into a helper function 03: disk: efi: expose the part_get_gpt_pte() helper function 04: efi_loader: disk: add EFI_PARTITION_INFO_PROTOCOL support 05: efi_selftest: Add basic partition info check to block io test 5 0 0 /5 qemu_arm64_lwip Completed: 5 total built, 5 newly), duration 0:01:32, rate 0.05 /tmp/qemu_arm64_lwip/add-efi-part-info-proto-v2/boards.cfg is up to date. Nothing to do. Summary of 5 commits for 1 boards (1 thread, 8 jobs per thread) 01: Merge tag 'u-boot-dfu-20250616' of https://source.denx.de/u-boot/custodians/u-boot-dfu 02: disk: efi: Move logic to get a GPT entry into a helper function aarch64: (for 1/1 boards) all -64.0 text -64.0 qemu_arm64_lwip: all -64 text -64 u-boot: add: 0/0, grow: 0/-1 bytes: 0/-72 (-72) function old new delta part_get_info_efi 468 396 -72 03: disk: efi: expose the part_get_gpt_pte() helper function aarch64: (for 1/1 boards) all +32.0 text +32.0 qemu_arm64_lwip: all +32 text +32 u-boot: add: 1/0, grow: 0/-1 bytes: 200/-164 (36) function old new delta part_get_gpt_pte - 200 +200 part_get_info_efi 396 232 -164 04: efi_loader: disk: add EFI_PARTITION_INFO_PROTOCOL support aarch64: (for 1/1 boards) all +144.0 rodata +16.0 text +128.0 qemu_arm64_lwip: all +144 rodata +16 text +128 u-boot: add: 0/0, grow: 1/0 bytes: 148/0 (148) function old new delta static.efi_disk_add_dev 636 784 +148 05: efi_selftest: Add basic partition info check to block io test aarch64: (for 1/1 boards) all +563.0 rodata +179.0 text +384.0 qemu_arm64_lwip: all +563 rodata +179 text +384 u-boot: add: 1/0, grow: 1/0 bytes: 384/0 (384) function old new delta execute 36428 36796 +368 partition_info_guid - 16 +16 (no errors to report) Changes in v2: - Add a test for the EFI partition information protocol (Tom Rini). Javier Martinez Canillas (4): disk: efi: Move logic to get a GPT entry into a helper function disk: efi: expose the part_get_gpt_pte() helper function efi_loader: disk: add EFI_PARTITION_INFO_PROTOCOL support efi_selftest: Add basic partition info check to block io test disk/part_efi.c | 67 ++++++++++++-------- include/part.h | 14 ++++ include/part_efi.h | 20 ++++++ lib/efi_loader/efi_disk.c | 38 ++++++++++- lib/efi_selftest/efi_selftest_block_device.c | 29 +++++++++ 5 files changed, 139 insertions(+), 29 deletions(-) -- 2.49.0 base-commit: 17012e3068d047ad71460f039eeb0c3be63f82a0 branch: add-efi-part-info-proto-v2

