Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/contrib/edk2/Include/Uefi/UefiGpt.h
48383 views
1
/** @file
2
EFI Guid Partition Table Format Definition.
3
4
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5
SPDX-License-Identifier: BSD-2-Clause-Patent
6
7
**/
8
9
#ifndef __UEFI_GPT_H__
10
#define __UEFI_GPT_H__
11
12
///
13
/// The primary GUID Partition Table Header must be
14
/// located in LBA 1 (i.e., the second logical block).
15
///
16
#define PRIMARY_PART_HEADER_LBA 1
17
///
18
/// EFI Partition Table Signature: "EFI PART".
19
///
20
#define EFI_PTAB_HEADER_ID SIGNATURE_64 ('E','F','I',' ','P','A','R','T')
21
///
22
/// Minimum bytes reserve for EFI entry array buffer.
23
///
24
#define EFI_GPT_PART_ENTRY_MIN_SIZE 16384
25
26
#pragma pack(1)
27
28
///
29
/// GPT Partition Table Header.
30
///
31
typedef struct {
32
///
33
/// The table header for the GPT partition Table.
34
/// This header contains EFI_PTAB_HEADER_ID.
35
///
36
EFI_TABLE_HEADER Header;
37
///
38
/// The LBA that contains this data structure.
39
///
40
EFI_LBA MyLBA;
41
///
42
/// LBA address of the alternate GUID Partition Table Header.
43
///
44
EFI_LBA AlternateLBA;
45
///
46
/// The first usable logical block that may be used
47
/// by a partition described by a GUID Partition Entry.
48
///
49
EFI_LBA FirstUsableLBA;
50
///
51
/// The last usable logical block that may be used
52
/// by a partition described by a GUID Partition Entry.
53
///
54
EFI_LBA LastUsableLBA;
55
///
56
/// GUID that can be used to uniquely identify the disk.
57
///
58
EFI_GUID DiskGUID;
59
///
60
/// The starting LBA of the GUID Partition Entry array.
61
///
62
EFI_LBA PartitionEntryLBA;
63
///
64
/// The number of Partition Entries in the GUID Partition Entry array.
65
///
66
UINT32 NumberOfPartitionEntries;
67
///
68
/// The size, in bytes, of each the GUID Partition
69
/// Entry structures in the GUID Partition Entry
70
/// array. This field shall be set to a value of 128 x 2^n where n is
71
/// an integer greater than or equal to zero (e.g., 128, 256, 512, etc.).
72
///
73
UINT32 SizeOfPartitionEntry;
74
///
75
/// The CRC32 of the GUID Partition Entry array.
76
/// Starts at PartitionEntryLBA and is
77
/// computed over a byte length of
78
/// NumberOfPartitionEntries * SizeOfPartitionEntry.
79
///
80
UINT32 PartitionEntryArrayCRC32;
81
} EFI_PARTITION_TABLE_HEADER;
82
83
///
84
/// GPT Partition Entry.
85
///
86
typedef struct {
87
///
88
/// Unique ID that defines the purpose and type of this Partition. A value of
89
/// zero defines that this partition entry is not being used.
90
///
91
EFI_GUID PartitionTypeGUID;
92
///
93
/// GUID that is unique for every partition entry. Every partition ever
94
/// created will have a unique GUID.
95
/// This GUID must be assigned when the GUID Partition Entry is created.
96
///
97
EFI_GUID UniquePartitionGUID;
98
///
99
/// Starting LBA of the partition defined by this entry
100
///
101
EFI_LBA StartingLBA;
102
///
103
/// Ending LBA of the partition defined by this entry.
104
///
105
EFI_LBA EndingLBA;
106
///
107
/// Attribute bits, all bits reserved by UEFI
108
/// Bit 0: If this bit is set, the partition is required for the platform to function. The owner/creator of the
109
/// partition indicates that deletion or modification of the contents can result in loss of platform
110
/// features or failure for the platform to boot or operate. The system cannot function normally if
111
/// this partition is removed, and it should be considered part of the hardware of the system.
112
/// Actions such as running diagnostics, system recovery, or even OS install or boot, could
113
/// potentially stop working if this partition is removed. Unless OS software or firmware
114
/// recognizes this partition, it should never be removed or modified as the UEFI firmware or
115
/// platform hardware may become non-functional.
116
/// Bit 1: If this bit is set, then firmware must not produce an EFI_BLOCK_IO_PROTOCOL device for
117
/// this partition. By not producing an EFI_BLOCK_IO_PROTOCOL partition, file system
118
/// mappings will not be created for this partition in UEFI.
119
/// Bit 2: This bit is set aside to let systems with traditional PC-AT BIOS firmware implementations
120
/// inform certain limited, special-purpose software running on these systems that a GPT
121
/// partition may be bootable. The UEFI boot manager must ignore this bit when selecting
122
/// a UEFI-compliant application, e.g., an OS loader.
123
/// Bits 3-47: Undefined and must be zero. Reserved for expansion by future versions of the UEFI
124
/// specification.
125
/// Bits 48-63: Reserved for GUID specific use. The use of these bits will vary depending on the
126
/// PartitionTypeGUID. Only the owner of the PartitionTypeGUID is allowed
127
/// to modify these bits. They must be preserved if Bits 0-47 are modified..
128
///
129
UINT64 Attributes;
130
///
131
/// Null-terminated name of the partition.
132
///
133
CHAR16 PartitionName[36];
134
} EFI_PARTITION_ENTRY;
135
136
#pragma pack()
137
#endif
138
139