openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Check on BMC Reboot Cause
@ 2021-11-15 10:46 Thang Nguyen
  2021-11-25  2:10 ` CS20 CHLi30
  0 siblings, 1 reply; 4+ messages in thread
From: Thang Nguyen @ 2021-11-15 10:46 UTC (permalink / raw)
  To: OpenBMC Maillist, , Tim Lee

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 -

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-29  5:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 10:46 Check on BMC Reboot Cause Thang Nguyen
2021-11-25  2:10 ` CS20 CHLi30
2021-11-26  1:29   ` Thang Nguyen
2021-11-29  5:44     ` CS20 CHLi30

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).