fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-x86_64 / nmi.h
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>
8 #include <asm/io.h>
9  
10 #ifdef CONFIG_XEN
11 #include <xen/interface/nmi.h>
12 #endif
13
14 /**
15  * do_nmi_callback
16  *
17  * Check to see if a callback exists and execute it.  Return 1
18  * if the handler exists and was handled successfully.
19  */
20 int do_nmi_callback(struct pt_regs *regs, int cpu);
21
22 #ifdef CONFIG_PM
23  
24 /** Replace the PM callback routine for NMI. */
25 struct pm_dev * set_nmi_pm_callback(pm_callback callback);
26
27 /** Unset the PM callback routine back to the default. */
28 void unset_nmi_pm_callback(struct pm_dev * dev);
29
30 #else
31
32 static inline struct pm_dev * set_nmi_pm_callback(pm_callback callback)
33 {
34         return 0;
35
36  
37 static inline void unset_nmi_pm_callback(struct pm_dev * dev)
38 {
39 }
40
41 #endif /* CONFIG_PM */
42  
43 extern void default_do_nmi(struct pt_regs *);
44 extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
45
46 #ifdef CONFIG_XEN
47 static inline unsigned char get_nmi_reason(void)
48 {
49         shared_info_t *s = HYPERVISOR_shared_info;
50         unsigned char reason = 0;
51
52         /* construct a value which looks like it came from
53          * port 0x61.
54          */
55         if (test_bit(_XEN_NMIREASON_io_error, &s->arch.nmi_reason))
56                 reason |= 0x40;
57         if (test_bit(_XEN_NMIREASON_parity_error, &s->arch.nmi_reason))
58                 reason |= 0x80;
59
60         return reason;
61 }
62 #else
63 #define get_nmi_reason() inb(0x61)
64 #endif
65
66 extern int panic_on_timeout;
67 extern int unknown_nmi_panic;
68 extern int nmi_watchdog_enabled;
69
70 extern int check_nmi_watchdog(void);
71 extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
72 extern int avail_to_resrv_perfctr_nmi(unsigned int);
73 extern int reserve_perfctr_nmi(unsigned int);
74 extern void release_perfctr_nmi(unsigned int);
75 extern int reserve_evntsel_nmi(unsigned int);
76 extern void release_evntsel_nmi(unsigned int);
77
78 extern void setup_apic_nmi_watchdog (void *);
79 extern void stop_apic_nmi_watchdog (void *);
80 extern void disable_timer_nmi_watchdog(void);
81 extern void enable_timer_nmi_watchdog(void);
82 extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
83
84 extern void nmi_watchdog_default(void);
85 extern int setup_nmi_watchdog(char *);
86
87 extern atomic_t nmi_active;
88 extern unsigned int nmi_watchdog;
89 #define NMI_DEFAULT     -1
90 #define NMI_NONE        0
91 #define NMI_IO_APIC     1
92 #define NMI_LOCAL_APIC  2
93 #define NMI_INVALID     3
94
95 struct ctl_table;
96 struct file;
97 extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
98                         void __user *, size_t *, loff_t *);
99
100 extern int unknown_nmi_panic;
101
102 void __trigger_all_cpu_backtrace(void);
103 #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
104
105 #endif /* ASM_NMI_H */