[feature/patina-boot] patina_boot: Add discover_boot_options helper#1447
[feature/patina-boot] patina_boot: Add discover_boot_options helper#1447kat-perez wants to merge 1 commit intoOpenDevicePartnership:feature/patina-bootfrom
Conversation
✅ QEMU Validation PassedAll QEMU validation jobs completed successfully.
Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/23876918302 Boot Time to EFI Shell
Dependencies
This comment was automatically generated by the Patina QEMU PR Validation Post workflow. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
8cee855 to
1892744
Compare
f168dff to
d9458cb
Compare
1892744 to
f39c078
Compare
| const LOAD_OPTION_ACTIVE: u32 = 0x00000001; | ||
|
|
||
| /// Null-terminated UTF-16 `BootOrder` variable name. | ||
| const BOOT_ORDER_VARIABLE_NAME: &[u16] = |
There was a problem hiding this comment.
I missed this on earlier ones, but for these various UEFI spec defined things, we should be taking them to r-efi as well. Hosting them here until they are merged there is fine.
| name.push(c as u16); | ||
| } | ||
| for c in hex_chars { | ||
| name.push(c.to_ascii_uppercase() as u16); |
There was a problem hiding this comment.
Aren't these all digits? What does to_ascii_uppercase do on a digit?
There was a problem hiding this comment.
char::from_digit(n, 16) returns lowercase hex and UEFI variable names use uppercase. The to_ascii_uppercase was there to fix the casing. I changed this to use format!("Boot{:04X}", option_number) to specify more clearly that we want uppercase hex.
| return None; | ||
| } | ||
|
|
||
| let attributes = u32::from_le_bytes([data[0], data[1], data[2], data[3]]); |
There was a problem hiding this comment.
Lots of from_le_bytes throughout all these changes. A place to use zerocopy?
There was a problem hiding this comment.
Updated to use zerocopy
f39c078 to
97c8715
Compare
Reads BootOrder and Boot#### UEFI variables to build a BootConfig from UEFI-compliant boot options, enabling SimpleBootManager to use standard boot variables instead of platform-hardcoded device paths.
97c8715 to
5428475
Compare
Description
Add
discover_boot_options()helper topatina_boot::helpersthat reads UEFIBootOrderandBoot####variables to build aBootConfigfrom standard UEFI boot options.This enables any
BootOrchestratorimplementation that consumesBootConfigto use UEFI-compliant boot variables instead of requiring platforms to hardcode device paths. The function:BootOrderto determine boot attempt orderBoot####EFI_LOAD_OPTIONstructure to extract device pathsLOAD_OPTION_ACTIVE)BootConfigwith discovered devices in priority orderHow This Was Tested
feature/patina-booton QEMU Q35 — full boot to UEFI Shell 2.0Integration Instructions
Platforms can call
discover_boot_options()with runtime services to automatically populate aBootConfigfrom UEFI boot variables instead of constructing device paths manually. This works with anyBootOrchestratorimplementation that accepts aBootConfig: