Skip to content

[major] Add Initial Patina UEFI Services [Rebase & FF] - #1743

Open
makubacki wants to merge 63 commits into
OpenDevicePartnership:majorfrom
makubacki:patina_uefi_services_major
Open

[major] Add Initial Patina UEFI Services [Rebase & FF]#1743
makubacki wants to merge 63 commits into
OpenDevicePartnership:majorfrom
makubacki:patina_uefi_services_major

Conversation

@makubacki

@makubacki makubacki commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Description

Includes an initial merge commit from the current main branch into major.

Adds a new set of Patina component services called "UEFI Services". These services are defined in the Patina SDK, produced by the Patina DXE Core, and used by Patina components.

Main changes:

  1. Add Patina UEFI Services trait and related definitions - see sdk\patina\src\component\service\uefi_services.
  2. Produce Patina UEFI Services in the DXE Core - see patina_dxe_core\src\uefi_services.
  3. Add Patina component samples using the services - see
    components\patina_samples\src\component\uefi_services.
  4. Migration of existing components (mostly those in /components) to Patina UEFI Services from StandardBootServices.
  5. Various supporting changes for (4).
  6. Introduction of a new type called ServiceCell<T> for uses cases where Service<T>::new_unit() is used today + an additional case. Slightly controversial. Considered an incremental improvement in clarity and safety. See the commit message for reasoning.
  7. Removal of StandardBootServices and related changes to do so across the codebase.
  8. Refactoring of several components to break apart monolithic implementations, reduce bloat, and make entry points cleaner, with a cleaner set of dependencies for given responsibilities.
  9. Adds a new component model parameter type Protocol<P> that can allow a protocol to be a dependency for component dispatch.
  10. Add UEFI Driver Model support
    • Adds a DriverBinding trait and the ability to generate agent handles - see sdk/patina/src/component/service/uefi_services/driver_binding.rs
    • Adds a UefiDriverModelComponentName trait that can be used for a component to produce the EFI Component Name protocols - see components/patina_samples/src/component/uefi_services/component_name_producer.rs
    • Adds a install_uefi_driver_model_driver_supported_efi_version Protocol service to allow components to easily produce the EFI Driver Supported EFI Version Protocol - see sdk/patina/src/component/service/uefi_services/driver_model/driver_supported_efi_version.rs
  11. Adds a "PCD Service" that while seemingly contradictory to Patina's stance to not support PCDs, only allows access to dynamic PCDs accessible through the PCD protocol (PCDs are still not really supported). This allows code written in Patina components to have minimal access to those dynamic PCDs that are accessible through the protocol. See components/patina_pcd/.
  12. Adds a "Patina Graphics Console" component that demonstrates using many prior changes to implement the functionality necessary to replace the EDK II GraphicsConsoleDxe driver. See components/patina_graphics_console.
  13. Documentation updates for various refactoring in components.
  14. Documentation for Patina service access and storage patterns. Useful even before this change, more useful now. See docs\src\component\storing_state.md.
  15. Documentation for when to use Patina UEFI Services - see docs\src\component\storing_state.md.
  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all
  • QEMU ArmVirt & Q35 boot to EFI shell with Patina samples included
    • Initial component dispatch (DXE core and sample components):

      INFO - Dispatching Drivers
      INFO - Dispatching patina_dxe_core::cpu::cpu_arch_protocol::CpuArchProtocolInstaller
      INFO - InstallProtocolInterface: 26BACCB1-6F42-11D4-BCE7-0080C73C8881 @ 0x000000007a1ff800
      INFO - installed EFI_CPU_ARCH_PROTOCOL_GUID
      INFO - Dispatching patina_dxe_core::systemtables::SystemTableChecksumInstaller
      INFO - Dispatching patina_dxe_core::decompress::DecompressProtocolInstaller
      INFO - InstallProtocolInterface: D8117CFE-94A6-11D4-9A3A-0090273FC14D @ 0x000000007a977700
      INFO - Dispatching patina_adv_logger::component::AdvancedLoggerComponent<patina::peripheral::serial::uart::uart_16550::Uart16550>
      INFO - InstallProtocolInterface: 434F695C-EF26-4A12-9EBA-DDEF0097497C @ 0x000000007a200220
      INFO - Advanced Logger protocol installed.
      INFO - Dispatching patina_samples::component::uefi_services::configuration_table::ConfigurationTableSample
      INFO - Installed SampleVendorTable v1
      INFO - Read back signature "PTNA", 0 entries
      INFO - Dispatching patina_samples::component::uefi_services::driver_connect::DriverConnectSample
      INFO - Dispatching patina_samples::component::uefi_services::protocol_publisher::ProtocolPublisherSample
      INFO - InstallProtocolInterface: A1B2C3D4-E5F6-4789-ABCD-EF0123456789 @ 0x000000007ad727c8
      INFO - published SampleVendorProtocol on handle Handle(0x688cdc10f3d4e4b5)
      INFO - Dispatching patina_samples::component::uefi_services::protocol_publisher::ProtocolConsumerSample
      INFO - SampleVendorProtocol rev 0x10000 returned status 0x12345678
      INFO - Dispatching patina_samples::component::uefi_services::protocol_consumer::ProtocolConsumerSample
      INFO - with_protocol() read status is 0x12345678
      INFO - open_protocol() revision is 0x10000
      INFO - open_protocol() status is 0x12345678
      INFO - Protocol token resolved, status is 0x12345678
      INFO - SampleVendorProtocol notification: Protocol is installed on Handle(0x688cdc10f3d4e4b5)
      INFO - Dispatching patina_samples::component::uefi_services::tpl_critical_section::TplCriticalSectionSample
      INFO - Counters were kept consistent under raised TPL
      INFO - Dispatching patina_samples::component::uefi_services::end_of_dxe_protocol_consumer::EndOfDxeProtocolConsumerSample
      INFO - Registered End-of-DXE callback for SampleVendorProtocol
      INFO - Dispatching qemu_resources::q35::component::service::mm_config_provider::MmConfigurationProvider
      INFO - ACPI I/O Port Address: 0xB00F8040
      INFO - ACPI (PMBASE) I/O Port: 0x600
      INFO - Found 1 MM Communicate Region HOBs
      INFO - Dispatching qemu_resources::q35::component::service::mm_control::QemuQ35PlatformMmControl
      INFO - Dispatching patina_mm::component::sw_mmi_manager::SwMmiManager
      INFO - Dispatching patina_mm::component::communicator::MmCommunicator
      INFO - Dispatching qemu_resources::q35::component::service::mm_test::QemuQ35MmTest
      INFO - MM Supervisor Version: 0x0, Patch Level: 0x0, Max Request Level: 0x3533715F756D6571
      INFO - Dispatching patina_performance::component::protocol::MeasurementProtocolPublisher
      INFO - InstallProtocolInterface: C85D06BE-5F75-48CE-A80F-1236BA3B87B1 @ 0x000000007ad715e8
      INFO - Dispatching patina_performance::component::property::PropertyPublisher
      INFO - Dispatching patina_performance::component::fbpt::FbptPublisher
      INFO - Dispatching patina_performance::component::mm_records::MmRecordCollector
      INFO - Dispatching patina_smbios::component::provider::SmbiosProvider
      INFO - Dispatching patina_smbios::component::protocol_publisher::SmbiosProtocolPublisher
      INFO - InstallProtocolInterface: 03583FF6-CB36-4940-947E-B9B39F4AFAF7 @ 0x000000007a973800
      INFO - Dispatching qemu_resources::q35::component::service::smbios_platform::Q35SmbiosPlatform
      INFO - Dispatching patina_acpi::component::AcpiComponent
      INFO - InstallProtocolInterface: FFE06BDD-6107-46A6-7BB2-5A9C7EC5275C @ 0x000000007ad35028
      INFO - InstallProtocolInterface: 7F3C1A92-8B4E-4D2F-A6C9-3E12F4B8D7C1 @ 0x000000007ad35010
      INFO - Depex evaluation complete, scheduled 2 drivers
      
    • Later after the Timer Architectural protocol is installed:

      INFO - Dispatching patina_samples::component::uefi_services::overview::UefiServicesSample
      INFO - Sample crc32 = 0x7c22221c
      INFO - Dispatching patina_samples::component::uefi_services::timers::TimerSample
      INFO - Armed one-shot (50 ms) and periodic (10 ms) timers
      INFO - Logged from the periodic timer event
      INFO - Logged from the one-shot timer event
      INFO - Logged from the periodic timer event
      INFO - Logged from the periodic timer event
      INFO - Logged from the periodic timer event
      INFO - Logged from the periodic timer event
      INFO - Logged from the periodic timer event
      
    • End of DXE messages:

      INFO - End of DXE: sample_get_status returned 0x12345678
      INFO - Logged from the periodic timer event
      All EndOfDxe callbacks have returned successfully
      
    • All Patina on-system tests pass:

      INFO - adv_logger_test: Direct log message!!!
      adv_logger_test: Logged through the protocol!!!
      INFO - Patina on-system unit-test results:
        patina_acpi::integration_test::acpi_protocol_test ... ok (1 passes)
        patina_acpi::integration_test::acpi_test ... ok (1 passes)
        patina_adv_logger::integration_test::adv_logger_test ... ok (1 passes)
        patina_dxe_core::core_patina_tests::audit_tests::gcd_free_memory_merged_test ... ok (1 passes)
        patina_dxe_core::core_patina_tests::stability_tests::page_table_tests_1gb_split ... ok (4 passes)
        patina_dxe_core::core_patina_tests::stability_tests::page_table_tests_1gb_unmap_2mb_remap ... ok (4 passes)
        patina_dxe_core::core_patina_tests::stability_tests::page_table_tests_1gb_unmap_4kb_remap ... ok (4 passes)
        patina_dxe_core::core_patina_tests::stability_tests::page_table_tests_2mb_split ... ok (4 passes)
        patina_dxe_core::core_patina_tests::stability_tests::page_table_tests_2mb_unmap ... ok (4 passes)
        patina_dxe_core::memory_manager::memory_manager_allocations_test ... ok (1 passes)
        patina_dxe_core::memory_manager::memory_manager_attributes_test ... ok (1 passes)
        qemu_resources::q35::component::service::smbios_test::q35_smbios_ffi_test ... ok (1 passes)
      Patina on-system unit-test result totals: 27 passes, 0 fails
      
  • Verified EFI shell console rendering after removing GraphicsConsoleDxe from QEMU platforms and using the patina_graphics_console component instead.

