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>
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index da0af9b..f03a8dc 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -32,6 +32,7 @@
static LoadKernelParams lkp;
static uint8_t workbuf[VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE];
static struct vb2_context ctx;
+static struct vb2_shared_data *sd;
static int shutdown_request_calls_left;
static int audio_looping_calls_left;
@@ -80,6 +81,7 @@
ctx.workbuf_size = sizeof(workbuf);
vb2_init_context(&ctx);
vb2_nv_init(&ctx);
+ sd = vb2_get_sd(&ctx);
shutdown_request_calls_left = -1;
audio_looping_calls_left = 30;
@@ -297,8 +299,8 @@
/* Proceed to legacy after timeout if GBB flag set */
ResetMocks();
- gbb.flags |= GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY |
- GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
+ sd->gbb_flags |= VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY |
+ VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Timeout");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
@@ -410,7 +412,7 @@
/* Enter does if GBB flag set */
ResetMocks();
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
- gbb.flags |= GBB_FLAG_ENTER_TRIGGERS_TONORM;
+ sd->gbb_flags |= VB2_GBB_FLAG_ENTER_TRIGGERS_TONORM;
mock_keypress[0] = '\r';
mock_keypress[1] = '\r';
TEST_EQ(VbBootDeveloper(&ctx, &cparams), VBERROR_REBOOT_REQUIRED,
@@ -419,7 +421,7 @@
/* Tonorm ignored if GBB forces dev switch on */
ResetMocks();
shared->flags = VBSD_HONOR_VIRT_DEV_SWITCH | VBSD_BOOT_DEV_SWITCH_ON;
- gbb.flags |= GBB_FLAG_FORCE_DEV_SWITCH_ON;
+ sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON;
mock_keypress[0] = ' ';
mock_keypress[1] = '\r';
TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002,
@@ -458,7 +460,7 @@
/* Ctrl+D doesn't boot legacy even if GBB flag is set */
ResetMocks();
mock_keypress[0] = 0x04;
- gbb.flags |= GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY;
+ sd->gbb_flags |= VB2_GBB_FLAG_DEFAULT_DEV_BOOT_LEGACY;
TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002, "Ctrl+D");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
@@ -469,7 +471,7 @@
TEST_EQ(vbexlegacy_called, 0, " not legacy");
ResetMocks();
- gbb.flags |= GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
+ sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
mock_keypress[0] = 0x0c;
TEST_EQ(VbBootDeveloper(&ctx, &cparams), 1002,
"Ctrl+L force legacy");
@@ -503,7 +505,7 @@
/* Ctrl+U enabled via GBB */
ResetMocks();
- gbb.flags |= GBB_FLAG_FORCE_DEV_BOOT_USB;
+ sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_BOOT_USB;
mock_keypress[0] = 0x15;
vbtlk_retval = VBERROR_SUCCESS - VB_DISK_FLAG_REMOVABLE;
TEST_EQ(VbBootDeveloper(&ctx, &cparams), 0, "Ctrl+U force USB");