virtfw_libefi/
guids.rs

1//! efi guid database
2
3#![allow(non_upper_case_globals)]
4
5extern crate alloc;
6use alloc::format;
7use alloc::string::{String, ToString};
8
9use uguid::{guid, Guid};
10
11// efi variable namespaces
12pub const EfiCustomModeEnable: Guid = guid!("c076ec0c-7028-4399-a072-71ee5c448b9f");
13pub const EfiGlobalVariable: Guid = guid!("8be4df61-93ca-11d2-aa0d-00e098032b8c");
14pub const EfiImageSecurityDatabase: Guid = guid!("d719b2cb-3d3a-4596-a3bc-dad00e67656f");
15pub const EfiSecureBootEnable: Guid = guid!("f0a30bc7-af08-4556-99c4-001009c93a44");
16pub const LoaderInfo: Guid = guid!("4a67b082-0a4c-41cf-b6c7-440b29bb8c4f");
17pub const ShimVariable: Guid = guid!("605dab50-e046-4300-abb6-3dd810dd8b23");
18pub const VMMBootOrder: Guid = guid!("668f4529-63d0-4bb5-b65d-6fbb9d36a44a");
19
20// efi signatures
21pub const EfiCertPkcs7: Guid = guid!("4aafd29d-68df-49ee-8aa9-347d375665a7");
22pub const EfiCertSha256: Guid = guid!("c1c41626-504c-4092-aca9-41f936934328");
23pub const EfiCertSha384: Guid = guid!("ff3e5307-9fd0-48c9-85f1-8ad56c701e01");
24pub const EfiCertSha512: Guid = guid!("093e0fae-a6c4-4f50-9f1b-d41e2b89c19a");
25pub const EfiCertRsa2048: Guid = guid!("3c5766e8-269c-4e34-aa14-ed776e85b3b6");
26pub const EfiCertX509: Guid = guid!("a5c059a1-94e4-4aa7-87b5-ab155c2bf072");
27
28// efi events
29pub const EfiEndOfDxeEventGroup: Guid = guid!("02ce967a-dd7e-4ffc-9ee7-810cf0470880");
30pub const EfiEventExitBootServices: Guid = guid!("27abf055-b1b8-4c26-8048-748f37baa2df");
31pub const EfiEventReadyToBoot: Guid = guid!("7ce88fb3-4bd7-4679-87a8-a8d8dee50d2b");
32
33// mm protocols
34pub const EfiSmmVariableProtocol: Guid = guid!("ed32d533-99e6-4209-9cc0-2d72cdd998a7");
35pub const VarCheckPolicyLibMmiHandler: Guid = guid!("da1b0d11-d1a7-46c4-9dc9-f3714875c6eb");
36
37// config tables
38pub const Acpi2Cfg: Guid = guid!("8868e871-e4f1-11d3-bc22-0080c73c8881");
39pub const AcpiCfg: Guid = guid!("eb9d2d30-2d88-11d3-9a16-0090273fc14d");
40pub const DebugImageInfoCfg: Guid = guid!("49152e77-1ada-4764-b7a2-7afefed95e8b");
41pub const DxeServicesCfg: Guid = guid!("05ad34ba-6f02-4214-952e-4da0398e2bb9");
42pub const HandOffBlockListCfg: Guid = guid!("7739f24c-93d7-11d4-9a3a-0090273fc14d");
43pub const MemoryTypeInfoCfg: Guid = guid!("4c19049f-4137-4dd3-9c10-8b97a83ffdfa");
44pub const SmbiosCfg: Guid = guid!("eb9d2d31-2d88-11d3-9a16-0090273fc14d");
45
46// guid HOBs
47pub const FdtHob: Guid = guid!("16958446-19B7-480B-B047-7485AD3F716D");
48pub const OvmfPkgPlatformInfo: Guid = guid!("dec9b486-1f16-47c7-8f68-df1a41888ba5");
49pub const PcdDatabase: Guid = guid!("9b3ada4f-ae56-4c24-8dea-f03b7558ae50");
50pub const SecPlatformInformation2: Guid = guid!("9e9f374b-8f16-4230-9824-5846ee766a97");
51
52pub fn try_pretty_name(guid: &Guid) -> Option<&'static str> {
53    match *guid {
54        EfiCustomModeEnable => Some("EfiCustomModeEnable"),
55        EfiGlobalVariable => Some("EfiGlobalVariable"),
56        EfiImageSecurityDatabase => Some("EfiImageSecurityDatabase"),
57        EfiSecureBootEnable => Some("EfiSecureBootEnable"),
58        LoaderInfo => Some("LoaderInfo"),
59        ShimVariable => Some("ShimVariable"),
60        VMMBootOrder => Some("VMMBootOrder"),
61
62        EfiCertPkcs7 => Some("EfiCertPkcs7"),
63        EfiCertSha256 => Some("EfiCertSha256"),
64        EfiCertSha384 => Some("EfiCertSha384"),
65        EfiCertSha512 => Some("EfiCertSha512"),
66        EfiCertRsa2048 => Some("EfiCertRsa2048"),
67        EfiCertX509 => Some("EfiCertX509"),
68
69        EfiEndOfDxeEventGroup => Some("EfiEndOfDxeEventGroup"),
70        EfiEventExitBootServices => Some("EfiEventExitBootServices"),
71        EfiEventReadyToBoot => Some("EfiEventReadyToBoot"),
72
73        EfiSmmVariableProtocol => Some("EfiSmmVariableProtocol"),
74        VarCheckPolicyLibMmiHandler => Some("VarCheckPolicyLibMmiHandler"),
75
76        Acpi2Cfg => Some("Acpi2Cfg"),
77        AcpiCfg => Some("AcpiCfg"),
78        DebugImageInfoCfg => Some("DebugImageInfoCfg"),
79        DxeServicesCfg => Some("DxeServicesCfg"),
80        HandOffBlockListCfg => Some("HandOffBlockListCfg"),
81        MemoryTypeInfoCfg => Some("MemoryTypeInfoCfg"),
82        SmbiosCfg => Some("SmbiosCfg"),
83
84        FdtHob => Some("FdtHob"),
85        OvmfPkgPlatformInfo => Some("OvmfPkgPlatformInfo"),
86        PcdDatabase => Some("PcdDatabase"),
87        SecPlatformInformation2 => Some("SecPlatformInformation2"),
88
89        _ => None,
90    }
91}
92
93pub fn pretty_name(guid: &Guid) -> String {
94    match try_pretty_name(guid) {
95        Some(name) => name.to_string(),
96        None => format!("{guid}"),
97    }
98}