summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-04-25 17:58:11 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-05-07 08:15:42 -0700
commitdde7e4c51831d542a52f166fa3fa2634b5b9b615 (patch)
tree6a24fa91011ac04b92cb58ca1bd38a6fc012d589
parentad1a123984414144d977c547b92de57b9e2b791b (diff)
downloadvboot-dde7e4c51831d542a52f166fa3fa2634b5b9b615.tar.gz
vboot: relocate GBB flag definitions to 2gbb_flags.h
vb2_gbb_header should NOT be in the public API, but GBB flag definitions themselves SHOULD be. BUG=b:124141368, chromium:956474 TEST=make clean && make runtests BRANCH=none Change-Id: I9b9cb1bc67c31c3a29b7a237d90a11aba55f131e Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1583821 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--firmware/2lib/include/2api.h1
-rw-r--r--firmware/2lib/include/2gbb_flags.h87
-rw-r--r--firmware/2lib/include/2struct.h80
3 files changed, 92 insertions, 76 deletions
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 68fb12bd..26417c59 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -25,6 +25,7 @@
#include "2constants.h"
#include "2crypto.h"
#include "2fw_hash_tags.h"
+#include "2gbb_flags.h"
#include "2id.h"
#include "2recovery_reasons.h"
#include "2return_codes.h"
diff --git a/firmware/2lib/include/2gbb_flags.h b/firmware/2lib/include/2gbb_flags.h
new file mode 100644
index 00000000..6749aa3f
--- /dev/null
+++ b/firmware/2lib/include/2gbb_flags.h
@@ -0,0 +1,87 @@
+/* Copyright 2019 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.
+ *
+ * Flags for vb2_gbb_header.flags.
+ *
+ * Should be imported externally via vb2_api.h.
+ */
+
+#ifndef VBOOT_2_GBB_FLAGS_H_
+#define VBOOT_2_GBB_FLAGS_H_
+
+enum vb2_gbb_flag {
+ /*
+ * Reduce the dev screen delay to 2 sec from 30 sec to speed up
+ * factory.
+ */
+ VB2_GBB_FLAG_DEV_SCREEN_SHORT_DELAY = 1 << 0,
+
+ /*
+ * BIOS should load option ROMs from arbitrary PCI devices. We'll never
+ * enable this ourselves because it executes non-verified code, but if
+ * a customer wants to void their warranty and set this flag in the
+ * read-only flash, they should be able to do so.
+ *
+ * (TODO: Currently not supported. Mark as deprecated/unused?)
+ */
+ VB2_GBB_FLAG_LOAD_OPTION_ROMS = 1 << 1,
+
+ /*
+ * The factory flow may need the BIOS to boot a non-ChromeOS kernel if
+ * the dev-switch is on. This flag allows that.
+ *
+ * (TODO: Currently not supported. Mark as deprecated/unused?)
+ */
+ VB2_GBB_FLAG_ENABLE_ALTERNATE_OS = 1 << 2,
+
+ /*
+ * Force dev switch on, regardless of physical/keyboard dev switch
+ * position.
+ */
+ VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON = 1 << 3,
+
+ /* Allow booting from USB in dev mode even if dev_boot_usb=0. */
+ VB2_GBB_FLAG_FORCE_DEV_BOOT_USB = 1 << 4,
+
+ /* Disable firmware rollback protection. */
+ VB2_GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK = 1 << 5,
+
+ /* Allow Enter key to trigger dev->tonorm screen transition */
+ VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM = 1 << 6,
+
+ /* Allow booting Legacy OSes in dev mode even if dev_boot_legacy=0. */
+ VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY = 1 << 7,
+
+ /* Allow booting using alternate keys for FAFT servo testing */
+ VB2_GBB_FLAG_FAFT_KEY_OVERIDE = 1 << 8,
+
+ /* Disable EC software sync */
+ VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC = 1 << 9,
+
+ /* Default to booting legacy OS when dev screen times out */
+ VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY = 1 << 10,
+
+ /* Disable PD software sync */
+ VB2_GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC = 1 << 11,
+
+ /* Disable shutdown on lid closed */
+ VB2_GBB_FLAG_DISABLE_LID_SHUTDOWN = 1 << 12,
+
+ /*
+ * Allow full fastboot capability in firmware even if
+ * dev_boot_fastboot_full_cap=0.
+ */
+ VB2_GBB_FLAG_FORCE_DEV_BOOT_FASTBOOT_FULL_CAP = 1 << 13,
+
+ /* Recovery mode always assumes manual recovery, even if EC_IN_RW=1 */
+ VB2_GBB_FLAG_FORCE_MANUAL_RECOVERY = 1 << 14,
+
+ /* Disable FWMP */
+ VB2_GBB_FLAG_DISABLE_FWMP = 1 << 15,
+
+ /* Enable USB Device Controller */
+ VB2_GBB_FLAG_ENABLE_UDC = 1 << 16,
+};
+
+#endif /* VBOOT_2_GBB_FLAGS_H_ */
diff --git a/firmware/2lib/include/2struct.h b/firmware/2lib/include/2struct.h
index adff0d7b..a1f11a18 100644
--- a/firmware/2lib/include/2struct.h
+++ b/firmware/2lib/include/2struct.h
@@ -10,6 +10,7 @@
#define VBOOT_REFERENCE_VBOOT_2STRUCT_H_
#include <stdint.h>
#include "2crypto.h"
+#include "2gbb_flags.h"
/*
* Key block flags.
@@ -247,88 +248,15 @@ struct vb2_shared_data {
#define VB2_GBB_MINOR_VER 2
/* v1.2 - added fields for sha256 digest of the HWID */
-/* Flags for vb2_gbb_header.flags */
-enum vb2_gbb_flag {
- /*
- * Reduce the dev screen delay to 2 sec from 30 sec to speed up
- * factory.
- */
- VB2_GBB_FLAG_DEV_SCREEN_SHORT_DELAY = (1 << 0),
-
- /*
- * BIOS should load option ROMs from arbitrary PCI devices. We'll never
- * enable this ourselves because it executes non-verified code, but if
- * a customer wants to void their warranty and set this flag in the
- * read-only flash, they should be able to do so.
- *
- * (TODO: Currently not supported. Mark as deprecated/unused?)
- */
- VB2_GBB_FLAG_LOAD_OPTION_ROMS = (1 << 1),
-
- /*
- * The factory flow may need the BIOS to boot a non-ChromeOS kernel if
- * the dev-switch is on. This flag allows that.
- *
- * (TODO: Currently not supported. Mark as deprecated/unused?)
- */
- VB2_GBB_FLAG_ENABLE_ALTERNATE_OS = (1 << 2),
-
- /*
- * Force dev switch on, regardless of physical/keyboard dev switch
- * position.
- */
- VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON = (1 << 3),
-
- /* Allow booting from USB in dev mode even if dev_boot_usb=0. */
- VB2_GBB_FLAG_FORCE_DEV_BOOT_USB = (1 << 4),
-
- /* Disable firmware rollback protection. */
- VB2_GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK = (1 << 5),
-
- /* Allow Enter key to trigger dev->tonorm screen transition */
- VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM = (1 << 6),
-
- /* Allow booting Legacy OSes in dev mode even if dev_boot_legacy=0. */
- VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY = (1 << 7),
-
- /* Allow booting using alternate keys for FAFT servo testing */
- VB2_GBB_FLAG_FAFT_KEY_OVERIDE = (1 << 8),
-
- /* Disable EC software sync */
- VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC = (1 << 9),
-
- /* Default to booting legacy OS when dev screen times out */
- VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY = (1 << 10),
-
- /* Disable PD software sync */
- VB2_GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC = (1 << 11),
-
- /* Disable shutdown on lid closed */
- VB2_GBB_FLAG_DISABLE_LID_SHUTDOWN = (1 << 12),
-
- /*
- * Allow full fastboot capability in firmware even if
- * dev_boot_fastboot_full_cap=0.
- */
- VB2_GBB_FLAG_FORCE_DEV_BOOT_FASTBOOT_FULL_CAP = (1 << 13),
-
- /* Recovery mode always assumes manual recovery, even if EC_IN_RW=1 */
- VB2_GBB_FLAG_FORCE_MANUAL_RECOVERY = (1 << 14),
-
- /* Disable FWMP */
- VB2_GBB_FLAG_DISABLE_FWMP = (1 << 15),
-
- /* Enable USB Device Controller */
- VB2_GBB_FLAG_ENABLE_UDC = (1 << 16),
-};
-
struct vb2_gbb_header {
/* Fields present in version 1.1 */
uint8_t signature[VB2_GBB_SIGNATURE_SIZE]; /* VB2_GBB_SIGNATURE */
uint16_t major_version; /* See VB2_GBB_MAJOR_VER */
uint16_t minor_version; /* See VB2_GBB_MINOR_VER */
uint32_t header_size; /* Size of GBB header in bytes */
- uint32_t flags; /* Flags (see enum vb2_gbb_flag) */
+
+ /* Flags (see enum vb2_gbb_flag in 2gbb_flags.h) */
+ uint32_t flags;
/* Offsets (from start of header) and sizes (in bytes) of components */
uint32_t hwid_offset; /* HWID */