Skip to content

Commit 17ff62b

Browse files
Merge pull request #1661 from fox0/table--cfg
ConfigTableEntry move constants and add example
2 parents 97390cb + 9a6b490 commit 17ff62b

File tree

3 files changed

+149
-18
lines changed

3 files changed

+149
-18
lines changed

uefi/CHANGELOG.md

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

3+
## Added
4+
- Added `ConfigTableEntry::MEMORY_ATTRIBUTES_GUID` and `ConfigTableEntry::IMAGE_SECURITY_DATABASE_GUID`.
5+
36
## Changed
4-
- **Breaking:** `boot::stall` now take `Duration` instead of
5-
`usize`.
7+
- **Breaking:** `boot::stall` now take `core::time::Duration` instead of `usize`.
8+
- `table::cfg::*_GUID` constants now deprecated. Use `ConfigTableEntry::*_GUID` instead.
69

710

811
# uefi - 0.35.0 (2025-05-04)

uefi/src/system.rs

+17
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ pub fn uefi_revision() -> Revision {
5151

5252
/// Call `f` with a slice of [`ConfigTableEntry`]. Each entry provides access to
5353
/// a vendor-specific table.
54+
///
55+
/// # Example
56+
///
57+
/// ```rust,no_run
58+
/// use uefi::system::with_config_table;
59+
/// use uefi::table::cfg::ConfigTableEntry;
60+
///
61+
/// with_config_table(|slice| {
62+
/// for i in slice {
63+
/// match i.guid {
64+
/// ConfigTableEntry::ACPI_GUID => println!("Found ACPI1"),
65+
/// ConfigTableEntry::ACPI2_GUID => println!("Found ACPI2"),
66+
/// guid => println!("Found {}", guid),
67+
/// }
68+
/// }
69+
/// });
70+
/// ```
5471
pub fn with_config_table<F, R>(f: F) -> R
5572
where
5673
F: Fn(&[ConfigTableEntry]) -> R,

uefi/src/table/cfg.rs

+127-16
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
//!
99
//! This module contains the actual entries of the configuration table,
1010
//! as well as GUIDs for many known vendor tables.
11+
//!
12+
//! See <https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-configuration-table-properties-table>.
1113
1214
use crate::{guid, Guid};
1315
use bitflags::bitflags;
@@ -16,6 +18,8 @@ use core::ffi::c_void;
1618
/// Contains a set of GUID / pointer for a vendor-specific table.
1719
///
1820
/// The UEFI standard guarantees each entry is unique.
21+
///
22+
/// See <https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-configuration-table>.
1923
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
2024
#[repr(C)]
2125
pub struct ConfigTableEntry {
@@ -26,26 +30,106 @@ pub struct ConfigTableEntry {
2630
/// Whether this is a physical or virtual address depends on the table.
2731
pub address: *const c_void,
2832
}
29-
/// Entry pointing to the old ACPI 1 RSDP.
30-
pub const ACPI_GUID: Guid = guid!("eb9d2d30-2d88-11d3-9a16-0090273fc14d");
3133

32-
///Entry pointing to the ACPI 2 RSDP.
33-
pub const ACPI2_GUID: Guid = guid!("8868e871-e4f1-11d3-bc22-0080c73c8881");
34+
impl ConfigTableEntry {
35+
/// Entry pointing to the old ACPI 1 RSDP.
36+
pub const ACPI_GUID: Guid = guid!("eb9d2d30-2d88-11d3-9a16-0090273fc14d");
37+
38+
/// Entry pointing to the ACPI 2 RSDP.
39+
pub const ACPI2_GUID: Guid = guid!("8868e871-e4f1-11d3-bc22-0080c73c8881");
40+
41+
/// Entry pointing to the SMBIOS 1.0 table.
42+
pub const SMBIOS_GUID: Guid = guid!("eb9d2d31-2d88-11d3-9a16-0090273fc14d");
43+
44+
/// Entry pointing to the SMBIOS 3.0 table.
45+
pub const SMBIOS3_GUID: Guid = guid!("f2fd1544-9794-4a2c-992e-e5bbcf20e394");
46+
47+
/// Entry pointing to the EFI System Resource table (ESRT).
48+
pub const ESRT_GUID: Guid = guid!("b122a263-3661-4f68-9929-78f8b0d62180");
49+
50+
/// Hand-off Blocks are used to pass data from the early pre-UEFI environment to the UEFI drivers.
51+
///
52+
/// Most OS loaders or applications should not mess with this.
53+
pub const HAND_OFF_BLOCK_LIST_GUID: Guid = guid!("7739f24c-93d7-11d4-9a3a-0090273fc14d");
54+
55+
/// Table used in the early boot environment to record memory ranges.
56+
pub const MEMORY_TYPE_INFORMATION_GUID: Guid = guid!("4c19049f-4137-4dd3-9c10-8b97a83ffdfa");
57+
58+
/// Used to identify Hand-off Blocks which store
59+
/// status codes reported during the pre-UEFI environment.
60+
pub const MEMORY_STATUS_CODE_RECORD_GUID: Guid = guid!("060cc026-4c0d-4dda-8f41-595fef00a502");
61+
62+
/// Provides additional information about regions within the run-time memory blocks.
63+
/// See <https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table>.
64+
pub const MEMORY_ATTRIBUTES_GUID: Guid = guid!("dcfa911d-26eb-469f-a220-38b7dc461220");
65+
66+
/// Constants used for UEFI signature database variable access.
67+
/// See <https://uefi.org/specs/UEFI/2.11/32_Secure_Boot_and_Driver_Signing.html#uefi-image-variable-guid-variable-name>.
68+
pub const IMAGE_SECURITY_DATABASE_GUID: Guid = guid!("d719b2cb-3d3a-4596-a3bc-dad00e67656f");
69+
70+
/// Table which provides Driver eXecution Environment services.
71+
pub const DXE_SERVICES_GUID: Guid = guid!("05ad34ba-6f02-4214-952e-4da0398e2bb9");
72+
73+
/// LZMA-compressed filesystem.
74+
pub const LZMA_COMPRESS_GUID: Guid = guid!("ee4e5898-3914-4259-9d6e-dc7bd79403cf");
75+
76+
/// A custom compressed filesystem used by the Tiano UEFI implementation.
77+
pub const TIANO_COMPRESS_GUID: Guid = guid!("a31280ad-481e-41b6-95e8-127f4c984779");
78+
79+
/// Pointer to the debug image info table.
80+
pub const DEBUG_IMAGE_INFO_GUID: Guid = guid!("49152e77-1ada-4764-b7a2-7afefed95e8b");
81+
82+
/// GUID of the UEFI properties table.
83+
///
84+
/// The properties table is used to provide additional info
85+
/// about the UEFI implementation.
86+
pub const PROPERTIES_TABLE_GUID: Guid = guid!("880aaca3-4adc-4a04-9079-b747340825e5");
87+
}
88+
89+
/// Entry pointing to the old ACPI 1 RSDP.
90+
#[deprecated(
91+
since = "0.35.1",
92+
note = "please use `ConfigTableEntry::ACPI_GUID` instead"
93+
)]
94+
pub const ACPI_GUID: Guid = ConfigTableEntry::ACPI_GUID;
95+
96+
/// Entry pointing to the ACPI 2 RSDP.
97+
#[deprecated(
98+
since = "0.35.1",
99+
note = "please use `ConfigTableEntry::ACPI2_GUID` instead"
100+
)]
101+
pub const ACPI2_GUID: Guid = ConfigTableEntry::ACPI2_GUID;
34102

