Skip to content

[lib][uefi] implement missing protocols required by GBL#512

Merged
zhangxp1998 merged 3 commits into
littlekernel:masterfrom
zhangxp1998:master
Jun 24, 2026
Merged

[lib][uefi] implement missing protocols required by GBL#512
zhangxp1998 merged 3 commits into
littlekernel:masterfrom
zhangxp1998:master

Conversation

@zhangxp1998

Copy link
Copy Markdown
Contributor

Summary

  • add UEFI protocol implementations needed by GBL
  • add boot buffer allocation support for UEFI boot flows
  • print readable protocol GUID names in UEFI boot service traces

Test

  • source .env && make qemu-virt-arm64-test
  • git diff --check origin/master..HEAD

Copilot AI review requested due to automatic review settings June 16, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the LK UEFI shim to satisfy additional protocol expectations from GBL by adding protocol implementations/stubs, expanding boot buffer allocation options, and improving boot service trace readability via protocol GUID names.

Changes:

  • Added platform “open_*” hooks for GBL AVB, GBL Boot Control, and EFI RNG protocols, and wired them into open_protocol/handle-location paths.
  • Extended GblEfiBootMemoryProtocol::get_boot_buffer to support kernel/ramdisk/FDT buffer allocation.
  • Added protocol GUID → readable name mapping and improved boot service tracing/log formatting.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/uefi/uefi_platform.h Declares new protocol “open” helpers needed by the boot service provider.
lib/uefi/uefi_platform.cpp Adds stub implementations for AVB/BootControl/RNG protocols and changes default DT selection behavior.
lib/uefi/memory_protocols.cpp Adds additional boot buffer types and allocations for UEFI boot flows.
lib/uefi/boot_service_provider.h Exposes protocol_name() and adds the AVB protocol GUID constant.
lib/uefi/boot_service_provider.cpp Improves trace output with protocol names and implements singleton protocol handle discovery/allocation.
lib/uefi/blockio_protocols.h Updates block device listing API to use caller-provided buffers.
lib/uefi/blockio_protocols.cpp Implements the updated block device listing behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/uefi/uefi_platform.cpp
Comment thread lib/uefi/blockio_protocols.cpp
Comment thread lib/uefi/uefi_platform.cpp
Comment thread lib/uefi/boot_service_provider.cpp
Comment thread lib/uefi/blockio_protocols.cpp
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/boot_service_provider.cpp
Comment thread lib/uefi/boot_service_provider.h Outdated
Comment thread lib/uefi/uefi_platform.cpp Outdated
Comment thread lib/uefi/uefi_platform.h Outdated
Comment thread lib/uefi/boot_service_provider.cpp Outdated
Comment thread lib/uefi/uefi_platform.cpp Outdated
@zhangxp1998 zhangxp1998 force-pushed the master branch 2 times, most recently from 1dda88c to 595f932 Compare June 24, 2026 01:33
Comment thread lib/uefi/uefi_platform.cpp Outdated
Comment on lines +122 to +124
if (selected_overlay != num_device_trees) {
device_trees[selected_overlay].selected = true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we default to select the first overlay?

I think DT overlays should be selected by some criteria, like platform version / SOC name etc. Since we are not checking those, does it make more sense to select none overlays by default? or select ALL by default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent here is that this weak uefi_platform.cpp implementation is a QEMU-like reference implementation rather than a platform policy recommendation. QEMU normally does not provide overlay DTBs, so the exact overlay choice does not matter for the QEMU case.

For real OEM platforms, this hook is the place to filter and locate overlay DTBs from the input list using platform-specific criteria such as board/SOC/version. Selecting the first overlay here is just a simple reference behavior that shows where overlay selection happens; platform code should override it when the input can contain multiple meaningful overlays.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2eee933a: simplified the selection logic with select_first_dtb(type), then use it to select the first base DTB and the first overlay separately after clearing existing selections.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@zhangxp1998 zhangxp1998 merged commit 987f7f9 into littlekernel:master Jun 24, 2026
175 of 176 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants