[WATCHDOG] hpwdt.c kdebug support

add kdebug support for the hpwdt.c driver.

Signed-off-by: Thomas Mingarelli <Thomas.Mingarelli@hp.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Thomas Mingarelli 2008-07-15 19:40:41 +00:00 committed by Wim Van Sebroeck
parent 03ec58568a
commit ab4ba3cdeb

View file

@ -116,6 +116,7 @@ static unsigned int reload; /* the computed soft_margin */
static int nowayout = WATCHDOG_NOWAYOUT; static int nowayout = WATCHDOG_NOWAYOUT;
static char expect_release; static char expect_release;
static unsigned long hpwdt_is_open; static unsigned long hpwdt_is_open;
static unsigned int allow_kdump;
static void __iomem *pci_mem_addr; /* the PCI-memory address */ static void __iomem *pci_mem_addr; /* the PCI-memory address */
static unsigned long __iomem *hpwdt_timer_reg; static unsigned long __iomem *hpwdt_timer_reg;
@ -356,7 +357,6 @@ asm(".text \n\t"
"call *%r12 \n\t" "call *%r12 \n\t"
"pushfq \n\t" "pushfq \n\t"
"popq %r12 \n\t" "popq %r12 \n\t"
"popfq \n\t"
"movl %eax, (%r9) \n\t" "movl %eax, (%r9) \n\t"
"movl %ebx, 4(%r9) \n\t" "movl %ebx, 4(%r9) \n\t"
"movl %ecx, 8(%r9) \n\t" "movl %ecx, 8(%r9) \n\t"
@ -405,41 +405,13 @@ static int __devinit detect_cru_service(void)
dmi_walk(dmi_find_cru); dmi_walk(dmi_find_cru);
/* if cru_rom_addr has been set then we found a CRU service */ /* if cru_rom_addr has been set then we found a CRU service */
return ((cru_rom_addr != NULL) ? 0: -ENODEV); return ((cru_rom_addr != NULL) ? 0 : -ENODEV);
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#endif #endif
/*
* NMI Handler
*/
static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
void *data)
{
unsigned long rom_pl;
static int die_nmi_called;
if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
return NOTIFY_OK;
spin_lock_irqsave(&rom_lock, rom_pl);
if (!die_nmi_called)
asminline_call(&cmn_regs, cru_rom_addr);
die_nmi_called = 1;
spin_unlock_irqrestore(&rom_lock, rom_pl);
if (cmn_regs.u1.ral == 0) {
printk(KERN_WARNING "hpwdt: An NMI occurred, "
"but unable to determine source.\n");
} else {
panic("An NMI occurred, please see the Integrated "
"Management Log for details.\n");
}
return NOTIFY_STOP;
}
/* /*
* Watchdog operations * Watchdog operations
*/ */
@ -483,6 +455,36 @@ static int hpwdt_change_timer(int new_margin)
return 0; return 0;
} }
/*
* NMI Handler
*/
static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
void *data)
{
unsigned long rom_pl;
static int die_nmi_called;
if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
return NOTIFY_OK;
spin_lock_irqsave(&rom_lock, rom_pl);
if (!die_nmi_called)
asminline_call(&cmn_regs, cru_rom_addr);
die_nmi_called = 1;
spin_unlock_irqrestore(&rom_lock, rom_pl);
if (cmn_regs.u1.ral == 0) {
printk(KERN_WARNING "hpwdt: An NMI occurred, "
"but unable to determine source.\n");
} else {
if (allow_kdump)
hpwdt_stop();
panic("An NMI occurred, please see the Integrated "
"Management Log for details.\n");
}
return NOTIFY_STOP;
}
/* /*
* /dev/watchdog handling * /dev/watchdog handling
*/ */
@ -632,6 +634,7 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev,
/* /*
* First let's find out if we are on an iLO2 server. We will * First let's find out if we are on an iLO2 server. We will
* not run on a legacy ASM box. * not run on a legacy ASM box.
* So we only support the G5 ProLiant servers and higher.
*/ */
if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) { if (dev->subsystem_vendor != PCI_VENDOR_ID_HP) {
dev_warn(&dev->dev, dev_warn(&dev->dev,
@ -699,8 +702,9 @@ static int __devinit hpwdt_init_one(struct pci_dev *dev,
printk(KERN_INFO printk(KERN_INFO
"hp Watchdog Timer Driver: 1.00" "hp Watchdog Timer Driver: 1.00"
", timer margin: %d seconds( nowayout=%d).\n", ", timer margin: %d seconds (nowayout=%d)"
soft_margin, nowayout); ", allow kernel dump: %s (default = 0/OFF).\n",
soft_margin, nowayout, (allow_kdump == 0) ? "OFF" : "ON");
return 0; return 0;
@ -755,6 +759,9 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
module_param(soft_margin, int, 0); module_param(soft_margin, int, 0);
MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds"); MODULE_PARM_DESC(soft_margin, "Watchdog timeout in seconds");
module_param(allow_kdump, int, 0);
MODULE_PARM_DESC(allow_kdump, "Start a kernel dump after NMI occurs");
module_param(nowayout, int, 0); module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");