aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2011-11-15 20:25:44 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-07 17:03:18 -0500
commit34bd92e27becdc2c8b50d200a329da5e9b8174d9 (patch)
tree80379235839035261bbdc239dc517beeeadba2f1 /arch/mips
parent18a1eef92dcd6b8ec30fcbe6e074e5d33ef31c02 (diff)
MIPS: Add NMI notifier
Allow the board support code to register a raw notifier callback for NMI, similar to what is done for CU2 exceptions. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2958/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/traps.h12
-rw-r--r--arch/mips/kernel/traps.c9
2 files changed, 21 insertions, 0 deletions
diff --git a/arch/mips/include/asm/traps.h b/arch/mips/include/asm/traps.h
index 90ff2f497c50..4edab87eebd2 100644
--- a/arch/mips/include/asm/traps.h
+++ b/arch/mips/include/asm/traps.h
@@ -25,4 +25,16 @@ extern void (*board_nmi_handler_setup)(void);
25extern void (*board_ejtag_handler_setup)(void); 25extern void (*board_ejtag_handler_setup)(void);
26extern void (*board_bind_eic_interrupt)(int irq, int regset); 26extern void (*board_bind_eic_interrupt)(int irq, int regset);
27 27
28extern int register_nmi_notifier(struct notifier_block *nb);
29
30#define nmi_notifier(fn, pri) \
31({ \
32 static struct notifier_block fn##_nb = { \
33 .notifier_call = fn, \
34 .priority = pri \
35 }; \
36 \
37 register_nmi_notifier(&fn##_nb); \
38})
39
28#endif /* _ASM_TRAPS_H */ 40#endif /* _ASM_TRAPS_H */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 5c8a49d55054..33945aaa9b1b 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1339,9 +1339,18 @@ void ejtag_exception_handler(struct pt_regs *regs)
1339 1339
1340/* 1340/*
1341 * NMI exception handler. 1341 * NMI exception handler.
1342 * No lock; only written during early bootup by CPU 0.
1342 */ 1343 */
1344static RAW_NOTIFIER_HEAD(nmi_chain);
1345
1346int register_nmi_notifier(struct notifier_block *nb)
1347{
1348 return raw_notifier_chain_register(&nmi_chain, nb);
1349}
1350
1343NORET_TYPE void ATTRIB_NORET nmi_exception_handler(struct pt_regs *regs) 1351NORET_TYPE void ATTRIB_NORET nmi_exception_handler(struct pt_regs *regs)
1344{ 1352{
1353 raw_notifier_call_chain(&nmi_chain, 0, regs);
1345 bust_spinlocks(1); 1354 bust_spinlocks(1);
1346 printk("NMI taken!!!!\n"); 1355 printk("NMI taken!!!!\n");
1347 die("NMI", regs); 1356 die("NMI", regs);