Integration Instructions

  • See individual crate documentation samples. In addition, a patina-dxe-core-qemu PR will demonstrate the changes needed to integrate and use the new components.

@makubacki makubacki self-assigned this Aug 13, 2026
@github-actions github-actions Bot added impact:breaking-change Requires integration attention impact:testing Affects testing type:documentation Improvements or additions to documentation labels Aug 13, 2026
@makubacki

Copy link
Copy Markdown
Collaborator Author

I'm working on some changes to improve unit test coverage.

@patina-automation

patina-automation Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

ℹ️ QEMU Validation Skipped - Unsupported Target Branch

The Patina QEMU PR validation workflow did not run because the PR targets an unsupported branch.

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

Note: Previous results are available in this comment's edit history.

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

@makubacki
makubacki force-pushed the patina_uefi_services_major branch from f63f1af to 3e810b7 Compare August 14, 2026 20:08
@makubacki

Copy link
Copy Markdown
Collaborator Author

I'm working on some changes to improve unit test coverage.

Pushed. Also updated the major branch to include the clippy pedantic changes in main (merged at a1f6643) and rebased changes against those new lints.

@cfernald cfernald left a comment

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.

just reviewed the SDK interface for now. Will review the full changes later.

Comment thread sdk/patina/src/component/service/uefi_services/timing.rs
Comment thread sdk/patina/src/component/service/uefi_services/timing.rs
Comment thread sdk/patina/src/component/service/uefi_services/timer_event.rs
Comment thread sdk/patina/src/component/service/uefi_services/protocol.rs
Comment thread sdk/patina/src/component/service/uefi_services/protocol.rs
Comment thread sdk/patina/src/component/service/uefi_services/protocol.rs
Comment thread sdk/patina/src/component/service/uefi_services/misc.rs Outdated
Comment thread sdk/patina/src/component/service/uefi_services/image.rs
Comment thread sdk/patina/src/component/service/uefi_services/config_table.rs Outdated
Comment thread sdk/patina/src/component/service/uefi_services/config_table.rs Outdated
Comment thread sdk/patina/src/component/service.rs Outdated
Comment thread sdk/patina/src/component/service/cell.rs Outdated
Comment thread sdk/patina/src/component/service/cell.rs

