diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-03-29 11:09:30 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-02 14:12:52 -0700 |
commit | 0c3ba249abb1dc60f5ebabccf84ff13206440b83 (patch) | |
tree | 81cd2ada3845b8bb4b83fde6e27050483d5b941e /firmware/lib/cgptlib | |
parent | 28b65ca99f4042fcc1218a4c18297f7ffb32ea15 (diff) | |
download | vboot-0c3ba249abb1dc60f5ebabccf84ff13206440b83.tar.gz |
Massive refactoring of external header files.
This reduces the number of exported header files to the minimum needed by
the existing userspace utilities and firmware implementations.
BUG=chromium:221544
BRANCH=none
TEST=manual, trybots
CQ-DEPEND=CL:47019,CL:47022,CL:47023
sudo FEATURES=test emerge vboot_reference
FEATURES=test emerge-$BOARD \
vboot_reference \
chromeos-cryptohome \
chromeos-installer \
chromeos-u-boot \
peach-u-boot \
depthcharge
Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware/lib/cgptlib')
-rw-r--r-- | firmware/lib/cgptlib/cgptlib.c | 2 | ||||
-rw-r--r-- | firmware/lib/cgptlib/cgptlib_internal.c | 2 | ||||
-rw-r--r-- | firmware/lib/cgptlib/crc32.c | 2 | ||||
-rw-r--r-- | firmware/lib/cgptlib/include/gpt.h | 115 |
4 files changed, 6 insertions, 115 deletions
diff --git a/firmware/lib/cgptlib/cgptlib.c b/firmware/lib/cgptlib/cgptlib.c index 370530f1..6fc29f62 100644 --- a/firmware/lib/cgptlib/cgptlib.c +++ b/firmware/lib/cgptlib/cgptlib.c @@ -3,6 +3,8 @@ * found in the LICENSE file. */ +#include "sysincludes.h" + #include "cgptlib.h" #include "cgptlib_internal.h" #include "crc32.h" diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c index d51ce33b..c87f981c 100644 --- a/firmware/lib/cgptlib/cgptlib_internal.c +++ b/firmware/lib/cgptlib/cgptlib_internal.c @@ -3,6 +3,8 @@ * found in the LICENSE file. */ +#include "sysincludes.h" + #include "cgptlib.h" #include "cgptlib_internal.h" #include "crc32.h" diff --git a/firmware/lib/cgptlib/crc32.c b/firmware/lib/cgptlib/crc32.c index 002c5b9a..286cfa09 100644 --- a/firmware/lib/cgptlib/crc32.c +++ b/firmware/lib/cgptlib/crc32.c @@ -39,6 +39,8 @@ /* polynomial $edb88320 */ /* */ /* -------------------------------------------------------------------- */ +#include "sysincludes.h" + #include "crc32.h" static uint32_t crc32_tab[] = { diff --git a/firmware/lib/cgptlib/include/gpt.h b/firmware/lib/cgptlib/include/gpt.h deleted file mode 100644 index 0418655b..00000000 --- a/firmware/lib/cgptlib/include/gpt.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Defines EFI related structure. See more details in EFI 2.3 spec. - * - * To download EFI standard, please visit UEFI homepage: - * http://www.uefi.org/ - */ -#ifndef VBOOT_REFERENCE_CGPTLIB_GPT_H_ -#define VBOOT_REFERENCE_CGPTLIB_GPT_H_ - -#include "sysincludes.h" - -#define GPT_HEADER_SIGNATURE "EFI PART" -#define GPT_HEADER_SIGNATURE2 "CHROMEOS" -#define GPT_HEADER_SIGNATURE_SIZE sizeof(GPT_HEADER_SIGNATURE) -#define GPT_HEADER_REVISION 0x00010000 - -/* - * The first 3 numbers should be stored in network-endian format according to - * the GUID RFC. The UEFI spec appendix A claims they should be stored in - * little-endian format. But they need to be _displayed_ in network-endian - * format, which is also how they're documented in the specs. - * - * Since what we have here are little-endian constants, they're byte-swapped - * from the normal display order. - */ -#define GPT_ENT_TYPE_UNUSED \ - {{{0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}}} -#define GPT_ENT_TYPE_EFI \ - {{{0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}}} -#define GPT_ENT_TYPE_CHROMEOS_FIRMWARE \ - {{{0xcab6e88e,0xabf3,0x4102,0xa0,0x7a,{0xd4,0xbb,0x9b,0xe3,0xc1,0xd3}}}} -#define GPT_ENT_TYPE_CHROMEOS_KERNEL \ - {{{0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}}}} -#define GPT_ENT_TYPE_CHROMEOS_ROOTFS \ - {{{0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}}}} -#define GPT_ENT_TYPE_CHROMEOS_RESERVED \ - {{{0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}}}} -#define GPT_ENT_TYPE_LINUX_DATA \ - {{{0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}}}} - -#define UUID_NODE_LEN 6 -#define GUID_SIZE 16 - -/* GUID definition. Defined in appendix A of EFI standard. */ -typedef struct { - union { - struct { - uint32_t time_low; - uint16_t time_mid; - uint16_t time_high_and_version; - uint8_t clock_seq_high_and_reserved; - uint8_t clock_seq_low; - uint8_t node[UUID_NODE_LEN]; - } Uuid; - uint8_t raw[GUID_SIZE]; - } u; -} __attribute__((packed)) Guid; - -#define GUID_EXPECTED_SIZE GUID_SIZE - -/* - * GPT header defines how many partitions exist on a drive and sectors managed. - * For every drive device, there are 2 headers, primary and secondary. Most of - * fields are duplicated except my_lba and entries_lba. - * - * You may find more details in chapter 5 of EFI standard. - */ -typedef struct { - char signature[8]; - uint32_t revision; - uint32_t size; - uint32_t header_crc32; - uint32_t reserved_zero; - uint64_t my_lba; - uint64_t alternate_lba; - uint64_t first_usable_lba; - uint64_t last_usable_lba; - Guid disk_uuid; - uint64_t entries_lba; - uint32_t number_of_entries; - uint32_t size_of_entry; - uint32_t entries_crc32; - /* Remainder of sector is reserved and should be 0 */ -} __attribute__((packed)) GptHeader; - -#define GPTHEADER_EXPECTED_SIZE 92 - -/* - * GPT partition entry defines the starting and ending LBAs of a partition. It - * also contains the unique GUID, type, and attribute bits. - * - * You may find more details in chapter 5 of EFI standard. - */ -typedef struct { - Guid type; - Guid unique; - uint64_t starting_lba; - uint64_t ending_lba; - union { - struct { - uint16_t reserved[3]; - uint16_t gpt_att; - } __attribute__((packed)) fields; - uint64_t whole; - } attrs; - uint16_t name[36]; /* UTF-16 encoded partition name */ - /* Remainder of entry is reserved and should be 0 */ -} __attribute__((packed)) GptEntry; - -#define GPTENTRY_EXPECTED_SIZE 128 - -#endif /* VBOOT_REFERENCE_CGPTLIB_GPT_H_ */ |