35103
/// Entry pointing to the SMBIOS 1.0 table.
36-
pub const SMBIOS_GUID: Guid = guid!("eb9d2d31-2d88-11d3-9a16-0090273fc14d");
104+
#[deprecated(
105+
since = "0.35.1",
106+
note = "please use `ConfigTableEntry::SMBIOS_GUID` instead"
107+
)]
108+
pub const SMBIOS_GUID: Guid = ConfigTableEntry::SMBIOS_GUID;
37109

38110
/// Entry pointing to the SMBIOS 3.0 table.
39-
pub const SMBIOS3_GUID: Guid = guid!("f2fd1544-9794-4a2c-992e-e5bbcf20e394");
111+
#[deprecated(
112+
since = "0.35.1",
113+
note = "please use `ConfigTableEntry::SMBIOS3_GUID` instead"
114+
)]
115+
pub const SMBIOS3_GUID: Guid = ConfigTableEntry::SMBIOS3_GUID;
40116

41117
/// Entry pointing to the EFI System Resource table (ESRT).
42-
pub const ESRT_GUID: Guid = guid!("b122a263-3661-4f68-9929-78f8b0d62180");
118+
#[deprecated(
119+
since = "0.35.1",
120+
note = "please use `ConfigTableEntry::ESRT_GUID` instead"
121+
)]
122+
pub const ESRT_GUID: Guid = ConfigTableEntry::ESRT_GUID;
43123

