Skip to content

Commit 081574f

Browse files
CyberShadowWim Van Sebroeck
authored andcommitted
watchdog: sp5100_tco: Add "action" module parameter
Allow configuring the "action" bit, as documented in [1]. Previously, the only action supported by this module was to reset the system (0). It can now be configured to power off (1) instead. [1]: https://www.amd.com/system/files/TechDocs/44413.pdf Signed-off-by: Vladimir Panteleev <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 8ed2dc4 commit 081574f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/watchdog/sp5100_tco.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ static struct pci_dev *sp5100_tco_pci;
6565

6666
/* module parameters */
6767

68+
#define WATCHDOG_ACTION 0
69+
static bool action = WATCHDOG_ACTION;
70+
module_param(action, bool, 0);
71+
MODULE_PARM_DESC(action, "Action taken when watchdog expires, 0 to reset, 1 to poweroff (default="
72+
__MODULE_STRING(WATCHDOG_ACTION) ")");
73+
6874
#define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat. */
6975
static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
7076
module_param(heartbeat, int, 0);
@@ -297,8 +303,11 @@ static int sp5100_tco_timer_init(struct sp5100_tco *tco)
297303
if (val & SP5100_WDT_FIRED)
298304
wdd->bootstatus = WDIOF_CARDRESET;
299305

300-
/* Set watchdog action to reset the system */
301-
val &= ~SP5100_WDT_ACTION_RESET;
306+
/* Set watchdog action */
307+
if (action)
308+
val |= SP5100_WDT_ACTION_RESET;
309+
else
310+
val &= ~SP5100_WDT_ACTION_RESET;
302311
writel(val, SP5100_WDT_CONTROL(tco->tcobase));
303312

304313
/* Set a reasonable heartbeat before we stop the timer */

0 commit comments

Comments
 (0)