diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2020-05-13 18:23:52 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-14 08:38:15 +0000 |
commit | 63a8d07fbc74c8a141a8d30f56434846d8e5af08 (patch) | |
tree | c66d71335650f89d4a945308cb84f1f27c6f7095 /common | |
parent | b70e2768c856641e91205fdb50b20a4147b2a7e2 (diff) | |
download | chrome-ec-63a8d07fbc74c8a141a8d30f56434846d8e5af08.tar.gz |
system: Add EC_RESET_FLAG_EFS
This patch adds EC_RESET_FLAG_EFS. It indicates EC jumped to RW by
successfully running EFS.
system_jumped_late can be used to avoid running some code twice
(once in RO and again in RW). Such code is currently (wrongly)
guarded by system_jumped_to_this_image.
BUG=b:156101251, chromium:1072743
BRANCH=none
TEST=Verified the bug is fixed.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I58fc18510b2f95dfd116cbacba09875cb7cf5051
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2200245
Diffstat (limited to 'common')
-rw-r--r-- | common/system.c | 6 | ||||
-rw-r--r-- | common/vboot/efs2.c | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/common/system.c b/common/system.c index d64c9c3643..aa427e0dc0 100644 --- a/common/system.c +++ b/common/system.c @@ -274,6 +274,12 @@ int system_jumped_to_this_image(void) return jumped_to_image; } +int system_jumped_late(void) +{ + return !(reset_flags & EC_RESET_FLAG_EFS) + && (reset_flags & EC_RESET_FLAG_SYSJUMP); +} + int system_add_jump_tag(uint16_t tag, int version, int size, const void *data) { struct jump_tag *t; diff --git a/common/vboot/efs2.c b/common/vboot/efs2.c index 29ad42995f..3e949455fd 100644 --- a/common/vboot/efs2.c +++ b/common/vboot/efs2.c @@ -209,8 +209,11 @@ static void verify_and_jump(void) enable_pd(); break; case CR50_COMM_SUCCESS: + system_set_reset_flags( + system_get_reset_flags() | EC_RESET_FLAG_EFS); rv = system_run_image_copy(EC_IMAGE_RW); CPRINTS("Failed to jump (0x%x)", rv); + system_clear_reset_flags(EC_RESET_FLAG_EFS); show_critical_error(); break; default: |