Skip to content

Commit b43b0b0

Browse files
committed
Add RuntimeServices::update_capsule
This allows passing capsules[1] to firmware. Firmware updates cannot be explicitly tested as it is not supported by OVMF. [1]:https://uefi.org/specs/UEFI/2.9_A/08_Services_Runtime_Services.html#update-capsule
1 parent 2356270 commit b43b0b0

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

uefi/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# uefi - [Unreleased]
22

3+
## Added
4+
- Added `RuntimeServices::update_capsule`.
5+
36
## Removed
47
- Removed the `panic-on-logger-errors` feature of the `uefi` crate. Logger
58
errors are now silently ignored.

uefi/src/table/runtime.rs

+18
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ use core::fmt::{self, Debug, Display, Formatter};
77
use core::mem::MaybeUninit;
88
use core::ptr;
99

10+
pub use uefi_raw::capsule::{CapsuleBlockDescriptor, CapsuleHeader};
1011
pub use uefi_raw::table::runtime::{
1112
ResetType, TimeCapabilities, VariableAttributes, VariableVendor,
1213
};
1314
pub use uefi_raw::time::Daylight;
15+
pub use uefi_raw::PhysicalAddress;
1416

1517
#[cfg(feature = "alloc")]
1618
use {
@@ -290,6 +292,22 @@ impl RuntimeServices {
290292
) -> Status {
291293
(self.0.set_virtual_address_map)(map_size, desc_size, desc_version, virtual_map)
292294
}
295+
296+
/// Passes capsules to the firmware. Capsules are most commonly used to update system firmware.
297+
pub fn update_capsule(
298+
&self,
299+
capsule_header_array: &[&CapsuleHeader],
300+
capsule_block_descriptors: &[CapsuleBlockDescriptor],
301+
) -> Result {
302+
unsafe {
303+
(self.0.update_capsule)(
304+
capsule_header_array.as_ptr().cast(),
305+
capsule_header_array.len(),
306+
capsule_block_descriptors.as_ptr() as PhysicalAddress,
307+
)
308+
.to_result()
309+
}
310+
}
293311
}
294312

295313
impl super::Table for RuntimeServices {

0 commit comments

Comments
 (0)