@kat-perez kat-perez left a comment

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.

I found several safety and contract issues in the new service layer that should be addressed before merge. The inline comments focus on callback lifetime, protocol reference lifetime, marker protocol compatibility, and duration conversion.

@kat-perez
kat-perez dismissed their stale review August 19, 2026 20:52

Withdrawn by reviewer for additional cross-checking before feedback is submitted.

Comment thread components/patina_smbios/src/manager.rs Outdated
@makubacki
makubacki force-pushed the patina_uefi_services_major branch 3 times, most recently from b9d0dbd to 75530e3 Compare August 20, 2026 20:19
@makubacki

Copy link
Copy Markdown
Collaborator Author

@Javagedes, @cfernald, @kat-perez, this is ready for you review again when you get time.

Updates `acpi_protocol_test` to use `ProtocolServices` instead of
`StandardBootServices` to locate the ACPI Table and ACPI Get protocols.

This allows two unsafe code blocks at the call sites to be removed.

This was the last `StandardBootServices` usage in the crate, so
`patina_acpi` no longer depends on it at all.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
`CpuArchProtocolInstaller`, `HwInterruptProtocolInstaller`,
`SystemTableChecksumInstaller`, and `DecompressProtocolInstaller`
were the last components in patina_dxe_core still depending on
`StandardBootServices` directly.

