blob: 65b6acf3bb593af5edd4460d9a8bd3cdb32ff924 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Zickus3e4ff112006-06-26 13:57:01 +02008#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Don Zickus3adbbcc2006-09-26 10:52:26 +020010/**
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 */
16int do_nmi_callback(struct pt_regs *regs, int cpu);
17
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#ifdef CONFIG_PM
19
20/** Replace the PM callback routine for NMI. */
21struct pm_dev * set_nmi_pm_callback(pm_callback callback);
22
23/** Unset the PM callback routine back to the default. */
24void unset_nmi_pm_callback(struct pm_dev * dev);
25
26#else
27
28static inline struct pm_dev * set_nmi_pm_callback(pm_callback callback)
29{
30 return 0;
31}
32
33static inline void unset_nmi_pm_callback(struct pm_dev * dev)
34{
35}
36
37#endif /* CONFIG_PM */
38
39extern void default_do_nmi(struct pt_regs *);
Andi Kleenfac58552006-09-26 10:52:27 +020040extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42#define get_nmi_reason() inb(0x61)
43
44extern int panic_on_timeout;
45extern int unknown_nmi_panic;
Don Zickus407984f2006-09-26 10:52:27 +020046extern int nmi_watchdog_enabled;
Andi Kleen75152112005-05-16 21:53:34 -070047
48extern int check_nmi_watchdog(void);
Don Zickus828f0af2006-09-26 10:52:26 +020049extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
50extern int avail_to_resrv_perfctr_nmi(unsigned int);
51extern int reserve_perfctr_nmi(unsigned int);
52extern void release_perfctr_nmi(unsigned int);
53extern int reserve_evntsel_nmi(unsigned int);
54extern void release_evntsel_nmi(unsigned int);
55
Don Zickusf2802e72006-09-26 10:52:26 +020056extern void setup_apic_nmi_watchdog (void *);
Shaohua Li4038f902006-09-26 10:52:27 +020057extern void stop_apic_nmi_watchdog (void *);
Don Zickus3e4ff112006-06-26 13:57:01 +020058extern void disable_timer_nmi_watchdog(void);
59extern void enable_timer_nmi_watchdog(void);
Don Zickus3adbbcc2006-09-26 10:52:26 +020060extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
Don Zickus3e4ff112006-06-26 13:57:01 +020061
62extern void nmi_watchdog_default(void);
63extern int setup_nmi_watchdog(char *);
64
Don Zickusf2802e72006-09-26 10:52:26 +020065extern atomic_t nmi_active;
Don Zickus3e4ff112006-06-26 13:57:01 +020066extern unsigned int nmi_watchdog;
Daniel Gollub0328ece2007-08-15 02:40:35 +020067#define NMI_DISABLED -1
Don Zickus3e4ff112006-06-26 13:57:01 +020068#define NMI_NONE 0
69#define NMI_IO_APIC 1
70#define NMI_LOCAL_APIC 2
71#define NMI_INVALID 3
Daniel Gollub0328ece2007-08-15 02:40:35 +020072#define NMI_DEFAULT NMI_DISABLED
Don Zickus3e4ff112006-06-26 13:57:01 +020073
Andi Kleen29cbc782006-09-30 01:47:55 +020074struct ctl_table;
75struct file;
76extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
77 void __user *, size_t *, loff_t *);
78
79extern int unknown_nmi_panic;
80
Andrew Mortonbb81a092006-12-07 02:14:01 +010081void __trigger_all_cpu_backtrace(void);
82#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
83
Andi Kleen05cb0072007-05-02 19:27:20 +020084
85void lapic_watchdog_stop(void);
86int lapic_watchdog_init(unsigned nmi_hz);
87int lapic_wd_event(unsigned nmi_hz);
88unsigned lapic_adjust_nmi_hz(unsigned hz);
89int lapic_watchdog_ok(void);
90void disable_lapic_nmi_watchdog(void);
91void enable_lapic_nmi_watchdog(void);
Andi Kleen8f4e9562007-07-22 11:12:32 +020092void stop_nmi(void);
93void restart_nmi(void);
Andi Kleen05cb0072007-05-02 19:27:20 +020094
Linus Torvalds1da177e2005-04-16 15:20:36 -070095#endif /* ASM_NMI_H */