vboot: Set VB2_SD_STATUS_EC_SYNC_COMPLETE in shared data status

CL:1877066 introduced shared data status VB2_SD_STATUS_EC_SYNC_COMPLETE,
but incorrectly saved it in shared data flags.

BRANCH=hatch
BUG=chromium:1057517
TEST=make runtests

Change-Id: Idc993304760c419f80c6b160b30763142cf47234
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2082756
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Julius Werner <jwerner@chromium.org>
diff --git a/firmware/2lib/2ec_sync.c b/firmware/2lib/2ec_sync.c
index 684c890..cba6782 100644
--- a/firmware/2lib/2ec_sync.c
+++ b/firmware/2lib/2ec_sync.c
@@ -436,10 +436,10 @@
 	vb2_error_t rv;
 
 	/*
-	 * If the flags indicate that the EC has already gone through
+	 * If the status indicates that the EC has already gone through
 	 * software sync this boot, then don't do it again.
 	 */
-	if (sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE) {
+	if (sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE) {
 		VB2_DEBUG("EC software sync already performed this boot, skipping\n");
 		return VB2_SUCCESS;
 	}
@@ -477,7 +477,7 @@
 		return rv;
 
 	/* Establish that EC software sync is complete and successful */
-	sd->flags |= VB2_SD_STATUS_EC_SYNC_COMPLETE;
+	sd->status |= VB2_SD_STATUS_EC_SYNC_COMPLETE;
 
 	return VB2_SUCCESS;
 }
diff --git a/tests/vb2_ec_sync_tests.c b/tests/vb2_ec_sync_tests.c
index 5123ea7..eae83b0 100644
--- a/tests/vb2_ec_sync_tests.c
+++ b/tests/vb2_ec_sync_tests.c
@@ -213,7 +213,7 @@
 	/* Check flag toggling */
 	ResetMocks();
 	test_ssync(VB2_SUCCESS, 0, "Normal sync");
-	TEST_NEQ(sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
+	TEST_NEQ(sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
 		 "  EC sync complete");
 	TEST_EQ(ec_ro_updated, 0, "  ec ro updated");
 	TEST_EQ(ec_rw_updated, 0, "  ec rw updated");
@@ -226,7 +226,7 @@
 	TEST_EQ(ec_vboot_done_calls, 1, "ec_vboot_done calls");
 
 	ResetMocks();
-	sd->flags |= VB2_SD_STATUS_EC_SYNC_COMPLETE;
+	sd->status |= VB2_SD_STATUS_EC_SYNC_COMPLETE;
 	test_ssync(VB2_SUCCESS, 0, "EC sync already complete");
 	TEST_EQ(ec_ro_updated, 0, "  ec ro updated");
 	TEST_EQ(ec_rw_updated, 0, "  ec rw updated");
@@ -238,7 +238,7 @@
 	ResetMocks();
 	ctx->flags &= ~VB2_CONTEXT_EC_SYNC_SUPPORTED;
 	test_ssync(VB2_SUCCESS, 0, "EC sync not supported");
-	TEST_NEQ(sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
+	TEST_NEQ(sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
 		 "  EC sync complete");
 	TEST_EQ(ec_ro_updated, 0, "  ec ro updated");
 	TEST_EQ(ec_rw_updated, 0, "  ec rw updated");
@@ -250,7 +250,7 @@
 	ResetMocks();
 	gbb.flags |= VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC;
 	test_ssync(VB2_SUCCESS, 0, "EC sync disabled by GBB");
-	TEST_NEQ(sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
+	TEST_NEQ(sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
 		 "  EC sync complete");
 	TEST_EQ(ec_ro_updated, 0, "  ec ro updated");
 	TEST_EQ(ec_rw_updated, 0, "  ec rw updated");
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index 1f20cb4..a7c088c 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -183,7 +183,7 @@
 	reset_common_data();
 	test_slk(0, 0, "Normal");
 	TEST_EQ(kernel_version, 0x10002, "  version");
-	TEST_NEQ(sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
+	TEST_NEQ(sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
 		 "  EC sync complete");
 	TEST_FALSE(commit_data_called, "  no commit data");
 
@@ -192,13 +192,13 @@
 	ctx->flags |= VB2_CONTEXT_EC_SYNC_SUPPORTED;
 	gbb.flags |= VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC;
 	test_slk(0, 0, "EC sync disabled by GBB");
-	TEST_NEQ(sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
+	TEST_NEQ(sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
 		 "  EC sync complete");
 
 	reset_common_data();
 	ctx->flags |= VB2_CONTEXT_EC_SYNC_SUPPORTED;
 	test_slk(0, 0, "Normal with EC sync");
-	TEST_NEQ(sd->flags & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
+	TEST_NEQ(sd->status & VB2_SD_STATUS_EC_SYNC_COMPLETE, 0,
 		 "  EC sync complete");
 
 	reset_common_data();