This change moves them onto `Service<dyn ProtocolServices>` so
`StandardBootServices` can be removed from the component model
in a follow up change.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Now that no component in patina_dxe_core depends on `StandardBootServices`
directly, this drops `ComponentDispatcher::set_boot_services` and the code
in `Core::initialize_system_table` that constructed a `StandardBootServices`
for the component dispatcher. `StandardRuntimeServices` not modified.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Removes the `StandardBootServices` param from the component benchmark
entrry points since `StandardBootServices` is about to be removed
from the component model.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Removes the `StandardBootServices` `Param` implementation and all
references to it. Removes the `boot_services` field from `Storage`.

Removes logic in the `#[component]` parameter validation macro that
checked for duplicate `StandardBootServices` parameters.

In cases where `StandardBootServices` was used as an example type in
tests for `Option<T>` and tuple `Param` implementations, it was
replaced with `StandardRuntimeServices`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Straightforward update to docs that referenced `StandardBootServices`
to either drop the reference or replace it with the equivalent info
or example from UEFI Services.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Provides a `locate_first_handle()` method to more conveniently find
a single handle that supports a given protocol.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a `DriverBinding` trait  that can be implemented and passed to
`install_driver_binding()` to produce a driver binding protocol in a
component.

Since components are all statically compiled with the DXE Core, they
cannot use image handles as agent handles as is common in C-based DXE
drivers. Therefore, a `register_agent()` function is added to
`ProtocolServices` that generates a unique agent handle for a component
to use when opening protocols. An example of using this API and opening
a protocol is added to `patina_samples`.

The `open_protocol()` interface is updated to accept an agent handle
and `OpenAttributes` that describe how the protocol is being opened.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Moves driver.rs and driver_binding.rs from
component/service/uefi_services into a new
component/service/uefi_services/driver_model module. Both files expose
services that are part of the UEFI Driver Model, connecting drivers to
controllers and producing a driver binding protocol, so grouping them
together gives components and future additions like component name
publishing a clear place in the SDK.

Had to broaden `DriverBindingHolder` and its trampoline functions from
`pub(super)` to `pub(in crate::component::service::uefi_services)`
since protocol.rs is no longer a direct sibling.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Add `LanguageTable` and `LanguageEntry` under
`component::service::uefi_services::driver_model`.

A `LanguageTable` holds a small list of names, each paired with the
ISO 639-2 code the legacy component name protocol uses and the
RFC 4646 tag the current one uses. This is similar to how EDK II
drivers share `EFI_UNICODE_STRING_TABLE` between both protocols.

`lookup_v1()` matches the fixed three character ISO 639-2 code.

`lookup_v2()` matches the RFC 4646 tag case insensitively, then falls
back to the primary subtag, this covers a practical subset of what
`GetBestLanguage()` (in EDK II) does.

