summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2020-01-21 11:05:18 +0800
committerCommit Bot <commit-bot@chromium.org>2020-01-22 23:24:08 +0000
commit2efe82cbadaea5c5583da6ff775400171e99387b (patch)
treefa0a24252edb2099bad9420ca6670c891ec0aeac
parente22ceb974fc551e41ca588c2b524a0a91fbe5d5a (diff)
downloadvboot-2efe82cbadaea5c5583da6ff775400171e99387b.tar.gz
vboot: convert several vboot1 flags to vboot2
Use vboot2 flag as source of truth for NVDATA_V2, DEV_MODE_ENABLED, and NOFAIL_BOOT. Mark vboot1 flags LF_DEV_SWITCH_ON and NOFAIL_BOOT as deprecated. Fix up spacing of vboot1 flags in vboot_struct.h. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I6af8cd97ade8284e198f966d1b86f57101fcd070 Cq-Depend: chromium:2011415 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2011416 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
-rw-r--r--firmware/include/vboot_struct.h14
-rw-r--r--firmware/lib/vboot_api_kernel.c14
-rw-r--r--firmware/lib/vboot_kernel.c2
3 files changed, 14 insertions, 16 deletions
diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h
index 6334b99b..5d76ece7 100644
--- a/firmware/include/vboot_struct.h
+++ b/firmware/include/vboot_struct.h
@@ -48,8 +48,9 @@ extern "C" {
* kernel keyblock.
*/
#define VBSD_KERNEL_KEY_VERIFIED 0x00000002
-/* LoadFirmware() was told the developer switch was on */
-#define VBSD_LF_DEV_SWITCH_ON 0x00000004
+/* LoadFirmware() was told the developer switch was on;
+ Deprecated as part of chromium:1038260 */
+#define VBSD_DEPRECATED_LF_DEV_SWITCH_ON 0x00000004
/*
* LoadFirmware() is requesting the read only normal/dev code path. This is
* deprecated and unsupported by current firmware.
@@ -74,7 +75,7 @@ extern "C" {
#define VBSD_EC_SOFTWARE_SYNC 0x00000800
/* VbInit() was told that the EC firmware is slow to update
Deprecated as part of chromium:1038259 */
-#define VBSD_DEPRECATED_EC_SLOW_UPDATE 0x00001000
+#define VBSD_DEPRECATED_EC_SLOW_UPDATE 0x00001000
/* Firmware software write protect was enabled at boot time.
Crossystem support deprecated as part of CL:575389. */
#define VBSD_DEPRECATED_BOOT_FIRMWARE_SW_WP_ENABLED 0x00002000
@@ -88,11 +89,12 @@ extern "C" {
/* Firmware has loaded the VGA Option ROM;
Deprecated as part of chromium:948529 */
#define VBSD_DEPRECATED_OPROM_LOADED 0x00020000
-/* Don't try for boot failures */
-#define VBSD_NOFAIL_BOOT 0x00040000
+/* Don't try for boot failures;
+ * Deprecated as part of chromium:1038260 */
+#define VBSD_DEPRECATED_NOFAIL_BOOT 0x00040000
/* VbInit() was told that the EC firmware supports EFS
Deprecated as part of chromium:1038259 */
-#define VBSD_DEPRECATED_EC_EFS 0x00080000
+#define VBSD_DEPRECATED_EC_EFS 0x00080000
/* NvStorage uses 64-byte record, not 16-byte */
#define VBSD_NVDATA_V2 0x00100000
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index ef9cd4d9..24b63c43 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -236,17 +236,13 @@ static vb2_error_t vb2_kernel_setup(struct vb2_context *ctx,
if (sd->flags & VB2_SD_FLAG_DEV_MODE_ENABLED)
ctx->flags |= VB2_CONTEXT_DEVELOPER_MODE;
- /*
- * The following flags are set by depthcharge.
- *
- * TODO: Some of these are set at compile-time, so could be #defines
- * instead of flags. That would save on firmware image size because
- * features that won't be used in an image could be compiled out.
- */
+ /* Translate vboot2 flags and fields into vboot1. */
if (ctx->flags & VB2_CONTEXT_EC_SYNC_SUPPORTED)
shared->flags |= VBSD_EC_SOFTWARE_SYNC;
- if (shared->flags & VBSD_NVDATA_V2)
- ctx->flags |= VB2_CONTEXT_NVDATA_V2;
+ if (ctx->flags & VB2_CONTEXT_NVDATA_V2)
+ shared->flags |= VBSD_NVDATA_V2;
+ if (sd->flags & VB2_SD_FLAG_DEV_MODE_ENABLED)
+ shared->flags |= VBSD_BOOT_DEV_SWITCH_ON;
/* Translate recovery reason-related fields into vboot1 */
shared->recovery_reason = sd->recovery_reason;
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 7821c418..72ea0ebc 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -603,7 +603,7 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
* But not when we assume that the boot process may
* not complete for valid reasons (eg. early shutdown).
*/
- if (!(shared->flags & VBSD_NOFAIL_BOOT))
+ if (!(ctx->flags & VB2_CONTEXT_NOFAIL_BOOT))
GptUpdateKernelEntry(&gpt, GPT_UPDATE_ENTRY_TRY);
/*