2008-04-03 06:56:34 +02:00
|
|
|
/** @file
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI Guid Partition Table Format Definition.
|
|
|
|
|
2019-01-16 09:11:51 +01:00
|
|
|
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
2018-06-27 15:11:33 +02:00
|
|
|
This program and the accompanying materials are licensed and made available under
|
|
|
|
the terms and conditions of the BSD License that accompanies this distribution.
|
2010-03-12 23:19:12 +01:00
|
|
|
The full text of the license may be found at
|
2018-06-27 15:11:33 +02:00
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
2010-03-12 23:19:12 +01:00
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-06-08 13:31:52 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __UEFI_GPT_H__
|
|
|
|
#define __UEFI_GPT_H__
|
|
|
|
|
2008-10-20 17:31:22 +02:00
|
|
|
///
|
|
|
|
/// The primary GUID Partition Table Header must be
|
|
|
|
/// located in LBA 1 (i.e., the second logical block).
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
#define PRIMARY_PART_HEADER_LBA 1
|
2008-06-24 09:14:18 +02:00
|
|
|
///
|
2010-03-12 23:19:12 +01:00
|
|
|
/// EFI Partition Table Signature: "EFI PART".
|
2018-06-27 15:11:33 +02:00
|
|
|
///
|
2008-12-12 09:51:16 +01:00
|
|
|
#define EFI_PTAB_HEADER_ID SIGNATURE_64 ('E','F','I',' ','P','A','R','T')
|
2019-01-16 09:11:51 +01:00
|
|
|
///
|
|
|
|
/// Minimum bytes reserve for EFI entry array buffer.
|
|
|
|
///
|
|
|
|
#define EFI_GPT_PART_ENTRY_MIN_SIZE 16384
|
2007-06-08 13:31:52 +02:00
|
|
|
|
|
|
|
#pragma pack(1)
|
2008-06-24 09:14:18 +02:00
|
|
|
|
|
|
|
///
|
2010-03-12 23:19:12 +01:00
|
|
|
/// GPT Partition Table Header.
|
2008-06-24 09:14:18 +02:00
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
typedef struct {
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The table header for the GPT partition Table.
|
2010-03-12 23:19:12 +01:00
|
|
|
/// This header contains EFI_PTAB_HEADER_ID.
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_TABLE_HEADER Header;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The LBA that contains this data structure.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA MyLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// LBA address of the alternate GUID Partition Table Header.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA AlternateLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The first usable logical block that may be used
|
|
|
|
/// by a partition described by a GUID Partition Entry.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA FirstUsableLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The last usable logical block that may be used
|
|
|
|
/// by a partition described by a GUID Partition Entry.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA LastUsableLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// GUID that can be used to uniquely identify the disk.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_GUID DiskGUID;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The starting LBA of the GUID Partition Entry array.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA PartitionEntryLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The number of Partition Entries in the GUID Partition Entry array.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
UINT32 NumberOfPartitionEntries;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The size, in bytes, of each the GUID Partition
|
|
|
|
/// Entry structures in the GUID Partition Entry
|
2011-04-14 09:04:59 +02:00
|
|
|
/// array. This field shall be set to a value of 128 x 2^n where n is
|
|
|
|
/// an integer greater than or equal to zero (e.g., 128, 256, 512, etc.).
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
UINT32 SizeOfPartitionEntry;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// The CRC32 of the GUID Partition Entry array.
|
|
|
|
/// Starts at PartitionEntryLBA and is
|
|
|
|
/// computed over a byte length of
|
|
|
|
/// NumberOfPartitionEntries * SizeOfPartitionEntry.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
UINT32 PartitionEntryArrayCRC32;
|
|
|
|
} EFI_PARTITION_TABLE_HEADER;
|
|
|
|
|
2008-06-24 09:14:18 +02:00
|
|
|
///
|
2010-03-12 23:19:12 +01:00
|
|
|
/// GPT Partition Entry.
|
2008-06-24 09:14:18 +02:00
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
typedef struct {
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// Unique ID that defines the purpose and type of this Partition. A value of
|
|
|
|
/// zero defines that this partition entry is not being used.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_GUID PartitionTypeGUID;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// GUID that is unique for every partition entry. Every partition ever
|
|
|
|
/// created will have a unique GUID.
|
|
|
|
/// This GUID must be assigned when the GUID Partition Entry is created.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_GUID UniquePartitionGUID;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// Starting LBA of the partition defined by this entry
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA StartingLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// Ending LBA of the partition defined by this entry.
|
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
EFI_LBA EndingLBA;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
|
|
|
/// Attribute bits, all bits reserved by UEFI
|
2009-09-21 16:11:08 +02:00
|
|
|
/// Bit 0: If this bit is set, the partition is required for the platform to function. The owner/creator of the
|
|
|
|
/// partition indicates that deletion or modification of the contents can result in loss of platform
|
|
|
|
/// features or failure for the platform to boot or operate. The system cannot function normally if
|
|
|
|
/// this partition is removed, and it should be considered part of the hardware of the system.
|
2010-03-12 23:19:12 +01:00
|
|
|
/// Actions such as running diagnostics, system recovery, or even OS install or boot, could
|
2009-09-21 16:11:08 +02:00
|
|
|
/// potentially stop working if this partition is removed. Unless OS software or firmware
|
|
|
|
/// recognizes this partition, it should never be removed or modified as the UEFI firmware or
|
|
|
|
/// platform hardware may become non-functional.
|
2011-01-27 05:54:22 +01:00
|
|
|
/// Bit 1: If this bit is set, then firmware must not produce an EFI_BLOCK_IO_PROTOCOL device for
|
|
|
|
/// this partition. By not producing an EFI_BLOCK_IO_PROTOCOL partition, file system
|
2009-09-21 16:11:08 +02:00
|
|
|
/// mappings will not be created for this partition in UEFI.
|
2011-01-27 05:54:22 +01:00
|
|
|
/// Bit 2: This bit is set aside to let systems with traditional PC-AT BIOS firmware implementations
|
2018-06-27 15:11:33 +02:00
|
|
|
/// inform certain limited, special-purpose software running on these systems that a GPT
|
2011-01-27 05:54:22 +01:00
|
|
|
/// partition may be bootable. The UEFI boot manager must ignore this bit when selecting
|
|
|
|
/// a UEFI-compliant application, e.g., an OS loader.
|
|
|
|
/// Bits 3-47: Undefined and must be zero. Reserved for expansion by future versions of the UEFI
|
2009-09-21 16:11:08 +02:00
|
|
|
/// specification.
|
|
|
|
/// Bits 48-63: Reserved for GUID specific use. The use of these bits will vary depending on the
|
|
|
|
/// PartitionTypeGUID. Only the owner of the PartitionTypeGUID is allowed
|
2009-09-21 16:44:09 +02:00
|
|
|
/// to modify these bits. They must be preserved if Bits 0-47 are modified..
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
UINT64 Attributes;
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
2009-09-24 10:56:33 +02:00
|
|
|
/// Null-terminated name of the partition.
|
2008-12-10 09:22:03 +01:00
|
|
|
///
|
2007-06-08 13:31:52 +02:00
|
|
|
CHAR16 PartitionName[36];
|
|
|
|
} EFI_PARTITION_ENTRY;
|
|
|
|
|
|
|
|
#pragma pack()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|