diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2015-01-13 14:42:18 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-14 03:16:02 +0000 |
commit | 3951165fe9182cb6c9981d0a69c36765c7fe8916 (patch) | |
tree | 9e36579a088495978ecf1e132f1c3753f452bef8 | |
parent | 6527d9e8411fe7067eab405890e87f3d81b8ec74 (diff) | |
download | chrome-ec-3951165fe9182cb6c9981d0a69c36765c7fe8916.tar.gz |
hoho/dingdong: support unprotected RO partition
If the RO firmware has a different view of the protection than
the RW copy, we should not change the option bytes (write protection
settings) in RW else we will trigger a reboot loop : RW protects and reset,
then RO unprotects, resets and jump to RW, RW protects and reset again ...
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=samus
BUG=chrome-os-partner:35383
TEST=craft a firmware image whose RO partition doesn't include commit
42d0104 (no virtual WP, no RDP set) and RW partition has everything
including this patch, see that HoHo no longer reboots in a loop.
Change-Id: I4cbdbf25a96cb6fb7cbabc7f2d1dc76d3a2a9e36
Reviewed-on: https://chromium-review.googlesource.com/240561
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | chip/stm32/flash-f.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/stm32/flash-f.c b/chip/stm32/flash-f.c index 6f334b94a2..1fa809a449 100644 --- a/chip/stm32/flash-f.c +++ b/chip/stm32/flash-f.c @@ -406,12 +406,20 @@ static void unprotect_all_blocks(void) int flash_pre_init(void) { + uint32_t reset_flags = system_get_reset_flags(); uint32_t prot_flags = flash_get_protect(); int need_reset = 0; if (flash_physical_restore_state()) return EC_SUCCESS; + /* + * If we have already jumped between images, an earlier image could + * have applied write protection. Nothing additional needs to be done. + */ + if (reset_flags & RESET_FLAG_SYSJUMP) + return EC_SUCCESS; + if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) { if ((prot_flags & EC_FLASH_PROTECT_RO_AT_BOOT) && !(prot_flags & EC_FLASH_PROTECT_RO_NOW)) { |