1 /** 2 Based on Uefi/UefiGpt.h file, original notice: 3 4 EFI Guid Partition Table Format Definition. 5 6 This is the include file for any module of type base. Base modules only use 7 types defined via this include file and can be ported easily to any 8 environment. There are a set of base libraries in the Mde Package that can 9 be used to implement base modules. 10 11 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. 12 This program and the accompanying materials 13 are licensed and made available under the terms and conditions of the BSD License 14 which accompanies this distribution. The full text of the license may be found at 15 http://opensource.org/licenses/bsd-license.php 16 17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 **/ 20 module uefi.gpt; 21 22 import uefi.bind; 23 import uefi.base; 24 import uefi.base_type; 25 26 public: 27 extern (C): 28 29 /// 30 /// The primary GUID Partition Table Header must be 31 /// located in LBA 1 (i.e., the second logical block). 32 /// 33 enum PRIMARY_PART_HEADER_LBA = 1; 34 35 /// 36 /// EFI Partition Table Signature: "EFI PART". 37 /// 38 enum EFI_PTAB_HEADER_ID = SIGNATURE_64('E', 'F', 'I', ' ', 'P', 'A', 'R', 'T'); 39 40 /// 41 /// GPT Partition Table Header. 42 /// 43 struct EFI_PARTITION_TABLE_HEADER 44 { 45 align(1): 46 /// 47 /// The table header for the GPT partition Table. 48 /// This header contains EFI_PTAB_HEADER_ID. 49 /// 50 EFI_TABLE_HEADER Header; 51 /// 52 /// The LBA that contains this data structure. 53 /// 54 EFI_LBA MyLBA; 55 /// 56 /// LBA address of the alternate GUID Partition Table Header. 57 /// 58 EFI_LBA AlternateLBA; 59 /// 60 /// The first usable logical block that may be used 61 /// by a partition described by a GUID Partition Entry. 62 /// 63 EFI_LBA FirstUsableLBA; 64 /// 65 /// The last usable logical block that may be used 66 /// by a partition described by a GUID Partition Entry. 67 /// 68 EFI_LBA LastUsableLBA; 69 /// 70 /// GUID that can be used to uniquely identify the disk. 71 /// 72 EFI_GUID DiskGUID; 73 /// 74 /// The starting LBA of the GUID Partition Entry array. 75 /// 76 EFI_LBA PartitionEntryLBA; 77 /// 78 /// The number of Partition Entries in the GUID Partition Entry array. 79 /// 80 UINT32 NumberOfPartitionEntries; 81 /// 82 /// The size, in bytes, of each the GUID Partition 83 /// Entry structures in the GUID Partition Entry 84 /// array. This field shall be set to a value of 128 x 2^n where n is 85 /// an integer greater than or equal to zero (e.g., 128, 256, 512, etc.). 86 /// 87 UINT32 SizeOfPartitionEntry; 88 /// 89 /// The CRC32 of the GUID Partition Entry array. 90 /// Starts at PartitionEntryLBA and is 91 /// computed over a byte length of 92 /// NumberOfPartitionEntries * SizeOfPartitionEntry. 93 /// 94 UINT32 PartitionEntryArrayCRC32; 95 } 96 97 /// 98 /// GPT Partition Entry. 99 /// 100 struct EFI_PARTITION_ENTRY 101 { 102 align(1): 103 /// 104 /// Unique ID that defines the purpose and type of this Partition. A value of 105 /// zero defines that this partition entry is not being used. 106 /// 107 EFI_GUID PartitionTypeGUID; 108 /// 109 /// GUID that is unique for every partition entry. Every partition ever 110 /// created will have a unique GUID. 111 /// This GUID must be assigned when the GUID Partition Entry is created. 112 /// 113 EFI_GUID UniquePartitionGUID; 114 /// 115 /// Starting LBA of the partition defined by this entry 116 /// 117 EFI_LBA StartingLBA; 118 /// 119 /// Ending LBA of the partition defined by this entry. 120 /// 121 EFI_LBA EndingLBA; 122 /// 123 /// Attribute bits, all bits reserved by UEFI 124 /// Bit 0: If this bit is set, the partition is required for the platform to function. The owner/creator of the 125 /// partition indicates that deletion or modification of the contents can result in loss of platform 126 /// features or failure for the platform to boot or operate. The system cannot function normally if 127 /// this partition is removed, and it should be considered part of the hardware of the system. 128 /// Actions such as running diagnostics, system recovery, or even OS install or boot, could 129 /// potentially stop working if this partition is removed. Unless OS software or firmware 130 /// recognizes this partition, it should never be removed or modified as the UEFI firmware or 131 /// platform hardware may become non-functional. 132 /// Bit 1: If this bit is set, then firmware must not produce an EFI_BLOCK_IO_PROTOCOL device for 133 /// this partition. By not producing an EFI_BLOCK_IO_PROTOCOL partition, file system 134 /// mappings will not be created for this partition in UEFI. 135 /// Bit 2: This bit is set aside to let systems with traditional PC-AT BIOS firmware implementations 136 /// inform certain limited, special-purpose software running on these systems that a GPT 137 /// partition may be bootable. The UEFI boot manager must ignore this bit when selecting 138 /// a UEFI-compliant application, e.g., an OS loader. 139 /// Bits 3-47: Undefined and must be zero. Reserved for expansion by future versions of the UEFI 140 /// specification. 141 /// Bits 48-63: Reserved for GUID specific use. The use of these bits will vary depending on the 142 /// PartitionTypeGUID. Only the owner of the PartitionTypeGUID is allowed 143 /// to modify these bits. They must be preserved if Bits 0-47 are modified.. 144 /// 145 UINT64 Attributes; 146 /// 147 /// Null-terminated name of the partition. 148 /// 149 CHAR16[36] PartitionName; 150 }