SCSI: Silencing 'killing requests for dead queue'
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / sh / kernel / nmi_debug.c
blobff0abbd1e6526a960ec014c4f14ee03a8bb070ba
1 /*
2 * Copyright (C) 2007 Atmel Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8 #include <linux/delay.h>
9 #include <linux/kdebug.h>
10 #include <linux/notifier.h>
11 #include <linux/sched.h>
12 #include <linux/hardirq.h>
14 enum nmi_action {
15 NMI_SHOW_STATE = 1 << 0,
16 NMI_SHOW_REGS = 1 << 1,
17 NMI_DIE = 1 << 2,
18 NMI_DEBOUNCE = 1 << 3,
21 static unsigned long nmi_actions;
23 static int nmi_debug_notify(struct notifier_block *self,
24 unsigned long val, void *data)
26 struct die_args *args = data;
28 if (likely(val != DIE_NMI))
29 return NOTIFY_DONE;
31 if (nmi_actions & NMI_SHOW_STATE)
32 show_state();
33 if (nmi_actions & NMI_SHOW_REGS)
34 show_regs(args->regs);
35 if (nmi_actions & NMI_DEBOUNCE)
36 mdelay(10);
37 if (nmi_actions & NMI_DIE)
38 return NOTIFY_BAD;
40 return NOTIFY_OK;
43 static struct notifier_block nmi_debug_nb = {
44 .notifier_call = nmi_debug_notify,
47 static int __init nmi_debug_setup(char *str)
49 char *p, *sep;
51 register_die_notifier(&nmi_debug_nb);
53 if (*str != '=')
54 return 0;
56 for (p = str + 1; *p; p = sep + 1) {
57 sep = strchr(p, ',');
58 if (sep)
59 *sep = 0;
60 if (strcmp(p, "state") == 0)
61 nmi_actions |= NMI_SHOW_STATE;
62 else if (strcmp(p, "regs") == 0)
63 nmi_actions |= NMI_SHOW_REGS;
64 else if (strcmp(p, "debounce") == 0)
65 nmi_actions |= NMI_DEBOUNCE;
66 else if (strcmp(p, "die") == 0)
67 nmi_actions |= NMI_DIE;
68 else
69 printk(KERN_WARNING "NMI: Unrecognized action `%s'\n",
70 p);
71 if (!sep)
72 break;
75 return 0;
77 __setup("nmi_debug", nmi_debug_setup);