diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-09-19 14:22:58 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-09-20 16:03:05 -0700 |
commit | 920e10419d6ff5dedd43e79732785cabee803cbf (patch) | |
tree | 4b1ed6f971adb2a61759592f6655bfd4de2a7db0 | |
parent | bfed8c576c1c2a2b387192d4cc3edde5d8ed3738 (diff) | |
download | chrome-ec-920e10419d6ff5dedd43e79732785cabee803cbf.tar.gz |
EC recalculates RW code hash after all sysjumps
This solves the problem where the AP updates EC-RW as part of software
sync, then tells the EC to jump to EC-RW. On the next boot the EC
still returned the saved old RW hash, causing a needless cold boot.
This change is backwards/forwards compatible; existing RO code will
simply save a hash new RW code won't look at, and existing RW code
already knows to recompute the hash if the RO code didn't save it.
Hash computation is done in the background and takes ~350ms, so this
should have no noticeable effect on performance.
BUG=chrome-os-partner:13511
BRANCH=all (not needed for FSI, since RW code with this change will do
the right thing with existing RO code)
TEST=at the EC console, "sysjump RW" and look at the EC debug log for
"hash done".
Original-Change-Id: Ie5255727b9d896b7c4e4f537e91d831682afc7f6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33634
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 07cae3f8e1f7e8b53c8b60752d4e7d519ff01a74)
Change-Id: I8465037e8cf39d3b6d52109134a2b484a5ea264e
Reviewed-on: https://gerrit.chromium.org/gerrit/33705
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
-rw-r--r-- | common/vboot_hash.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c index c80c174588..ed011aee05 100644 --- a/common/vboot_hash.c +++ b/common/vboot_hash.c @@ -80,7 +80,6 @@ static int vboot_hash_start(uint32_t offset, uint32_t size, return EC_SUCCESS; } - /* Abort hash currently in progress, if any. */ static void vboot_hash_abort(void) { @@ -88,9 +87,9 @@ static void vboot_hash_abort(void) want_abort = 1; } - static void vboot_hash_init(void) { +#ifdef CONFIG_SAVE_VBOOT_HASH const struct vboot_hash_tag *tag; int version, size; @@ -103,15 +102,16 @@ static void vboot_hash_init(void) hash = tag->hash; data_offset = tag->offset; data_size = tag->size; - } else { - /* Start computing the hash of firmware A */ + } else +#endif + { + /* Start computing the hash of RW firmware */ vboot_hash_start(CONFIG_FW_RW_OFF, system_get_image_used(SYSTEM_IMAGE_RW), NULL, 0); } } - void vboot_hash_task(void) { vboot_hash_init(); @@ -154,6 +154,8 @@ void vboot_hash_task(void) /*****************************************************************************/ /* Hooks */ +#ifdef CONFIG_SAVE_VBOOT_HASH + static int vboot_hash_preserve_state(void) { struct vboot_hash_tag tag; @@ -172,6 +174,8 @@ static int vboot_hash_preserve_state(void) } DECLARE_HOOK(HOOK_SYSJUMP, vboot_hash_preserve_state, HOOK_PRIO_DEFAULT); +#endif + /****************************************************************************/ /* Console commands */ |