summaryrefslogtreecommitdiff
path: root/common/vboot_hash.c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-08-15 16:34:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-21 01:07:55 -0700
commit729a4ba2bdc20675e24ed9e7d0a98d19934d72f8 (patch)
treee6096452677021e40378d7e50aaa722a9257c048 /common/vboot_hash.c
parent60b77099e0b7a0bd40e7504c2752091c378a2f1d (diff)
downloadchrome-ec-729a4ba2bdc20675e24ed9e7d0a98d19934d72f8.tar.gz
EFS: Switch active slot when current slot is invalid
When EFS finds the active slot is invalid, it tries the other slot. This patch makes the other slot active so that the following boots will try the other slot first. This patch also replaces enum flash_rw_slot with system_image_copy_t. The new APIs are therefore renamed from *_slot to *_copy. Basically, this makes vboot see slots as a conceptual place instead of physical spaces bound to flash storage. BUG=b:65028930 BRANCH=none TEST=On Fizz, verify: 1. RW_B is old and updated by soft sync. RW_B is activated and executed after reboot. System continues to boot to OS. 2. RW_A is old and updated by soft sync. RW_A is activated and executed after reboot. System continues to boot to OS. Change-Id: Icf97da13e651e7a931b9d507052b9422566eb16c Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/648449
Diffstat (limited to 'common/vboot_hash.c')
-rw-r--r--common/vboot_hash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index fab56c1d0a..21a78aa585 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -261,7 +261,7 @@ static void vboot_hash_init(void)
#endif
{
/* Start computing the hash of RW firmware */
- vboot_hash_start(flash_get_rw_offset(flash_get_active_slot()),
+ vboot_hash_start(flash_get_rw_offset(system_get_active_copy()),
get_rw_size(), NULL, 0);
}
}
@@ -298,9 +298,9 @@ static int get_offset(int offset)
if (offset == EC_VBOOT_HASH_OFFSET_RO)
return CONFIG_EC_PROTECTED_STORAGE_OFF + CONFIG_RO_STORAGE_OFF;
if (offset == EC_VBOOT_HASH_OFFSET_ACTIVE)
- return flash_get_rw_offset(flash_get_active_slot());
+ return flash_get_rw_offset(system_get_active_copy());
if (offset == EC_VBOOT_HASH_OFFSET_UPDATE)
- return flash_get_rw_offset(flash_get_update_slot());
+ return flash_get_rw_offset(system_get_update_copy());
return offset;
}