Check on BMC Reboot Cause
Thang Nguyen
thang at amperemail.onmicrosoft.com
Mon Nov 15 21:46:28 AEDT 2021
Hi Tim Lee,
I checked your change at
https://github.com/openbmc/phosphor-state-manager/commit/2bfb1efc4bc7e781224e19c05b51e6675f13a488
to support BMC Reboot Cause feature. But I does not understand about why
WDIOF_EXTERN1 is translated to watchdog reboot and WDIOF_CARDRESET is
translated to Power ON reboot. Can you help explain about it?
I checked on
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/watchdog/watchdog-api.rst
but the explanation seems not clear.
Note that we are trying to make Aspeed watchdog support this as below
but I still not clear if the use of WDIOF_CARDRESET and WDIOF_EXTERN1
are correct:
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index 436571b6fc79..c5c3f80dfc48 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -54,6 +54,7 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
#define WDT_CTRL_ENABLE BIT(0)
#define WDT_TIMEOUT_STATUS 0x10
#define WDT_TIMEOUT_STATUS_BOOT_SECONDARY BIT(1)
+#define WDT_EVENT_COUNTER_MASK (0xFF << 8)
#define WDT_CLEAR_TIMEOUT_STATUS 0x14
#define WDT_CLEAR_TIMEOUT_AND_BOOT_CODE_SELECTION BIT(0)
@@ -369,13 +370,19 @@ static int aspeed_wdt_probe(struct platform_device
*pdev)
status = readl(wdt->base + WDT_TIMEOUT_STATUS);
if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) {
- wdt->wdd.bootstatus = WDIOF_CARDRESET;
-
if (of_device_is_compatible(np, "aspeed,ast2400-wdt") ||
of_device_is_compatible(np, "aspeed,ast2500-wdt"))
wdt->wdd.groups = bswitch_groups;
}
+ if(status & WDT_EVENT_COUNTER_MASK) {
+ // Reset cause by WatchDog
+ wdt->wdd.bootstatus |= WDIOF_EXTERN1;
+ } else {
+ // Reset cause by Power On Reset
+ wdt->wdd.bootstatus |= WDIOF_CARDRESET;
+ }
+
dev_set_drvdata(dev, wdt);
return devm_watchdog_register_device(dev, &wdt->wdd);
Thanks,
Thang Q. Nguyen -
More information about the openbmc
mailing list