Skip to content

Merge major branch into main [Rebase & FF] - #1876

Merged
makubacki merged 57 commits into
mainfrom
major
Oct 13, 2026
Merged

makubacki merged 57 commits into
mainfrom
major

Conversation

@makubacki

@makubacki makubacki commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

QEMU PR VALIDATION IS EXPECTED TO FAIL (BREAKING CHANGES) AND WILL BE OVERRIDDEN

Description

Closes #1537
Closes #432
Closes #515

Merges changes accumulated in the major branch since the last Patina major release into the main branch. By definition, this will be a breaking change for Patina integration. Read the integration notes carefully, refer to QEMU examples, sample code included in these changes, documentation updates, and finally reach out in GitHub discussions if there are any questions.


Key high-level changes:


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

How This Was Tested

  • Verify all new unit tests added
  • Write Patina components leveraging UEFI Services
  • Verify all existing Patina components ported to use UEFI Services
  • Verify testing of all patina_samples using UEFI Services

Integration Instructions

  • Review the UEFI Services overview

  • Replace components using StandardBootServices with the corresponding UEFI Service dependencies

  • Review the Patina UEFI Services samples to see how UEFI Services are used for common operations

  • Update the code used to build your DXE core binary to account for components that may have been split into more granular components. The following components were split into more granular components: patina_performance and patina_smbios

  • Update the code used to build your DXE Core binary to specify the UEFI Specification version your platform supports by assigning PlatformInfo::UEFI_SPEC_VERSION. For example:

    // ...
    impl PlatformInfo for Q35 {
        const UEFI_SPEC_VERSION: patina::UefiSpecVersion = patina::UefiSpecVersion::V2_11;
        // ...

Detailed Changes


1687: [major] Remove "alloc" from "core" feature

Description

  • The core feature is redundant and ambiguous with its dependent
    feature "alloc" now explicitly called out. Hence removing it.

  • The actual usage of the "core" feature need to reevaluated eventually,
    As its current usage is hacky just to expose
    arch::enable_interrupts() and arch::disable_interrupts() only to
    Patina crates (also referred to as "core" crates). However, it does
    not prevent external crates from enabling the core feature in their
    dependencies and using these restricted APIs. Overall, feature flags
    are intended for conditional compilation, not for enforcing
    visibility or access control over internal APIs.

  • Impacts functionality?

  • Impacts security?

  • Breaking change?

  • Includes tests?

  • Includes documentation?

How This Was Tested

cargo make all in Patina and patina-dxe-core-qemu

Integration Instructions

NA: core feature is expected to be enabled only by internal crates of Patina. So removal of "alloc" should not affect consumers of patina crates. Hence the change is not marked as breaking.


1743: Add Initial Patina UEFI Services

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.

Note: Throughout the development of this PR, other changes were added that built on the code that currently remains. Those have been removed to reduce the size of this PR, and the above set of changes are the primary set that remain.

  • 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.

1787: Prevent protocol notification at TPL_HIGH

Description

Note: This can be squashed into earlier commits when major is being prepared to merge into main.

TPLs allowed as arguments to register_install_notify() are defined in patina::component::service::uefi_services::tpl::Tpl.

This change prevents registering protocol install notifications at TPL_HIGH, ensuring that callbacks are only invoked at allowed TPL levels.

Matches the behavior defined in CoreCreateEventEx() in edk2 for EVT_NOTIFY_SIGNAL events.

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

How This Was Tested

  • cargo make all

Integration Instructions

  • N/A

1778: Add and integrate ServiceCell

Description

A series of commits for adding a new type ServiceCell<T> in place of Service::new_unit(). This was already part of approved changes in #1743, but broken out here for clarity.


sdk: Add ServiceCell for bridging services to context-free callbacks

extern "efiapi" functions backing EDK II protocols carry no context
parameter, so a component can't hand them a Service<T> the way it
can a closure-based callback. ServiceCell<T> gives components a
wait-free, write-once cell for this. The publish() function never
blocks even under contention, so it can't deadlock under preemption
like other mechanisms.


sdk: Impl Debug for Service

Implements the Debug trait for Service<T> to allow the type to be
used in contexts where Debug is required.

Since the value field in Service<T> is OnceCell<&'static dyn Any>
and dyn Any does not implement Debug, the implementation here
is custom (instead of deriving Debug) and just prints the type
name of the service interface T.


Swap Service::new_unit() usage to ServiceCell

Updates code using Service::new_unit() to use ServiceCell<T> to
align on a single approach for safely storing services accessed in
different contexts.


sdk: Drop Service::new_uninit()

There is nothing wrong with Service::new_uninit() for the use case
it directly supports, that allows a Service<T> to be created before
the underlying service is available.

For example, it allows AdvancedLogger to be const-constructible
before the actual component dispatch system is available. Then the
component entry point can call .replace() to safely fill in the
actual service implementation once the service is ready.

However, there is also a need to more generically support service
storage for cases when an extern "efiapi" protocol function produced
by a component and the protocol interface does not have a this
context pointer. Using Service<T> for that case is certainly
possible, but it starts to mix two different use cases in a single
type.

Service<T> relies heavily on Deref to provide a convenient
interface to the underlying service, but that convenience can be
dangerous when the service is not yet available. It is easy to
forget to check for availability before dereferencing, which can
lead to panics. Deref::deref() has to return &Target, it cannot
return Option<&Target>, so there is no way to signal that the
service is not yet available.

Of course, is_init() or map_or_else() could be used, but it
is safer and makes Service<T> easier to reason about if it
simply represents an available service. Then, dereferencing a
service is always safe (the common case).

This aligns with official Deref implementation guidance
(https://doc.rust-lang.org/std/ops/trait.Deref.html#when-to-implement-deref-or-derefmut):

In general, deref traits should not be implemented if:

1. the deref implementations could fail unexpectedly; or
2. the type has methods that are likely to collide with methods on the target type; or
3. committing to deref coercion as part of the public API is not desirable.

For these cases, having a dedicated type that does not implement
Deref allows the type to clearly distinguish between an
uninitialized service and an initialized one forcing users to
handle the uninitialized case explicitly while also making the
usage pattern more clear.

The ServiceCell<T> moves these semantics into a separate type
that allows the value to set once (wrapping OnceCell<T>) and then
read as an Option<&T> (using get()). Existing callers that want
to panic can simply call .get().expect("service not published yet")
to get the same behavior and provide a custom message at the call
site. The ServiceCell<T> type is also Sync and compare-exchange
guarded, so a second call to publish() will return an error instead
of racing the first.


Remove clone calls on Service instances

Now that Service<T> implements Copy, explicit calls to clone()
are no longer necessary and can be removed.

Also prevents the clippy::clone_on_copy lint from warning about
unnecessary clones.


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

How This Was Tested

  • cargo make all
  • Boot to EFI shell on QEMU ArmVirt & SBSA with all components enabled

Integration Instructions

  • N/A

1798: Integrate UEFI Services with patina_performance and refactor the component

Description

A series of commits to split patina_performance into more granular components that take dependencies relevant to that task they are performing and integrate UEFI Services in the process.


patina_performance: Migrate protocol.rs to MeasurementProtocolPublisher

Splits the protocol-installation responsibility out of the monolithic
Performance component into its own MeasurementProtocolPublisher, and
replaces the custom ServiceHolder (OnceCell + AtomicBool + manual
unsafe impl Sync) with ServiceCell, installing the protocol
through ProtocolServicesExt instead of a raw BootServices call.

The old Performance component is untouched and keeps working during
this incremental migration. It will be removed once the remaining
components are split out.


patina_performance: Add PropertyPublisher component

Splits performance property publishing out of the monolithic
Performance component. Depends only on ArchTimerFunctionality and
ConfigurationTableServices for its own work, plus PerformanceManager
as a dependency so this table is only published when performance
measurement is enabled.


patina_performance: Add FbptPublisher component

Splits FBPT (Firmware Basic Boot Performance Table) publishing out of
the monolithic Performance component.

Migrates the End-of-DXE event registration, protocol location, page
allocation, and configuration table installation from raw BootServices
calls to granular service calls to EventServices, ProtocolServices,
MemoryManager, and ConfigurationTableServices.

RuntimeServices is left as a generic parameter since there is not
a dedicated Patina service for Runtime Services at this time.

The old close_event() once-only guard is replaced with a captured
Cell<bool>, since the closure-based event API does not hand the
callback its own Event to close.


patina_performance: Add MmRecordCollector component

Splits MM performance record collection out of the monolithic
Performance component.

mm_comm_service is now a required Service<dyn MmCommunication>
rather than Option<Service<...>>, so the dispatcher itself skips
this component on platforms with no MM communication region instead
of branching on an Option<Service<...>> at runtime.

Also adds a core::error::Error impl for MmPerformanceError
while it is already being moved.


patina_performance: Remove the monolithic Performance component

The monolithic Performance component has now been split into separate
single-purpose components, each with its own responsibilities, so it
can be removed.


components/patina_performance: Add key log messages

Makes it easier to confirm key events happen in the patina_perforamnce
components by being able to track and verify important events in the
log.


Update docs for the patina_performance component split

Updates docs in the mdbook and the patina_performance component crate
to reflect the recent split of the monolithic patina_performance
component into separate components.


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

How This Was Tested

  • cargo make all
  • Add components to Q35 with PERF_TRACE_ENABLE=TRUE and check perf data is available

Integration Instructions

  • N/A

1807: sdk: Implement TplController for Service

Description

Adds an impl of TplController for Service<dyn TplServices> along with a TryFrom<BootServicesTpl> implementation for Tpl that acts as a bridge between the raw boot services TPL values and the newer Tpl enum.

The "raw" TPL type is BootServicesTpl which is ultimately a usize and it can hold TPL values outside those defined by the UEFI Specification. The Tpl enum is a strongly-typed representation of the standard TPL levels defined by the UEFI specification for use in UEFI Services.

TplMutex defaults to StandardBootServices:

pub struct TplMutex<T: ?Sized, B: TplController = StandardBootServices> {
    tpl_controller: TplControllerStorage<B>,
    tpl_lock_level: Tpl,
    lock: AtomicBool,
    data: UnsafeCell<T>,
}

By implementing TplController for Service<dyn TplServices>, the TPL Service can now be used with TplMutex.

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

How This Was Tested

  • cargo make all
  • Use TplMutex in components back by TplServices

Integration Instructions

  • N/A

1814: Add no-notification timer event support to UEFI Services

Description

Allows timer events to be created without notification functions. The current function (TimerEventServices::create_timer_event()) creates the event with EVT_TIMER | EVT_NOTIFY_SIGNAL and requires a boxed notification callback. For code wanting to simply create a timer event and check it with EventServices::check_event() there is not a direct path with UEFI Services because check_event() (per spec) requires that the event is not a notify-signal event.

This adds a function called create_timer_event_no_notify(). That name is consistent with naming convention to others in the trait and allows timer events without notification functions to easily be created for this use case. A simple example is addeed to timers.rs in patina_samples.

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

How This Was Tested

  • cargo make all (including unit tests)

Integration Instructions

  • N/A

1813: Add device path APIs to UEFI Services

Description

Adds first-class support for device paths to protocol services.

Similar to other protocol service methods, ProtocolServices gets a locate_device_path() method that can take a BinaryGuid and a DevicePath directly. ProtocolServicesExt gets the fully featured version taking advantage of the ProtocolInterface trait. It is called as follows:

let (handle, remaining) = protocols.locate_device_path_for::<SimpleFileSystem>(&path)?;

To support this, locate_device_path() is added to CoreProtocolServices in patina_dxe_core as a wrapper around core_locate_device_path(). This provides handling for the BinaryGuid and DevicePath types around the call.

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

How This Was Tested

  • cargo make all (including unit tests)

Integration Instructions

  • N/A - New methods can be called on protocol services as needed

1821: Add marker protocol APIs to UEFI Services

Description

"Marker protocols" are protocols without a protocol interface structure where the pointer to the protocol structure is a null pointer. This PR has two commits to support marker protocols in UEFI Services.


sdk: Add MarkerProtocol trait

To better enforce and identify "marker protocols" in the type system, a new trait is added called MarkerProtocol.

A const assert is added that verifies the size is zero. Because it is const, it is treated as a built-time compilation failure not a runtime check.


Add marker protocol APIs to UEFI Services

The existing install_interface function can't express a "marker" protocol because it takes ProtocolPtr which wraps NonNull<c_void>.

That is intentional to reduce the risk of installing an invalid interface and requiring the caller to work more directly with raw pointer logic. Other functions like locate_protocol also have logic around returning sound protocol interfaces to callers (e.g. verifying the GUID matches the protocol interface).

The ProtocolInterface trait used to establish a protocol GUID to interface relationship already supports marker protocols with the interface being a zero-sized type.

This adds new functions like install_marker_protocol::<P>(handle) and uninstall_marker_protocol::<P>(handle) to protocol services to make working with marker protocols and ProtocolInterface obvious and ergonomic.

An is_marker_protocol_installed function is also provided to make it simple to check if a marker protocol is installed without needing to worry about optional protocol interfaces and null pointers.

Protocol notification works with marker protocols as well, so some unit tests are added to test and demonstrate that.


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

How This Was Tested

  • cargo make all (including unit test changes)

Integration Instructions

  • N/A

1831: Only return config table copies and pointers

Description

Note: Can be squashed into the earlier configuration table UEFI services commit when major is merged into main.

Updates the configuration table services currently returning &'static references to return a copy instead.

This changes:

fn get<T: ConfigTable>(&self) -> Option<&'static T>;
unsafe fn get_bytes<T: ConfigTable>(&self) -> Option<&'static [u8]>;

To:

fn get<T: ConfigTable + Copy>(&self) -> Option<T>;
unsafe fn get_bytes<T: ConfigTable + Copy>(&self) -> Option<Vec<u8>>;

To allow the caller to determine whether they can work with a short-lived reference, a pointer to the table is available through a new function with function doc guidance on using it:

fn get_ptr<T: ConfigTable>(&self) -> Option<NonNull<T>>;
  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all

Integration Instructions

  • N/A - This is only a breaking change to current UEFI Services code in major

1815: components/patina_adv_logger: Update to use UEFI Services

Description

Replaces boot services calls to StandardBootServices with calls to the Patina UEFI Services.

Includes some test code for the component entry point.

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

How This Was Tested

  • cargo make all (with unit tests included)
  • Verify advanced logger functionality on QEMU ArmVirt and Q35

Integration Instructions

  • N/A

1819: Split event ownership model

Description

Note: These commits can be squashed into commit 98e6dc3 when the major branch is merged into main.


Split event ownership model

Currently the function (e.g. on_event) that registers a callback returns the Event. This makes it difficult to pass that event through to the notification function. There is tension between the ownership of the event at the caller and notification (closure) levels. The original implementation essentially did not provide a straightforward path for notifications to close their own event and leaving it to the caller.

Notifications closing their own event is common and there was a previous change made to defer their closure/cleanup in nested notification scenarios.

This change better reflects the two event ownership models: one where the caller retains ownership and one where the callback takes ownership. This is done by separting event creation functions into "caller-managed" and "self-managed" variants. This makes intention clear in the code while preventing ownership confusion.


Add create_wait_event to UEFI Services

Allows a caller to create a wait (non-timer) event.


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

How This Was Tested

  • cargo make all (includes unit test updates)
  • Integrate and run patina_samples components on QEMU Q35

Integration Instructions

  • N/A

1836: Add signal_group to UEFI Services

Description

Provides a simple way to signal an event group by GUID using event services.

Found during an audit of event patterns currently not available in event services.

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

How This Was Tested

  • cargo make all (unit tests)

Integration Instructions

  • N/A

1811: Integrate UEFI Services with patina_smbios and refactor the component

Description

A series of commits to integrate UEFI Services into patina_smbios and refactor the component to take more granular dependencies and to use injected dependencies on the component entry point(s). These changes are unmodified in any significant way from the already approved changes in a previous, larger UEFI Services PR.


components/patina_smbios: Add a Busy error for SMBIOS lock contention

Adds SmbiosError::Busy so lock contention can be reported as a
normal error. It maps to EfiError::DeviceError.


components/patina_smbios: Extend the Smbios trait with record lookup methods

Adds a couple of methods to the Smbios trait so the C protocol shim
will be able to look up the next record after a handle and the address
of a published record without touching the SmbiosManager or its
TplMutex directly.

Both return owned data instead of a borrowing iterator, since the
existing SmbiosRecordsIter cannot outlive a lock guard.


components/patina_smbios: Move SMBIOS service off raw BootServices

SmbiosImpl no longer takes a generic BootServices parameter. Its
TplMutex now uses Service<dyn TplServices>. Every lock acquisition
goes through try_lock, which returns SmbiosError::Busy on lock
contention instead of panicking. SmbiosImpl stores a
Service<dyn ConfigurationTableServices> and uses it to install the
SMBIOS configuration table entry.

SmbiosProtocolInternal now holds only the protocol struct and a
Service<dyn Smbios>, dropping the raw TplMutex reference.

The extern functions call through the service trait instead of locking
the manager directly, and the protocol is installed through
ProtocolServices instead of a raw unsafe boot services call.

component.rs is updated minimally to keep the crate compiling, still
fetching the newly needed services through storage.get_service in
the same style it already used. It will be split into two components
with typed parameters in a future change.


components/patina_smbios: Split SmbiosProvider and add SmbiosProtocolPublisher

Moves SmbiosProvider into component/provider.rs and migrates its
entry point to use typed service parameters for memory, configuration
table, and TPL services, plus Commands for registration, dropping
the storage.get_service and storage.boot_services calls used
previously. Buffer allocation is updated to use leak_as_slice instead
of into_raw_slice.

Adds a new SmbiosProtocolPublisher component that installs the
protocol for C drivers depending only on Service<dyn Smbios> and
Service<dyn ProtocolServices>. This is the piece the earlier
Smbios trait extension made it possible to split out on its own.

Adds a new entry point test for each component, now that every
dependency is mockable.


Update SMBIOS docs for the two component split

Updates the crate README and the patina_samples SMBIOS example to
reflect the SmbiosProvider and SmbiosProtocolPublisher split.

Updates the "Global State Justification" section to describe that the
C protocol shim now reaches the Smbios service through a field on
the leaked protocol struct instead of extra global state.


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

How This Was Tested

  • cargo make all
  • Integrate and verify SMBIOS component launches properly and install the SMBIOS Protocol and configuration table on QEMU Q35

Integration Instructions

  • N/A

1832: patina_dxe_core: Require platforms declare supported UEFI spec version

Description

This commit requires the platform to declare its supported UEFI Specification version, which is propagated to the various system tables.

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

How This Was Tested

CI

Integration Instructions

The platform must now set a specific UefiSpecVersion in their PlatformInfo trait implementation.

struct Platform;

impl PlatformInfo for Platform {
    const UEFI_SPEC_VERSION: patina::UefiSpecVersion = UefiSpecVersion::V2_11;
}

1839: Make FromHob::parse fallible

Description

Previously, FromHob::parse panicked on malformed guided HOB payloads.

Since HOBs are input data outside the DXE Core's (and component's) control, HOB parsing is naturally a fallible operation and treating it as such allows more robust HOB parsing and reduces the inclination to treat malformed HOBs as fatal errors.

Therefore, FromHob::parse now returns Result<Self, HobParseError>.

A HOB that fails to parse is logged and not registered, so components that depend on it are not dispatched.

Code that implemented FromHob is updated accordingly.

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

How This Was Tested

  • cargo make all
  • Q35 boot to EFI shell with component dispatch

Integration Instructions

This is a breaking change because of the update to the parse method signature in the FromHob trait. Trait implementations will need to be updated to use the new method return value (as shown in examples in this commit).


1844: components/patina_acpi: Update to use UEFI Services

Description

A series of commits to update the patina_acpi component to use UEFI Services.

This change is light on component refactor unrelated to directly using the services since an overall patina_acpi component refactor is already planned in the future.


components/patina_acpi: Cover all AcpiError enum variants with tests

Improve the code coverage in this module by adding tests that cover
variants that are not currently covered.


components/patina_acpi: Rename BootServicesAlreadyInitialized

StandardAcpiProvider is about to stop depending on BootServices
entirely when it transitions to UEFI Services.

This renames the BootServicesAlreadyInitialized error variant to
ConfigTableServicesAlreadyInitialized so the next commit can focus
on behavioral changes.


components/patina_acpi: Use UEFI Services in the ACPI component

Updates the ACPI component to use the new UEFI Services instead of
StandardBootServices. Overall changes are relatively minimal to
focus on the transition itself and keeping in mind that more ACPI
component refactoring is expected in the future.

StandardAcpiProvider no longer needs to be generic over
BootServices.

Testing is simplified overall using MockTplServices and
MockConfigurationTableServices instead of MockBootServices.


components/patina_acpi: Use ProtocolServices in acpi_protocol_test

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.


components/patina_acpi: Install protocols at end of the entry point

The ACPI Table and ACPI Get protocols are currently insalled at the
beginning of the entry point. This is before the STANDARD_ACPI_PROVIDER
is initialized and the XSDT and RSDP exist.

This commit moves protocol installation to the end of the entry point,
after the AcpiTableManager service is produced.


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

How This Was Tested

  • cargo make all
  • QEMU Q35 EFI shell boot

Integration Instructions

  • N/A

1841: components/patina_mm: Update to use UEFI Services

Description

A couple of commits to update the patina_mm component to use UEFI Services.


components/patina_mm: Replace StandardBootServices with UEFI Services

Updates the entry point to depend on ProtocolServices. Replaces raw
pointer handling with safe code using on_protocol_installed().

Implements the ProtocolInterface trait for MmCommBufferUpdateProtocol
to allow safe access to the protocol's fields without unsafe pointer
casts.


components/patina_mm: Increase test coverage with protocol mocking

Protocol services can be mocked with the ProtocolServices trait
now, so functions dependent on that like entry_point and
handle_protocol_installed are updated to use mocked protocol
services and drop their exclusion from code coverage.


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

How This Was Tested

  • cargo make all
  • QEMU Q35 EFI shell boot

Integration Instructions

  • N/A

1847: patina_dxe_core: Migrate internal components off StandardBootServices

Description

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.

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

How This Was Tested

  • cargo make all
  • QEMU ArmVirt and Q35 boot to EFI shell

Integration Instructions

  • N/A

1848: sdk: Update component benchmark to drop StandardBootServices

Description

Removes the StandardBootServices param from the component benchmark entry points since StandardBootServices is about to be removed from the component model.

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

How This Was Tested

  • cargo make bench

Integration Instructions

  • N/A

1830: components/patina_test: Update to use UEFI Services

Description

This commit updates Patina Test to use the UEFI Services APIs made
available through the core, instead of using StandardBootServices struct.

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

How This Was Tested

N/A

Integration Instructions

N/A


1850: patina_dxe_core: Remove StandardBootServices from the dispatcher

Description

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 is not modified.

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

How This Was Tested

  • cargo make all
  • QEMU EFI shell boot with components using UEFI Services

Integration Instructions

  • N/A

1851: sdk: Remove StandardBootServices from the Patina SDK component model

Description

Two commits to remove StandardBootServices from the SDK component code and mdbook documentation.


sdk: Remove StandardBootServices from the Patina SDK component model

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.


docs: Account for StandardBootServices removal

Straightforward update to docs that referenced StandardBootServices
to either drop the reference or replace it with the equivalent info
or example from UEFI Services.


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

How This Was Tested

  • cargo make all
  • cargo make test-mdbook

Integration Instructions

  • N/A - Part of the overall work to transition to UEFI Services

1854: UEFI Services documentation updates

Description

New documentation and updates to existing documentation in the mdbook to account for UEFI Services.


docs: Add component state storage docs

Adds a document that explains common scenario where services need
be shared and stored and patterns for those scenarios.


docs: Add Patina UEFI Services documentation

Adds a document that explains when to use Patina UEFI Services and
links to individual service documentation.


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

How This Was Tested

  • cargo make cspell
  • mdbook build docs
  • Preview changes in cargo make serve-mdbook

Integration Instructions

  • N/A

1866: patina_dxe_core: Split the MP services component

Description

This commit splits the MP services component into 3:

  1. MpServicesComponent - Creates the service and all associated resources.
  2. MpProtocolInstaller - Installs the MP services protocol using the service.
  3. MpBistReporter - Reports the Built-In Self-Test (BIST) results for the processors from PEI.

To split this functionality, the MpServices service now gets installed as a service. However, the definition of this struct is scoped to the mp_services module and so it cannot be retrieved or used by external components.

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

How This Was Tested

  • Unit tests
  • patina_tests on q35

Integration Instructions

N/A

@makubacki makubacki self-assigned this Oct 13, 2026
@patina-automation

patina-automation Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

QEMU Validation Failed

QEMU validation did not complete successfully or did not shutdown as expected.

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

⚠️ Build Failure Detected

The Setup and Build patina-dxe-core-qemu step failed in the following job(s):

  • Run Patina QEMU Validation / Validate QEMU Q35 (Windows)
  • Run Patina QEMU Validation / Validate QEMU - ArmVirt (Linux)
  • Run Patina QEMU Validation / Validate QEMU - Q35 (Linux)

Build logs are available in the workflow run artifacts:

Download the log artifacts from the workflow run to review the build output and
determine whether the error is expected.

Is this expected? If the PR introduces breaking changes to patina that
require a corresponding update to patina-dxe-core-qemu,
the build failure is expected.

Contact a repo admin or PR reviewer to override the Patina QEMU PR Validation status check.

Job Results

Job Result
Gather Incoming PR Metadata ✅
Run Patina QEMU Validation / Preflight Checks ✅
Run Patina QEMU Validation / Post In-Progress Notification ✅
Run Patina QEMU Validation / Get Constants / Get Repository Constants ✅
Run Patina QEMU Validation / Validate QEMU Q35 (Windows) ❌
Run Patina QEMU Validation / Validate QEMU - ArmVirt (Linux) ❌
Run Patina QEMU Validation / Validate QEMU - Q35 (Linux) ❌
Run Patina QEMU Validation / Emit PR Metadata ✅

Error Details

qemu-validation-logs-Windows-Q35/q35-windows.log (6 error/warning sections)
error[E0277]: The function signature does not meet the requirements.
              

error[E0277]: The function signature does not meet the requirements.
              

error[E0599]: the method `run` exists for struct `FunctionTest<_, fn(StandardBootServices) -> ... {q35_smbios_ffi_test}>`, but its trait bounds were not satisfied
  --> src\q35\component\service\smbios_test.rs:25:1
   |
25 | #[patina_test]
   | ^^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:

error: could not compile `qemu_dxe_core` (lib) due to 3 previous errors

warning: build failed, waiting for other jobs to finish...

[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 113 - Error while executing command, exit code: 101
qemu-validation-logs-Linux-ArmVirt/armvirt-linux.log (6 error/warning sections)
error[E0277]: The function signature does not meet the requirements.
              

error[E0277]: The function signature does not meet the requirements.
              

error[E0599]: the method `run` exists for struct `FunctionTest<_, fn(StandardBootServices) -> ... {q35_smbios_ffi_test}>`, but its trait bounds were not satisfied
  --> src/q35/component/service/smbios_test.rs:25:1
   |
25 | #[patina_test]
   | ^^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:

error: could not compile `qemu_dxe_core` (lib) due to 3 previous errors

warning: build failed, waiting for other jobs to finish...

[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 113 - Error while executing command, exit code: 101
qemu-validation-logs-Linux-Q35/q35-linux.log (6 error/warning sections)
error[E0277]: The function signature does not meet the requirements.
              

error[E0277]: The function signature does not meet the requirements.
              

error[E0599]: the method `run` exists for struct `FunctionTest<_, fn(StandardBootServices) -> ... {q35_smbios_ffi_test}>`, but its trait bounds were not satisfied
  --> src/q35/component/service/smbios_test.rs:25:1
   |
25 | #[patina_test]
   | ^^^^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:

error: could not compile `qemu_dxe_core` (lib) due to 3 previous errors

warning: build failed, waiting for other jobs to finish...

[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 113 - Error while executing command, exit code: 101

Dependencies

Repository Ref
patina c95e8bb
patina-dxe-core-qemu 93ef089
patina-fw-patcher a450500
patina-qemu firmware v4.1.2
patina-qemu build script f170bda

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

@github-actions github-actions Bot added impact:breaking-change Requires integration attention impact:non-functional Does not have a functional impact impact:testing Affects testing type:documentation Improvements or additions to documentation labels Oct 13, 2026
@os-d

os-d commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@makubacki I reviewed the majority of these changes when they went into the major branch. Is there any part that should be reviewed in particular for the integration to main that may have changed?

@makubacki makubacki removed the impact:non-functional Does not have a functional impact label Oct 13, 2026
@makubacki

Copy link
Copy Markdown
Collaborator Author

@makubacki I reviewed the majority of these changes when they went into the major branch. Is there any part that should be reviewed in particular for the integration to main that may have changed?

The only three that were not trivially updated for merge conflicts and minor clippy issues are these three commits that were made before the PR to split MP Services:

vineelko and others added 12 commits October 13, 2026 12:35
…#1685)

**Background:** Behavior of `--all-features` with explicit package vs
without explicit package:
```
cargo clippy --all-features --tests
workspace
  crate a(feature fa)           <--- all features defined in crate_a are enabled and built as a test binary
    crate b(feature fb)         <--- all features defined in crate_b are enabled and built as a lib

cargo clippy -p crate_a --all-features --tests
workspace
  crate a(feature fa)           <--- all features defined in crate_a are enabled and built as a test binary
    crate b(feature fb)         <--- only features selected when specifying crate_b as dependency are enabled(if non selected, default features are applied) and built as a lib
```
**NOTE:** `--tests` is nothing special here any target can be picked

**Problem:** Rust MM Supervisor avoids hidden heap allocations from
dependencies
by ensuring the "alloc" feature is not enabled. Since Patina currently
includes
"alloc" in its default feature set, the MM Supervisor branch had to
explicitly
remove it from its default features(`default = []`) and also by not
defining an
explicit `#[global_allocator]`. Because `default-features = false` only
affects
a direct dependency, not transitive dependencies

Now with `default=[]` in place on patina sdk in feature/supv branch,

Before the SDK refactor, c_ptr.rs is gated as shown below. Which means
trying to
run `cargo clippy --tests` did not break the build with or without
--all-features because in both cases c_ptr.rs is fully stubbed out as
patina
sdk is neither built with test feature(remember this is a dependency to
whatever
crate is being built) nor alloc(since we have set default=[]).

```
sdk\patina\src\lib.rs
extern crate alloc;

pub mod boot_services;

sdk\patina\src\boot_services\c_ptr.rs       <----- stubbed out because patina sdk is a dependency for whatever test crate is being built right now
use alloc::boxed::Box;
```

After the SDK refactor, c_ptr.rs is NOT gated. Which means trying to run
`cargo clippy --tests` will break the build with or without
`--all-features` because in
both the cases c_ptr.rs is always present and `extern crate alloc` is
always
absent as neither test feature(again remember this is a dependency to
whatever
crate is being built) nor alloc(since we have set default=[]).

```
sdk\patina\src\lib.rs
extern crate alloc;

pub mod base;                               <----- NOT STUBBED OUT

sdk\patina\src\base\c_ptr.rs                <----- NOT STUBBED OUT
use alloc::boxed::Box;
```

Resulting in below error:

  ```
  error[E0433]: cannot find module or crate `alloc` in this scope
 --> sdk\patina\src\base\c_ptr.rs:9:5
  |
9 | use alloc::boxed::Box;
  |     ^^^^^ use of unresolved module or unlinked crate `alloc`
  ```

While restoring the feature gate on `c_ptr` fixes this immediate
issue(also done
in #1677), debugging
"feature"
related failures like this is not a very pleasant experience. In
particular,
`--all-features` only applies to the package being built and does not
propagate
to dependencies. To some extent `cargo hack` makes it easier to run
failing
command on individual packages but that brings in its own set of new
challenges.
After spending a considerable amount of time untangling the dependencies
and
finding the root cause, it seems that removing "alloc" from the default
feature set
across all Patina crates would alleviate some of the debugging pain.

**Benefits:**
1. Patina crates no longer assume the presence of the `alloc` feature.
2. Crates within Patina repo are nothing special and they have to
explicitly
declare the required feature set, making feature usage easier to audit
and
   maintain.

    ```
E:\repos\patina>cargo tree -e features -p patina_ffs_extractors
-e=no-dev
patina_ffs_extractors v23.0.1
(E:\repos\patina\sdk\patina_ffs_extractors)
    ...
    ├── patina feature "default"  <----

    vs

E:\repos\patina>cargo tree -e features -p patina_ffs_extractors
-e=no-dev
patina_ffs_extractors v23.0.1
(E:\repos\patina\sdk\patina_ffs_extractors)
    ...
    ├── patina feature "alloc"    <----
    ```
3. Rust MM Supervisor can now opt out of `alloc` without requiring any
hacks.
Please note that #[global_allocator] should still be avoided so that the
compiler can flag any dependent code paths that require heap
allocations.

This is a breaking change because existing consumers relying on Patina's
default
feature set will need to explicitly enable the required features. Most
existing
crates have already been updated as part of this commit.

- [ ] Impacts functionality?
- [ ] Impacts security?
- [x] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

`cargo make all` and validated on hardware platform.

All external crates relying on patina crates will need to add "alloc" to
the features list like below
`patina = { workspace = true, features = ["alloc"] }`
- The core feature is redundant and ambiguous with its dependent
  feature "alloc" now explicitly called out. Hence removing it.
- The actual usage of the "core" feature need to reevaluated eventually,
  As its current usage is hacky just to expose
  arch::enable_interrupts() and arch::disable_interrupts() only to
  Patina crates (also referred to as "core" crates). However, it does
  not prevent external crates from enabling the core feature in their
  dependencies and using these restricted APIs. Overall, feature flags
  are intended for conditional compilation, not for enforcing
  visibility or access control over internal APIs.
---
- [ ] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

`cargo make all` in `Patina` and `patina-dxe-core-qemu`

NA: core feature is expected to be enabled only by internal crates of
Patina. So removal of "alloc" should not affect consumers of patina
crates. Hence the change is not marked as breaking.
Patina UEFI Services are a set of service traits that expose UEFI Boot
Services (and, potentially Runtime Services in the future) to Patina
components so that they can perform the operations provided by the
services in a safer more idiomatic way.

These services are the recommended way for components to consume UEFI
functionality. Unlike the raw `uefi::boot_services` abstractions,
which wrap the C `EFI_BOOT_SERVICES` function-pointer table, these
services are implemented by the Patina DXE Core directly against its
internal Rust APIs. Components therefore do not interact with C-style
constructs such as the boot services table or raw pointers until they
go down an unavoidable path into C code, such as calling a protocol
function pointer when the protocol is produced by a C driver.

The services are only defined in this commit and will be produced by
the Patina DXE Core in a future commit.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Binds these types to the GUID they are published under, so they can
be used with Configuration Table Services without handling a raw
pointer or repeating the GUID at each call site.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Produces UEFI Services for components to have safer, direct access to
common UEFI Services implemented in the DXE Core.

---

This includes a change to defer event and protocol notification
closures originally made separately. Its message is included below
for context.

Currently, events are dispatched in `restore_tpl()` by calling
`EVENT_DB.consume_next_event_notify()`. Note that the event is only
actually removed from `EVENT_DB` by calling `close_event()`.

When `EventServices` are used, the actual "raw event notification"
is a wrapper (`notify_trampoline()`) that creates a `ClosureHolder`
that contains the actual notification function registered.

Once the closure is executing, if it (or a nested call within the stack),
calls `close_event()` on its own event, the `close_event()` will remove
the event from `EVENT_DB` immediately, which frees the `ClosureHolder`
(and boxed closure). The issue is that the closure might still be
executing earlier in the call stack.

Control will return to the closure body (after the `close_event()`
call) and any use of captured state in the closure is no longer valid.

This change shares a small set of state between `notify_trampoline()`
and `close_event()` to track whether the closure is still active,
allowing `close_event()` to determine if it is safe to free the event.

Similarly, a protocol `NotifyHolder` could be freed while the callback
is still executing if the notify function cancels its own registration.

In this case, `notify_install_trampoline()` is what's actually called
when the watched protocol is installed. This change updates it to
push its context before starting to call notification functions and
then to pop its context after all notification functions have been
called to determine if its registration was requested to be closed.

`cancel_install_notify()` is updated to be able to set the
`close_requested` flag on the active notification context and defer
dropping the `NotifyHolder` if the notification is still active.

To reduce the total number of statics, a new type called
`UefiServicesState` is introduced to hold shared internal state for
UEFI Services in the DXE Core.

---

Also includes a change to tighten down config table type tracking
originally made separately. Its message is included below for context.

Makes the type tracking for configuration tables more strict and
consistent between configuration table interfaces.

There are two general paths for working with config tables:

- Untyped: C FFI for UEFI Boot Services
  - Compatibility with existing C drivers using Boot Services
- Typed: Safe Rust API available through UEFI Services
  - Used by Patina Rust components

These have to be supported simultaneously while keeping the safe API as
safe as possible.

The untyped path (C EFIAPI) is:
  - `unsafe extern "efiapi" fn install_configuration_table`
    - Which calls: `core_install_configuration_table()`
      - Calls: `install_configuration_table_entry()`

The typed path (Safe Rust API) is:
  - `ConfigurationTableServicesExt::install<T>()`
    - Calls: `ConfigurationTableServicesExt::install_typed_table()`
      - Calls: `core_install_typed_configuration_table()`
        - Calls: `install_configuration_table_entry()`

On the typed path, `core_install_typed_configuration_table()` is what
checks if an update is allowed (overwrite is allowed) and record the
type information for the configuration table entry.

Below that, the same `install_configuration_table_entry()` is used for
both paths.

`CoreConfigurationTableServices::get_typed_table()` checks the type
tracked map for a table and then gets the pointer from the actual
configuration table in memory (shared with the untyped path).

To ensure that the "typed" API path is safe, an update through the
untyped path for any configuration table already under a GUID will be
unconditionally clear that table entry. This provides compatibility for
the C API while ensuring any table considered "typed" is the correct
type. This design is about ensuring the safety assertions of a typed
table in safe code, not denying updates through the untyped path.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Adds a set of new sample components that demonstrate how to use the
UEFI Services.

Samples include:

- `overview` - A quick tour of timer, event, and protocol usage in
  one component.
- `configuration_table` - Installs a vendor configuration table and
  reads it back.
- `driver_connect` - Discovers controllers by protocol and connects
  drivers to them.
- `end_of_dxe_protocol_consumer` - Defers protocol consumption to
  End-of-DXE.
- `protocol_consumer` - Shows different ways to consume a protocol.
- `protocol_publisher` - Demonstrates one component publishing a
  protocol and another consuming it.
- `timers` - Drives work from one-shot and periodic timers using Rust
  closures.
- `tpl_critical_section` - Serializes access to shared state with TPL.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
TPLs allowed as arguments to `register_install_notify()` are defined in
`patina::component::service::uefi_services::tpl::Tpl`.

This change prevents registering protocol install notifications at
`TPL_HIGH`, ensuring that callbacks are only invoked at allowed TPL
levels.

Matches the behavior defined in [`CoreCreateEventEx()` in
edk2](https://github.com/tianocore/edk2/blob/96341752cef63f3626d64d0b19f60202367627cf/MdeModulePkg/Core/Dxe/Event/Event.c#L332-L339)
for `EVT_NOTIFY_SIGNAL` events.

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [x] Includes tests?
- [ ] Includes documentation?

- `cargo make all`

- N/A

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
extern "efiapi" functions backing EDK II protocols carry no context
parameter, so a component can't hand them a `Service<T>` the way it
can a closure-based callback. `ServiceCell<T>` gives components a
wait-free, write-once cell for this. The `publish()` function never
blocks even under contention, so it can't deadlock under preemption
like other mechanisms.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Implements the `Debug` trait for `Service<T>` to allow the type to be
used in contexts where `Debug` is required.

Since the `value` field in `Service<T>` is `OnceCell<&'static dyn Any>`
and `dyn Any` does not implement `Debug`, the implementation here
is custom (instead of deriving `Debug`) and just prints the type
name of the service interface `T`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates code using `Service::new_unit()` to use `ServiceCell<T>` to
align on a single approach for safely storing services accessed in
different contexts.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
There is nothing wrong with `Service::new_uninit()` for the use case
it directly supports, that allows a `Service<T>` to be created before
the underlying service is available.

For example, it allows `AdvancedLogger` to be const-constructible
before the actual component dispatch system is available. Then the
component entry point can call `.replace()` to safely fill in the
actual service implementation once the service is ready.

However, there is also a need to more generically support service
storage for cases when an `extern "efiapi"` protocol function produced
by a component and the protocol interface does not have a `this`
context pointer. Using `Service<T>` for that case is certainly
possible, but it starts to mix two different use cases in a single
type.

`Service<T>` relies heavily on `Deref` to provide a convenient
interface to the underlying service, but that convenience can be
dangerous when the service is not yet available. It is easy to
forget to check for availability before dereferencing, which can
lead to panics. `Deref::deref()` has to return `&Target`, it cannot
return `Option<&Target>`, so there is no way to signal that the
service is not yet available.

Of course, `is_init()` or `map_or_else()` could be used, but it
is safer and makes `Service<T>` easier to reason about if it
simply represents an available service. Then, dereferencing a
service is always safe (the common case).

This aligns with official `Deref` implementation guidance
(https://doc.rust-lang.org/std/ops/trait.Deref.html#when-to-implement-deref-or-derefmut):

```
In general, deref traits should not be implemented if:

1. the deref implementations could fail unexpectedly; or
2. the type has methods that are likely to collide with methods on the target type; or
3. committing to deref coercion as part of the public API is not desirable.
```

For these cases, having a dedicated type that does not implement
`Deref` allows the type to clearly distinguish between an
uninitialized service and an initialized one forcing users to
handle the uninitialized case explicitly while also making the
usage pattern more clear.

The `ServiceCell<T>` moves these semantics into a separate type
that allows the value to set once (wrapping `OnceCell<T>`) and then
read as an `Option<&T>` (using `get()`). Existing callers that want
to panic can simply call `.get().expect("service not published yet")`
to get the same behavior and provide a custom message at the call
site. The `ServiceCell<T>` type is also `Sync` and compare-exchange
guarded, so a second call to `publish()` will return an error instead
of racing the first.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Now that `Service<T>` implements `Copy`, explicit calls to `clone()`
are no longer necessary and can be removed.

Also prevents the `clippy::clone_on_copy` lint from warning about
unnecessary clones.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Javagedes and others added 23 commits October 13, 2026 12:35
#1832)

This commit requires the platform to declare its supported UEFI
Specification version, which is propagated to the various system tables.

- [ ] Impacts functionality?
- [ ] Impacts security?
- [x] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

CI

The platform must now set a specific `UefiSpecVersion` in their
`PlatformInfo` trait implementation.

```rust
struct Platform;

impl PlatformInfo for Platform {
    const UEFI_SPEC_VERSION: patina::UefiSpecVersion = UefiSpecVersion::V2_11;
}
```
Previously, `FromHob::parse` panicked on malformed guided HOB payloads.

Since HOBs are input data outside the DXE Core's (and component's)
control, HOB parsing is naturally a fallible operation and treating it
as such allows more robust HOB parsing and reduces the inclination to
treat malformed HOBs as fatal errors.

Therefore, `FromHob::parse` now returns `Result<Self, HobParseError>`.

A HOB that fails to parse is logged and not registered, so components
that depend on it are not dispatched.

Code that implemented `FromHob` is updated accordingly.

- [x] Impacts functionality?
- [ ] Impacts security?
- [x] Breaking change?
- [x] Includes tests?
- [x] Includes documentation?

- `cargo make all`
- Q35 boot to EFI shell with component dispatch

This is a breaking change because of the update to the `parse` method
signature in the `FromHob` trait. Trait implementations will need to be
updated to use the new method return value (as shown in examples in this
commit).

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Tests would just restate the same mappings already defined in the
enum variants, so coverage is disabled.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
`StandardAcpiProvider` is about to stop depending on `BootServices`
entirely when it transitions to UEFI Services.

This renames the `BootServicesAlreadyInitialized` error variant to
`ConfigTableServicesAlreadyInitialized` so the next commit can focus
on behavioral changes.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates the ACPI component to use the new UEFI Services instead of
`StandardBootServices`. Overall changes are relatively minimal to
focus on the transition itself and keeping in mind that more ACPI
component refactoring is expected in the future.

`StandardAcpiProvider` no longer needs to be generic over
`BootServices`.

Testing is simplified overall using `MockTplServices` and
`MockConfigurationTableServices` instead of `MockBootServices`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
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>
The ACPI Table and ACPI Get protocols are currently insalled at the
beginning of the entry point. This is before the `STANDARD_ACPI_PROVIDER`
is initialized and the XSDT and RSDP exist.

This commit moves protocol installation to the end of the entry point,
after the `AcpiTableManager` service is produced.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates the entry point to depend on `ProtocolServices`. Replaces raw
pointer handling with safe code using `on_protocol_installed()`.

Implements the `ProtocolInterface` trait for `MmCommBufferUpdateProtocol`
to allow safe access to the protocol's fields without unsafe pointer
casts.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Protocol services can be mocked with the `ProtocolServices` trait
now, so functions dependent on that like `entry_point` and
`handle_protocol_installed` are updated to use mocked protocol
services and drop their exclusion from code coverage.

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>
…overage

Some internal component entry points could be tested with service
mocks, but they are just installing protocols or notification functions
without significant logic, so coverage is disabled.

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

- [x] Impacts functionality?
- [ ] Impacts security?
- [x] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

- `cargo make bench`

- N/A

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit updates Patina Test to use the UEFI Services APIs made
available through the core, instead of using StandardBootServices
struct.

- [ ] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

N/A

N/A
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` is not modified.

- [x] Impacts functionality?
- [ ] Impacts security?
- [x] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

- `cargo make all`
- QEMU EFI shell boot with components using UEFI Services

- N/A

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>
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>
`FromHob::parse` was updated to return `Result<Self, HobParseError>`.

This commit reports a truncated `MpInformation2`, `MpHandOff` or
`MpHandOffConfig` as `BufferTooSmall` instead of being parsed as
empty or zeroed data.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates the MP Services patina tests to account for UEFI Services.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Accounts for `StandardBootServices` no longer being a component
parameter.

The MP Services component now takes the services it needs as
parameters rather than as a single `StandardBootServices` structure.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit splits the MP services component into 3:
1. `MpServicesComponent` - Creates the service and all associated resources.
2. `MpProtocolInstaller` - Installs the MP services protocol using the service.
3. `MpBistReporter` - Reports the Built-In Self-Test (BIST) results for the processors from PEI.

To split this functionality, the `MpServices` service now gets installed
as a service. However, the definition of this struct is scoped to the
`mp_services` module and so it cannot be retrieved or used by external
components.
Updates the documentation to reflect the new component
split in MP services.
@github-actions github-actions Bot added the impact:non-functional Does not have a functional impact label Oct 13, 2026
@makubacki makubacki removed the impact:non-functional Does not have a functional impact label Oct 13, 2026
@github-actions github-actions Bot added the impact:non-functional Does not have a functional impact label Oct 13, 2026
@makubacki makubacki removed the impact:non-functional Does not have a functional impact label Oct 13, 2026
@makubacki
makubacki merged commit 49a7445 into main Oct 13, 2026
20 of 21 checks passed
@makubacki
makubacki deleted the major branch October 13, 2026 16:56
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

5 participants