summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-06-13 15:54:32 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-06-15 20:13:51 -0700
commit4af07d9b00e8bf9724d60dfd30d6aa3724565a6f (patch)
tree233e245c3febc7acc939e505de206959571b0ca6 /chip
parentdcca1de5288660409a78e5682dc2d445450fe1a5 (diff)
downloadchrome-ec-4af07d9b00e8bf9724d60dfd30d6aa3724565a6f.tar.gz
g: provide an API to set rollback counter to ensure rollback
with the board ID match happening in the RW we need to be able to set the rollback counter to a value which would guarantee a fallback during the next boot. BRANCH=cr50 BUG=b:35586335 TEST=with the rest of the patches verified the ability to set the counter to trigger a fallback on the next reboot. Change-Id: I161f39354e5523121e26e8ad84a791a8b06e5123 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/535976 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/g/system.c7
-rw-r--r--chip/g/system_chip.h9
2 files changed, 14 insertions, 2 deletions
diff --git a/chip/g/system.c b/chip/g/system.c
index f1b45c802e..b3ded8f963 100644
--- a/chip/g/system.c
+++ b/chip/g/system.c
@@ -523,6 +523,13 @@ int system_process_retry_counter(void)
return corrupt_header(newer_image);
}
+void system_ensure_rollback(void)
+{
+ GWRITE_FIELD(PMU, LONG_LIFE_SCRATCH_WR_EN, REG0, 1);
+ GREG32(PMU, LONG_LIFE_SCRATCH0) = RW_BOOT_MAX_RETRY_COUNT + 1;
+ GWRITE_FIELD(PMU, LONG_LIFE_SCRATCH_WR_EN, REG0, 0);
+}
+
int system_rolling_reboot_suspected(void)
{
if (GREG32(PMU, LONG_LIFE_SCRATCH0) > 50) {
diff --git a/chip/g/system_chip.h b/chip/g/system_chip.h
index 251c2d3007..ce63f3eab8 100644
--- a/chip/g/system_chip.h
+++ b/chip/g/system_chip.h
@@ -57,8 +57,7 @@ int system_battery_cutoff_support_required(void);
*/
void system_update_rollback_mask(void);
-/*
- **
+/**
* Scan INFO1 rollback map and infomap fields of both RW and RW_B image
* headers, and return a string showing how many zeros are there at the base
* of in each of these objects.
@@ -68,4 +67,10 @@ void system_update_rollback_mask(void);
*/
void system_get_rollback_bits(char *value, size_t value_size);
+/**
+ * Set the rollback counter to a value which would ensure a rollback on the
+ * next boot.
+ */
+void system_ensure_rollback(void);
+
#endif /* __CROS_EC_SYSTEM_CHIP_H */