diff options
author | Dino Li <Dino.Li@ite.com.tw> | 2018-05-24 10:30:19 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-28 00:53:29 -0700 |
commit | cadc0f2513cb40a52ae70f66b34ff9f6abaa2250 (patch) | |
tree | d2c2c83359eb5cb1bb6033c681296ca0081244cc /chip | |
parent | 2352723c9f6fa21455e4796db5ca955605aa314f (diff) | |
download | chrome-ec-cadc0f2513cb40a52ae70f66b34ff9f6abaa2250.tar.gz |
it83xx: system: print out message if reset cause is unknown
The message will indicate the reset is caused by which program address
of jump and link instruction.
BRANCH=None
BUG=b:79706847
TEST=No error message under these tests: cold reset, soft reset,
and sysjump.
On bip, declare ".get_cc = NULL" for it83xx tcpm driver. And get
the following message.
log:
--- UART initialized after reboot ---
[Reset cause: unknown]
...
===Unknown reset! jump from f824 or f826===
[0.004504 low power idle task started]
...
Disassembly:
0000f814 <tcpm_get_cc>:
f814: fc 00 push25 $r6, #0 ! {$r6, $fp, $gp, $lp}
f816: 46 30 00 17 sethi $r3, #0x17
f81a: 58 31 8a cc ori $r3, $r3, #0xacc
f81e: 95 04 slli333 $r4, $r0, #4
f820: 88 64 add45 $r3, $r4
f822: a0 da lwi333 $r3, [$r3 + #8]
f824: a0 da lwi333 $r3, [$r3 + #8]
f826: dd 23 jral5 $r3
f828: fc 80 pop25 $r6, #0 ! {$r6, $fp, $gp, $lp}
Change-Id: I2eaf2ad95eb92c68ce6f8240ea6ec90ac2b4a5c9
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1070387
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/it83xx/system.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chip/it83xx/system.c b/chip/it83xx/system.c index 3ff3921d1b..23e832b902 100644 --- a/chip/it83xx/system.c +++ b/chip/it83xx/system.c @@ -9,6 +9,7 @@ #include "cpu.h" #include "ec2i_chip.h" #include "flash.h" +#include "hooks.h" #include "host_command.h" #include "intc.h" #include "registers.h" @@ -80,6 +81,20 @@ static void check_reset_cause(void) system_set_reset_flags(flags); } +static void system_reset_cause_is_unknown(void) +{ + /* No reset cause and not sysjump. */ + if (!system_get_reset_flags() && !system_jumped_to_this_image()) + /* + * We decrease 4 or 2 for "ec_reset_lp" here, that depend on + * which jump and link instruction has executed. + * (jral5: LP=PC+2, jal: LP=PC+4) + */ + ccprintf("===Unknown reset! jump from %x or %x===\n", + ec_reset_lp - 4, ec_reset_lp - 2); +} +DECLARE_HOOK(HOOK_INIT, system_reset_cause_is_unknown, HOOK_PRIO_FIRST); + int system_is_reboot_warm(void) { uint32_t reset_flags; |