Neither method depends on anything specific to a protocol, so both can
be reused by whatever eventually consumes the table.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This temporary definition of the component name v1 and v2 protocols
is added until the r-efi changes are released.

This commit should simply be reverted and the r-efi protocol used
(through the SDK re-export) when it is released.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
…tion (until in r-efi)

This temporary definition of the EFI Driver Supported EFI Version
protocol is added until the r-efi changes are released.

This commit should simply be reverted and the r-efi protocol used
(through the SDK re-export) when it is released.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
…cols

Adds a trait that a component can implement to publish both
`EFI_COMPONENT_NAME_PROTOCOL` and `EFI_COMPONENT_NAME2_PROTOCOL`.
This prevents components from handling raw structures and maintaining
their `SupportedLanguages` strings (having to keep them in sync) the
way a C driver does today.

`driver_name` is required and returns a `LanguageTable`.

`controller_name` defaults to returning `None`. Many drivers only
name themselves and do not name their controllers.

Adds a new function `install_uefi_driver_model_component_name()` to
`ProtocolServicesExt`. This function builds both protocols from a
single implementation and computes each protocol's `SupportedLanguages`
from the driver name table, and installs both on the same handle.

If installing the second protocol fails, the first is uninstalled so
a partial publish is not left behind.

The `Language` parameter is handled differently between the two
protocols because the UEFI specification treats them differently.

`EFI_COMPONENT_NAME_PROTOCOL`'s `Language` is a fixed three byte
ISO 639-2 code with no NUL termination guarantee, so it is read as a
three byte buffer. `EFI_COMPONENT_NAME2_PROTOCOL`'s `Language` is a NUL
terminated RFC 4646 tag, so it is read with the existing `Char8Str`
type.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds `ComponentNameProducerSample` to show a component that publishes
a fixed English driver name using `install_uefi_driver_model_component_name()`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
…I Services

To ease UEFI driver model development, this adds a function to
`ProtocolServicesExt` to build and install the EFI Driver Supported EFI
Version protocol on a handle, creating a new handle if needed.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Demonstrates how to install an instance of the EFI Driver Supported EFI
Version protocol on a handle.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a new `Param` type, `Protocol<P>`, so a component's `entry_point`
can depend on a specific UEFI protocol interface being installed.

The component is not dispatched until both the `ProtocolServices`
service and an interface for `P` are available. Dereferencing the
parameter gives direct access to the interface.

Reuses `Param` implementation from `Service<dyn ProtocolServices>`
where possible, with a `locate_interface()` check in `validate()`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Shows how a `Protocol<P>` parameter can be used to gate component
dispatch on a protocol being installed.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Add the PCD Protocol definition to the Patina SDK and implement
`ProtocolInterface` for it.

This is only intended to be used by a Patina PCD service wrapper
to provide service-based access to components that must read and
write dynamic PCDs to interact with existing C-based code in an
overall software stack.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a trait to define PCD accessors, and a `PcdError` type. Expected
to be used by a component to produce a PCD Service and by other
component that need to interact with PCDs using the service.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds `patina_pcd`, a component that locates `PCD_PROTOCOL` and
produces a `PcdServices` service so other components can get and set
`Dynamic` and `DynamicEx` PCDs.

The `PcdProvider` component takes `Protocol<PcdProtocol>` as an entry
point parameter and registers itself as the `PcdServices` service.

Scope is limited to get and set. SKU selection, set-callbacks, and
token/token-space enumeration are not supported.

In general, Patina components should not use PCDs. The Dynamic type
PCDs are available through this service only because many C-based
drivers dynamically set and read PCD values and, in order for a
Patina component to interoperate with those drivers, it must be able
to read and set the same PCDs.

Patina components that do not have that requirement should not use
this service and not include the component at all in their Patina
DXE Core binary file where components are selected.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a new Patina Graphics Console Components that implements the
functionality of the EDK II GraphicsConsoleDxe driver.

Because the EDK II GraphicsConsoleDxe driver is just a participant
in a larger UEFI driver model set of drivers, this component is also
used to show how a Patina component can participate in the UEFI driver
model with other code still written in C and using EDK II-specific
mechanisms during DXE execution such as dynamic PCDs.

