summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2019-10-23 14:53:09 -0600
committerCommit Bot <commit-bot@chromium.org>2019-11-15 02:45:45 +0000
commit38796a80f76d6ff0c5c4947a4cf217fd20742855 (patch)
tree65b73aff053df673d5d9c52fef87e0cd318213bf
parent49428f49143ba0357693f4ace9b169ce63cfa42c (diff)
downloadvboot-38796a80f76d6ff0c5c4947a4cf217fd20742855.tar.gz
EC sync: Add a new shared flag VB2_SD_STATUS_EC_SYNC_COMPLETE
The new flag can be set by any firmware which updates the EC to let further stages know that the EC sync has already been completed during this boot. BUG=none BRANCH=none TEST=make runtests Change-Id: Ide14efe7091631b62d240ddc984c8c70527a6d37 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1877066 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--firmware/2lib/2ec_sync.c19
-rw-r--r--firmware/2lib/include/2struct.h4
2 files changed, 22 insertions, 1 deletions
diff --git a/firmware/2lib/2ec_sync.c b/firmware/2lib/2ec_sync.c
index 0bc58a85..979c0a5d 100644
--- a/firmware/2lib/2ec_sync.c
+++ b/firmware/2lib/2ec_sync.c
@@ -479,8 +479,18 @@ static vb2_error_t ec_sync_phase3(struct vb2_context *ctx)
vb2_error_t vb2api_ec_sync(struct vb2_context *ctx)
{
+ struct vb2_shared_data *sd = vb2_get_sd(ctx);
vb2_error_t rv;
+ /*
+ * If the flags indicate 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) {
+ VB2_DEBUG("EC software sync already performed this boot, skipping\n");
+ return VB2_SUCCESS;
+ }
+
/* Phase 1; this determines if we need an update */
vb2_error_t phase1_rv = ec_sync_phase1(ctx);
int need_wait_screen = ec_will_update_slowly(ctx);
@@ -500,5 +510,12 @@ vb2_error_t vb2api_ec_sync(struct vb2_context *ctx)
return rv;
/* Phase 3; Completes sync and handles battery cutoff */
- return ec_sync_phase3(ctx);
+ rv = ec_sync_phase3(ctx);
+ if (rv)
+ return rv;
+
+ /* Establish that EC software sync is complete and successful */
+ sd->flags |= VB2_SD_STATUS_EC_SYNC_COMPLETE;
+
+ return VB2_SUCCESS;
}
diff --git a/firmware/2lib/include/2struct.h b/firmware/2lib/include/2struct.h
index a9fb000c..a992d7ab 100644
--- a/firmware/2lib/include/2struct.h
+++ b/firmware/2lib/include/2struct.h
@@ -78,6 +78,10 @@ enum vb2_shared_data_status {
/* FWMP secure data initialized */
VB2_SD_STATUS_SECDATA_FWMP_INIT = (1 << 5),
+
+ /* EC Sync completed successfully */
+ VB2_SD_STATUS_EC_SYNC_COMPLETE = (1 << 6),
+
};
/* "V2SD" = vb2_shared_data.magic */