Check on BMC Reboot Cause
CS20 CHLi30
CHLI30 at nuvoton.com
Thu Nov 25 13:10:37 AEDT 2021
Hi Thang,
Sorry for late reply your message.
In my opinion, usually BMC play rule of card and be pulgged in server motherboard.
However, according watchdog.h the definition WDIOF_CARDRESET is more reasonable
for power on reboot BMC card then the other definitions.
In NPCM watchdog driver, we will provide dts flag for customer to design their watchodog
system. For example, we provide card-reset-type, ext1-reset-type and ext2-reset-type.
Customer can define their own reset type according their server motherboard design with BMC card.
card-reset-type = Power ON Reset
ext1-reset-type = Watchdog Reset 0, 1, 2 (depends on your SOC support)
ext2-reset-type = Software Reset 1, 2, 3 (depends on your SOC support)
Then according your SOC support to assign bootstatus as example:
if (rstval & wdt->card_reset)
wdt->wdd.bootstatus |= WDIOF_CARDRESET;
if (rstval & wdt->ext1_reset)
wdt->wdd.bootstatus |= WDIOF_EXTERN1;
if (rstval & wdt->ext2_reset)
wdt->wdd.bootstatus |= WDIOF_EXTERN2;
Sincerely,
Tim
-----Original Message-----
From: openbmc <openbmc-bounces+chli30=nuvoton.com at lists.ozlabs.org> On Behalf Of Thang Nguyen
Sent: Monday, November 15, 2021 6:46 PM
To: OpenBMC Maillist <openbmc at lists.ozlabs.org>; , Tim Lee <timlee660101 at gmail.com>
Subject: Check on BMC Reboot Cause
Hi Tim Lee,
I checked your change at
https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenbmc%2Fphosphor-state-manager%2Fcommit%2F2bfb1efc4bc7e781224e19c05b51e6675f13a488&data=04%7C01%7Cchli30%40nuvoton.com%7C5e09ba4542d844db827108d9a82559f0%7Ca3f24931d4034b4a94f17d83ac638e07%7C0%7C0%7C637726413598056663%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7nPq4H3s1hhZVqSfLwVHas%2F%2FVm8eWZ9ceexUzZ8bvR0%3D&reserved=0
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://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Ftree%2FDocumentation%2Fwatchdog%2Fwatchdog-api.rst&data=04%7C01%7Cchli30%40nuvoton.com%7C5e09ba4542d844db827108d9a82559f0%7Ca3f24931d4034b4a94f17d83ac638e07%7C0%7C0%7C637726413598056663%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=GRpNzdv9PYTVsFWB%2FAE2h0X1lFRXoX4LHOIOOSJb5s4%3D&reserved=0
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 -
________________________________
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
More information about the openbmc
mailing list