blob: efb45c894d7604ff89b92e35ddf12091636e634f [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
10struct pt_regs;
Don Zickus3e4ff112006-06-26 13:57:01 +020011
Linus Torvalds1da177e2005-04-16 15:20:36 -070012typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu);
Don Zickus3e4ff112006-06-26 13:57:01 +020013
14/**
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 * set_nmi_callback
16 *
17 * Set a handler for an NMI. Only one handler may be
18 * set. Return 1 if the NMI was handled.
19 */
20void set_nmi_callback(nmi_callback_t callback);
Don Zickus3e4ff112006-06-26 13:57:01 +020021
22/**
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 * unset_nmi_callback
24 *
25 * Remove the handler previously set.
26 */
27void unset_nmi_callback(void);
Don Zickus3e4ff112006-06-26 13:57:01 +020028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#ifdef CONFIG_PM
30
31/** Replace the PM callback routine for NMI. */
32struct pm_dev * set_nmi_pm_callback(pm_callback callback);
33
34/** Unset the PM callback routine back to the default. */
35void unset_nmi_pm_callback(struct pm_dev * dev);
36
37#else
38
39static inline struct pm_dev * set_nmi_pm_callback(pm_callback callback)
40{
41 return 0;
42}
43
44static inline void unset_nmi_pm_callback(struct pm_dev * dev)
45{
46}
47
48#endif /* CONFIG_PM */
49
50extern void default_do_nmi(struct pt_regs *);
51extern void die_nmi(char *str, struct pt_regs *regs);
52
53#define get_nmi_reason() inb(0x61)
54
55extern int panic_on_timeout;
56extern int unknown_nmi_panic;
Andi Kleen75152112005-05-16 21:53:34 -070057
58extern int check_nmi_watchdog(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Don Zickus3e4ff112006-06-26 13:57:01 +020060extern void setup_apic_nmi_watchdog (void);
61extern int reserve_lapic_nmi(void);
62extern void release_lapic_nmi(void);
63extern void disable_timer_nmi_watchdog(void);
64extern void enable_timer_nmi_watchdog(void);
65extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
66
67extern void nmi_watchdog_default(void);
68extern int setup_nmi_watchdog(char *);
69
70extern unsigned int nmi_watchdog;
71#define NMI_DEFAULT -1
72#define NMI_NONE 0
73#define NMI_IO_APIC 1
74#define NMI_LOCAL_APIC 2
75#define NMI_INVALID 3
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#endif /* ASM_NMI_H */