Skip to content

Commit a3e551c

Browse files
RaitoBezariusnicholasbishop
authored andcommitted
1 parent 1b96994 commit a3e551c

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## uefi - [Unreleased]
44

5+
### Added
6+
7+
- Added `BootServices::install_configuration_table`.
8+
59
### Changed
610

711
- Renamed `FileSystemIOErrorContext` to `IoErrorContext`.

uefi/src/table/boot.rs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ pub struct BootServices {
174174
device_path: &mut *const FfiDevicePath,
175175
out_handle: &mut MaybeUninit<Handle>,
176176
) -> Status,
177-
install_configuration_table: usize,
177+
install_configuration_table:
178+
extern "efiapi" fn(guid_entry: Guid, table_ptr: *const c_void) -> Status,
178179

179180
// Image services
180181
load_image: unsafe extern "efiapi" fn(
@@ -1139,6 +1140,34 @@ impl BootServices {
11391140
assert_eq!((self.stall)(time), Status::SUCCESS);
11401141
}
11411142

1143+
/// Adds, updates, or removes a configuration table entry
1144+
/// from the EFI System Table.
1145+
///
1146+
/// # Safety
1147+
///
1148+
/// This relies on `table_ptr` being allocated in the
1149+
/// pool of type [`uefi::table::boot::MemoryType::RUNTIME_SERVICES_DATA`]
1150+
/// according to the specification.
1151+
/// Other memory types such as
1152+
/// [`uefi::table::boot::MemoryType::ACPI_RECLAIM`]
1153+
/// can be considered.
1154+
///
1155+
/// # Errors
1156+
///
1157+
/// See section `EFI_BOOT_SERVICES.InstallConfigurationTable()` in the UEFI
1158+
/// Specification for more details.
1159+
///
1160+
/// * [`uefi::Status::INVALID_PARAMETER`]
1161+
/// * [`uefi::Status::NOT_FOUND`]
1162+
/// * [`uefi::Status::OUT_OF_RESOURCES`]
1163+
pub unsafe fn install_configuration_table(
1164+
&self,
1165+
guid_entry: Guid,
1166+
table_ptr: *const c_void,
1167+
) -> Result {
1168+
(self.install_configuration_table)(guid_entry, table_ptr).to_result()
1169+
}
1170+
11421171
/// Set the watchdog timer.
11431172
///
11441173
/// UEFI will start a 5-minute countdown after an UEFI image is loaded.
@@ -1581,7 +1610,7 @@ impl Debug for BootServices {
15811610
&(self.locate_device_path as *const usize),
15821611
)
15831612
.field(
1584-
"install_configuration_table",
1613+
"install_configuration_table (fn ptr)",
15851614
&(self.install_configuration_table as *const usize),
15861615
)
15871616
.field("load_image (fn ptr)", &(self.load_image as *const usize))

0 commit comments

Comments
 (0)