diff options
author | Joel Kitching <kitching@google.com> | 2019-09-28 13:32:22 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-06 03:49:12 +0000 |
commit | 123bd5f6dbc2f039c28ac826993454489dc6767d (patch) | |
tree | c06d02908b048e53a89318334178a94eb03fe59b | |
parent | ed8390ec50b2decdf18a3416d07d37222cb0130d (diff) | |
download | vboot-123bd5f6dbc2f039c28ac826993454489dc6767d.tar.gz |
vboot: remove VbExEcEnteringMode and friends
After informing EC of the mode chosen by vboot, it is stored
in a global and never accessed again. Remove this function,
its calls, and its tests.
Also note some significant issues which existed:
(1) Using accessor VbGetMode for tests, rather than just
overriding VbExEcEnteringMode when needed.
(2) The tests checking the value sent to VbExEcEnteringMode
(vboot_api_kernel2_tests and vboot_detach_menu_tests)
actually call the function themselves.
BUG=b:124141368, chromium:1014379
TEST=make clean && make runtests
BRANCH=none
Change-Id: Ib8e510a1e1c663bb3f8238a9ad15e3e64d7350b0
Signed-off-by: Joel Kitching <kitching@google.com>
Cq-Depend: chromium:1864533
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1830239
Reviewed-by: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | firmware/include/vboot_api.h | 7 | ||||
-rw-r--r-- | firmware/include/vboot_test.h | 8 | ||||
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 3 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub.c | 13 | ||||
-rw-r--r-- | tests/vboot_api_kernel2_tests.c | 7 | ||||
-rw-r--r-- | tests/vboot_detach_menu_tests.c | 5 |
6 files changed, 5 insertions, 38 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 9f1b9551..d07852a5 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -710,13 +710,6 @@ vb2_error_t VbExEcUpdateImage(int devidx, enum VbSelectFirmware_t select, vb2_error_t VbExEcProtect(int devidx, enum VbSelectFirmware_t select); /** - * Info the EC of the boot mode selected by the AP. - * mode: Normal, Developer, or Recovery - */ -enum VbEcBootMode_t {VB_EC_NORMAL, VB_EC_DEVELOPER, VB_EC_RECOVERY }; -vb2_error_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode); - -/** * Perform EC post-verification / updating / jumping actions. * * This routine is called to perform certain actions that must wait until diff --git a/firmware/include/vboot_test.h b/firmware/include/vboot_test.h index a825bd9c..bdd1f378 100644 --- a/firmware/include/vboot_test.h +++ b/firmware/include/vboot_test.h @@ -8,7 +8,9 @@ #ifndef VBOOT_REFERENCE_TEST_API_H_ #define VBOOT_REFERENCE_TEST_API_H_ -/* +/**************************************************************************** + * 2rsa.c + * * Internal functions from 2rsa.c that have error conditions we can't trigger * from the public APIs. These include checks for bad algorithms where the * next call level up already checks for bad algorithms, etc. @@ -21,8 +23,8 @@ int vb2_mont_ge(const struct vb2_public_key *key, uint32_t *a); vb2_error_t vb2_check_padding(const uint8_t *sig, const struct vb2_public_key *key); -enum VbEcBootMode_t; -enum VbEcBootMode_t VbGetMode(void); +/**************************************************************************** + * vboot_api_kernel.c */ struct RollbackSpaceFwmp; struct RollbackSpaceFwmp *VbApiKernelGetFwmp(void); diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index fe1e7e3d..68419aa3 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -391,7 +391,6 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, rv = VbBootRecoveryMenu(ctx); else rv = VbBootRecovery(ctx); - VbExEcEnteringMode(0, VB_EC_RECOVERY); } else if (DIAGNOSTIC_UI && vb2_nv_get(ctx, VB2_NV_DIAG_REQUEST)) { vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0); @@ -418,11 +417,9 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, rv = VbBootDeveloperMenu(ctx); else rv = VbBootDeveloper(ctx); - VbExEcEnteringMode(0, VB_EC_DEVELOPER); } else { /* Normal boot */ rv = VbBootNormal(ctx); - VbExEcEnteringMode(0, VB_EC_NORMAL); } VbSelectAndLoadKernel_exit: diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index c30aa8e9..770be359 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -17,8 +17,6 @@ #include "vboot_api.h" #include "vboot_test.h" -static enum VbEcBootMode_t vboot_mode; - void VbExSleepMs(uint32_t msec) { } @@ -128,12 +126,6 @@ vb2_error_t VbExEcProtect(int devidx, enum VbSelectFirmware_t select) return VB2_SUCCESS; } -vb2_error_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode) -{ - vboot_mode = mode; - return VB2_SUCCESS; -} - vb2_error_t VbExEcVbootDone(int in_recovery) { return VB2_SUCCESS; @@ -155,11 +147,6 @@ vb2_error_t VbExUpdateAuxFw(void) return VB2_SUCCESS; } -enum VbEcBootMode_t VbGetMode(void) -{ - return vboot_mode; -} - vb2_error_t VbExLegacy(enum VbAltFwIndex_t altfw_num) { return 1; diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c index 3e2ae042..0b82bdcd 100644 --- a/tests/vboot_api_kernel2_tests.c +++ b/tests/vboot_api_kernel2_tests.c @@ -471,9 +471,7 @@ static void VbUserConfirmsTest(void) static void VbBootTest(void) { ResetMocks(); - VbExEcEnteringMode(0, VB_EC_NORMAL); TEST_EQ(VbBootNormal(&ctx), 1002, "VbBootNormal()"); - TEST_EQ(VbGetMode(), VB_EC_NORMAL, "vboot_mode normal"); ResetMocks(); vb2_nv_set(&ctx, VB2_NV_DISPLAY_REQUEST, 1); @@ -498,9 +496,7 @@ static void VbBootDevTest(void) /* Proceed after timeout */ ResetMocks(); - VbExEcEnteringMode(0, VB_EC_DEVELOPER); TEST_EQ(VbBootDeveloper(&ctx), 1002, "Timeout"); - TEST_EQ(VbGetMode(), VB_EC_DEVELOPER, "vboot_mode developer"); TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING, " warning screen"); TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0, @@ -1068,11 +1064,9 @@ static void VbBootRecTest(void) /* Shutdown requested in loop */ ResetMocks(); MockGpioAfter(10, GPIO_SHUTDOWN); - VbExEcEnteringMode(0, VB_EC_RECOVERY); TEST_EQ(VbBootRecovery(&ctx), VBERROR_SHUTDOWN_REQUESTED, "Shutdown requested"); - TEST_EQ(VbGetMode(), VB_EC_RECOVERY, "vboot_mode recovery"); TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0, " recovery reason"); @@ -1081,7 +1075,6 @@ static void VbBootRecTest(void) /* Shutdown requested by keyboard */ ResetMocks(); - VbExEcEnteringMode(0, VB_EC_RECOVERY); mock_keypress[0] = VB_BUTTON_POWER_SHORT_PRESS; TEST_EQ(VbBootRecovery(&ctx), VBERROR_SHUTDOWN_REQUESTED, diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c index 8d134e46..7374882c 100644 --- a/tests/vboot_detach_menu_tests.c +++ b/tests/vboot_detach_menu_tests.c @@ -114,7 +114,6 @@ static void ResetMocksForDeveloper(void) { ResetMocks(); shared->flags |= VBSD_BOOT_DEV_SWITCH_ON; - VbExEcEnteringMode(0, VB_EC_DEVELOPER); shutdown_request_calls_left = -1; } @@ -123,7 +122,6 @@ static void ResetMocksForManualRecovery(void) ResetMocks(); shared->flags |= VBSD_BOOT_REC_SWITCH_ON; trust_ec = 1; - VbExEcEnteringMode(0, VB_EC_RECOVERY); } /* Mock functions */ @@ -276,7 +274,6 @@ static void VbBootDevTest(void) /* Proceed after timeout */ ResetMocksForDeveloper(); TEST_EQ(VbBootDeveloperMenu(&ctx), vbtlk_retval_fixed, "Timeout"); - TEST_EQ(VbGetMode(), VB_EC_DEVELOPER, "vboot_mode developer"); TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING_MENU, " warning screen"); TEST_EQ(screens_displayed[1], VB_SCREEN_BLANK, " final blank screen"); @@ -1295,10 +1292,8 @@ static void VbBootRecTest(void) /* Shutdown requested in BROKEN */ ResetMocks(); - VbExEcEnteringMode(0, VB_EC_RECOVERY); TEST_EQ(VbBootRecoveryMenu(&ctx), VBERROR_SHUTDOWN_REQUESTED, "Shutdown requested in BROKEN"); - TEST_EQ(VbGetMode(), VB_EC_RECOVERY, "vboot_mode recovery"); TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0, " no recovery"); TEST_EQ(debug_info_displayed, 0, " no debug info"); TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN, |