The driver may drop certain extensions specific to EDK II compatibility
as more of the dependencies using those features are ported to Patina.

The driver is currently not a "drop-in" replacement for the
GraphicsConsoleDxe driver as it does not implement a default font
package. That will be added in a future commit.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki
makubacki force-pushed the patina_uefi_services_major branch from 1fed1b9 to 5051c61 Compare September 8, 2026 19:23
The C GraphicsConsoleDxe driver registered a default font package
with a single font ("simple font") that was used to render glyphs
when another font was not available. The component currently relies
on an `EFI_HII_FONT_PROTOCOL` that is typically published by
HiiDatabaseDxe. In the C GraphicsConsoleDxe driver, the driver entry
point registers a notify callback on `gEfiHiiDatabaseProtocolGuid`
which calls a `RegisterFontPackage()` function in the driver that
builds a `EFI_HII_SIMPLE_FONT_PACKAGE_HDR` structure that wraps
the glyph data (from `gUsStdNarrowGlyphData`) and then calls
`HiiAddPackages()` to register it with the HII Database.

Originally, the component did not register a default font package.
However, at least on QEMU firmware, the default is used. Therefore,
this change adds a default font package to the component that is
registered with the HII Database if it is available.

This copies the `gUsStdNarrowGlyphData` glyph data exactly from
the C driver. A `font_package` module is added that locates the HII
Database protocol and registers the font package.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a document that explains common scenario where services need
be shared and stored and patterns for those scenarios.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a document that explains when to use Patina UEFI Services and
links to individual service documentation.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki
makubacki force-pushed the patina_uefi_services_major branch from 5051c61 to 89f426b Compare September 8, 2026 19:41
@makubacki

makubacki commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

I've decided to spend a bit more time improving open protocol and driver binding since that might impact some other interfaces and there's no point having those in an intermediate state. Will push that update within a few days.

Merged main into the major branch (at commit 35f9055) and rebased the PR onto it. The main set of changes added are in commit 59cc862.

I made some cumulative changes to better support UEFI Driver Model components, the PR description is updated.

The summary of new changes is a locate_first_handle function in Protocol Services, support for producing the EFI Component Name protocol, support for producing the EFI Driver Supported EFI Version protocol, support for a new component parameter Protocol<P> that allows a protocol to be a component dependency, a minimal PCD service that only abstracts access to Dynamic PCDs using an underlying PCD protocol, and a Patina component port of GraphicsConsoleDxe to show many of the UEFI Services changes working together.

/// Ok(())
/// }
/// ```
pub trait ConfigTable: Sized + 'static {

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 not ?Sized? A lot of config tables are DSTs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I went with a different approach than an actual DST as I'm not sure it would work here if following the Config Table ABI in the UEFI Spec (GUID and pointer pairs). An example is SampleDynamicTable.

I thought that gets most of the practical value for a header + trailing data.

/// Ok(())
/// }
/// ```
pub trait ConfigTable: Sized + 'static {

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.

It seems odd for the trait to require 'static. I think if this is a requirement to install it should be in the install function instead of the trait.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Is there a particular reason why? From a boot timeline perspective, a config table is expected to persist through the OS transition, which we treat as 'static. So, it accurately reflects that a UEFI configuration table must stay valid throughout that time once published.

Centralizing it on the trait avoids the lifetime being forgotten elsewhere. The functions rely on TypeId::of::<T>() which requires T be 'static. Functions like get() only return Option<&'static T> so the bound there can just be derived from parameters like in install() where a T parameter is present.

I think it also simplifies tracking what's expected versus manually coordinating/managing it in individual functions.

@makubacki

Copy link
Copy Markdown
Collaborator Author

I've made some additional changes to handle pool allocations returned from C code, split GOP-specific logic out to a dedicated component/service and move the default font package into its own component (out of patina_graphics_console), so it, along with other font packages, can be independently managed from the graphics console component. Will push these updates soon. I've also started breaking out standalone changes into PRs into main to start reducing this PR to incremental changes that need to go to major. When that's done, I'll merge main into major and rebase this PR, dropping those commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:breaking-change Requires integration attention impact:testing Affects testing type:documentation Improvements or additions to documentation

Projects

None yet

6 participants