summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-08-02 16:35:48 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-03 19:40:48 -0700
commit96e05799536c264b63d11604429ed760a4e019d2 (patch)
treed5aaa8615f3105a58120b9e129d46c87f05a9570 /chip
parentfc55bb5026a86fffc54a291c16b22ccfb5d4b2c0 (diff)
downloadchrome-ec-96e05799536c264b63d11604429ed760a4e019d2.tar.gz
g: Always reboot on watchdog or lockup
Watchdog events are delivered as internal ARM interrupts, so we can print a crash dump and then reboot. However, if interrupts are disabled when the watchdog triggers, it just hangs forever. This CL configures the watchdog and processor lockup events to trigger a hard reboot through a security alert. This is the only way to make these events non-maskable. BUG=chrome-os-partner:52597 BRANCH=none TEST=manual I added this console command: static int command_hang(int argc, char **argv) { interrupt_disable(); while (1) ; return EC_ERROR_UNKNOWN; /* Not reached */ } DECLARE_CONSOLE_COMMAND(hang, command_hang, NULL, "Hang", NULL); Without this CL, that command locked the SoC up until it was reset from outside. With this CL, it reboots after a couple of seconds. Change-Id: I773c0138fd2243cdbcdd86b2c7138520155d7920 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/365531 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/g/system.c2
-rw-r--r--chip/g/watchdog.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/chip/g/system.c b/chip/g/system.c
index 46af21174d..80b55601d9 100644
--- a/chip/g/system.c
+++ b/chip/g/system.c
@@ -47,7 +47,7 @@ static void check_reset_cause(void)
flags |= RESET_FLAG_OTHER;
}
- /* TODO(crosbug.com/p/47289): This bit doesn't work */
+ /* This bit doesn't work. See crosbug.com/p/47289. */
if (g_rstsrc & GC_PMU_RSTSRC_WDOG_MASK)
flags |= RESET_FLAG_WATCHDOG;
diff --git a/chip/g/watchdog.c b/chip/g/watchdog.c
index 0d07ddec4b..0c565f3850 100644
--- a/chip/g/watchdog.c
+++ b/chip/g/watchdog.c
@@ -85,9 +85,6 @@ DECLARE_HOOK(HOOK_TICK, watchdog_reload, HOOK_PRIO_DEFAULT);
int watchdog_init(void)
{
- /* Enable clocks */
- /* TODO_FPGA add relevant clock init here, when supported. */
-
/* Unlock watchdog registers */
GR_WATCHDOG_LOCK = WATCHDOG_MAGIC_WORD;
@@ -106,5 +103,9 @@ int watchdog_init(void)
/* Enable watchdog interrupt */
task_enable_irq(GC_IRQNUM_WATCHDOG0_WDOGINT);
+ /* Reboot hard if the watchdog fires or the processor locks up */
+ GWRITE_FIELD(GLOBALSEC, ALERT_CONTROL, WATCHDOG_RESET_SHUTDOWN_EN, 1);
+ GWRITE_FIELD(GLOBALSEC, ALERT_CONTROL, PROC_LOCKUP_SHUTDOWN_EN, 1);
+
return EC_SUCCESS;
}