diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2019-10-23 14:53:09 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-20 06:53:41 +0000 |
commit | a2851446c2ccb535303be84636175f1603a36785 (patch) | |
tree | 65b73aff053df673d5d9c52fef87e0cd318213bf | |
parent | c9cfa1b57b42219969f410ae8a60b5d9499869f2 (diff) | |
download | vboot-a2851446c2ccb535303be84636175f1603a36785.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>
(cherry picked from commit 38796a80f76d6ff0c5c4947a4cf217fd20742855)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1924297
Reviewed-by: Shelley Chen <shchen@chromium.org>
Commit-Queue: Shelley Chen <shchen@chromium.org>
Tested-by: Shelley Chen <shchen@chromium.org>
-rw-r--r-- | firmware/2lib/2ec_sync.c | 19 | ||||
-rw-r--r-- | firmware/2lib/include/2struct.h | 4 |
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 */ |