44124
/// GUID of the UEFI properties table.
45125
///
46126
/// The properties table is used to provide additional info
47127
/// about the UEFI implementation.
48-
pub const PROPERTIES_TABLE_GUID: Guid = guid!("880aaca3-4adc-4a04-9079-b747340825e5");
128+
#[deprecated(
129+
since = "0.35.1",
130+
note = "please use `ConfigTableEntry::PROPERTIES_TABLE_GUID` instead"
131+
)]
132+
pub const PROPERTIES_TABLE_GUID: Guid = ConfigTableEntry::PROPERTIES_TABLE_GUID;
49133

50134
/// This table contains additional information about the UEFI implementation.
51135
#[repr(C)]
@@ -77,23 +161,50 @@ bitflags! {
77161
/// Hand-off Blocks are used to pass data from the early pre-UEFI environment to the UEFI drivers.
78162
///
79163
/// Most OS loaders or applications should not mess with this.
80-
pub const HAND_OFF_BLOCK_LIST_GUID: Guid = guid!("7739f24c-93d7-11d4-9a3a-0090273fc14d");
164+
#[deprecated(
165+
since = "0.35.1",
166+
note = "please use `ConfigTableEntry::HAND_OFF_BLOCK_LIST_GUID` instead"
167+
)]
168+
pub const HAND_OFF_BLOCK_LIST_GUID: Guid = ConfigTableEntry::HAND_OFF_BLOCK_LIST_GUID;
81169

82170
/// Table used in the early boot environment to record memory ranges.
83-
pub const MEMORY_TYPE_INFORMATION_GUID: Guid = guid!("4c19049f-4137-4dd3-9c10-8b97a83ffdfa");
171+
#[deprecated(
172+
since = "0.35.1",
173+
note = "please use `ConfigTableEntry::MEMORY_TYPE_INFORMATION_GUID` instead"
174+
)]
175+
pub const MEMORY_TYPE_INFORMATION_GUID: Guid = ConfigTableEntry::MEMORY_TYPE_INFORMATION_GUID;
84176

85177
/// Used to identify Hand-off Blocks which store
86178
/// status codes reported during the pre-UEFI environment.
87-
pub const MEMORY_STATUS_CODE_RECORD_GUID: Guid = guid!("060cc026-4c0d-4dda-8f41-595fef00a502");
179+
#[deprecated(
180+
since = "0.35.1",
181+
note = "please use `ConfigTableEntry::MEMORY_STATUS_CODE_RECORD_GUID` instead"
182+
)]
183+
pub const MEMORY_STATUS_CODE_RECORD_GUID: Guid = ConfigTableEntry::MEMORY_STATUS_CODE_RECORD_GUID;
88184

89185
/// Table which provides Driver eXecution Environment services.
90-
pub const DXE_SERVICES_GUID: Guid = guid!("05ad34ba-6f02-4214-952e-4da0398e2bb9");
186+
#[deprecated(
187+
since = "0.35.1",
188+
note = "please use `ConfigTableEntry::DXE_SERVICES_GUID` instead"
189+
)]
190+
pub const DXE_SERVICES_GUID: Guid = ConfigTableEntry::DXE_SERVICES_GUID;
91191

92192
/// LZMA-compressed filesystem.
93-
pub const LZMA_COMPRESS_GUID: Guid = guid!("ee4e5898-3914-4259-9d6e-dc7bd79403cf");
193+
#[deprecated(
194+
since = "0.35.1",
195+
note = "please use `ConfigTableEntry::LZMA_COMPRESS_GUID` instead"
196+
)]
197+
pub const LZMA_COMPRESS_GUID: Guid = ConfigTableEntry::LZMA_COMPRESS_GUID;
94198

95199
/// A custom compressed filesystem used by the Tiano UEFI implementation.
96-
pub const TIANO_COMPRESS_GUID: Guid = guid!("a31280ad-481e-41b6-95e8-127f4c984779");
97-
200+
#[deprecated(
201+
since = "0.35.1",
202+
note = "please use `ConfigTableEntry::TIANO_COMPRESS_GUID` instead"
203+
)]
204+
pub const TIANO_COMPRESS_GUID: Guid = ConfigTableEntry::TIANO_COMPRESS_GUID;
98205
/// Pointer to the debug image info table.
99-
pub const DEBUG_IMAGE_INFO_GUID: Guid = guid!("49152e77-1ada-4764-b7a2-7afefed95e8b");
206+
#[deprecated(
207+
since = "0.35.1",
208+
note = "please use `ConfigTableEntry::DEBUG_IMAGE_INFO_GUID` instead"
209+
)]
210+
pub const DEBUG_IMAGE_INFO_GUID: Guid = ConfigTableEntry::DEBUG_IMAGE_INFO_GUID;

0 commit comments

Comments
 (0)