summaryrefslogtreecommitdiff
path: root/firmware/lib/vboot_ui.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2017-12-14 15:43:17 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-05 21:14:11 -0800
commit5142132f44bbee683c830fdb837bbedb00bad8ba (patch)
tree699df9f59656ff30f12bfacc4331d69afb9af1e1 /firmware/lib/vboot_ui.c
parent4e0939b377f65048dfc1ec8ceda6fd7c444fc8b8 (diff)
downloadvboot-5142132f44bbee683c830fdb837bbedb00bad8ba.tar.gz
firmware: use sd->gbb_flags
Vboot1 code directly referenced the GBB from cparams even though now it has access to the GBB flags via the vb2 context. Refactor all existing code to use the vb2 context, since that takes us one step closer to getting rid of the old vboot1 cparams. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: Ic4a5bf215b723a2eacbf0a4cf0eba8b1338155a2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/847310 Reviewed-by: Shelley Chen <shchen@chromium.org>
Diffstat (limited to 'firmware/lib/vboot_ui.c')
-rw-r--r--firmware/lib/vboot_ui.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
index 4d913f0e..50c27e76 100644
--- a/firmware/lib/vboot_ui.c
+++ b/firmware/lib/vboot_ui.c
@@ -38,15 +38,16 @@ static void VbAllowUsbBoot(struct vb2_context *ctx)
*
* Returns true if a shutdown is required and false if no shutdown is required.
*/
-static int VbWantShutdown(uint32_t gbb_flags, uint32_t key)
+static int VbWantShutdown(struct vb2_context *ctx, uint32_t key)
{
+ struct vb2_shared_data *sd = vb2_get_sd(ctx);
uint32_t shutdown_request = VbExIsShutdownRequested();
if (key == VB_BUTTON_POWER_SHORT_PRESS)
shutdown_request |= VB_SHUTDOWN_REQUEST_POWER_BUTTON;
/* If desired, ignore shutdown request due to lid closure. */
- if (gbb_flags & GBB_FLAG_DISABLE_LID_SHUTDOWN)
+ if (sd->gbb_flags & GBB_FLAG_DISABLE_LID_SHUTDOWN)
shutdown_request &= ~VB_SHUTDOWN_REQUEST_LID_CLOSED;
return !!shutdown_request;
@@ -105,7 +106,7 @@ int VbUserConfirms(struct vb2_context *ctx, VbCommonParams *cparams,
/* Await further instructions */
while (1) {
key = VbExKeyboardReadWithFlags(&key_flags);
- if (VbWantShutdown(cparams->gbb->flags, key))
+ if (VbWantShutdown(ctx, key))
return -1;
switch (key) {
case '\r':
@@ -161,9 +162,9 @@ static const char dev_disable_msg[] =
VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
{
- GoogleBinaryBlockHeader *gbb = cparams->gbb;
VbSharedDataHeader *shared =
(VbSharedDataHeader *)cparams->shared_data_blob;
+ struct vb2_shared_data *sd = vb2_get_sd(ctx);
uint32_t disable_dev_boot = 0;
uint32_t use_usb = 0;
@@ -187,11 +188,11 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
use_legacy = 1;
/* Handle GBB flag override */
- if (gbb->flags & GBB_FLAG_FORCE_DEV_BOOT_USB)
+ if (sd->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_USB)
allow_usb = 1;
- if (gbb->flags & GBB_FLAG_FORCE_DEV_BOOT_LEGACY)
+ if (sd->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY)
allow_legacy = 1;
- if (gbb->flags & GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY) {
+ if (sd->gbb_flags & VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY) {
use_legacy = 1;
use_usb = 0;
}
@@ -203,7 +204,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
if (fwmp_flags & FWMP_DEV_ENABLE_LEGACY)
allow_legacy = 1;
if (fwmp_flags & FWMP_DEV_DISABLE_BOOT) {
- if (gbb->flags & GBB_FLAG_FORCE_DEV_SWITCH_ON) {
+ if (sd->gbb_flags & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) {
VB2_DEBUG("FWMP_DEV_DISABLE_BOOT rejected by "
"FORCE_DEV_SWITCH_ON\n");
} else {
@@ -245,7 +246,7 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
/* We'll loop until we finish the delay or are interrupted */
do {
uint32_t key = VbExKeyboardRead();
- if (VbWantShutdown(gbb->flags, key)) {
+ if (VbWantShutdown(ctx, key)) {
VB2_DEBUG("VbBootDeveloper() - shutdown requested!\n");
VbAudioClose(audio);
return VBERROR_SHUTDOWN_REQUESTED;
@@ -257,7 +258,8 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
break;
case '\r':
/* Only disable virtual dev switch if allowed by GBB */
- if (!(gbb->flags & GBB_FLAG_ENTER_TRIGGERS_TONORM))
+ if (!(sd->gbb_flags &
+ VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM))
break;
case ' ':
/* See if we should disable virtual dev-mode switch. */
@@ -266,7 +268,8 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx, VbCommonParams *cparams)
shared->flags & VBSD_BOOT_DEV_SWITCH_ON) {
/* Stop the countdown while we go ask... */
VbAudioClose(audio);
- if (gbb->flags & GBB_FLAG_FORCE_DEV_SWITCH_ON) {
+ if (sd->gbb_flags &
+ GBB_FLAG_FORCE_DEV_SWITCH_ON) {
/*
* TONORM won't work (only for
* non-shipping devices).
@@ -446,7 +449,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
while (1) {
key = VbExKeyboardRead();
VbCheckDisplayKey(ctx, cparams, key);
- if (VbWantShutdown(cparams->gbb->flags, key))
+ if (VbWantShutdown(ctx, key))
return VBERROR_SHUTDOWN_REQUESTED;
VbExSleepMs(REC_KEY_DELAY);
}
@@ -543,7 +546,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx, VbCommonParams *cparams)
} else {
VbCheckDisplayKey(ctx, cparams, key);
}
- if (VbWantShutdown(cparams->gbb->flags, key))
+ if (VbWantShutdown(ctx, key))
return VBERROR_SHUTDOWN_REQUESTED;
VbExSleepMs(REC_KEY_DELAY);
}