ELOG: Refactor watchdog_tombstone
The symbol watchdog_tombstone is not really about ChromeOS but ELOG instead. This prepares for furher move of the watchdog_tombstone implementation. Change-Id: I8446fa1a395b2d17912a23b87b83277c80828874 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63300 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
24a20e4d21
commit
662353ac3e
|
@ -76,6 +76,7 @@ DECLARE_REGION(pdpt)
|
||||||
DECLARE_OPTIONAL_REGION(opensbi)
|
DECLARE_OPTIONAL_REGION(opensbi)
|
||||||
DECLARE_OPTIONAL_REGION(bl31)
|
DECLARE_OPTIONAL_REGION(bl31)
|
||||||
DECLARE_REGION(transfer_buffer)
|
DECLARE_REGION(transfer_buffer)
|
||||||
|
DECLARE_OPTIONAL_REGION(watchdog_tombstone)
|
||||||
|
|
||||||
/* Returns true when pre-RAM symbols are known to the linker.
|
/* Returns true when pre-RAM symbols are known to the linker.
|
||||||
* (Does not necessarily mean that the memory is accessible.) */
|
* (Does not necessarily mean that the memory is accessible.) */
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
/* functions implemented in watchdog.c */
|
/* functions implemented in watchdog.c */
|
||||||
void mark_watchdog_tombstone(void);
|
void mark_watchdog_tombstone(void);
|
||||||
void reboot_from_watchdog(void);
|
void reboot_from_watchdog(void);
|
||||||
|
bool reset_watchdog_tombstone(void);
|
||||||
#else
|
#else
|
||||||
static inline void mark_watchdog_tombstone(void) { return; }
|
static inline void mark_watchdog_tombstone(void) { return; }
|
||||||
static inline void reboot_from_watchdog(void) { return; }
|
static inline void reboot_from_watchdog(void) { return; }
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
|
|
||||||
#ifndef __CHROMEOS_SYMBOLS_H
|
|
||||||
#define __CHROMEOS_SYMBOLS_H
|
|
||||||
|
|
||||||
#include <symbols.h>
|
|
||||||
|
|
||||||
DECLARE_OPTIONAL_REGION(watchdog_tombstone)
|
|
||||||
|
|
||||||
#endif /* __CHROMEOS_SYMBOLS_H */
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <symbols.h>
|
#include <symbols.h>
|
||||||
|
|
||||||
#include "chromeos.h"
|
#include "chromeos.h"
|
||||||
#include "symbols.h"
|
|
||||||
|
|
||||||
#define WATCHDOG_TOMBSTONE_MAGIC 0x9d2f41a7
|
#define WATCHDOG_TOMBSTONE_MAGIC 0x9d2f41a7
|
||||||
|
|
||||||
|
@ -21,11 +20,7 @@ static void elog_handle_watchdog_tombstone(void *unused)
|
||||||
if (CONFIG(CHROMEOS_USE_EC_WATCHDOG_FLAG))
|
if (CONFIG(CHROMEOS_USE_EC_WATCHDOG_FLAG))
|
||||||
flag |= google_chromeec_get_ap_watchdog_flag();
|
flag |= google_chromeec_get_ap_watchdog_flag();
|
||||||
|
|
||||||
if (REGION_SIZE(watchdog_tombstone)) {
|
flag |= reset_watchdog_tombstone();
|
||||||
flag |= (read32(_watchdog_tombstone) ==
|
|
||||||
WATCHDOG_TOMBSTONE_MAGIC);
|
|
||||||
write32(_watchdog_tombstone, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
elog_add_event(ELOG_TYPE_ASYNC_HW_TIMER_EXPIRED);
|
elog_add_event(ELOG_TYPE_ASYNC_HW_TIMER_EXPIRED);
|
||||||
|
@ -34,6 +29,16 @@ static void elog_handle_watchdog_tombstone(void *unused)
|
||||||
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY,
|
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY,
|
||||||
elog_handle_watchdog_tombstone, NULL);
|
elog_handle_watchdog_tombstone, NULL);
|
||||||
|
|
||||||
|
bool reset_watchdog_tombstone(void)
|
||||||
|
{
|
||||||
|
if (!REGION_SIZE(watchdog_tombstone))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool flag = (read32(_watchdog_tombstone) == WATCHDOG_TOMBSTONE_MAGIC);
|
||||||
|
write32(_watchdog_tombstone, 0);
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
void mark_watchdog_tombstone(void)
|
void mark_watchdog_tombstone(void)
|
||||||
{
|
{
|
||||||
assert(REGION_SIZE(watchdog_tombstone));
|
assert(REGION_SIZE(watchdog_tombstone));
|
||||||
|
|
Loading…
Reference in New Issue