Skip to content

Add RuntimeServices::update_capsule #1162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions uefi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# uefi - [Unreleased]

## Added
- Added `RuntimeServices::update_capsule`.

## Removed
- Removed the `panic-on-logger-errors` feature of the `uefi` crate. Logger
errors are now silently ignored.
Expand Down
18 changes: 18 additions & 0 deletions uefi/src/table/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use core::fmt::{self, Debug, Display, Formatter};
use core::mem::MaybeUninit;
use core::ptr;

pub use uefi_raw::capsule::{CapsuleBlockDescriptor, CapsuleHeader};
pub use uefi_raw::table::runtime::{
ResetType, TimeCapabilities, VariableAttributes, VariableVendor,
};
pub use uefi_raw::time::Daylight;
pub use uefi_raw::PhysicalAddress;

#[cfg(feature = "alloc")]
use {
Expand Down Expand Up @@ -290,6 +292,22 @@ impl RuntimeServices {
) -> Status {
(self.0.set_virtual_address_map)(map_size, desc_size, desc_version, virtual_map)
}

/// Passes capsules to the firmware. Capsules are most commonly used to update system firmware.
pub fn update_capsule(
&self,
capsule_header_array: &[&CapsuleHeader],
capsule_block_descriptors: &[CapsuleBlockDescriptor],
) -> Result {
unsafe {
(self.0.update_capsule)(
capsule_header_array.as_ptr().cast(),
capsule_header_array.len(),
capsule_block_descriptors.as_ptr() as PhysicalAddress,
)
.to_result()
}
}
}

impl super::Table for RuntimeServices {
Expand Down