Path: blob/main/sys/contrib/edk2/Include/Uefi/UefiGpt.h
48383 views
/** @file1EFI Guid Partition Table Format Definition.23Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>4SPDX-License-Identifier: BSD-2-Clause-Patent56**/78#ifndef __UEFI_GPT_H__9#define __UEFI_GPT_H__1011///12/// The primary GUID Partition Table Header must be13/// located in LBA 1 (i.e., the second logical block).14///15#define PRIMARY_PART_HEADER_LBA 116///17/// EFI Partition Table Signature: "EFI PART".18///19#define EFI_PTAB_HEADER_ID SIGNATURE_64 ('E','F','I',' ','P','A','R','T')20///21/// Minimum bytes reserve for EFI entry array buffer.22///23#define EFI_GPT_PART_ENTRY_MIN_SIZE 163842425#pragma pack(1)2627///28/// GPT Partition Table Header.29///30typedef struct {31///32/// The table header for the GPT partition Table.33/// This header contains EFI_PTAB_HEADER_ID.34///35EFI_TABLE_HEADER Header;36///37/// The LBA that contains this data structure.38///39EFI_LBA MyLBA;40///41/// LBA address of the alternate GUID Partition Table Header.42///43EFI_LBA AlternateLBA;44///45/// The first usable logical block that may be used46/// by a partition described by a GUID Partition Entry.47///48EFI_LBA FirstUsableLBA;49///50/// The last usable logical block that may be used51/// by a partition described by a GUID Partition Entry.52///53EFI_LBA LastUsableLBA;54///55/// GUID that can be used to uniquely identify the disk.56///57EFI_GUID DiskGUID;58///59/// The starting LBA of the GUID Partition Entry array.60///61EFI_LBA PartitionEntryLBA;62///63/// The number of Partition Entries in the GUID Partition Entry array.64///65UINT32 NumberOfPartitionEntries;66///67/// The size, in bytes, of each the GUID Partition68/// Entry structures in the GUID Partition Entry69/// array. This field shall be set to a value of 128 x 2^n where n is70/// an integer greater than or equal to zero (e.g., 128, 256, 512, etc.).71///72UINT32 SizeOfPartitionEntry;73///74/// The CRC32 of the GUID Partition Entry array.75/// Starts at PartitionEntryLBA and is76/// computed over a byte length of77/// NumberOfPartitionEntries * SizeOfPartitionEntry.78///79UINT32 PartitionEntryArrayCRC32;80} EFI_PARTITION_TABLE_HEADER;8182///83/// GPT Partition Entry.84///85typedef struct {86///87/// Unique ID that defines the purpose and type of this Partition. A value of88/// zero defines that this partition entry is not being used.89///90EFI_GUID PartitionTypeGUID;91///92/// GUID that is unique for every partition entry. Every partition ever93/// created will have a unique GUID.94/// This GUID must be assigned when the GUID Partition Entry is created.95///96EFI_GUID UniquePartitionGUID;97///98/// Starting LBA of the partition defined by this entry99///100EFI_LBA StartingLBA;101///102/// Ending LBA of the partition defined by this entry.103///104EFI_LBA EndingLBA;105///106/// Attribute bits, all bits reserved by UEFI107/// Bit 0: If this bit is set, the partition is required for the platform to function. The owner/creator of the108/// partition indicates that deletion or modification of the contents can result in loss of platform109/// features or failure for the platform to boot or operate. The system cannot function normally if110/// this partition is removed, and it should be considered part of the hardware of the system.111/// Actions such as running diagnostics, system recovery, or even OS install or boot, could112/// potentially stop working if this partition is removed. Unless OS software or firmware113/// recognizes this partition, it should never be removed or modified as the UEFI firmware or114/// platform hardware may become non-functional.115/// Bit 1: If this bit is set, then firmware must not produce an EFI_BLOCK_IO_PROTOCOL device for116/// this partition. By not producing an EFI_BLOCK_IO_PROTOCOL partition, file system117/// mappings will not be created for this partition in UEFI.118/// Bit 2: This bit is set aside to let systems with traditional PC-AT BIOS firmware implementations119/// inform certain limited, special-purpose software running on these systems that a GPT120/// partition may be bootable. The UEFI boot manager must ignore this bit when selecting121/// a UEFI-compliant application, e.g., an OS loader.122/// Bits 3-47: Undefined and must be zero. Reserved for expansion by future versions of the UEFI123/// specification.124/// Bits 48-63: Reserved for GUID specific use. The use of these bits will vary depending on the125/// PartitionTypeGUID. Only the owner of the PartitionTypeGUID is allowed126/// to modify these bits. They must be preserved if Bits 0-47 are modified..127///128UINT64 Attributes;129///130/// Null-terminated name of the partition.131///132CHAR16 PartitionName[36];133} EFI_PARTITION_ENTRY;134135#pragma pack()136#endif137138139