diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-08-07 19:11:45 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-08 20:19:46 -0700 |
commit | 3b24f8ac3f13969b745bae6239d2b7780d6e79cf (patch) | |
tree | cc0a7228e0364342819f28b3696246b75d8e29c5 | |
parent | 37784e1e868fc9c722a80dbf1179a72782c87056 (diff) | |
download | chrome-ec-stabilize-8688.B.tar.gz |
cr50: try recovering from rolling rebootsstabilize-8688.B
Sometimes a perfectly sane image enters rolling reboot mode in case
some data change triggered a bug which prevents the normal startup and
causes a reset.
The most likely task causing in in case of cr50 would be the tpm task.
Let's add another check of the restart counter: should it reach the
value of 50, do not start the TPM task.
BRANCH=none
BUG=chrome-os-partner:55708
TEST=with this code plus an unaligned access introduced in tpm
initialization sequence in both RW_A and RW_B, program the full
image on the dev board.
Observe the device reset 50 time is rapid succession and then
stop with the following message on the console:
Bldr |511709
retry|50
Himg =4F992103..408D193E
Hfss =384E4655..EE13EBD0
Hinf =44D21600..B70529BD
jump @00044000
--- UART initialized after reboot ---
[Reset cause: rtc-alarm]
[Image: RW, cr50_v1.1.5044-8d6f7a2+ private-cr51:v0.0.68-633229c ...
+ cryptoc:v0.0.4-5319e83 2016-08-07 19:37:16 vbendeb@kvasha]
[0.004130 Inits done]
[0.006919 Active NVram partition set to 0]
Console is enabled; type HELP for help.
> system_rolling_reboot_suspected: roling reboots suspected. Try \
powercycling to clear
this condition.
[0.010502 Task 2 (TPM) exited!]
Change-Id: I6b08c5c1a02da9edf9bdf394e57cc56d2e595ad1
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366892
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | chip/g/system.c | 16 | ||||
-rw-r--r-- | common/tpm_registers.c | 3 | ||||
-rw-r--r-- | include/system.h | 8 |
3 files changed, 27 insertions, 0 deletions
diff --git a/chip/g/system.c b/chip/g/system.c index 9bc3a26b8e..461f05a462 100644 --- a/chip/g/system.c +++ b/chip/g/system.c @@ -353,6 +353,22 @@ int system_process_retry_counter(void) */ return corrupt_other_header(other); } + +int system_rolling_reboot_suspected(void) +{ + if (GREG32(PMU, LONG_LIFE_SCRATCH0) > 50) { + /* + * The chip has restarted 50 times without the restart counter + * cleared. There must be something wrong going, the chip is + * likely in rolling reboot. + */ + ccprintf("%s: Try powercycling to clear this condition.\n", + __func__); + return 1; + } + + return 0; +} #endif uint32_t system_get_board_properties(void) diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 94b1636b0a..6811c1d758 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -571,6 +571,9 @@ static void call_extension_command(struct tpm_cmd_header *tpmh, void tpm_task(void) { + if (system_rolling_reboot_suspected()) + return; + tpm_init(); sps_tpm_enable(); while (1) { diff --git a/include/system.h b/include/system.h index 1c04ee3404..7b08683ac0 100644 --- a/include/system.h +++ b/include/system.h @@ -489,4 +489,12 @@ uint32_t system_get_board_properties(void); */ uint32_t system_board_properties_callback(void); +/** + * A function provided by some platforms to hint that something is going + * wrong. + * + * @return a boolean, set to True if rolling reboot condition is suspected. + */ +int system_rolling_reboot_suspected(void); + #endif /* __CROS_EC_SYSTEM_H */ |