From: Thang Nguyen <thang@amperemail.onmicrosoft.com>
To: OpenBMC Maillist <openbmc@lists.ozlabs.org>, ",
Tim Lee" <timlee660101@gmail.com>
Subject: Check on BMC Reboot Cause
Date: Mon, 15 Nov 2021 17:46:28 +0700 [thread overview]
Message-ID: <0653d3ba-7bd6-c01a-741e-8b8cf5ee3655@amperemail.onmicrosoft.com> (raw)
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 -
next reply other threads:[~2021-11-15 10:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 10:46 Thang Nguyen [this message]
2021-11-25 2:10 ` Check on BMC Reboot Cause CS20 CHLi30
2021-11-26 1:29 ` Thang Nguyen
2021-11-29 5:44 ` CS20 CHLi30
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0653d3ba-7bd6-c01a-741e-8b8cf5ee3655@amperemail.onmicrosoft.com \
--to=thang@amperemail.onmicrosoft.com \
--cc=openbmc@lists.ozlabs.org \
--cc=timlee660101@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).