brintos

brintos / linux-shallow public Read only

0
0
Text · 3.6 KiB · 84b9f36 Raw
116 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/************************************************************3 * EFI GUID Partition Table4 * Per Intel EFI Specification v1.025 * http://developer.intel.com/technology/efi/efi.htm6 *7 * By Matt Domsch <Matt_Domsch@dell.com>  Fri Sep 22 22:15:56 CDT 2000  8 *   Copyright 2000,2001 Dell Inc.9 ************************************************************/10 11#ifndef FS_PART_EFI_H_INCLUDED12#define FS_PART_EFI_H_INCLUDED13 14#include <linux/types.h>15#include <linux/fs.h>16#include <linux/kernel.h>17#include <linux/major.h>18#include <linux/string.h>19#include <linux/efi.h>20#include <linux/compiler.h>21 22#define MSDOS_MBR_SIGNATURE 0xaa5523#define EFI_PMBR_OSTYPE_EFI 0xEF24#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE25 26#define GPT_MBR_PROTECTIVE  127#define GPT_MBR_HYBRID      228 29#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL30#define GPT_HEADER_REVISION_V1 0x0001000031#define GPT_PRIMARY_PARTITION_TABLE_LBA 132 33#define PARTITION_SYSTEM_GUID \34    EFI_GUID( 0xC12A7328, 0xF81F, 0x11d2, \35              0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B) 36#define LEGACY_MBR_PARTITION_GUID \37    EFI_GUID( 0x024DEE41, 0x33E7, 0x11d3, \38              0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F)39#define PARTITION_MSFT_RESERVED_GUID \40    EFI_GUID( 0xE3C9E316, 0x0B5C, 0x4DB8, \41              0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE)42#define PARTITION_BASIC_DATA_GUID \43    EFI_GUID( 0xEBD0A0A2, 0xB9E5, 0x4433, \44              0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7)45#define PARTITION_LINUX_RAID_GUID \46    EFI_GUID( 0xa19d880f, 0x05fc, 0x4d3b, \47              0xa0, 0x06, 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e)48#define PARTITION_LINUX_SWAP_GUID \49    EFI_GUID( 0x0657fd6d, 0xa4ab, 0x43c4, \50              0x84, 0xe5, 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f)51#define PARTITION_LINUX_LVM_GUID \52    EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \53              0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)54 55typedef struct _gpt_header {56	__le64 signature;57	__le32 revision;58	__le32 header_size;59	__le32 header_crc32;60	__le32 reserved1;61	__le64 my_lba;62	__le64 alternate_lba;63	__le64 first_usable_lba;64	__le64 last_usable_lba;65	efi_guid_t disk_guid;66	__le64 partition_entry_lba;67	__le32 num_partition_entries;68	__le32 sizeof_partition_entry;69	__le32 partition_entry_array_crc32;70 71	/* The rest of the logical block is reserved by UEFI and must be zero.72	 * EFI standard handles this by:73	 *74	 * uint8_t		reserved2[ BlockSize - 92 ];75	 */76} __packed gpt_header;77 78typedef struct _gpt_entry_attributes {79	u64 required_to_function:1;80	u64 reserved:47;81        u64 type_guid_specific:16;82} __packed gpt_entry_attributes;83 84typedef struct _gpt_entry {85	efi_guid_t partition_type_guid;86	efi_guid_t unique_partition_guid;87	__le64 starting_lba;88	__le64 ending_lba;89	gpt_entry_attributes attributes;90	__le16 partition_name[72/sizeof(__le16)];91} __packed gpt_entry;92 93typedef struct _gpt_mbr_record {94	u8	boot_indicator; /* unused by EFI, set to 0x80 for bootable */95	u8	start_head;     /* unused by EFI, pt start in CHS */96	u8	start_sector;   /* unused by EFI, pt start in CHS */97	u8	start_track;98	u8	os_type;        /* EFI and legacy non-EFI OS types */99	u8	end_head;       /* unused by EFI, pt end in CHS */100	u8	end_sector;     /* unused by EFI, pt end in CHS */101	u8	end_track;      /* unused by EFI, pt end in CHS */102	__le32	starting_lba;   /* used by EFI - start addr of the on disk pt */103	__le32	size_in_lba;    /* used by EFI - size of pt in LBA */104} __packed gpt_mbr_record;105 106 107typedef struct _legacy_mbr {108	u8 boot_code[440];109	__le32 unique_mbr_signature;110	__le16 unknown;111	gpt_mbr_record partition_record[4];112	__le16 signature;113} __packed legacy_mbr;114 115#endif116