From 8c03950f59c86df17eca8dfe2a8bdc7ea3e075c7 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Fri, 17 Apr 2020 11:36:20 +0800 Subject: vboot: Rename VB_AUX_FW_* to VB2_AUXFW_* For naming consistency, rename any variations of "AUX_FW" to "auxfw". BRANCH=none BUG=none TEST=make runtests Cq-Depend: chromium:2154265 Change-Id: Icf74215f5babf19228f2f362c3c29c9b14794dfc Signed-off-by: Yu-Ping Wu Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2154266 Reviewed-by: Joel Kitching --- firmware/2lib/2auxfw_sync.c | 18 ++++---- firmware/2lib/2recovery_reasons.c | 4 +- firmware/2lib/2stub.c | 2 +- firmware/2lib/include/2api.h | 14 +++---- firmware/2lib/include/2recovery_reasons.h | 4 +- firmware/lib/vboot_api_kernel.c | 4 +- firmware/stub/vboot_api_stub.c | 2 +- tests/vb2_auxfw_sync_tests.c | 70 +++++++++++++++---------------- 8 files changed, 59 insertions(+), 59 deletions(-) diff --git a/firmware/2lib/2auxfw_sync.c b/firmware/2lib/2auxfw_sync.c index 0be4b4da..da7bc979 100644 --- a/firmware/2lib/2auxfw_sync.c +++ b/firmware/2lib/2auxfw_sync.c @@ -2,7 +2,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * - * Auxiliary firmware sync routines for vboot + * Auxiliary firmware (auxfw) sync routines for vboot. */ #include "2api.h" @@ -10,7 +10,7 @@ #include "2misc.h" /** - * Determine if we are allowed to update auxfw + * Determine if we are allowed to update auxfw. * * @param ctx Vboot2 context * @return boolean (true iff we can update auxfw) @@ -28,7 +28,7 @@ static int auxfw_sync_allowed(struct vb2_context *ctx) } /** - * Update the specified Aux FW and verify the update succeeded + * Update the specified auxfw and verify the update succeeded. * * @param ctx Vboot2 context * @return VB2_SUCCESS, or non-zero error code. @@ -55,14 +55,14 @@ static vb2_error_t update_auxfw(struct vb2_context *ctx) * If we fail for any other reason, trigger recovery mode. */ if (rv != VB2_REQUEST_REBOOT_EC_TO_RO) - vb2api_fail(ctx, VB2_RECOVERY_AUX_FW_UPDATE, rv); + vb2api_fail(ctx, VB2_RECOVERY_AUXFW_UPDATE, rv); } return rv; } /** - * Decides if auxfw sync is allowed to be performed + * Decides if auxfw sync is allowed to be performed. * * If sync is allowed, invokes the external callback, * vb2ex_auxfw_check() to allow the client to decide on the auxfw @@ -75,7 +75,7 @@ static vb2_error_t auxfw_sync_check_update(struct vb2_context *ctx, enum vb2_auxfw_update_severity *severity) { if (!auxfw_sync_allowed(ctx)) { - *severity = VB_AUX_FW_NO_UPDATE; + *severity = VB2_AUXFW_NO_UPDATE; return VB2_SUCCESS; } @@ -84,15 +84,15 @@ static vb2_error_t auxfw_sync_check_update(struct vb2_context *ctx, vb2_error_t vb2api_auxfw_sync(struct vb2_context *ctx) { - enum vb2_auxfw_update_severity fw_update = VB_AUX_FW_NO_UPDATE; + enum vb2_auxfw_update_severity fw_update = VB2_AUXFW_NO_UPDATE; /* Check for update severity */ VB2_TRY(auxfw_sync_check_update(ctx, &fw_update)); - if (fw_update > VB_AUX_FW_NO_UPDATE) { + if (fw_update > VB2_AUXFW_NO_UPDATE) { VB2_TRY(update_auxfw(ctx)); /* - * AUX FW Update is applied successfully. Request EC reboot to + * auxfw update is applied successfully. Request EC reboot to * RO, so that the chips that had FW update get reset to a * clean state. */ diff --git a/firmware/2lib/2recovery_reasons.c b/firmware/2lib/2recovery_reasons.c index bf64d517..c2b66c90 100644 --- a/firmware/2lib/2recovery_reasons.c +++ b/firmware/2lib/2recovery_reasons.c @@ -94,8 +94,8 @@ const char *vb2_get_recovery_reason_string(uint8_t code) return "Error reading or updating developer switch"; /* 0x2f */ case VB2_RECOVERY_FW_SLOT: return "Error selecting RW firmware slot"; - /* 0x30 */ case VB2_RECOVERY_AUX_FW_UPDATE: - return "Error updating AUX firmware"; + /* 0x30 */ case VB2_RECOVERY_AUXFW_UPDATE: + return "Error updating auxiliary firmware"; /* 0x3f */ case VB2_RECOVERY_RO_UNSPECIFIED: return "Unspecified/unknown error in RO firmware"; /* 0x41 */ case VB2_RECOVERY_DEPRECATED_RW_DEV_SCREEN: diff --git a/firmware/2lib/2stub.c b/firmware/2lib/2stub.c index 69873393..70cbeffc 100644 --- a/firmware/2lib/2stub.c +++ b/firmware/2lib/2stub.c @@ -70,7 +70,7 @@ vb2_error_t vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val) __attribute__((weak)) vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity) { - *severity = VB_AUX_FW_NO_UPDATE; + *severity = VB2_AUXFW_NO_UPDATE; return VB2_SUCCESS; } diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h index 17271bb1..416e2aa5 100644 --- a/firmware/2lib/include/2api.h +++ b/firmware/2lib/include/2api.h @@ -999,13 +999,13 @@ vb2_error_t vb2api_auxfw_sync(struct vb2_context *ctx); */ enum vb2_auxfw_update_severity { /* no update needed and no protection needed */ - VB_AUX_FW_NO_DEVICE = 0, + VB2_AUXFW_NO_DEVICE = 0, /* no update needed */ - VB_AUX_FW_NO_UPDATE = 1, + VB2_AUXFW_NO_UPDATE = 1, /* update needed, can be done quickly */ - VB_AUX_FW_FAST_UPDATE = 2, + VB2_AUXFW_FAST_UPDATE = 2, /* update needed, "this would take a while..." */ - VB_AUX_FW_SLOW_UPDATE = 3, + VB2_AUXFW_SLOW_UPDATE = 3, }; /* @@ -1031,10 +1031,10 @@ vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity); vb2_error_t vb2ex_auxfw_update(void); /* - * Notify client that vboot is done with Aux FW. + * Notify client that vboot is done with auxfw. * - * If Aux FW sync was successful, this will be called at the end so that - * the client may perform actions that require the Aux FW to be in its + * If auxfw sync was successful, this will be called at the end so that + * the client may perform actions that require the auxfw to be in its * final state. This may include protecting the communcations tunnels that * allow auxiliary firmware updates from the OS. * diff --git a/firmware/2lib/include/2recovery_reasons.h b/firmware/2lib/include/2recovery_reasons.h index de64e596..6362e066 100644 --- a/firmware/2lib/include/2recovery_reasons.h +++ b/firmware/2lib/include/2recovery_reasons.h @@ -166,8 +166,8 @@ enum vb2_nv_recovery { /* Error determining firmware slot */ VB2_RECOVERY_FW_SLOT = 0x2f, - /* Error updating AUX firmware */ - VB2_RECOVERY_AUX_FW_UPDATE = 0x30, + /* Error updating auxiliary firmware */ + VB2_RECOVERY_AUXFW_UPDATE = 0x30, /* Unspecified/unknown error in read-only firmware */ VB2_RECOVERY_RO_UNSPECIFIED = 0x3f, diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index 2750325b..2bc31845 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -36,7 +36,7 @@ static vb2_error_t handle_battery_cutoff(struct vb2_context *ctx) { /* * Check if we need to cut-off battery. This should be done after EC - * FW and Aux FW are updated, and before the kernel is started. This + * FW and auxfw are updated, and before the kernel is started. This * is to make sure all firmware is up-to-date before shipping (which * is the typical use-case for cutoff). */ @@ -189,7 +189,7 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, VB2_DEBUG("GBB flags are %#x\n", gbb_flags); /* - * Do EC and Aux FW software sync unless we're in recovery mode. This + * Do EC and auxfw software sync unless we're in recovery mode. This * has UI but it's just a single non-interactive WAIT screen. */ if (!(ctx->flags & VB2_CONTEXT_RECOVERY_MODE)) { diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index a6939443..6d854557 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -127,7 +127,7 @@ vb2_error_t vb2ex_ec_battery_cutoff(void) vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity) { - *severity = VB_AUX_FW_NO_UPDATE; + *severity = VB2_AUXFW_NO_UPDATE; return VB2_SUCCESS; } diff --git a/tests/vb2_auxfw_sync_tests.c b/tests/vb2_auxfw_sync_tests.c index 104455f9..75b139be 100644 --- a/tests/vb2_auxfw_sync_tests.c +++ b/tests/vb2_auxfw_sync_tests.c @@ -50,8 +50,8 @@ static void ResetMocks(void) memset(&gbb, 0, sizeof(gbb)); auxfw_retval = VB2_SUCCESS; - auxfw_mock_severity = VB_AUX_FW_NO_UPDATE; - auxfw_update_severity = VB_AUX_FW_NO_UPDATE; + auxfw_mock_severity = VB2_AUXFW_NO_UPDATE; + auxfw_update_severity = VB2_AUXFW_NO_UPDATE; auxfw_mock_display_available = 1; auxfw_update_req = 0; auxfw_protected = 0; @@ -68,7 +68,7 @@ vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity) { *severity = auxfw_mock_severity; auxfw_update_severity = auxfw_mock_severity; - if (*severity == VB_AUX_FW_SLOW_UPDATE) + if (*severity == VB2_AUXFW_SLOW_UPDATE) if (!auxfw_mock_display_available) return VB2_REQUEST_REBOOT; return VB2_SUCCESS; @@ -76,15 +76,15 @@ vb2_error_t vb2ex_auxfw_check(enum vb2_auxfw_update_severity *severity) vb2_error_t vb2ex_auxfw_update(void) { - if (auxfw_update_severity != VB_AUX_FW_NO_DEVICE && - auxfw_update_severity != VB_AUX_FW_NO_UPDATE) + if (auxfw_update_severity != VB2_AUXFW_NO_DEVICE && + auxfw_update_severity != VB2_AUXFW_NO_UPDATE) auxfw_update_req = 1; return auxfw_retval; } vb2_error_t vb2ex_auxfw_finalize(struct vb2_context *c) { - auxfw_protected = auxfw_update_severity != VB_AUX_FW_NO_DEVICE; + auxfw_protected = auxfw_update_severity != VB2_AUXFW_NO_DEVICE; return auxfw_done_retval; } @@ -102,61 +102,61 @@ static void VbSoftwareSyncTest(void) { ResetMocks(); gbb.flags |= VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC; - auxfw_mock_severity = VB_AUX_FW_FAST_UPDATE; + auxfw_mock_severity = VB2_AUXFW_FAST_UPDATE; test_auxsync(VB2_REQUEST_REBOOT_EC_TO_RO, 0, "VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC" - " does not disable auxiliary FW update request"); - TEST_EQ(auxfw_update_req, 1, " aux fw update requested"); - TEST_EQ(auxfw_protected, 0, " aux fw protected"); + " does not disable auxfw update request"); + TEST_EQ(auxfw_update_req, 1, " auxfw update requested"); + TEST_EQ(auxfw_protected, 0, " auxfw protected"); ResetMocks(); gbb.flags |= VB2_GBB_FLAG_DISABLE_AUXFW_SOFTWARE_SYNC; - auxfw_mock_severity = VB_AUX_FW_FAST_UPDATE; + auxfw_mock_severity = VB2_AUXFW_FAST_UPDATE; test_auxsync(VB2_SUCCESS, 0, "VB2_GBB_FLAG_DISABLE_AUXFW_SOFTWARE_SYNC" - " disables auxiliary FW update request"); - TEST_EQ(auxfw_update_req, 0, " aux fw update disabled"); - TEST_EQ(auxfw_protected, 1, " aux fw protected"); + " disables auxfw update request"); + TEST_EQ(auxfw_update_req, 0, " auxfw update disabled"); + TEST_EQ(auxfw_protected, 1, " auxfw protected"); ResetMocks(); - auxfw_mock_severity = VB_AUX_FW_NO_DEVICE; + auxfw_mock_severity = VB2_AUXFW_NO_DEVICE; test_auxsync(VB2_SUCCESS, 0, - "No auxiliary FW update needed"); - TEST_EQ(auxfw_update_req, 0, " no aux fw update requested"); - TEST_EQ(auxfw_protected, 0, " no aux fw protected"); + "No auxfw update needed"); + TEST_EQ(auxfw_update_req, 0, " no auxfw update requested"); + TEST_EQ(auxfw_protected, 0, " no auxfw protected"); ResetMocks(); - auxfw_mock_severity = VB_AUX_FW_NO_UPDATE; + auxfw_mock_severity = VB2_AUXFW_NO_UPDATE; test_auxsync(VB2_SUCCESS, 0, - "No auxiliary FW update needed"); - TEST_EQ(auxfw_update_req, 0, " no aux fw update requested"); - TEST_EQ(auxfw_protected, 1, " aux fw protected"); + "No auxfw update needed"); + TEST_EQ(auxfw_update_req, 0, " no auxfw update requested"); + TEST_EQ(auxfw_protected, 1, " auxfw protected"); ResetMocks(); - auxfw_mock_severity = VB_AUX_FW_FAST_UPDATE; + auxfw_mock_severity = VB2_AUXFW_FAST_UPDATE; test_auxsync(VB2_REQUEST_REBOOT_EC_TO_RO, 0, - "Fast auxiliary FW update needed"); - TEST_EQ(auxfw_update_req, 1, " aux fw update requested"); - TEST_EQ(auxfw_protected, 0, " aux fw protected"); + "Fast auxfw update needed"); + TEST_EQ(auxfw_update_req, 1, " auxfw update requested"); + TEST_EQ(auxfw_protected, 0, " auxfw protected"); ResetMocks(); - auxfw_mock_severity = VB_AUX_FW_SLOW_UPDATE; + auxfw_mock_severity = VB2_AUXFW_SLOW_UPDATE; auxfw_mock_display_available = 0; test_auxsync(VB2_REQUEST_REBOOT, 0, - "Slow auxiliary FW update needed - reboot for display"); + "Slow auxfw update needed - reboot for display"); ResetMocks(); - auxfw_mock_severity = VB_AUX_FW_SLOW_UPDATE; + auxfw_mock_severity = VB2_AUXFW_SLOW_UPDATE; test_auxsync(VB2_REQUEST_REBOOT_EC_TO_RO, 0, - "Slow auxiliary FW update needed"); - TEST_EQ(auxfw_update_req, 1, " aux fw update requested"); - TEST_EQ(auxfw_protected, 0, " aux fw protected"); + "Slow auxfw update needed"); + TEST_EQ(auxfw_update_req, 1, " auxfw update requested"); + TEST_EQ(auxfw_protected, 0, " auxfw protected"); ResetMocks(); - auxfw_mock_severity = VB_AUX_FW_FAST_UPDATE; + auxfw_mock_severity = VB2_AUXFW_FAST_UPDATE; auxfw_retval = VB2_ERROR_UNKNOWN; - test_auxsync(VB2_ERROR_UNKNOWN, VB2_RECOVERY_AUX_FW_UPDATE, - "Error updating AUX firmware"); + test_auxsync(VB2_ERROR_UNKNOWN, VB2_RECOVERY_AUXFW_UPDATE, + "Error updating auxfw"); } int main(void) -- cgit v1.2.1