Root/
1 | /* |
2 | * Copyright (C) 2007 Atmel Corporation |
3 | * |
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 | |
13 | #include <asm/irq.h> |
14 | |
15 | enum nmi_action { |
16 | NMI_SHOW_STATE = 1 << 0, |
17 | NMI_SHOW_REGS = 1 << 1, |
18 | NMI_DIE = 1 << 2, |
19 | NMI_DEBOUNCE = 1 << 3, |
20 | }; |
21 | |
22 | static unsigned long nmi_actions; |
23 | |
24 | static int nmi_debug_notify(struct notifier_block *self, |
25 | unsigned long val, void *data) |
26 | { |
27 | struct die_args *args = data; |
28 | |
29 | if (likely(val != DIE_NMI)) |
30 | return NOTIFY_DONE; |
31 | |
32 | if (nmi_actions & NMI_SHOW_STATE) |
33 | show_state(); |
34 | if (nmi_actions & NMI_SHOW_REGS) |
35 | show_regs(args->regs); |
36 | if (nmi_actions & NMI_DEBOUNCE) |
37 | mdelay(10); |
38 | if (nmi_actions & NMI_DIE) |
39 | return NOTIFY_BAD; |
40 | |
41 | return NOTIFY_OK; |
42 | } |
43 | |
44 | static struct notifier_block nmi_debug_nb = { |
45 | .notifier_call = nmi_debug_notify, |
46 | }; |
47 | |
48 | static int __init nmi_debug_setup(char *str) |
49 | { |
50 | char *p, *sep; |
51 | |
52 | register_die_notifier(&nmi_debug_nb); |
53 | if (nmi_enable()) { |
54 | printk(KERN_WARNING "Unable to enable NMI.\n"); |
55 | return 0; |
56 | } |
57 | |
58 | if (*str != '=') |
59 | return 0; |
60 | |
61 | for (p = str + 1; *p; p = sep + 1) { |
62 | sep = strchr(p, ','); |
63 | if (sep) |
64 | *sep = 0; |
65 | if (strcmp(p, "state") == 0) |
66 | nmi_actions |= NMI_SHOW_STATE; |
67 | else if (strcmp(p, "regs") == 0) |
68 | nmi_actions |= NMI_SHOW_REGS; |
69 | else if (strcmp(p, "debounce") == 0) |
70 | nmi_actions |= NMI_DEBOUNCE; |
71 | else if (strcmp(p, "die") == 0) |
72 | nmi_actions |= NMI_DIE; |
73 | else |
74 | printk(KERN_WARNING "NMI: Unrecognized action `%s'\n", |
75 | p); |
76 | if (!sep) |
77 | break; |
78 | } |
79 | |
80 | return 0; |
81 | } |
82 | __setup("nmi_debug", nmi_debug_setup); |
83 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9