Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2977208

Browse files
committed
uefi: Add safe bindings for HiiConfigRouting protocol
1 parent 40fd06e commit 2977208

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

‎uefi/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Added `proto::acpi::AcpiTable`.
1111
- Added `proto::hii::database::HiiDatabase`.
1212
- Added `proto::hii::config_str::MultiConfigurationStringIter`.
13+
- Added `proto::hii::config_routing::HiiConfigRouting`.
1314

1415
## Changed
1516
- **Breaking:** `boot::stall` now take `core::time::Duration` instead of `usize`.

‎uefi/src/proto/hii/config_routing.rs‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
3+
//! HII Configuration protocols.
4+
5+
use core::ptr;
6+
7+
use alloc::string::{String, ToString};
8+
use uefi_macros::unsafe_protocol;
9+
use uefi_raw::Char16;
10+
use uefi_raw::protocol::hii::config::HiiConfigRoutingProtocol;
11+
12+
use crate::{CStr16, StatusExt};
13+
14+
/// The HII Configuration Routing Protocol.
15+
///
16+
/// # UEFI Spec Description
17+
///
18+
/// The EFI HII Configuration Routing Protocol manages the movement of configuration
19+
/// data from drivers to configuration applications. It then serves as the single point
20+
/// to receive configuration information from configuration applications, routing the results
21+
/// to the appropriate drivers.
22+
#[derive(Debug)]
23+
#[repr(transparent)]
24+
#[unsafe_protocol(HiiConfigRoutingProtocol::GUID)]
25+
pub struct HiiConfigRouting(HiiConfigRoutingProtocol);
26+
impl HiiConfigRouting {
27+
/// Request the current configuration for the entirety of the current HII database and
28+
/// return the data as string in multi configuration string format.
29+
///
30+
/// Use `super::config_str::MultiConfigurationStringIter` to parse the returned `String`.
31+
pub fn export(&self) -> uefi::Result<String> {
32+
unsafe {
33+
let mut results: *const Char16 = ptr::null();
34+
(self.0.export_config)(&self.0, &mut results)
35+
.to_result_with_val(|| CStr16::from_ptr(results.cast()).to_string())
36+
}
37+
}
38+
}

‎uefi/src/proto/hii/mod.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
pub mod config;
66
#[cfg(feature = "alloc")]
7+
pub mod config_routing;
8+
#[cfg(feature = "alloc")]
79
pub mod config_str;
810
#[cfg(feature = "alloc")]
911
pub mod database;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /