H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_NMI_H |
| 2 | #define _ASM_X86_NMI_H |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 3 | |
| 4 | #include <linux/pm.h> |
| 5 | #include <asm/irq.h> |
| 6 | #include <asm/io.h> |
| 7 | |
Don Zickus | 4a7863c | 2010-12-22 14:00:03 -0500 | [diff] [blame] | 8 | #ifdef CONFIG_X86_LOCAL_APIC |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 9 | |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 10 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 11 | extern int reserve_perfctr_nmi(unsigned int); |
| 12 | extern void release_perfctr_nmi(unsigned int); |
| 13 | extern int reserve_evntsel_nmi(unsigned int); |
| 14 | extern void release_evntsel_nmi(unsigned int); |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 15 | |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 16 | struct ctl_table; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 17 | extern int proc_nmi_enabled(struct ctl_table *, int , |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 18 | void __user *, size_t *, loff_t *); |
| 19 | extern int unknown_nmi_panic; |
| 20 | |
Ingo Molnar | 47cab6a | 2009-08-03 09:31:54 +0200 | [diff] [blame] | 21 | void arch_trigger_all_cpu_backtrace(void); |
| 22 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 23 | #endif |
| 24 | |
Don Zickus | c9126b2 | 2011-09-30 15:06:20 -0400 | [diff] [blame] | 25 | #define NMI_FLAG_FIRST 1 |
| 26 | |
| 27 | enum { |
| 28 | NMI_LOCAL=0, |
| 29 | NMI_UNKNOWN, |
Don Zickus | 553222f | 2012-03-29 16:11:16 -0400 | [diff] [blame] | 30 | NMI_SERR, |
| 31 | NMI_IO_CHECK, |
Don Zickus | c9126b2 | 2011-09-30 15:06:20 -0400 | [diff] [blame] | 32 | NMI_MAX |
| 33 | }; |
| 34 | |
| 35 | #define NMI_DONE 0 |
| 36 | #define NMI_HANDLED 1 |
| 37 | |
| 38 | typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *); |
| 39 | |
Li Zhong | 72b3fb2 | 2012-03-29 16:11:17 -0400 | [diff] [blame] | 40 | struct nmiaction { |
| 41 | struct list_head list; |
| 42 | nmi_handler_t handler; |
Betty Dall | 6ff968c | 2012-04-27 14:40:55 -0600 | [diff] [blame] | 43 | unsigned long flags; |
Li Zhong | 72b3fb2 | 2012-03-29 16:11:17 -0400 | [diff] [blame] | 44 | const char *name; |
| 45 | }; |
| 46 | |
Li Zhong | 0718467 | 2012-06-18 15:56:33 -0400 | [diff] [blame] | 47 | #define register_nmi_handler(t, fn, fg, n, init...) \ |
Li Zhong | 72b3fb2 | 2012-03-29 16:11:17 -0400 | [diff] [blame] | 48 | ({ \ |
Li Zhong | 0718467 | 2012-06-18 15:56:33 -0400 | [diff] [blame] | 49 | static struct nmiaction init fn##_na = { \ |
Li Zhong | 72b3fb2 | 2012-03-29 16:11:17 -0400 | [diff] [blame] | 50 | .handler = (fn), \ |
| 51 | .name = (n), \ |
| 52 | .flags = (fg), \ |
| 53 | }; \ |
Li Zhong | 0718467 | 2012-06-18 15:56:33 -0400 | [diff] [blame] | 54 | __register_nmi_handler((t), &fn##_na); \ |
Don Zickus | eeaaa96 | 2012-06-06 10:05:42 -0400 | [diff] [blame] | 55 | }) |
| 56 | |
Li Zhong | 72b3fb2 | 2012-03-29 16:11:17 -0400 | [diff] [blame] | 57 | int __register_nmi_handler(unsigned int, struct nmiaction *); |
Don Zickus | c9126b2 | 2011-09-30 15:06:20 -0400 | [diff] [blame] | 58 | |
| 59 | void unregister_nmi_handler(unsigned int, const char *); |
| 60 | |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 61 | void stop_nmi(void); |
| 62 | void restart_nmi(void); |
Don Zickus | b227e23 | 2011-09-30 15:06:22 -0400 | [diff] [blame] | 63 | void local_touch_nmi(void); |
Glauber de Oliveira Costa | 6d60cd5 | 2008-03-19 14:25:36 -0300 | [diff] [blame] | 64 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 65 | #endif /* _ASM_X86_NMI_H */ |