aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/hpwdt.c
diff options
context:
space:
mode:
authordann frazier <dannf@hp.com>2010-07-27 19:51:02 -0400
committerWim Van Sebroeck <wim@iguana.be>2010-08-13 16:54:53 -0400
commit86ded1f35df32ad795cfc8cc1bdaeffbcaec0d5f (patch)
tree7b8d9f1b39b1b53d6d85bdee8518ced02c033f3c /drivers/watchdog/hpwdt.c
parent2ec7ed67dc1e4e57d891233f5014d25f43f941ff (diff)
watchdog: hpwdt (12/12): Make NMI decoding a compile-time option
hpwdt is quite functional without the NMI decoding feature. This change lets users disable the NMI portion at compile-time via the new HPWDT_NMI_DECODING config option. Signed-off-by: dann frazier <dannf@hp.com> Acked-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.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 850f17877e9c..3d77116e4634 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -27,14 +27,16 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/watchdog.h> 29#include <linux/watchdog.h>
30#ifdef CONFIG_HPWDT_NMI_DECODING
30#include <linux/dmi.h> 31#include <linux/dmi.h>
31#include <linux/spinlock.h> 32#include <linux/spinlock.h>
32#include <linux/nmi.h> 33#include <linux/nmi.h>
33#include <linux/kdebug.h> 34#include <linux/kdebug.h>
34#include <linux/notifier.h> 35#include <linux/notifier.h>
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#endif /* CONFIG_HPWDT_NMI_DECODING */
36 38
37#define HPWDT_VERSION "1.1.1" 39#define HPWDT_VERSION "1.2.0"
38#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128) 40#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
39#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000) 41#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000)
40#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535) 42#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535)
@@ -57,6 +59,7 @@ static struct pci_device_id hpwdt_devices[] = {
57}; 59};
58MODULE_DEVICE_TABLE(pci, hpwdt_devices); 60MODULE_DEVICE_TABLE(pci, hpwdt_devices);
59 61
62#ifdef CONFIG_HPWDT_NMI_DECODING
60#define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */ 63#define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */
61#define CRU_BIOS_SIGNATURE_VALUE 0x55524324 64#define CRU_BIOS_SIGNATURE_VALUE 0x55524324
62#define PCI_BIOS32_PARAGRAPH_LEN 16 65#define PCI_BIOS32_PARAGRAPH_LEN 16
@@ -407,6 +410,7 @@ static int __devinit detect_cru_service(void)
407} 410}
408/* ------------------------------------------------------------------------- */ 411/* ------------------------------------------------------------------------- */
409#endif /* CONFIG_X86_64 */ 412#endif /* CONFIG_X86_64 */
413#endif /* CONFIG_HPWDT_NMI_DECODING */
410 414
411/* 415/*
412 * Watchdog operations 416 * Watchdog operations
@@ -455,6 +459,7 @@ static int hpwdt_time_left(void)
455 return TICKS_TO_SECS(ioread16(hpwdt_timer_reg)); 459 return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
456} 460}
457 461
462#ifdef CONFIG_HPWDT_NMI_DECODING
458/* 463/*
459 * NMI Handler 464 * NMI Handler
460 */ 465 */
@@ -487,6 +492,7 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
487out: 492out:
488 return NOTIFY_OK; 493 return NOTIFY_OK;
489} 494}
495#endif /* CONFIG_HPWDT_NMI_DECODING */
490 496
491/* 497/*
492 * /dev/watchdog handling 498 * /dev/watchdog handling
@@ -624,15 +630,18 @@ static struct miscdevice hpwdt_miscdev = {
624 .fops = &hpwdt_fops, 630 .fops = &hpwdt_fops,
625}; 631};
626 632
633#ifdef CONFIG_HPWDT_NMI_DECODING
627static struct notifier_block die_notifier = { 634static struct notifier_block die_notifier = {
628 .notifier_call = hpwdt_pretimeout, 635 .notifier_call = hpwdt_pretimeout,
629 .priority = 0, 636 .priority = 0,
630}; 637};
638#endif /* CONFIG_HPWDT_NMI_DECODING */
631 639
632/* 640/*
633 * Init & Exit 641 * Init & Exit
634 */ 642 */
635 643
644#ifdef CONFIG_HPWDT_NMI_DECODING
636#ifdef ARCH_HAS_NMI_WATCHDOG 645#ifdef ARCH_HAS_NMI_WATCHDOG
637static void __devinit hpwdt_check_nmi_decoding(struct pci_dev *dev) 646static void __devinit hpwdt_check_nmi_decoding(struct pci_dev *dev)
638{ 647{
@@ -712,6 +721,20 @@ static void __devexit hpwdt_exit_nmi_decoding(void)
712 if (cru_rom_addr) 721 if (cru_rom_addr)
713 iounmap(cru_rom_addr); 722 iounmap(cru_rom_addr);
714} 723}
724#else /* !CONFIG_HPWDT_NMI_DECODING */
725static void __devinit hpwdt_check_nmi_decoding(struct pci_dev *dev)
726{
727}
728
729static int __devinit hpwdt_init_nmi_decoding(struct pci_dev *dev)
730{
731 return 0;
732}
733
734static void __devexit hpwdt_exit_nmi_decoding(void)
735{
736}
737#endif /* CONFIG_HPWDT_NMI_DECODING */
715 738
716static int __devinit hpwdt_init_one(struct pci_dev *dev, 739static int __devinit hpwdt_init_one(struct pci_dev *dev,
717 const struct pci_device_id *ent) 740 const struct pci_device_id *ent)
@@ -823,12 +846,14 @@ module_param(nowayout, int, 0);
823MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" 846MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
824 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 847 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
825 848
849#ifdef CONFIG_HPWDT_NMI_DECODING
826module_param(allow_kdump, int, 0); 850module_param(allow_kdump, int, 0);
827MODULE_PARM_DESC(allow_kdump, "Start a kernel dump after NMI occurs"); 851MODULE_PARM_DESC(allow_kdump, "Start a kernel dump after NMI occurs");
828 852
829module_param(priority, int, 0); 853module_param(priority, int, 0);
830MODULE_PARM_DESC(priority, "The hpwdt driver handles NMIs first or last" 854MODULE_PARM_DESC(priority, "The hpwdt driver handles NMIs first or last"
831 " (default = 0/Last)\n"); 855 " (default = 0/Last)\n");
856#endif /* !CONFIG_HPWDT_NMI_DECODING */
832 857
833module_init(hpwdt_init); 858module_init(hpwdt_init);
834module_exit(hpwdt_cleanup); 859module_exit(hpwdt_cleanup);