Add patina_nvme crate#11
Open
kat-perez wants to merge 1 commit into
Open
Conversation
5 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a new
patina_nvmecrate that exposes thin wrappers overEFI_NVM_EXPRESS_PASS_THRU_PROTOCOLadmin commands. Initial surface area is a single helper,lock_partition_write, which write-protects the NVMe boot partitions until the next power cycle viaSet Features(FID 0x11, BPWPS).This supersedes the placement explored in patina#1488, where the same helper lived inside
patina_boot::partition. Reviewer feedback there (os-d, makubacki) made the case thatpatina_bootshould not implement storage-protocol abstractions; this PR is the relocation.The crate stays narrow on purpose:
lib.rs— publiclock_partition_writehelper plus the unsafe inner Set Features dispatch.pass_thru.rs— minimal FFI bindings forEFI_NVM_EXPRESS_PASS_THRU_PROTOCOL(Protocol struct, command/completion shapes, opcode/FID/flag constants).Like
patina_bootfrom #9,patina_nvmepullspatinadirectly from thefeature/patina-bootgit branch until apatinarelease ships the required APIs (DevicePathBuf, etc.).How This Was Tested
cargo test --lib -p patina_nvme— all 6 unit tests pass:The unsafe FFI dispatch path is exercised via mock
pass_thrufunction pointers that capture the constructed command and verify opcode/flags/CDW10/CDW11/queue type match the NVMe spec.Integration Instructions
Consumers depend on
patina_nvme = "0.1"from this repo. Until apatinarelease containing the new APIs is published, consumers needing to build against this crate will also need to redirectpatinato thefeature/patina-bootbranch (matching the existing pattern inpatina_boot/Cargo.toml).Closes #61 (tracked on the SRE board) once patina#1488 is closed in favor of this PR.