提交 6fd65601 编写于 作者: S Samuel Tardieu 提交者: Wim Van Sebroeck

[WATCHDOG] Add w83697h_wdt early_disable option

Pádraig Brady requested the possibility of not disabling the watchdog
at module load time or kernel boot time if it had been previously enabled
in the bios. It may help rebooting the machine if it freezes before the
userland daemon kicks in.
Signed-off-by: NSamuel Tardieu <sam@rfc1149.net>
Cc: Pádraig Brady <P@draigBrady.com>
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 5794a9f4
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#define WATCHDOG_NAME "w83697hf/hg WDT" #define WATCHDOG_NAME "w83697hf/hg WDT"
#define PFX WATCHDOG_NAME ": " #define PFX WATCHDOG_NAME ": "
#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
#define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */
static unsigned long wdt_is_open; static unsigned long wdt_is_open;
static char expect_close; static char expect_close;
...@@ -62,6 +63,10 @@ static int nowayout = WATCHDOG_NOWAYOUT; ...@@ -62,6 +63,10 @@ static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0); module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static int early_disable = WATCHDOG_EARLY_DISABLE;
module_param(early_disable, int, 0);
MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")");
/* /*
* Kernel methods. * Kernel methods.
*/ */
...@@ -178,6 +183,22 @@ wdt_disable(void) ...@@ -178,6 +183,22 @@ wdt_disable(void)
spin_unlock(&io_lock); spin_unlock(&io_lock);
} }
static unsigned char
wdt_running(void)
{
unsigned char t;
spin_lock(&io_lock);
w83697hf_select_wdt();
t = w83697hf_get_reg(0xF4); /* Read timer */
w83697hf_deselect_wdt();
spin_unlock(&io_lock);
return t;
}
static int static int
wdt_set_heartbeat(int t) wdt_set_heartbeat(int t)
{ {
...@@ -394,7 +415,11 @@ wdt_init(void) ...@@ -394,7 +415,11 @@ wdt_init(void)
} }
w83697hf_init(); w83697hf_init();
wdt_disable(); /* Disable watchdog until first use */ if (early_disable) {
if (wdt_running())
printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n");
wdt_disable();
}
if (wdt_set_heartbeat(timeout)) { if (wdt_set_heartbeat(timeout)) {
wdt_set_heartbeat(WATCHDOG_TIMEOUT); wdt_set_heartbeat(WATCHDOG_TIMEOUT);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册