Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-i386/nmi.h |
| 3 | */ |
| 4 | #ifndef ASM_NMI_H |
| 5 | #define ASM_NMI_H |
| 6 | |
| 7 | #include <linux/pm.h> |
Don Zickus | 3e4ff11 | 2006-06-26 13:57:01 +0200 | [diff] [blame] | 8 | #include <asm/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
Don Zickus | 3adbbcc | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 10 | /** |
| 11 | * do_nmi_callback |
| 12 | * |
| 13 | * Check to see if a callback exists and execute it. Return 1 |
| 14 | * if the handler exists and was handled successfully. |
| 15 | */ |
| 16 | int do_nmi_callback(struct pt_regs *regs, int cpu); |
| 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #ifdef CONFIG_PM |
| 19 | |
| 20 | /** Replace the PM callback routine for NMI. */ |
| 21 | struct pm_dev * set_nmi_pm_callback(pm_callback callback); |
| 22 | |
| 23 | /** Unset the PM callback routine back to the default. */ |
| 24 | void unset_nmi_pm_callback(struct pm_dev * dev); |
| 25 | |
| 26 | #else |
| 27 | |
| 28 | static inline struct pm_dev * set_nmi_pm_callback(pm_callback callback) |
| 29 | { |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | static inline void unset_nmi_pm_callback(struct pm_dev * dev) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | #endif /* CONFIG_PM */ |
| 38 | |
| 39 | extern void default_do_nmi(struct pt_regs *); |
Andi Kleen | fac5855 | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 40 | extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
| 42 | #define get_nmi_reason() inb(0x61) |
| 43 | |
| 44 | extern int panic_on_timeout; |
| 45 | extern int unknown_nmi_panic; |
Don Zickus | 407984f | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 46 | extern int nmi_watchdog_enabled; |
Andi Kleen | 7515211 | 2005-05-16 21:53:34 -0700 | [diff] [blame] | 47 | |
| 48 | extern int check_nmi_watchdog(void); |
Don Zickus | 828f0af | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 49 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); |
| 50 | extern int avail_to_resrv_perfctr_nmi(unsigned int); |
| 51 | extern int reserve_perfctr_nmi(unsigned int); |
| 52 | extern void release_perfctr_nmi(unsigned int); |
| 53 | extern int reserve_evntsel_nmi(unsigned int); |
| 54 | extern void release_evntsel_nmi(unsigned int); |
| 55 | |
Don Zickus | f2802e7 | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 56 | extern void setup_apic_nmi_watchdog (void *); |
Shaohua Li | 4038f90 | 2006-09-26 10:52:27 +0200 | [diff] [blame] | 57 | extern void stop_apic_nmi_watchdog (void *); |
Don Zickus | 3e4ff11 | 2006-06-26 13:57:01 +0200 | [diff] [blame] | 58 | extern void disable_timer_nmi_watchdog(void); |
| 59 | extern void enable_timer_nmi_watchdog(void); |
Don Zickus | 3adbbcc | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 60 | extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); |
Don Zickus | 3e4ff11 | 2006-06-26 13:57:01 +0200 | [diff] [blame] | 61 | |
| 62 | extern void nmi_watchdog_default(void); |
| 63 | extern int setup_nmi_watchdog(char *); |
| 64 | |
Don Zickus | f2802e7 | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 65 | extern atomic_t nmi_active; |
Don Zickus | 3e4ff11 | 2006-06-26 13:57:01 +0200 | [diff] [blame] | 66 | extern unsigned int nmi_watchdog; |
Linus Torvalds | 8ce5e3e | 2007-03-14 17:50:48 -0700 | [diff] [blame] | 67 | #define NMI_DEFAULT -1 |
Don Zickus | 3e4ff11 | 2006-06-26 13:57:01 +0200 | [diff] [blame] | 68 | #define NMI_NONE 0 |
| 69 | #define NMI_IO_APIC 1 |
| 70 | #define NMI_LOCAL_APIC 2 |
| 71 | #define NMI_INVALID 3 |
| 72 | |
Andi Kleen | 29cbc78 | 2006-09-30 01:47:55 +0200 | [diff] [blame] | 73 | struct ctl_table; |
| 74 | struct file; |
| 75 | extern int proc_nmi_enabled(struct ctl_table *, int , struct file *, |
| 76 | void __user *, size_t *, loff_t *); |
| 77 | |
| 78 | extern int unknown_nmi_panic; |
| 79 | |
Andrew Morton | bb81a09 | 2006-12-07 02:14:01 +0100 | [diff] [blame] | 80 | void __trigger_all_cpu_backtrace(void); |
| 81 | #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() |
| 82 | |
Andi Kleen | 05cb007 | 2007-05-02 19:27:20 +0200 | [diff] [blame] | 83 | |
| 84 | void lapic_watchdog_stop(void); |
| 85 | int lapic_watchdog_init(unsigned nmi_hz); |
| 86 | int lapic_wd_event(unsigned nmi_hz); |
| 87 | unsigned lapic_adjust_nmi_hz(unsigned hz); |
| 88 | int lapic_watchdog_ok(void); |
| 89 | void disable_lapic_nmi_watchdog(void); |
| 90 | void enable_lapic_nmi_watchdog(void); |
| 91 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | #endif /* ASM_NMI_H */ |