OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. |
| 4 * |
| 5 * Defines EFI related structure. See more details in EFI 2.3 spec. |
| 6 * |
| 7 * To download EFI standard, please visit UEFI homepage: |
| 8 * http://www.uefi.org/ |
| 9 */ |
| 10 #ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_ |
| 11 #define VBOOT_REFERENCE_CGPTLIB_GPT_H_ |
| 12 |
| 13 #include <stdint.h> |
| 14 |
| 15 #define GPT_HEADER_SIGNATURE "EFI PART" |
| 16 #define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE) |
| 17 #define GPT_HEADER_REVISION 0x00010000 |
| 18 |
| 19 #define GPT_ENT_TYPE_EFI \ |
| 20 {{Uuid: {0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}}} |
| 21 #define GPT_ENT_TYPE_UNUSED \ |
| 22 {{Uuid: {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}}} |
| 23 #define GPT_ENT_TYPE_CHROMEOS_KERNEL \ |
| 24 {{Uuid: {0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}}}} |
| 25 #define GPT_ENT_TYPE_CHROMEOS_ROOTFS \ |
| 26 {{Uuid: {0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}}}} |
| 27 #define GPT_ENT_TYPE_CHROMEOS_RESERVED \ |
| 28 {{Uuid: {0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}}}} |
| 29 |
| 30 #define UUID_NODE_LEN 6 |
| 31 #define GUID_SIZE 16 |
| 32 |
| 33 /* GUID definition. |
| 34 * Defined in appendix A of EFI standard. |
| 35 */ |
| 36 typedef struct { |
| 37 union { |
| 38 struct { |
| 39 uint32_t time_low; |
| 40 uint16_t time_mid; |
| 41 uint16_t time_high_and_version; |
| 42 uint8_t clock_seq_high_and_reserved; |
| 43 uint8_t clock_seq_low; |
| 44 uint8_t node[UUID_NODE_LEN]; |
| 45 } Uuid; |
| 46 uint8_t raw[GUID_SIZE]; |
| 47 }; |
| 48 } __attribute__((packed)) Guid; |
| 49 |
| 50 /* GPT header defines how many partitions exist on a drive and sectors managed. |
| 51 * For every drive device, there are 2 headers, primary and secondary. |
| 52 * Most of fields are duplicated except my_lba and entries_lba. |
| 53 * |
| 54 * You may find more details in chapter 5 of EFI standard. |
| 55 */ |
| 56 typedef struct { |
| 57 char signature[8]; |
| 58 uint32_t revision; |
| 59 uint32_t size; |
| 60 uint32_t header_crc32; |
| 61 uint32_t reserved; |
| 62 uint64_t my_lba; |
| 63 uint64_t alternate_lba; |
| 64 uint64_t first_usable_lba; |
| 65 uint64_t last_usable_lba; |
| 66 Guid disk_uuid; |
| 67 |
| 68 uint64_t entries_lba; |
| 69 uint32_t number_of_entries; |
| 70 uint32_t size_of_entry; |
| 71 uint32_t entries_crc32; |
| 72 uint32_t padding; /* since header size must be a multiple of 8, pad here. */ |
| 73 } GptHeader; |
| 74 |
| 75 /* GPT partition entry defines the starting and ending LBAs of a partition. |
| 76 * It also contains the unique GUID, type, and attribute bits. |
| 77 * |
| 78 * You may find more details in chapter 5 of EFI standard. |
| 79 */ |
| 80 typedef struct { |
| 81 Guid type; |
| 82 Guid unique; |
| 83 uint64_t starting_lba; |
| 84 uint64_t ending_lba; |
| 85 uint64_t attributes; |
| 86 uint16_t name[36]; /* UTF-16 encoded partition name */ |
| 87 } GptEntry; |
| 88 |
| 89 #endif /* VBOOT_REFERENCE_CGPTLIB_GPT_H_ */ |
OLD | NEW |