1 //! Configuration table utilities.
2 //!
3 //! The configuration table is an array of GUIDs and pointers to extra system tables.
4 //!
5 //! For example, it can be used to find the ACPI tables.
6 //!
7 //! This module contains the actual entries of the configuration table,
8 //! as well as GUIDs for many known vendor tables.
9 
10 use crate::{guid, Guid};
11 use bitflags::bitflags;
12 use core::ffi::c_void;
13 
14 /// Contains a set of GUID / pointer for a vendor-specific table.
15 ///
16 /// The UEFI standard guarantees each entry is unique.
17 #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
18 #[repr(C)]
19 pub struct ConfigTableEntry {
20     /// The GUID identifying this table.
21     pub guid: Guid,
22     /// The starting address of this table.
23     ///
24     /// Whether this is a physical or virtual address depends on the table.
25     pub address: *const c_void,
26 }
27 /// Entry pointing to the old ACPI 1 RSDP.
28 pub const ACPI_GUID: Guid = guid!("eb9d2d30-2d88-11d3-9a16-0090273fc14d");
29 
30 ///Entry pointing to the ACPI 2 RSDP.
31 pub const ACPI2_GUID: Guid = guid!("8868e871-e4f1-11d3-bc22-0080c73c8881");
32 
33 /// Entry pointing to the SMBIOS 1.0 table.
34 pub const SMBIOS_GUID: Guid = guid!("eb9d2d31-2d88-11d3-9a16-0090273fc14d");
35 
36 /// Entry pointing to the SMBIOS 3.0 table.
37 pub const SMBIOS3_GUID: Guid = guid!("f2fd1544-9794-4a2c-992e-e5bbcf20e394");
38 
39 /// Entry pointing to the EFI System Resource table (ESRT).
40 pub const ESRT_GUID: Guid = guid!("b122a263-3661-4f68-9929-78f8b0d62180");
41 
42 /// GUID of the UEFI properties table.
43 ///
44 /// The properties table is used to provide additional info
45 /// about the UEFI implementation.
46 pub const PROPERTIES_TABLE_GUID: Guid = guid!("880aaca3-4adc-4a04-9079-b747340825e5");
47 
48 /// This table contains additional information about the UEFI implementation.
49 #[repr(C)]
50 #[derive(Debug)]
51 pub struct PropertiesTable {
52     /// Version of the UEFI properties table.
53     ///
54     /// The only valid version currently is 0x10_000.
55     pub version: u32,
56     /// Length in bytes of this table.
57     ///
58     /// The initial version's length is 16.
59     pub length: u32,
60     /// Memory protection attributes.
61     pub memory_protection: MemoryProtectionAttribute,
62 }
63 
64 bitflags! {
65     /// Flags describing memory protection.
66     #[repr(transparent)]
67     #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
68     pub struct MemoryProtectionAttribute: usize {
69         /// If this bit is set, then the UEFI implementation will mark pages
70         /// containing data as non-executable.
71         const NON_EXECUTABLE_DATA = 1;
72     }
73 }
74 
75 /// Hand-off Blocks are used to pass data from the early pre-UEFI environment to the UEFI drivers.
76 ///
77 /// Most OS loaders or applications should not mess with this.
78 pub const HAND_OFF_BLOCK_LIST_GUID: Guid = guid!("7739f24c-93d7-11d4-9a3a-0090273fc14d");
79 
80 /// Table used in the early boot environment to record memory ranges.
81 pub const MEMORY_TYPE_INFORMATION_GUID: Guid = guid!("4c19049f-4137-4dd3-9c10-8b97a83ffdfa");
82 
83 /// Used to identify Hand-off Blocks which store
84 /// status codes reported during the pre-UEFI environment.
85 pub const MEMORY_STATUS_CODE_RECORD_GUID: Guid = guid!("060cc026-4c0d-4dda-8f41-595fef00a502");
86 
87 /// Table which provides Driver eXecution Environment services.
88 pub const DXE_SERVICES_GUID: Guid = guid!("05ad34ba-6f02-4214-952e-4da0398e2bb9");
89 
90 /// LZMA-compressed filesystem.
91 pub const LZMA_COMPRESS_GUID: Guid = guid!("ee4e5898-3914-4259-9d6e-dc7bd79403cf");
92 
93 /// A custom compressed filesystem used by the Tiano UEFI implementation.
94 pub const TIANO_COMPRESS_GUID: Guid = guid!("a31280ad-481e-41b6-95e8-127f4c984779");
95 
96 /// Pointer to the debug image info table.
97 pub const DEBUG_IMAGE_INFO_GUID: Guid = guid!("49152e77-1ada-4764-b7a2-7afefed95e8b");
98