summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_ui_menu.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-05-21 12:20:38 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-05-28 21:10:45 -0700
commitde2cae6b4d6ae864f2c90e6be73f683bad5f2f2f (patch)
tree023d1581f9054c6a54b9631be45f5277b721a23c /firmware/lib/vboot_ui_menu.c
parent236bfb0bc3bd0aa37bd06702c25993446f9b6dba (diff)
downloadvboot-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_menu.c')
-rw-r--r--firmware/lib/vboot_ui_menu.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c
index 42494772..3fdf77cb 100644
--- a/firmware/lib/vboot_ui_menu.c
+++ b/firmware/lib/vboot_ui_menu.c
@@ -45,11 +45,11 @@ static const char no_legacy[] = "Legacy boot failed. Missing BIOS?\n";
*/
static int VbWantShutdownMenu(struct vb2_context *ctx)
{
- struct vb2_shared_data *sd = vb2_get_sd(ctx);
+ struct vb2_gbb_header *gbb = vb2_get_gbb(ctx);
uint32_t shutdown_request = VbExIsShutdownRequested();
/* 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;
/*
@@ -181,7 +181,7 @@ static VbError_t boot_usb_action(struct vb2_context *ctx)
}
if (!vb2_nv_get(ctx, VB2_NV_DEV_BOOT_USB) &&
- !(vb2_get_sd(ctx)->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_USB) &&
+ !(vb2_get_gbb(ctx)->flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_USB) &&
!(vb2_get_fwmp_flags() & FWMP_DEV_ENABLE_USB)) {
vb2_flash_screen(ctx);
vb2_error_notify("WARNING: Booting from external media "
@@ -377,7 +377,7 @@ static VbError_t to_dev_action(struct vb2_context *ctx)
/* Action that disables developer mode, shows TO_NORM_CONFIRMED and reboots. */
static VbError_t to_norm_action(struct vb2_context *ctx)
{
- if (vb2_get_sd(ctx)->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) {
+ if (vb2_get_gbb(ctx)->flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) {
vb2_flash_screen(ctx);
vb2_error_notify("WARNING: TONORM prohibited by "
"GBB FORCE_DEV_SWITCH_ON.\n", NULL,
@@ -741,18 +741,18 @@ static VbError_t vb2_init_menus(struct vb2_context *ctx)
*/
static VbError_t vb2_developer_menu(struct vb2_context *ctx)
{
- struct vb2_shared_data *sd = vb2_get_sd(ctx);
+ struct vb2_gbb_header *gbb = vb2_get_gbb(ctx);
VbError_t ret;
/* Check if the default is to boot using disk, usb, or legacy */
default_boot = vb2_nv_get(ctx, VB2_NV_DEV_DEFAULT_BOOT);
- if (sd->gbb_flags & VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY)
+ if (gbb->flags & VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY)
default_boot = VB2_DEV_DEFAULT_BOOT_LEGACY;
/* Check if developer mode is disabled by FWMP */
disable_dev_boot = 0;
if (vb2_get_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 {
@@ -762,7 +762,7 @@ static VbError_t vb2_developer_menu(struct vb2_context *ctx)
}
}
altfw_allowed = vb2_nv_get(ctx, VB2_NV_DEV_BOOT_LEGACY) ||
- (vb2_get_sd(ctx)->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY) ||
+ (gbb->flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY) ||
(vb2_get_fwmp_flags() & FWMP_DEV_ENABLE_LEGACY);
/* Show appropriate initial menu */