summaryrefslogtreecommitdiff
path: root/include/system.h
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2016-12-15 14:21:56 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-21 00:43:38 -0800
commit4692be2957e102ad937d34c9eeccb76dca06ecff (patch)
tree980423d6b9c4a0a90d57064f35a04d9aa955cb39 /include/system.h
parent167f7e51d8e7693a277077d6c24294d2997e1c55 (diff)
downloadchrome-ec-4692be2957e102ad937d34c9eeccb76dca06ecff.tar.gz
cr50: keep wp and console state through deep sleep
After every reboot, we were resetting the write protect and console lock states back to default. With this change the wp and lock states will be preserved through deep sleep. They will still be reset on any other type of reboot (like Power On reset or panic). The states are also cleared if the system detects a rollback even when booting from the deep sleep. With this patch it is going to be impossible to remove hardware write protection guarding writes into AP and EC firmware flash, unless the cr50 console is unlocked. Locking the console would reinstate hardware write protection automatically even if it was disabled when the console was unlocked. Two long life scratch register 1 bits are used to keep the console and write protect states over resets. To make code cleaner bitmap assignments of the long life scratch register is put in its own include file. BUG=chrome-os-partner:58961 BRANCH=none TEST=manual On prod/dev images verify that the default wp and console lock states are still correct. change the lock and write protect states from the default and verify they are preserved through deep sleep. reboot cr50 and make sure that they are reset. unlock the console and enable flash writes, then set fallback counter on cr50 to the value of 6 (rw 0x40000128 1; rw 0x4000012c 6) and put the AP into deep sleep by hitting Alt-H-VolUp. In five minutes press the power button on the device to bring it back from s5. Observe cr50 fall back to an older image and console lock and wp disabled. Change-Id: Ie7e62cb0b2eda49b04a592ee1d0903e83246b045 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/420812 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'include/system.h')
-rw-r--r--include/system.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/system.h b/include/system.h
index c8b7c8ee97..4df0fb1bad 100644
--- a/include/system.h
+++ b/include/system.h
@@ -488,4 +488,10 @@ void system_clear_retry_counter(void);
*/
int system_rolling_reboot_suspected(void);
+/**
+ * Compare the rw headers to check if there was a rollback.
+ *
+ * @return a boolean, set to True if a rollback is detected.
+ */
+int system_rollback_detected(void);
#endif /* __CROS_EC_SYSTEM_H */