aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_watchdog.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
committerLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
commit64e47488c913ac704d465a6af86a26786d1412a5 (patch)
treed3b0148592963dcde26e4bb35ddfec8b1eaf8e23 /drivers/char/ipmi/ipmi_watchdog.c
parent4a35a46bf1cda4737c428380d1db5d15e2590d18 (diff)
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
Merge linux-2.6 with linux-acpi-2.6
Diffstat (limited to 'drivers/char/ipmi/ipmi_watchdog.c')
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index d35a953961cb..e71aaae855ad 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -53,8 +53,6 @@
53 53
54#define PFX "IPMI Watchdog: " 54#define PFX "IPMI Watchdog: "
55 55
56#define IPMI_WATCHDOG_VERSION "v33"
57
58/* 56/*
59 * The IPMI command/response information for the watchdog timer. 57 * The IPMI command/response information for the watchdog timer.
60 */ 58 */
@@ -259,7 +257,7 @@ static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg,
259 257
260 data[1] = 0; 258 data[1] = 0;
261 WDOG_SET_TIMEOUT_ACT(data[1], ipmi_watchdog_state); 259 WDOG_SET_TIMEOUT_ACT(data[1], ipmi_watchdog_state);
262 if (pretimeout > 0) { 260 if ((pretimeout > 0) && (ipmi_watchdog_state != WDOG_TIMEOUT_NONE)) {
263 WDOG_SET_PRETIMEOUT_ACT(data[1], preaction_val); 261 WDOG_SET_PRETIMEOUT_ACT(data[1], preaction_val);
264 data[2] = pretimeout; 262 data[2] = pretimeout;
265 } else { 263 } else {
@@ -659,19 +657,18 @@ static ssize_t ipmi_read(struct file *file,
659 657
660static int ipmi_open(struct inode *ino, struct file *filep) 658static int ipmi_open(struct inode *ino, struct file *filep)
661{ 659{
662 switch (iminor(ino)) 660 switch (iminor(ino)) {
663 { 661 case WATCHDOG_MINOR:
664 case WATCHDOG_MINOR: 662 if (test_and_set_bit(0, &ipmi_wdog_open))
665 if(test_and_set_bit(0, &ipmi_wdog_open))
666 return -EBUSY; 663 return -EBUSY;
667 664
668 /* Don't start the timer now, let it start on the 665 /* Don't start the timer now, let it start on the
669 first heartbeat. */ 666 first heartbeat. */
670 ipmi_start_timer_on_heartbeat = 1; 667 ipmi_start_timer_on_heartbeat = 1;
671 return nonseekable_open(ino, filep); 668 return nonseekable_open(ino, filep);
672 669
673 default: 670 default:
674 return (-ENODEV); 671 return (-ENODEV);
675 } 672 }
676} 673}
677 674
@@ -817,15 +814,19 @@ static void ipmi_register_watchdog(int ipmi_intf)
817static int 814static int
818ipmi_nmi(void *dev_id, struct pt_regs *regs, int cpu, int handled) 815ipmi_nmi(void *dev_id, struct pt_regs *regs, int cpu, int handled)
819{ 816{
817 /* If we are not expecting a timeout, ignore it. */
818 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE)
819 return NOTIFY_DONE;
820
820 /* If no one else handled the NMI, we assume it was the IPMI 821 /* If no one else handled the NMI, we assume it was the IPMI
821 watchdog. */ 822 watchdog. */
822 if ((!handled) && (preop_val == WDOG_PREOP_PANIC)) 823 if ((!handled) && (preop_val == WDOG_PREOP_PANIC)) {
824 /* On some machines, the heartbeat will give
825 an error and not work unless we re-enable
826 the timer. So do so. */
827 pretimeout_since_last_heartbeat = 1;
823 panic(PFX "pre-timeout"); 828 panic(PFX "pre-timeout");
824 829 }
825 /* On some machines, the heartbeat will give
826 an error and not work unless we re-enable
827 the timer. So do so. */
828 pretimeout_since_last_heartbeat = 1;
829 830
830 return NOTIFY_DONE; 831 return NOTIFY_DONE;
831} 832}
@@ -924,9 +925,6 @@ static int __init ipmi_wdog_init(void)
924{ 925{
925 int rv; 926 int rv;
926 927
927 printk(KERN_INFO PFX "driver version "
928 IPMI_WATCHDOG_VERSION "\n");
929
930 if (strcmp(action, "reset") == 0) { 928 if (strcmp(action, "reset") == 0) {
931 action_val = WDOG_TIMEOUT_RESET; 929 action_val = WDOG_TIMEOUT_RESET;
932 } else if (strcmp(action, "none") == 0) { 930 } else if (strcmp(action, "none") == 0) {
@@ -1011,6 +1009,8 @@ static int __init ipmi_wdog_init(void)
1011 register_reboot_notifier(&wdog_reboot_notifier); 1009 register_reboot_notifier(&wdog_reboot_notifier);
1012 notifier_chain_register(&panic_notifier_list, &wdog_panic_notifier); 1010 notifier_chain_register(&panic_notifier_list, &wdog_panic_notifier);
1013 1011
1012 printk(KERN_INFO PFX "driver initialized\n");
1013
1014 return 0; 1014 return 0;
1015} 1015}
1016 1016
@@ -1062,3 +1062,5 @@ static void __exit ipmi_wdog_exit(void)
1062module_exit(ipmi_wdog_exit); 1062module_exit(ipmi_wdog_exit);
1063module_init(ipmi_wdog_init); 1063module_init(ipmi_wdog_init);
1064MODULE_LICENSE("GPL"); 1064MODULE_LICENSE("GPL");
1065MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
1066MODULE_DESCRIPTION("watchdog timer based upon the IPMI interface.");