mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
panic: Send host event on panic detect
If a panic caused us to reboot, send a host event to notify the AP. BUG=chrome-os-partner:36985 TEST=Manual on Samus. Trigger EC panic, verify that "Panic Reset in previous boot" is seen in /var/log/eventlog. BRANCH=Samus Change-Id: Icf0d00a8cfc7aa788f3ceadd65fe3139f40df503 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/252410 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
accd0da789
commit
a8628526a3
@@ -115,6 +115,20 @@ struct panic_data *panic_get_data(void)
|
||||
return pdata_ptr->magic == PANIC_DATA_MAGIC ? pdata_ptr : NULL;
|
||||
}
|
||||
|
||||
static void panic_init(void)
|
||||
{
|
||||
#ifdef CONFIG_HOSTCMD_EVENTS
|
||||
struct panic_data *addr = panic_get_data();
|
||||
|
||||
/* Notify host of new panic event */
|
||||
if (addr && !(addr->flags & PANIC_DATA_FLAG_OLD_HOSTEVENT)) {
|
||||
host_set_single_event(EC_HOST_EVENT_PANIC);
|
||||
addr->flags |= PANIC_DATA_FLAG_OLD_HOSTEVENT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, panic_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
#ifdef CONFIG_CMD_STACKOVERFLOW
|
||||
static void stack_overflow_recurse(int n)
|
||||
{
|
||||
|
||||
@@ -279,6 +279,9 @@ enum host_event_code {
|
||||
/* Battery Status flags have changed */
|
||||
EC_HOST_EVENT_BATTERY_STATUS = 23,
|
||||
|
||||
/* EC encountered a panic, triggering a reset */
|
||||
EC_HOST_EVENT_PANIC = 24,
|
||||
|
||||
/*
|
||||
* The high bit of the event mask is not used as a host event code. If
|
||||
* it reads back as set, then the entire event mask should be
|
||||
|
||||
@@ -62,11 +62,13 @@ struct panic_data {
|
||||
|
||||
/* Flags for panic_data.flags */
|
||||
/* panic_data.frame is valid */
|
||||
#define PANIC_DATA_FLAG_FRAME_VALID (1 << 0)
|
||||
#define PANIC_DATA_FLAG_FRAME_VALID (1 << 0)
|
||||
/* Already printed at console */
|
||||
#define PANIC_DATA_FLAG_OLD_CONSOLE (1 << 1)
|
||||
#define PANIC_DATA_FLAG_OLD_CONSOLE (1 << 1)
|
||||
/* Already returned via host command */
|
||||
#define PANIC_DATA_FLAG_OLD_HOSTCMD (1 << 2)
|
||||
#define PANIC_DATA_FLAG_OLD_HOSTCMD (1 << 2)
|
||||
/* Already reported via host event */
|
||||
#define PANIC_DATA_FLAG_OLD_HOSTEVENT (1 << 3)
|
||||
|
||||
/**
|
||||
* Write a string to the panic reporting device
|
||||
|
||||
Reference in New Issue
Block a user