summaryrefslogtreecommitdiff
path: root/tests/ec_sync_tests.c
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@google.com>2017-05-12 16:46:41 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-06-28 03:09:49 -0700
commit3dd580298b42d9d77e1f37733e4df2b6d5c302c6 (patch)
tree4b637f49b5e9c40bb0657ef8f88beb721465d468 /tests/ec_sync_tests.c
parent074697374b452d44450d0108d598ad001dc2d90d (diff)
downloadvboot-3dd580298b42d9d77e1f37733e4df2b6d5c302c6.tar.gz
call depthcharge hooks for auxiliary FW update.
this adds calls to depthcharge (using callbacks) to do auxiliary firmware updates. in particular, this is intended to trigger TCPC updates, but other programmables could also be updated. no firmware updates take place until a board file has actually registered a firmware update "driver". board file updates to follow. TEST="COV=1 make" passes. depthcharge boots on snappy. with additional follow-on CLs, we can update the ps8751. the companion depthcharge changes are here: https://chromium-review.googlesource.com/c/498150/ the working design doc is here: https://docs.google.com/a/google.com/document/d/1uzS0b3O3Us1QI2Sx7LDkjEfHmuhYB2BolrAoNwCVoc0/edit?usp=sharing these features depend on vboot API updates: CQ-DEPEND=CL:498150 BUG=b:35586896 BRANCH=none Change-Id: If0d634eab08b429a8e7e80f5fe11eab3705bba0f Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/505260 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Diffstat (limited to 'tests/ec_sync_tests.c')
-rw-r--r--tests/ec_sync_tests.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c
index b632fb6c..66ea1ca2 100644
--- a/tests/ec_sync_tests.c
+++ b/tests/ec_sync_tests.c
@@ -60,6 +60,9 @@ static struct vb2_shared_data *sd;
static uint32_t screens_displayed[8];
static uint32_t screens_count = 0;
+static int ec_aux_fw_update_req;
+static VbAuxFwUpdateSeverity_t ec_aux_fw_update_severity;
+
/* Reset mock data (for use before each test) */
static void ResetMocks(void)
{
@@ -71,7 +74,7 @@ static void ResetMocks(void)
memset(&gbb, 0, sizeof(gbb));
gbb.major_version = GBB_MAJOR_VER;
gbb.minor_version = GBB_MINOR_VER;
- gbb.flags = GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC;
+ gbb.flags = 0;
cparams.gbb = &gbb;
memset(&ctx, 0, sizeof(ctx));
@@ -117,6 +120,9 @@ static void ResetMocks(void)
memset(screens_displayed, 0, sizeof(screens_displayed));
screens_count = 0;
+
+ ec_aux_fw_update_severity = VB_AUX_FW_NO_UPDATE;
+ ec_aux_fw_update_req = 0;
}
/* Mock functions */
@@ -213,6 +219,18 @@ VbError_t VbDisplayScreen(struct vb2_context *ctx, VbCommonParams *cparams,
return VBERROR_SUCCESS;
}
+VbError_t VbExCheckAuxFw(VbAuxFwUpdateSeverity_t *severity)
+{
+ *severity = ec_aux_fw_update_severity;
+ return VBERROR_SUCCESS;
+}
+
+VbError_t VbExUpdateAuxFw()
+{
+ ec_aux_fw_update_req = 1;
+ return VBERROR_SUCCESS;
+}
+
static void test_ssync(VbError_t retval, int recovery_reason, const char *desc)
{
TEST_EQ(ec_sync_all(&ctx, &cparams), retval, desc);
@@ -398,6 +416,46 @@ static void VbSoftwareSyncTest(void)
mock_in_rw = 1;
shutdown_request_calls_left = 0;
test_ssync(0, 0, "AP-RW shutdown requested");
+
+ ResetMocks();
+ cparams.gbb->flags |= GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC;
+ ec_aux_fw_update_severity = VB_AUX_FW_FAST_UPDATE;
+ test_ssync(VBERROR_SUCCESS, 0,
+ "GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC"
+ " disables auxiliary FW update request");
+ TEST_EQ(ec_aux_fw_update_req, 0, " aux fw update disabled");
+
+ ResetMocks();
+ cparams.gbb->flags |= GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC;
+ ec_aux_fw_update_severity = VB_AUX_FW_FAST_UPDATE;
+ test_ssync(VBERROR_SUCCESS, 0,
+ "GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC"
+ " disables auxiliary FW update request");
+ TEST_EQ(ec_aux_fw_update_req, 0, " aux fw update disabled");
+
+ ResetMocks();
+ ec_aux_fw_update_severity = VB_AUX_FW_NO_UPDATE;
+ test_ssync(VBERROR_SUCCESS, 0,
+ "No auxiliary FW update needed");
+ TEST_EQ(screens_count, 0,
+ " wait screen skipped");
+ TEST_EQ(ec_aux_fw_update_req, 0, " no aux fw update requested");
+
+ ResetMocks();
+ ec_aux_fw_update_severity = VB_AUX_FW_FAST_UPDATE;
+ test_ssync(VBERROR_SUCCESS, 0,
+ "Fast auxiliary FW update needed");
+ TEST_EQ(screens_count, 0,
+ " wait screen skipped");
+ TEST_EQ(ec_aux_fw_update_req, 1, " aux fw update requested");
+
+ ResetMocks();
+ ec_aux_fw_update_severity = VB_AUX_FW_SLOW_UPDATE;
+ test_ssync(VBERROR_SUCCESS, 0,
+ "Slow auxiliary FW update needed");
+ TEST_EQ(ec_aux_fw_update_req, 1, " aux fw update requested");
+ TEST_EQ(screens_displayed[0], VB_SCREEN_WAIT,
+ " wait screen forced");
}
int main(void)