| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Defines EFI related structure. See more details in EFI 2.3 spec. | 5 * Defines EFI related structure. See more details in EFI 2.3 spec. |
| 6 * | 6 * |
| 7 * To download EFI standard, please visit UEFI homepage: | 7 * To download EFI standard, please visit UEFI homepage: |
| 8 * http://www.uefi.org/ | 8 * http://www.uefi.org/ |
| 9 */ | 9 */ |
| 10 #ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_ | 10 #ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_ |
| 11 #define VBOOT_REFERENCE_CGPTLIB_GPT_H_ | 11 #define VBOOT_REFERENCE_CGPTLIB_GPT_H_ |
| 12 | 12 |
| 13 #include <stdint.h> | 13 #include <stdint.h> |
| 14 | 14 |
| 15 #define GPT_HEADER_SIGNATURE "EFI PART" | 15 #define GPT_HEADER_SIGNATURE "EFI PART" |
| 16 #define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE) | 16 #define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE) |
| 17 #define GPT_HEADER_REVISION 0x00010000 | 17 #define GPT_HEADER_REVISION 0x00010000 |
| 18 | 18 |
| 19 #define GPT_ENT_TYPE_EFI \ | 19 /* The first 3 numbers should be stored in network-endian format |
| 20 {{{0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}}} | 20 * according to the GUID RFC. The UEFI spec appendix A claims they |
| 21 * should be stored in little-endian format. But they need to be |
| 22 * _displayed_ in network-endian format, which is also how they're |
| 23 * documented in the specs. |
| 24 * |
| 25 * Since what we have here are little-endian constants, they're |
| 26 * byte-swapped from the normal display order. */ |
| 21 #define GPT_ENT_TYPE_UNUSED \ | 27 #define GPT_ENT_TYPE_UNUSED \ |
| 22 {{{0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}}} | 28 {{{0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}}} |
| 29 /* Hey, that one's right regardless of endianness... */ |
| 30 |
| 31 #define GPT_ENT_TYPE_EFI \ |
| 32 {{{0x28732ac1,0x1ff8,0xd211,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}}} |
| 33 /* c12a7328-f81f-11d2-ba4b-00a0c93ec93b */ |
| 34 |
| 23 #define GPT_ENT_TYPE_CHROMEOS_KERNEL \ | 35 #define GPT_ENT_TYPE_CHROMEOS_KERNEL \ |
| 24 {{{0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}}}} | 36 {{{0x5d2a3afe,0x324f,0xa741,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}}}} |
| 37 /* FE3A2A5D-4F32-41A7-B725-ACCC3285A309 */ |
| 38 |
| 25 #define GPT_ENT_TYPE_CHROMEOS_ROOTFS \ | 39 #define GPT_ENT_TYPE_CHROMEOS_ROOTFS \ |
| 26 {{{0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}}}} | 40 {{{0x02e2b83c,0x7e3b,0xdd47,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}}}} |
| 41 /* 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC */ |
| 42 |
| 27 #define GPT_ENT_TYPE_CHROMEOS_RESERVED \ | 43 #define GPT_ENT_TYPE_CHROMEOS_RESERVED \ |
| 28 {{{0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}}}} | 44 {{{0x3d750a2e,0x489e,0xb043,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}}}} |
| 45 /* 2e0a753d-9e48-43b0-8337-b15192cb1b5e */ |
| 29 | 46 |
| 30 #define UUID_NODE_LEN 6 | 47 #define UUID_NODE_LEN 6 |
| 31 #define GUID_SIZE 16 | 48 #define GUID_SIZE 16 |
| 32 | 49 |
| 33 /* GUID definition. | 50 /* GUID definition. |
| 34 * Defined in appendix A of EFI standard. | 51 * Defined in appendix A of EFI standard. |
| 35 */ | 52 */ |
| 36 typedef struct { | 53 typedef struct { |
| 37 union { | 54 union { |
| 38 struct { | 55 struct { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 62 uint64_t my_lba; | 79 uint64_t my_lba; |
| 63 uint64_t alternate_lba; | 80 uint64_t alternate_lba; |
| 64 uint64_t first_usable_lba; | 81 uint64_t first_usable_lba; |
| 65 uint64_t last_usable_lba; | 82 uint64_t last_usable_lba; |
| 66 Guid disk_uuid; | 83 Guid disk_uuid; |
| 67 | 84 |
| 68 uint64_t entries_lba; | 85 uint64_t entries_lba; |
| 69 uint32_t number_of_entries; | 86 uint32_t number_of_entries; |
| 70 uint32_t size_of_entry; | 87 uint32_t size_of_entry; |
| 71 uint32_t entries_crc32; | 88 uint32_t entries_crc32; |
| 72 uint32_t padding; /* since header size must be a multiple of 8, pad here. */ | 89 uint8_t padding[512 - 92]; /* Pad to end of sector */ |
| 73 } GptHeader; | 90 } GptHeader; |
| 74 | 91 |
| 75 /* GPT partition entry defines the starting and ending LBAs of a partition. | 92 /* GPT partition entry defines the starting and ending LBAs of a partition. |
| 76 * It also contains the unique GUID, type, and attribute bits. | 93 * It also contains the unique GUID, type, and attribute bits. |
| 77 * | 94 * |
| 78 * You may find more details in chapter 5 of EFI standard. | 95 * You may find more details in chapter 5 of EFI standard. |
| 79 */ | 96 */ |
| 80 typedef struct { | 97 typedef struct { |
| 81 Guid type; | 98 Guid type; |
| 82 Guid unique; | 99 Guid unique; |
| 83 uint64_t starting_lba; | 100 uint64_t starting_lba; |
| 84 uint64_t ending_lba; | 101 uint64_t ending_lba; |
| 85 uint64_t attributes; | 102 uint64_t attributes; |
| 86 uint16_t name[36]; /* UTF-16 encoded partition name */ | 103 uint16_t name[36]; /* UTF-16 encoded partition name */ |
| 87 } GptEntry; | 104 } GptEntry; |
| 88 | 105 |
| 89 #endif /* VBOOT_REFERENCE_CGPTLIB_GPT_H_ */ | 106 #endif /* VBOOT_REFERENCE_CGPTLIB_GPT_H_ */ |
| OLD | NEW |