diff options
author | Furquan Shaikh <furquan@google.com> | 2018-07-13 14:50:03 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-14 01:03:46 -0700 |
commit | 1e5d1d319f1836f4a14eb42c6b4d8e177344941f (patch) | |
tree | d3b8d241411a937dd02f5364ff4ec540f018362d /common/flash.c | |
parent | 59abb386c85753f568f246024902c79376958080 (diff) | |
download | chrome-ec-1e5d1d319f1836f4a14eb42c6b4d8e177344941f.tar.gz |
vboot: Invalidate cached hash if EC is in RO
Commit 65d6c6a (vboot: Don't invalidate cached hash for EXEC_IN_RAM
boards) changed the behavior of invalidating cached hash to ensure that
AP triggers software sync if EC-RW RAM and flash copies do not match.
However, this resulted in EC SW sync to fail because vboot in depthcharge
reads hash right away after updating EC-RW to ensure that the flash update
was indeed performed. Since EC does not invalidate the cache anymore,
this results in incorrect hash being returned thus causing the system to
reboot into recovery.
Since vboot in depthcharge puts the EC in RO before updating EC-RW,
this change invalidates cached hash if flash write/erase operations are
performed with EC in RO.
BUG=b:111449474
BRANCH=nami?
TEST=Verified following:
1. Cached hash is invalidated when EC-RW flash is updated with EC in RO
--> Flash BIOS-A and EC-A using servo
--> Flash EC-B using servo
--> Boot system
--> Ensure that AP performs SW sync and boots to OS with EC-RW updated
to EC-B
2. Cached hash is not invalidated when EC-RW flash is udpated with EC in
RW
--> Flash BIOS-A and EC-A using servo
--> Boot to OS
--> Flash BIOS-B and EC-B using flashrom on DUT
--> Reboot device
--> Ensure that AP detects mismatch in RAM and flash copies of EC-RW
and causes EC to reboot.
Change-Id: Ia50a9443e2f5ef9b1ed33992a46daf6230bf8816
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1137237
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/flash.c')
-rw-r--r-- | common/flash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/common/flash.c b/common/flash.c index bc23636550..6e7d8dba6b 100644 --- a/common/flash.c +++ b/common/flash.c @@ -494,11 +494,12 @@ static void flash_abort_or_invalidate_hash(int offset, int size) #ifdef CONFIG_EXTERNAL_STORAGE /* - * If EC executes in RAM, we keep the current hash. On the next - * hash check, AP will catch hash mismatch between the flash - * copy and the RAM copy, then take necessary actions. + * If EC executes in RAM and is currently in RW, we keep the current + * hash. On the next hash check, AP will catch hash mismatch between the + * flash copy and the RAM copy, then take necessary actions. */ - return; + if (system_is_in_rw()) + return; #endif /* If EC executes in place, we need to invalidate the cached hash. */ |