patina-v22.0.2
What's Changed
-
Eliminate mu\_rust\_helpers from Patina [Rebase \& FF] @makubacki (#1589)
Change Details
## Description
Closes #1588
A series of commits to finally eliminate all mu_rust_helpers dependencies in patina.
sdk: Add CALLER_ID GUID
Some Rust code is written in an environment where the module GUID is
defined in an environment variable called "FILE_GUID". While this is
not the case in patina, the GUID is added to the SDK to support these
scenarios.
sdk, patina_performance: Use SDK CALLER_ID GUID
Switches performance related code and documentation to the
CALLER_ID
definition in the Patina SDK.
sdk: Add function! macro
Adds a function! macro to the SDK that returns the name of the
containing function.
patina_dxe_core, patina_performance: Use SDK function! macro
Switches the DXE core and performance component from the
mu_rust_helpersfunction!macro to the newpatina::function!macro.
sdk: Add UEFI and Tiano decompression module
Adds a
uefi_decompressmodule to the SDK implementing decompression
algorithms from the UEFI Specification.Ported from code previously in mu_rust_helpers.
sdk, patina_dxe_core: Use SDK decompression module
Switches the Decompress protocol, FFS section extractor, and debugger
reload path from the mu_rust_helpers decompressor to the new
patina::uefi_decompressmodule.
patina_dxe_core: Format GUIDs with SDK OwnedGuid
Replaces the mu_rust_helpers
guid_fmt!macro withOwnedGuidfrom
the Patina SDK.
Remove mu_rust_helpers and mu_uefi_guid dependencies
Drops the mu_rust_helpers and mu_uefi_guid dependencies now that the
Patina SDK provides all equivalent functionality.
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all- QEMU ArmVirt & Q35 boot to EFI shell
Integration Instructions
- No changes anticipated. Some crate dependencies are eliminated from patina in these series of changes.
-
sdk/patina: add DevicePath::as\_bytes accessor @kat-perez (#1586)
Change Details
## Description
Adds
DevicePath::as_bytes(&self) -> &[u8]. Returns the underlying byte buffer of the device path.- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo test -p patina --features unstable-device-path --lib device_path::paths::tests::test_device_path_as_bytespasses.Integration Instructions
N/A.
-
sdk/patina: add HardDrive::try\_from\_node device-path helper @kat-perez (#1585)
Change Details
## Description
Adds
HardDrive::try_from_node(node: &UnknownDevicePathNode<'_>) -> Option<Self>. ReturnsSomeonly when the node's type/subtype identify a HardDrive and the 38-byte payload decodes cleanly viascroll::LE. Otherwise returnsNone.- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo check -p patina --features unstable-device-pathpasses.Integration Instructions
N/A.
-
Report Dependency Expressions with Indices [Rebase \& FF] @makubacki (#1574)
Change Details
## Description
A follow up to #1552 to improve reporting info and clean up overall dependency expression noise in a debug log.
pi_dispatcher: Render not-dispatched driver depex as infix expression
The "Drivers Not Dispatched" detail report previously printed a list of pushed protocol GUIDs with their presence flags.
This moves the opcode logic into the patina_internal_depex crate and adds two
Depexmethods to support rendering the depex in infix form which is more natural to read.Depex::pushesyields each pushed protocol GUID paired with its presence flag, in expression order.Depex::infix_expressionreconstructs the postfix opcode stream into a parenthesized infix string, referencing each protocol by its index-based position inpushes().
The report now numbers each protocol and prints the corresponding expression (e.g.
((1 AND 2) OR (3 AND 4))), so the expression can be used in conjunction with the numbered list to make it clear which combination of missing protocols blocked dispatch.
patina_internal_depex: Move open parsing log msgs to trace level
Now that the dispatcher produces a report showing the final results of depex evaluation, the detailed expression parsing logs throughout boot are less useful and moved to trace level in the change.
Note: The line that says a DEPEX is being evaluated for a given driver is left at debug log level since it is one line and "debug-level" analysis of the log at
pi_dispatcherscope is likely to care if a driver is being re-evaluated at all through different passes in the dispatcher.-
This line stays at
debug:Evaluating depex for candidate: PrintScreenLogger (EA205B85-27E0-44E6-9643-7E808368550F) -
The lines marked
TRACEbelow are nowtracelevel (they weredebugprior to this change):DEBUG - Evaluating depex for candidate: Udp4Dxe (6D6963AB-906D-4A65-A7CA-BD40E5D6AF2B) TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:162: Depex: TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(665e3ff6-46cc-11d4-9a38-0090273fc14d, false) => Some(false), stack ->[false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(26baccb1-6f42-11d4-bce7-0080c73c8881, true) => Some(true), stack ->[true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(26baccb2-6f42-11d4-bce7-0080c73c8881, true) => Some(true), stack ->[true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(1da97072-bddc-4b30-99f1-72a0b56fff2a, false) => Some(false), stack ->[false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(27cfac87-46cc-11d4-9a38-0090273fc14d, false) => Some(false), stack ->[false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(27cfac88-46cc-11d4-9a38-0090273fc14d, true) => Some(true), stack ->[true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(b7dfb4e1-052f-449f-87be-9818fc91b733, true) => Some(true), stack ->[true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(a46423e3-4617-49f1-b9ff-d1bfa9115839, true) => Some(true), stack ->[true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(26baccb3-6f42-11d4-bce7-0080c73c8881, true) => Some(true), stack ->[true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(665e3ff5-46cc-11d4-9a38-0090273fc14d, true) => Some(true), stack ->[true, true, true, true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:212: Push(3152bca5-eade-433d-862e-c01cdc291f44, true) => Some(true), stack ->[true, true, true, true, true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, true, true, true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, true, true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,true) => Some(true), stack ->[true, false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(true,false) => Some(false), stack ->[false, false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(false,false) => Some(false), stack ->[false, true, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(false,true) => Some(false), stack ->[false, true, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(false,true) => Some(false), stack ->[false, false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:222: And(false,false) => Some(false), stack ->[false] TRACE - C:\src\patina\core\patina_internal_depex\src\lib.rs:265: End => final result: false, final stack ->[]
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all- Verify
pi_dispatcherdebuglevel prints:TargetFilter { target: "pi_dispatcher", log_level: log::LevelFilter::Debug, hw_filter_override: Some(log::LevelFilter::Debug) },
Example of output:
DEBUG - Begin Report of Drivers Not Dispatched: DEBUG - Driver PrintScreenLogger (EA205B85-27E0-44E6-9643-7E808368550F) found but not dispatched. Protocols present: DEBUG - [1] 9042a9de-23dc-4a38-96fb-7aded080516a : false DEBUG - [2] dd9e7534-7762-4698-8c14-f58517a625aa : true DEBUG - [3] 13a3f0f6-264a-3ef0-f2e0-dec512342f34 : true DEBUG - [4] 0379be4e-d706-437d-b037-edb82fb772a4 : true DEBUG - Expression: (1 AND (2 AND (3 AND 4))) DEBUG - Driver DisplayEngine (C09E4CE4-AE29-4340-B941-078871BD89D1) found but not dispatched. Protocols present: DEBUG - [1] ef9fc172-a1b2-4693-b327-6d32fc416042 : true DEBUG - [2] 587e72d7-cc50-4f79-8209-ca291fc1a10f : true DEBUG - [3] a770c357-b693-4e6d-a6cf-d21c728e550b : true DEBUG - [4] 9d400d20-6f35-4268-904f-dc04b1877b62 : false DEBUG - [5] 13a3f0f6-264a-3ef0-f2e0-dec512342f34 : true DEBUG - [6] 0379be4e-d706-437d-b037-edb82fb772a4 : true DEBUG - [7] fc111ae5-f073-4348-aa5c-49124bbfed7b : true DEBUG - [8] 0fd96974-23aa-4cdc-b9cb-98d17750322a : true DEBUG - Expression: (1 AND (2 AND (3 AND (4 AND (5 AND (6 AND (7 AND 8))))))) DEBUG - End Report of Drivers Not Dispatched.
Example of a complex expression (with unusual opcodes):
In this case the GUIDs associated with
BEFOREandAFTERstay are not assigned a number since this are not directly pushed.let guid_a = Uuid::from_str("1e5668e2-8481-11d4-bcf1-0080c73c8881").unwrap(); let guid_b = Uuid::from_str("6441f818-6362-eb44-5700-7dba31dd2453").unwrap(); let guid_before = Uuid::from_str("76b6bdfa-2acd-4462-9e3f-cb58c969d937").unwrap(); let guid_after = Uuid::from_str("0379be4e-d706-437d-b037-edb82fb772a4").unwrap();
Built as:
let expression: &[Opcode] = &[ Opcode::Push(guid_a, false), Opcode::Push(guid_b, false), Opcode::And, Opcode::Before(guid_before), Opcode::After(guid_after), Opcode::Or, Opcode::And, Opcode::End, ];
Results in:
((1 AND 2) AND (BEFORE 76b6bdfa-2acd-4462-9e3f-cb58c969d937 OR AFTER 0379be4e-d706-437d-b037-edb82fb772a4))Integration Instructions
- N/A. For platform developers, note that format of the "report of drivers not dispatched" messages are different now than in b95fa53.
-
pi\_dispatcher: Report protocols present for Drivers Not Dispatched @yangrongwei (#1552)
Change Details
## Description
pi_dispatcher.rsreports protocols present for each "found but not dispatched" driver.08:12:04.220 : INFO - Finished Dispatching Drivers 08:12:04.221 : WARN - Driver MacAddressEmulationDxe (72AA9388-70DD-4669-8EC1-87444DD62CF3) found but not dispatched. 08:12:04.221 : WARN - Driver DisplayEngine (C09E4CE4-AE29-4340-B941-078871BD89D1) found but not dispatched. 08:12:04.221 : WARN - .. 08:12:04.222 : DEBUG - Begin Report of Drivers Not Dispatched: 08:12:04.224 : DEBUG - Driver MacAddressEmulationDxe (72AA9388-70DD-4669-8EC1-87444DD62CF3) found but not dispatched. Protocols present: 08:12:04.224 : DEBUG - 13a3f0f6-264a-3ef0-f2e0-dec512342f34 : true 08:12:04.224 : DEBUG - 81d1675c-86f6-48df-bd95-9a6e4f0925c3 : true 08:12:04.224 : DEBUG - e355fc05-37c2-468a-9f52-52e5bf1871d3 : true 08:12:04.224 : DEBUG - 7b9cc1a0-218d-4c1c-9fcf-99f3a34d35f8 : false 08:12:04.224 : DEBUG - End 08:12:04.224 : DEBUG - Driver DisplayEngine (C09E4CE4-AE29-4340-B941-078871BD89D1) found but not dispatched. Protocols present: 08:12:04.224 : DEBUG - ef9fc172-a1b2-4693-b327-6d32fc416042 : true 08:12:04.224 : DEBUG - 587e72d7-cc50-4f79-8209-ca291fc1a10f : true 08:12:04.224 : DEBUG - a770c357-b693-4e6d-a6cf-d21c728e550b : true 08:12:04.232 : DEBUG - 9d400d20-6f35-4268-904f-dc04b1877b62 : false 08:12:04.232 : DEBUG - 13a3f0f6-264a-3ef0-f2e0-dec512342f34 : true 08:12:04.232 : DEBUG - fc111ae5-f073-4348-aa5c-49124bbfed7b : true 08:12:04.232 : DEBUG - 0fd96974-23aa-4cdc-b9cb-98d17750322a : true 08:12:04.232 : DEBUG - End 08:12:04.256 : DEBUG - .. 08:12:04.257 : DEBUG - End Report of Drivers Not Dispatched. 08:12:04.257 : [Bds] Entry...
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
Tested on real hardware.
Integration Instructions
No action needed.
-
Cargo.toml: Use ruint 1.17.x for MSRV compatibility @makubacki (#1572)
Change Details
## Description
Resolves #1569
Patina's MSRV is currently Rust 1.89. ruint 1.18.0 has a MSRV of Rust 1.90. This sets the ruint dependency to version 1.17.x until the Patina MSRV is updated to Rust 1.90 or higher.
This is only used in tests and was not a compelling enough reason on its own to update the MSRV, so this just rolls the version back for now.
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
- Switch to the MSRV toolchain and run
cargo make all - MSRV workflow results (27727734091)
Integration Instructions
- N/A
-
Patina: Implement VirtIO serial port and supporting change [FF \& REBASE] @cfernald (#1565)
Change Details
## Description
Patina: Implement interrupt support for arch module
This commit implements basic interrupt management support in the Patina
SDK. This is needed for some low level implementations such as SerialIO
implementations where the TPL may not be available or accessible.This commit also creates an abstraction model for the architecture-specific
implementations in the arch module. This uses an internal trait-based
approach to provide a consistent interface across different architectures.
These implementations are then exposed to static wrapper functions.Patina: Implement VirtIO console based SerialIO
The commit adds a new SerialIO implementation for a VirtIO console based
on a VirtIO MMIO transport. VirtIO devices are common for virtualized
environments such as QEMU, and a SerialIO implementation allows for greater
flexibility in those environments.The implementation adds generic support for the basic VirtIO queue and
MMIO operations, but that is left as internal to this implementation for
the time being.- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
- ArmVirt debug transport
- Unit Tests
Integration Instructions
N/A
-
Update dependencies to latest [Rebase \& FF] @makubacki (#1566)
Change Details
## Description
Series of commits to get dependencies up-to-date. Does not include
uart_16550crate since that is being handled separately in #1560.
Normalize workspace dependency version specifier syntax
Right now, Cargo.toml has a mix of version specifier styles (bare,
caret, tilde). This commit standardizes on the bare form for all
dependencies for consistency and readability.- Drop redundant
^prefixes (e.g.^0.9to0.9) - Flatten
goblin = "~0.10.2"to"0.10.2". For 0.x with a minor and
patch version, tilde and caret resolve to the same range
(>=0.10.2, <0.11.0). - Standardize on double quotes.
alloc-no-stdlib does change from "~2.0"(>=2.0.0, <2.1.0) to
2.0(>=2.0.0, <3.0.0). This is a case where widening the version
range is intentional.
Cargo.toml: Bump semver-compatible workspace dependencies to latest
Updates the following workspace dependencies to their latest semver
compatible versions. These are non-breaking updates that should not
require integration changes:- clap 4.5.36 -> 4.6.1
- crc32fast 1.4 -> 1.5
- gdbstub 0.7.3 -> 0.7.10
- goblin 0.10.2 -> 0.10.7
- linkme 0.3.29 -> 0.3.36
- patina_lzma_rs 0.3.1 -> 0.3.2
- patina_paging 11.0.2 -> 11.0.4
- time 0.3.47 -> 0.3.49
- uuid 1.8 -> 1.23
- ruint 1.17.1 -> 1.18.0
- serial_test 3.0 -> 3.5
Cargo.toml: Bump safe-mmio to 0.3.0
The 0.3.0 release changes
UniqueMmioPointer::splitand
SharedMmioPointer::splitto take self instead of a reference. The
only direct consumer in the workspace is the PL011 UART register code
in the Patina SDK that uses field!/read/write rather than split, so
no integration changes are required.
Cargo.toml: Bump arm-gic to 0.8.1
The 0.8 release relocates the
InterruptGroupenum from thegicv3
submodule to thearm_giccrate root.This change updates the two import sites in the aarch64 GIC manager
and the DXE core hardware interrupt protocol accordingly.arm-gic0.8 also updates itssafe-mmiodependency to 0.3, which
matches the version already used by Patina.
Cargo.toml: Bump bitfield-struct to 0.13
The only direct consumer appears to be
patina_smbios, which uses
the#[bitfield(uN)]/#[bits(N)]attribute syntax that is not
changed in 0.13, so no integration changes are made.
Cargo.toml: Bump brotli-decompressor to 5.0.3
The Brotli decompression APIs used by
patina_ffs_extractors
(BrotliDecompressStream,BrotliState,BrotliResult,HuffmanCode)
and the customalloc_no_stdlib::Allocatorimplementation are
not changed in 5.0, so no integration changes are required.brotli-decompressor5.0.3 continues to depend onalloc-no-stdlib
2.x, so no changes are needed to thealloc-no-stdlibdependency.
Cargo.toml: Bump spin to 0.12
The 0.10 and 0.11 releases renamed the
portable_atomicfeature to
portable-atomicand renamedLazytoLazyLock.Patina only appears to use
Mutex,RwLock,rwlock::RwLock, and
Once(plus the unchangedrwlockfeature flag), none of which are
affected, so no integration changes are required.
Cargo.toml: Bump criterion to 0.8
criterion 0.6 deprecated
criterion::black_boxin favor of
std::hint::black_box. Patina benchmarks do not use
criterion::black_box.The APIs in use (
Criterion,BenchmarkId,Bencher,BatchSize,
criterion_group!,criterion_main!) are unchanged, so no
integration changes are required.
Cargo.toml: Bump mockall to 0.14
mockall 0.14.0 contains only additions and bug fixes plus an MSRV
bump to 1.77.0 (Patina requires 1.89). The macros and helpers in use
(mock!,automock,predicate) are unchanged, so no integration
changes are required.
cpu: Replace lazy_static with spin::LazyLock for the x64 GDT
Bumping
spinto 0.12 results in two versions ofspinin the
dependency tree:- 0.12 (the workspace's direct dependency and latest)
- 0.9.8, pulled in by
lazy_static'sspin_no_stdfeature.
This results in duplicate
spincrates being pulled in.lazy_staticwas only used in one place, the x64 GDT.This change replaces the single
lazy_static!block with
spin::LazyLock(already available inspin0.12).
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all- QEMU EFI shell boot
Integration Instructions
- N/A
- Drop redundant
📖 Documentation Updates
-
RFC: Runtime Service Module Support (Rejected) @cfernald (#877)
Change Details
## Description
This RFC proposes a roadmap for support of runtime service modules in Patina. The RFC has been rejected to defer to specification changes.
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
N/A
Integration Instructions
N/A
-
RFC [Reject]: Boot Orchestration Component @kat-perez (#1013)
Change Details
## Description
This RFC proposes modular components for UEFI spec compliant boot functionality in Patina firmware. Platforms can
use reference implementations for console initialization, boot option discovery, and boot orchestration,
or implement custom boot flows using the provided library functions.- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
- Creates a new crate?
How This Was Tested
N/A
Integration Instructions
N/A
-
docs: Add MSRV workflow documentation @makubacki (#1563)
Change Details
## Description
Closes #1545
Includes MSRV workflow details in the Rust version update process documentation.
The workflow itself was recently synced to the repo in commit 886f1fc.
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all
Integration Instructions
- N/A. Local repo documentation.
Full Changelog: patina-v22.0.1...v22.0.2