x86, nmi_watchdog: Remove the old nmi_watchdog
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86 / include / asm / nmi.h
1 #ifndef _ASM_X86_NMI_H
2 #define _ASM_X86_NMI_H
3
4 #include <linux/pm.h>
5 #include <asm/irq.h>
6 #include <asm/io.h>
7
8 #ifdef ARCH_HAS_NMI_WATCHDOG
9
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
18 extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
19 extern int check_nmi_watchdog(void);
20 extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
21 extern int reserve_perfctr_nmi(unsigned int);
22 extern void release_perfctr_nmi(unsigned int);
23 extern int reserve_evntsel_nmi(unsigned int);
24 extern void release_evntsel_nmi(unsigned int);
25
26 extern void setup_apic_nmi_watchdog(void *);
27 extern void stop_apic_nmi_watchdog(void *);
28 extern void disable_timer_nmi_watchdog(void);
29 extern void enable_timer_nmi_watchdog(void);
30 extern void cpu_nmi_set_wd_enabled(void);
31
32 extern atomic_t nmi_active;
33 extern unsigned int nmi_watchdog;
34 #define NMI_NONE        0
35 #define NMI_IO_APIC     1
36 #define NMI_LOCAL_APIC  2
37 #define NMI_INVALID     3
38
39 struct ctl_table;
40 extern int proc_nmi_enabled(struct ctl_table *, int ,
41                         void __user *, size_t *, loff_t *);
42 extern int unknown_nmi_panic;
43
44 void arch_trigger_all_cpu_backtrace(void);
45 #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
46
47 static inline void localise_nmi_watchdog(void)
48 {
49         if (nmi_watchdog == NMI_IO_APIC)
50                 nmi_watchdog = NMI_LOCAL_APIC;
51 }
52
53 /* check if nmi_watchdog is active (ie was specified at boot) */
54 static inline int nmi_watchdog_active(void)
55 {
56         /*
57          * actually it should be:
58          *      return (nmi_watchdog == NMI_LOCAL_APIC ||
59          *              nmi_watchdog == NMI_IO_APIC)
60          * but since they are power of two we could use a
61          * cheaper way --cvg
62          */
63         return nmi_watchdog & (NMI_LOCAL_APIC | NMI_IO_APIC);
64 }
65 #endif
66
67 void lapic_watchdog_stop(void);
68 int lapic_watchdog_init(unsigned nmi_hz);
69 int lapic_wd_event(unsigned nmi_hz);
70 unsigned lapic_adjust_nmi_hz(unsigned hz);
71 void disable_lapic_nmi_watchdog(void);
72 void enable_lapic_nmi_watchdog(void);
73 void stop_nmi(void);
74 void restart_nmi(void);
75
76 #endif /* _ASM_X86_NMI_H */