diff options
author | Joel Kitching <kitching@google.com> | 2019-05-21 12:20:38 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-28 21:10:45 -0700 |
commit | de2cae6b4d6ae864f2c90e6be73f683bad5f2f2f (patch) | |
tree | 023d1581f9054c6a54b9631be45f5277b721a23c /firmware/lib/vboot_ui.c | |
parent | 236bfb0bc3bd0aa37bd06702c25993446f9b6dba (diff) | |
download | vboot-de2cae6b4d6ae864f2c90e6be73f683bad5f2f2f.tar.gz |
vboot: save GBB header in workbuf during firmware verification
Since GBB header will be needed for subsequent GBB reads later on
(in kernel verification stage), and since GBB header is
relatively small (128 bytes), save the full GBB header onto
workbuf during firmware verification stage, and store an offset
pointer to it in vb2_shared_data. vb2_gbb_header object may be
accessed via the vb2_get_gbb function.
Additionally, update functions in firmware/lib/region-init.c to
read GBB data from flash, rather than using cparams passed in by
depthcharge, which is slated for deprecation.
BUG=b:124141368, chromium:954774
TEST=make clean && make runtests
BRANCH=none
Change-Id: I6e6218231299ce3a5b383663bc3480b20f929840
Signed-off-by: Joel Kitching <kitching@google.com>
Cq-Depend: chromium:1585500
Reviewed-on: https://chromium-review.googlesource.com/1627430
Commit-Ready: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware/lib/vboot_ui.c')
-rw-r--r-- | firmware/lib/vboot_ui.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 14508a63..8321fbbb 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -55,7 +55,7 @@ static void VbAllowUsbBoot(struct vb2_context *ctx) */ static int VbWantShutdown(struct vb2_context *ctx, uint32_t key) { - struct vb2_shared_data *sd = vb2_get_sd(ctx); + struct vb2_gbb_header *gbb = vb2_get_gbb(ctx); uint32_t shutdown_request = VbExIsShutdownRequested(); /* @@ -78,7 +78,7 @@ static int VbWantShutdown(struct vb2_context *ctx, uint32_t key) shutdown_request |= VB_SHUTDOWN_REQUEST_POWER_BUTTON; /* If desired, ignore shutdown request due to lid closure. */ - if (sd->gbb_flags & VB2_GBB_FLAG_DISABLE_LID_SHUTDOWN) + if (gbb->flags & VB2_GBB_FLAG_DISABLE_LID_SHUTDOWN) shutdown_request &= ~VB_SHUTDOWN_REQUEST_LID_CLOSED; return shutdown_request; @@ -518,6 +518,7 @@ static const char dev_disable_msg[] = static VbError_t vb2_developer_ui(struct vb2_context *ctx) { struct vb2_shared_data *sd = vb2_get_sd(ctx); + struct vb2_gbb_header *gbb = vb2_get_gbb(ctx); VbSharedDataHeader *shared = sd->vbsd; uint32_t disable_dev_boot = 0; @@ -540,11 +541,11 @@ static VbError_t vb2_developer_ui(struct vb2_context *ctx) use_legacy = 1; /* Handle GBB flag override */ - if (sd->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_USB) + if (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_USB) allow_usb = 1; - if (sd->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY) + if (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY) allow_legacy = 1; - if (sd->gbb_flags & VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY) { + if (gbb->flags & VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY) { use_legacy = 1; use_usb = 0; } @@ -556,7 +557,7 @@ static VbError_t vb2_developer_ui(struct vb2_context *ctx) if (fwmp_flags & FWMP_DEV_ENABLE_LEGACY) allow_legacy = 1; if (fwmp_flags & FWMP_DEV_DISABLE_BOOT) { - if (sd->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) { + if (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) { VB2_DEBUG("FWMP_DEV_DISABLE_BOOT rejected by " "FORCE_DEV_SWITCH_ON\n"); } else { @@ -609,15 +610,14 @@ static VbError_t vb2_developer_ui(struct vb2_context *ctx) break; case VB_KEY_ENTER: /* Only disable virtual dev switch if allowed by GBB */ - if (!(sd->gbb_flags & - VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM)) + if (!(gbb->flags & VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM)) break; case ' ': /* See if we should disable virtual dev-mode switch. */ VB2_DEBUG("shared->flags=0x%x\n", shared->flags); if (shared->flags & VBSD_BOOT_DEV_SWITCH_ON) { /* Stop the countdown while we go ask... */ - if (sd->gbb_flags & + if (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) { /* * TONORM won't work (only for |