summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott <scollyer@chromium.org>2017-02-06 17:15:00 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-07 20:14:33 -0800
commit3b997a8d16179bbd8770f38337c531222c597638 (patch)
tree24db5a5eed6b401a9a59131b8aa94a2b1f5ca6cc
parente1d255118e493e41d7ca16e8315a70856d4b4643 (diff)
downloadchrome-ec-3b997a8d16179bbd8770f38337c531222c597638.tar.gz
cr50: Check if inactive RW region needs to be invalidated
There is no need to invalidate the inactive RW image if it's already been done. Check the magic area of the header and if already 0s, then set *response_size and return VENDOR_RC_SUCCESS. BUG=chrome-os-partner:62588 BRANCH=none TEST=manual Update H1 FW on Eve. Using 'ver' command verify that it has valid A/B RW images. Log into chromeos and see console messages indicating that inactive image is being invalidated and via 'ver' command. Reboot via H1 console and see that this time the message vc_invalidate_inactive_rw: Inactive region already corrupted is displayed. Change-Id: I0894d456fdc63f64fc7272ad55d75ba94dbe94c4 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/438787 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@google.com>
-rw-r--r--board/cr50/board.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index adaa711f93..61543647bf 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -1259,6 +1259,16 @@ static enum vendor_cmd_rc vc_invalidate_inactive_rw(enum vendor_cmd_cc code,
get_program_memory_addr(SYSTEM_IMAGE_RW);
}
+ *response_size = 0;
+ /*
+ * First check to see if the inactive region has already been
+ * invalidated.
+ */
+ if (!header->magic) {
+ CPRINTS("%s: Inactive region already corrupted", __func__);
+ return VENDOR_RC_SUCCESS;
+ }
+
/* save the original flash region6 register values */
ctrl = GREAD(GLOBALSEC, FLASH_REGION6_CTRL);
base_addr = GREG32(GLOBALSEC, FLASH_REGION6_BASE_ADDR);
@@ -1285,8 +1295,6 @@ static enum vendor_cmd_rc vc_invalidate_inactive_rw(enum vendor_cmd_cc code,
GREG32(GLOBALSEC, FLASH_REGION6_SIZE) = size;
GREG32(GLOBALSEC, FLASH_REGION6_CTRL) = ctrl;
- *response_size = 0;
-
return VENDOR_RC_SUCCESS;
}
DECLARE_VENDOR_COMMAND(VENDOR_CC_INVALIDATE_INACTIVE_RW,