Skip to content

Increase Patina GUID Usage [Rebase & FF]#1391

Merged
makubacki merged 4 commits intoOpenDevicePartnership:mainfrom
makubacki:use_patina_guid_2
Mar 16, 2026
Merged

Increase Patina GUID Usage [Rebase & FF]#1391
makubacki merged 4 commits intoOpenDevicePartnership:mainfrom
makubacki:use_patina_guid_2

Conversation

@makubacki
Copy link
Copy Markdown
Collaborator

@makubacki makubacki commented Mar 12, 2026

Description

A series of commits to increase adoption of Patina GUID types in the codebase.


sdk: Make BinaryGuid::from_bytes() const

This function wraps efi::Guid::from_bytes() which is const. It is
made const as well.


BinaryGuid: Derive Ord and PartialOrd

Add Ord and PartialOrd derives to BinaryGuid, enabling its use as a
BTreeMap key.

Adds a test to verify BinaryGuid's derived ordering matches Guid<'a>'s
byte-order comparison for a set of GUID pairs.


guid: Convert GUID types to BinaryGuid

Resolves #1105

Converts all GUID constants, trait associated types, struct fields,
and other uses to Patina GUID types across the codebase.

Key changes:

  • GUID constants mostly use BinaryGuid::from_string() since strings
    are more readable than fields. In some cases, a field may have been
    a simple numbering sequence like "123456...", in which case it may
    have been left as from_fields.
  • Changed ProtocolInterface::PROTOCOL_GUID changed to use
    BinaryGuid, eliminating duplicated GUID values in implementations.
  • Updated FromHob::HOB_GUID and HobParsers BTreeMap key to
    BinaryGuid.
  • Updated #[repr(C)] struct fields (GuidHob, FV/FFS headers,
    MM communicate header) to use BinaryGuid since it provides
    binary-compatible GUID storage.
  • Updated the FromHob proc macro to use BinaryGuid::from_string().
  • Updated a lot of code to use Patina GUID types instead of the r-efi
    GUID type.

There were a few places, particularly in UEFI Spec FFI interfaces,
where the efi::Guid type is still used. This is intentional to
potentially simplify the r-efi 6.0.0 integration. In code that
interacts with those interfaces, From and Into functions are used
to simply convert between BinaryGuid and efi::Guid. Some code
that exclusively interacts with those interfaces, might also use
efi::Guid for local GUID definitions instead of Patina GUID types.


  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all
  • patina-qemu Q35 and SBSA boot to EFI shell
  • Tested boot to Windows on a physical Intel platform

Integration Instructions

  • N/A - Patina refactor

@makubacki makubacki self-assigned this Mar 12, 2026
@patina-automation
Copy link
Copy Markdown
Contributor

patina-automation Bot commented Mar 12, 2026

✅ QEMU Validation Passed

All QEMU validation jobs completed successfully.

Note: Windows Q35 is only built (QEMU boot is disabled due to QEMU vfat issue).

Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/23165210991

Boot Time to EFI Shell

Platform Elapsed
Linux Q35 43.4s
Linux SBSA 40.8s

This comment was automatically generated by the Patina QEMU PR Validation Post workflow.

@github-actions github-actions Bot added impact:non-functional Does not have a functional impact impact:testing Affects testing type:documentation Improvements or additions to documentation labels Mar 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2026

makubacki and others added 4 commits March 16, 2026 16:17
This function wraps `efi::Guid::from_bytes()` which is const. It is
made const as well.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Add Ord and PartialOrd derives to BinaryGuid, enabling its use as a
BTreeMap key.

Adds a test to verify BinaryGuid's derived ordering matches Guid<'a>'s
byte-order comparison for a set of GUID pairs.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This change adds a few standard GUID definitions. This is to pave way
for later usage in rust supervisor.
Converts all GUID constants, trait associated types, struct fields,
and other uses to Patina GUID types across the codebase.

Key changes:

- GUID constants mostly use `BinaryGuid::from_string()` since strings
  are more readable than fields. In some cases, a field may have been
  a simple numbering sequence like "123456...", in which case it may
  have been left as `from_fields`.
- Changed `ProtocolInterface::PROTOCOL_GUID` changed to use
  `BinaryGuid`, eliminating duplicated GUID values in implementations.
- Updated `FromHob::HOB_GUID` and `HobParser`s `BTreeMap` key to
  `BinaryGuid`.
- Updated `#[repr(C)]` struct fields (GuidHob, FV/FFS headers,
  MM communicate header) to use `BinaryGuid` since it provides
  binary-compatible GUID storage.
- Updated the `FromHob` proc macro to use `BinaryGuid::from_string()`.
- Updated a lot of code to use Patina GUID types instead of the r-efi
  GUID type.

There were a few places, particularly in UEFI Spec FFI interfaces,
where the `efi::Guid` type is still used. This is intentional to
potentially simplify the r-efi 6.0.0 integration. In code that
interacts with those interfaces, `From` and `Into` functions are used
to simply convert between `BinaryGuid` and `efi::Guid`. Some code
that exclusively interacts with those interfaces, might also use
`efi::Guid` for local GUID definitions instead of Patina GUID types.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki
Copy link
Copy Markdown
Collaborator Author

Note: Patina QEMU PR Validation boot failure is expected until a patina-qemu release that fixes the issue described in OpenDevicePartnership/patina-dxe-core-qemu#142 is made.

@makubacki makubacki merged commit 064db2f into OpenDevicePartnership:main Mar 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:non-functional Does not have a functional impact impact:testing Affects testing type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Apply the Patina GUID type across the repo

4 participants