Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_NMI_H
0003 #define _ASM_X86_NMI_H
0004 
0005 #include <linux/irq_work.h>
0006 #include <linux/pm.h>
0007 #include <asm/irq.h>
0008 #include <asm/io.h>
0009 
0010 #ifdef CONFIG_X86_LOCAL_APIC
0011 
0012 extern int reserve_perfctr_nmi(unsigned int);
0013 extern void release_perfctr_nmi(unsigned int);
0014 extern int reserve_evntsel_nmi(unsigned int);
0015 extern void release_evntsel_nmi(unsigned int);
0016 
0017 struct ctl_table;
0018 extern int proc_nmi_enabled(struct ctl_table *, int ,
0019             void __user *, size_t *, loff_t *);
0020 extern int unknown_nmi_panic;
0021 
0022 #endif /* CONFIG_X86_LOCAL_APIC */
0023 
0024 #define NMI_FLAG_FIRST  1
0025 
0026 enum {
0027     NMI_LOCAL=0,
0028     NMI_UNKNOWN,
0029     NMI_SERR,
0030     NMI_IO_CHECK,
0031     NMI_MAX
0032 };
0033 
0034 #define NMI_DONE    0
0035 #define NMI_HANDLED 1
0036 
0037 typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *);
0038 
0039 struct nmiaction {
0040     struct list_head    list;
0041     nmi_handler_t       handler;
0042     u64         max_duration;
0043     unsigned long       flags;
0044     const char      *name;
0045 };
0046 
0047 #define register_nmi_handler(t, fn, fg, n, init...) \
0048 ({                          \
0049     static struct nmiaction init fn##_na = {    \
0050         .list = LIST_HEAD_INIT(fn##_na.list),   \
0051         .handler = (fn),            \
0052         .name = (n),                \
0053         .flags = (fg),              \
0054     };                      \
0055     __register_nmi_handler((t), &fn##_na);      \
0056 })
0057 
0058 int __register_nmi_handler(unsigned int, struct nmiaction *);
0059 
0060 void unregister_nmi_handler(unsigned int, const char *);
0061 
0062 void stop_nmi(void);
0063 void restart_nmi(void);
0064 void local_touch_nmi(void);
0065 
0066 #endif /* _ASM_X86_NMI_H */