xref: /DragonOS/kernel/src/driver/firmware/efi/guid.rs (revision 86ee1395de7c614865236ee15071c3603b794e44)
1 use core::{fmt, mem};
2 
3 use uefi_raw::Guid;
4 
5 /// 由DragonStub设置的,用于描述内核被放置在的地址的GUID
6 pub static DRAGONSTUB_EFI_PAYLOAD_EFI_GUID: Guid = Guid::new(
7     unsafe { mem::transmute_copy(&0xddf1d47cu32) },
8     unsafe { mem::transmute_copy(&0x102cu32) },
9     unsafe { mem::transmute_copy(&0xaaf9u32) },
10     0xce,
11     0x34,
12     [0xbc, 0xef, 0x98, 0x12, 0x00, 0x31],
13 );
14 
15 pub static EFI_MEMORY_ATTRIBUTES_TABLE_GUID: Guid = Guid::new(
16     unsafe { mem::transmute_copy(&0xdcfa911du32) },
17     unsafe { mem::transmute_copy(&0x26ebu32) },
18     unsafe { mem::transmute_copy(&0x469fu32) },
19     0xa2,
20     0x20,
21     [0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20],
22 );
23 
24 pub static EFI_MEMRESERVE_TABLE_GUID: Guid = Guid::new(
25     unsafe { mem::transmute_copy(&0x888eb0c6u32) },
26     unsafe { mem::transmute_copy(&0x8edeu32) },
27     unsafe { mem::transmute_copy(&0x4ff5u32) },
28     0xa8,
29     0xf0,
30     [0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2],
31 );
32 
33 pub static EFI_SYSTEM_RESOURCE_TABLE_GUID: Guid = Guid::new(
34     unsafe { mem::transmute_copy(&0xb122a263u32) },
35     unsafe { mem::transmute_copy(&0x3661u32) },
36     unsafe { mem::transmute_copy(&0x4f68u32) },
37     0x99,
38     0x29,
39     [0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80],
40 );
41 /// 表示内核被加载到的地址的信息。
42 ///
43 /// 对应 `DRAGONSTUB_EFI_PAYLOAD_EFI_GUID`
44 #[derive(Clone, Copy)]
45 #[repr(C)]
46 pub struct DragonStubPayloadEFI {
47     /// 内核文件被加载到的物理地址
48     pub paddr: u64,
49 
50     /// 占用的空间的大小
51     pub size: u64,
52 }
53 
54 impl fmt::Debug for DragonStubPayloadEFI {
55     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
56         f.debug_struct("DragonStubPayloadEFI")
57             .field("paddr", &format_args!("0x{:x}", self.paddr))
58             .field("size", &self.size)
59             .finish()
60     }
61 }
62