google/chromeos: Support AP watchdog flag from Chrome EC

After ChromiumOS CL:1293132 and CL:1295890, Chrome EC can store the flag
telling if the last reboot was triggered by AP watchdog for some boards
(e.g., Kukui).

This CL adds a new function google_chromeec_get_ap_watchdog_flag(),
which reads the AP watchdog flag from Chrome EC, and updates the tables
of reset causes and reset flags.

A new Kconfig option CHROMEOS_USE_EC_WATCHDOG_FLAG is added for
elog_handle_watchdog_tombstone() to determine if watchdog reset was
triggered by the AP watchdog flag from EC instead of the tombstone in
AP.

BUG=b:109900671,b:118654976
BRANCH=none
TEST=test with https://review.coreboot.org/c/coreboot/+/31843

Change-Id: I7a970666a8c6da32ac1c6af8280e808fe7fc106d
Signed-off-by: You-Cheng Syu <youcheng@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31834
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
You-Cheng Syu
2019-03-12 13:02:18 +08:00
committed by Patrick Georgi
parent 8d6ea6a491
commit 85bb874c9c
4 changed files with 46 additions and 17 deletions

View File

@ -89,5 +89,11 @@ config CHROMEOS_DISABLE_PLATFORM_HIERARCHY_ON_RESUME
on normal boot as well as resume and coreboot is only involved
in the resume piece w.r.t. the platform hierarchy.
config CHROMEOS_USE_EC_WATCHDOG_FLAG
bool
default n
help
Use the AP watchdog flag stored in EC.
endif # CHROMEOS
endmenu

View File

@ -17,6 +17,7 @@
#include <assert.h>
#include <bootstate.h>
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <elog.h>
#include <reset.h>
#include <symbols.h>
@ -30,13 +31,19 @@ DECLARE_OPTIONAL_REGION(watchdog_tombstone);
static void elog_handle_watchdog_tombstone(void *unused)
{
if (!REGION_SIZE(watchdog_tombstone))
return;
bool flag = false;
if (read32(_watchdog_tombstone) == WATCHDOG_TOMBSTONE_MAGIC)
if (CONFIG(CHROMEOS_USE_EC_WATCHDOG_FLAG))
flag |= google_chromeec_get_ap_watchdog_flag();
if (REGION_SIZE(watchdog_tombstone)) {
flag |= (read32(_watchdog_tombstone) ==
WATCHDOG_TOMBSTONE_MAGIC);
write32(_watchdog_tombstone, 0);
}
if (flag)
elog_add_event(ELOG_TYPE_ASYNC_HW_TIMER_EXPIRED);
write32(_watchdog_tombstone, 0);
}
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY,