diff options
author | Tom Mingarelli <thomas.mingarelli@hp.com> | 2009-06-18 19:28:57 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2009-06-23 03:13:45 -0400 |
commit | 44df75353bc8f32e26e049284053a61d4f1047d6 (patch) | |
tree | 8ac01af7888c6d5c3746d30834fd63a148305078 /drivers/watchdog/hpwdt.c | |
parent | 789cd4702bf830416d2e1794495407be42fe95ad (diff) |
[WATCHDOG] hpwdt: Add NMI priority option
Add a priority option so that the user can choose if we do the NMI
first or last.
Signed-off-by: Thomas Mingarelli <thomas.mingarelli@hp.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/hpwdt.c')
-rw-r--r-- | drivers/watchdog/hpwdt.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index c0b9169ba5d5..a6c5674c78e6 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -120,7 +120,8 @@ static int nowayout = WATCHDOG_NOWAYOUT; | |||
120 | static char expect_release; | 120 | static char expect_release; |
121 | static unsigned long hpwdt_is_open; | 121 | static unsigned long hpwdt_is_open; |
122 | static unsigned int allow_kdump; | 122 | static unsigned int allow_kdump; |
123 | static int hpwdt_nmi_sourcing; | 123 | static unsigned int hpwdt_nmi_sourcing; |
124 | static unsigned int priority; /* hpwdt at end of die_notify list */ | ||
124 | 125 | ||
125 | static void __iomem *pci_mem_addr; /* the PCI-memory address */ | 126 | static void __iomem *pci_mem_addr; /* the PCI-memory address */ |
126 | static unsigned long __iomem *hpwdt_timer_reg; | 127 | static unsigned long __iomem *hpwdt_timer_reg; |
@@ -623,7 +624,7 @@ static struct miscdevice hpwdt_miscdev = { | |||
623 | 624 | ||
624 | static struct notifier_block die_notifier = { | 625 | static struct notifier_block die_notifier = { |
625 | .notifier_call = hpwdt_pretimeout, | 626 | .notifier_call = hpwdt_pretimeout, |
626 | .priority = 0x7FFFFFFF, | 627 | .priority = 0, |
627 | }; | 628 | }; |
628 | 629 | ||
629 | /* | 630 | /* |
@@ -641,7 +642,8 @@ static void __devinit hpwdt_check_nmi_sourcing(struct pci_dev *dev) | |||
641 | hpwdt_nmi_sourcing = 1; | 642 | hpwdt_nmi_sourcing = 1; |
642 | else | 643 | else |
643 | dev_warn(&dev->dev, "NMI sourcing is disabled. To enable this " | 644 | dev_warn(&dev->dev, "NMI sourcing is disabled. To enable this " |
644 | "functionality you must reboot with nmi_watchdog=0.\n"); | 645 | "functionality you must reboot with nmi_watchdog=0 " |
646 | "and load the hpwdt driver with priority=1.\n"); | ||
645 | } | 647 | } |
646 | #else | 648 | #else |
647 | static void __devinit hpwdt_check_nmi_sourcing(struct pci_dev *dev) | 649 | static void __devinit hpwdt_check_nmi_sourcing(struct pci_dev *dev) |
@@ -714,6 +716,14 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, | |||
714 | cmn_regs.u1.rah = 0x0D; | 716 | cmn_regs.u1.rah = 0x0D; |
715 | cmn_regs.u1.ral = 0x02; | 717 | cmn_regs.u1.ral = 0x02; |
716 | 718 | ||
719 | /* | ||
720 | * If the priority is set to 1, then we will be put first on the | ||
721 | * die notify list to handle a critical NMI. The default is to | ||
722 | * be last so other users of the NMI signal can function. | ||
723 | */ | ||
724 | if (priority) | ||
725 | die_notifier.priority = 0x7FFFFFFF; | ||
726 | |||
717 | retval = register_die_notifier(&die_notifier); | 727 | retval = register_die_notifier(&die_notifier); |
718 | if (retval != 0) { | 728 | if (retval != 0) { |
719 | dev_warn(&dev->dev, | 729 | dev_warn(&dev->dev, |
@@ -733,9 +743,11 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev, | |||
733 | printk(KERN_INFO | 743 | printk(KERN_INFO |
734 | "hp Watchdog Timer Driver: %s" | 744 | "hp Watchdog Timer Driver: %s" |
735 | ", timer margin: %d seconds (nowayout=%d)" | 745 | ", timer margin: %d seconds (nowayout=%d)" |
736 | ", allow kernel dump: %s (default = 0/OFF).\n", | 746 | ", allow kernel dump: %s (default = 0/OFF)" |
747 | ", priority: %s (default = 0/LAST).\n", | ||
737 | HPWDT_VERSION, soft_margin, nowayout, | 748 | HPWDT_VERSION, soft_margin, nowayout, |
738 | (allow_kdump == 0) ? "OFF" : "ON"); | 749 | (allow_kdump == 0) ? "OFF" : "ON", |
750 | (priority == 0) ? "LAST" : "FIRST"); | ||
739 | 751 | ||
740 | return 0; | 752 | return 0; |
741 | 753 | ||
@@ -798,5 +810,9 @@ module_param(nowayout, int, 0); | |||
798 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | 810 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
799 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 811 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
800 | 812 | ||
813 | module_param(priority, int, 0); | ||
814 | MODULE_PARM_DESC(priority, "The hpwdt driver handles NMIs first or last" | ||
815 | " (default = 0/Last)\n"); | ||
816 | |||
801 | module_init(hpwdt_init); | 817 | module_init(hpwdt_init); |
802 | module_exit(hpwdt_cleanup); | 818 | module_exit(hpwdt_cleanup); |