Jonathan Zhang | 6d27778 | 2020-06-09 17:56:53 -0700 | [diff] [blame] | 1 | /** @file |
| 2 | Legacy Master Boot Record Format Definition. |
| 3 | |
| 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> |
| 5 | SPDX-License-Identifier: BSD-2-Clause-Patent |
| 6 | |
| 7 | **/ |
| 8 | |
| 9 | #ifndef _MBR_H_ |
| 10 | #define _MBR_H_ |
| 11 | |
| 12 | #define MBR_SIGNATURE 0xaa55 |
| 13 | |
| 14 | #define EXTENDED_DOS_PARTITION 0x05 |
| 15 | #define EXTENDED_WINDOWS_PARTITION 0x0F |
| 16 | |
| 17 | #define MAX_MBR_PARTITIONS 4 |
| 18 | |
| 19 | #define PMBR_GPT_PARTITION 0xEE |
| 20 | #define EFI_PARTITION 0xEF |
| 21 | |
| 22 | #define MBR_SIZE 512 |
| 23 | |
| 24 | #pragma pack(1) |
| 25 | /// |
| 26 | /// MBR Partition Entry |
| 27 | /// |
| 28 | typedef struct { |
| 29 | UINT8 BootIndicator; |
| 30 | UINT8 StartHead; |
| 31 | UINT8 StartSector; |
| 32 | UINT8 StartTrack; |
| 33 | UINT8 OSIndicator; |
| 34 | UINT8 EndHead; |
| 35 | UINT8 EndSector; |
| 36 | UINT8 EndTrack; |
| 37 | UINT8 StartingLBA[4]; |
| 38 | UINT8 SizeInLBA[4]; |
| 39 | } MBR_PARTITION_RECORD; |
| 40 | |
| 41 | /// |
| 42 | /// MBR Partition Table |
| 43 | /// |
| 44 | typedef struct { |
| 45 | UINT8 BootStrapCode[440]; |
| 46 | UINT8 UniqueMbrSignature[4]; |
| 47 | UINT8 Unknown[2]; |
| 48 | MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS]; |
| 49 | UINT16 Signature; |
| 50 | } MASTER_BOOT_RECORD; |
| 51 | |
| 52 | #pragma pack() |
| 53 | |
| 54 | #endif |