Commit 1c894846 authored by Dave Jones's avatar Dave Jones

[PATCH] watchdog nowayout for wdt_pci

Originally from Matt Domsch.
Adds a nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
From 2.4
parent 6127800c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
* *
* Release 0.08. * Release 0.09.
* *
* Fixes * Fixes
* Dave Gregorich : Modularisation and minor bugs * Dave Gregorich : Modularisation and minor bugs
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
* Alan Cox : Split ISA and PCI cards into two drivers * Alan Cox : Split ISA and PCI cards into two drivers
* Jeff Garzik : PCI cleanups * Jeff Garzik : PCI cleanups
* Tigran Aivazian : Restructured wdtpci_init_one() to handle failures * Tigran Aivazian : Restructured wdtpci_init_one() to handle failures
* Matt Domsch : added nowayout and timeout module options
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -83,6 +84,26 @@ static int irq=11; ...@@ -83,6 +84,26 @@ static int irq=11;
#define WD_TIMO (100*60) /* 1 minute */ #define WD_TIMO (100*60) /* 1 minute */
static int timeout_val = WD_TIMO; /* value passed to card */
static int timeout = 60; /* in seconds */
MODULE_PARM(timeout,"i");
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default=60)");
#ifdef CONFIG_WATCHDOG_NOWAYOUT
static int nowayout = 1;
#else
static int nowayout = 0;
#endif
MODULE_PARM(nowayout,"i");
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
static void __init
wdtpci_validate_timeout(void)
{
timeout_val = timeout * 100;
}
#ifndef MODULE #ifndef MODULE
/** /**
...@@ -232,7 +253,7 @@ static void wdtpci_ping(void) ...@@ -232,7 +253,7 @@ static void wdtpci_ping(void)
/* Write a watchdog value */ /* Write a watchdog value */
inb_p(WDT_DC); inb_p(WDT_DC);
wdtpci_ctr_mode(1,2); wdtpci_ctr_mode(1,2);
wdtpci_ctr_load(1,WD_TIMO); /* Timeout */ wdtpci_ctr_load(1,timeout_val); /* Timeout */
outb_p(0, WDT_DC); outb_p(0, WDT_DC);
} }
...@@ -357,9 +378,9 @@ static int wdtpci_open(struct inode *inode, struct file *file) ...@@ -357,9 +378,9 @@ static int wdtpci_open(struct inode *inode, struct file *file)
{ {
return -EBUSY; return -EBUSY;
} }
#ifdef CONFIG_WATCHDOG_NOWAYOUT if (nowayout) {
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
#endif }
/* /*
* Activate * Activate
*/ */
...@@ -385,7 +406,7 @@ static int wdtpci_open(struct inode *inode, struct file *file) ...@@ -385,7 +406,7 @@ static int wdtpci_open(struct inode *inode, struct file *file)
wdtpci_ctr_mode(1,2); wdtpci_ctr_mode(1,2);
wdtpci_ctr_mode(2,1); wdtpci_ctr_mode(2,1);
wdtpci_ctr_load(0,20833); /* count at 100Hz */ wdtpci_ctr_load(0,20833); /* count at 100Hz */
wdtpci_ctr_load(1,WD_TIMO);/* Timeout 60 seconds */ wdtpci_ctr_load(1,timeout_val); /* Timeout */
/* DO NOT LOAD CTR2 on PCI card! -- JPN */ /* DO NOT LOAD CTR2 on PCI card! -- JPN */
outb_p(0, WDT_DC); /* Enable */ outb_p(0, WDT_DC); /* Enable */
return 0; return 0;
...@@ -412,10 +433,10 @@ static int wdtpci_release(struct inode *inode, struct file *file) ...@@ -412,10 +433,10 @@ static int wdtpci_release(struct inode *inode, struct file *file)
{ {
if(minor(inode->i_rdev)==WATCHDOG_MINOR) if(minor(inode->i_rdev)==WATCHDOG_MINOR)
{ {
#ifndef CONFIG_WATCHDOG_NOWAYOUT if (!nowayout) {
inb_p(WDT_DC); /* Disable counters */ inb_p(WDT_DC); /* Disable counters */
wdtpci_ctr_load(2,0); /* 0 length reset pulses now */ wdtpci_ctr_load(2,0); /* 0 length reset pulses now */
#endif }
clear_bit(0, &wdt_is_open ); clear_bit(0, &wdt_is_open );
} }
return 0; return 0;
...@@ -617,6 +638,8 @@ static int __init wdtpci_init(void) ...@@ -617,6 +638,8 @@ static int __init wdtpci_init(void)
if (rc < 1) if (rc < 1)
return -ENODEV; return -ENODEV;
wdtpci_validate_timeout();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment