1 #include <linux/device.h>
2 #include <asm/mce.h>
3
4 enum severity_level {
5 MCE_NO_SEVERITY,
6 MCE_DEFERRED_SEVERITY,
7 MCE_UCNA_SEVERITY = MCE_DEFERRED_SEVERITY,
8 MCE_KEEP_SEVERITY,
9 MCE_SOME_SEVERITY,
10 MCE_AO_SEVERITY,
11 MCE_UC_SEVERITY,
12 MCE_AR_SEVERITY,
13 MCE_PANIC_SEVERITY,
14 };
15
16 #define ATTR_LEN 16
17
18 /* One object for each MCE bank, shared by all CPUs */
19 struct mce_bank {
20 u64 ctl; /* subevents to enable */
21 unsigned char init; /* initialise bank? */
22 struct device_attribute attr; /* device attribute */
23 char attrname[ATTR_LEN]; /* attribute name */
24 };
25
26 int mce_severity(struct mce *a, int tolerant, char **msg, bool is_excp);
27 struct dentry *mce_get_debugfs_dir(void);
28
29 extern struct mce_bank *mce_banks;
30 extern mce_banks_t mce_banks_ce_disabled;
31
32 #ifdef CONFIG_X86_MCE_INTEL
33 unsigned long mce_intel_adjust_timer(unsigned long interval);
34 void mce_intel_cmci_poll(void);
35 void mce_intel_hcpu_update(unsigned long cpu);
36 void cmci_disable_bank(int bank);
37 #else
38 # define mce_intel_adjust_timer mce_adjust_timer_default
mce_intel_cmci_poll(void)39 static inline void mce_intel_cmci_poll(void) { }
mce_intel_hcpu_update(unsigned long cpu)40 static inline void mce_intel_hcpu_update(unsigned long cpu) { }
cmci_disable_bank(int bank)41 static inline void cmci_disable_bank(int bank) { }
42 #endif
43
44 void mce_timer_kick(unsigned long interval);
45
46 #ifdef CONFIG_ACPI_APEI
47 int apei_write_mce(struct mce *m);
48 ssize_t apei_read_mce(struct mce *m, u64 *record_id);
49 int apei_check_mce(void);
50 int apei_clear_mce(u64 record_id);
51 #else
apei_write_mce(struct mce * m)52 static inline int apei_write_mce(struct mce *m)
53 {
54 return -EINVAL;
55 }
apei_read_mce(struct mce * m,u64 * record_id)56 static inline ssize_t apei_read_mce(struct mce *m, u64 *record_id)
57 {
58 return 0;
59 }
apei_check_mce(void)60 static inline int apei_check_mce(void)
61 {
62 return 0;
63 }
apei_clear_mce(u64 record_id)64 static inline int apei_clear_mce(u64 record_id)
65 {
66 return -EINVAL;
67 }
68 #endif
69