2011-12-22 05:29:42 +07:00
|
|
|
#include <linux/device.h>
|
2009-05-28 02:56:54 +07:00
|
|
|
#include <asm/mce.h>
|
|
|
|
|
|
|
|
enum severity_level {
|
|
|
|
MCE_NO_SEVERITY,
|
2009-05-28 02:56:57 +07:00
|
|
|
MCE_KEEP_SEVERITY,
|
2009-05-28 02:56:54 +07:00
|
|
|
MCE_SOME_SEVERITY,
|
2009-05-28 02:56:57 +07:00
|
|
|
MCE_AO_SEVERITY,
|
2009-05-28 02:56:54 +07:00
|
|
|
MCE_UC_SEVERITY,
|
2009-05-28 02:56:57 +07:00
|
|
|
MCE_AR_SEVERITY,
|
2009-05-28 02:56:54 +07:00
|
|
|
MCE_PANIC_SEVERITY,
|
|
|
|
};
|
|
|
|
|
2009-07-09 05:31:43 +07:00
|
|
|
#define ATTR_LEN 16
|
|
|
|
|
|
|
|
/* One object for each MCE bank, shared by all CPUs */
|
|
|
|
struct mce_bank {
|
|
|
|
u64 ctl; /* subevents to enable */
|
|
|
|
unsigned char init; /* initialise bank? */
|
2011-12-22 05:29:42 +07:00
|
|
|
struct device_attribute attr; /* device attribute */
|
2009-07-09 05:31:43 +07:00
|
|
|
char attrname[ATTR_LEN]; /* attribute name */
|
|
|
|
};
|
|
|
|
|
2009-05-28 02:56:54 +07:00
|
|
|
int mce_severity(struct mce *a, int tolerant, char **msg);
|
2009-07-31 08:41:42 +07:00
|
|
|
struct dentry *mce_get_debugfs_dir(void);
|
2009-05-28 02:56:57 +07:00
|
|
|
|
2009-07-09 05:31:43 +07:00
|
|
|
extern struct mce_bank *mce_banks;
|
|
|
|
|
2012-08-10 01:44:51 +07:00
|
|
|
#ifdef CONFIG_X86_MCE_INTEL
|
|
|
|
unsigned long mce_intel_adjust_timer(unsigned long interval);
|
|
|
|
void mce_intel_cmci_poll(void);
|
|
|
|
void mce_intel_hcpu_update(unsigned long cpu);
|
|
|
|
#else
|
|
|
|
# define mce_intel_adjust_timer mce_adjust_timer_default
|
|
|
|
static inline void mce_intel_cmci_poll(void) { }
|
|
|
|
static inline void mce_intel_hcpu_update(unsigned long cpu) { }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void mce_timer_kick(unsigned long interval);
|
|
|
|
|
ACPI, APEI, Use ERST for persistent storage of MCE
Traditionally, fatal MCE will cause Linux print error log to console
then reboot. Because MCE registers will preserve their content after
warm reboot, the hardware error can be logged to disk or network after
reboot. But system may fail to warm reboot, then you may lose the
hardware error log. ERST can help here. Through saving the hardware
error log into flash via ERST before go panic, the hardware error log
can be gotten from the flash after system boot successful again.
The fatal MCE processing procedure with ERST involved is as follow:
- Hardware detect error, MCE raised
- MCE read MCE registers, check error severity (fatal), prepare error record
- Write MCE error record into flash via ERST
- Go panic, then trigger system reboot
- System reboot, /sbin/mcelog run, it reads /dev/mcelog to check flash
for error record of previous boot via ERST, and output and clear
them if available
- /sbin/mcelog logs error records into disk or network
ERST only accepts CPER record format, but there is no pre-defined CPER
section can accommodate all information in struct mce, so a customized
section type is defined to hold struct mce inside a CPER record as an
error section.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2010-05-18 13:35:22 +07:00
|
|
|
#ifdef CONFIG_ACPI_APEI
|
|
|
|
int apei_write_mce(struct mce *m);
|
|
|
|
ssize_t apei_read_mce(struct mce *m, u64 *record_id);
|
|
|
|
int apei_check_mce(void);
|
|
|
|
int apei_clear_mce(u64 record_id);
|
|
|
|
#else
|
|
|
|
static inline int apei_write_mce(struct mce *m)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
static inline ssize_t apei_read_mce(struct mce *m, u64 *record_id)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline int apei_check_mce(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline int apei_clear_mce(u64 record_id)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#endif
|