2009-07-24 19:51:42 +08:00
|
|
|
#ifndef _EDAC_MCE_AMD_H
|
|
|
|
#define _EDAC_MCE_AMD_H
|
|
|
|
|
2010-09-03 00:33:24 +08:00
|
|
|
#include <linux/notifier.h>
|
|
|
|
|
2009-07-24 19:51:42 +08:00
|
|
|
#include <asm/mce.h>
|
|
|
|
|
2010-10-15 21:20:18 +08:00
|
|
|
#define BIT_64(n) (U64_C(1) << (n))
|
|
|
|
|
2010-09-22 22:08:37 +08:00
|
|
|
#define EC(x) ((x) & 0xffff)
|
|
|
|
#define XEC(x, mask) (((x) >> 16) & mask)
|
2009-06-26 01:51:04 +08:00
|
|
|
|
2009-06-26 01:32:38 +08:00
|
|
|
#define LOW_SYNDROME(x) (((x) >> 15) & 0xff)
|
|
|
|
#define HIGH_SYNDROME(x) (((x) >> 24) & 0xff)
|
|
|
|
|
|
|
|
#define TLB_ERROR(x) (((x) & 0xFFF0) == 0x0010)
|
|
|
|
#define MEM_ERROR(x) (((x) & 0xFF00) == 0x0100)
|
|
|
|
#define BUS_ERROR(x) (((x) & 0xF800) == 0x0800)
|
|
|
|
|
|
|
|
#define TT(x) (((x) >> 2) & 0x3)
|
|
|
|
#define TT_MSG(x) tt_msgs[TT(x)]
|
|
|
|
#define II(x) (((x) >> 2) & 0x3)
|
|
|
|
#define II_MSG(x) ii_msgs[II(x)]
|
2010-09-22 22:08:37 +08:00
|
|
|
#define LL(x) ((x) & 0x3)
|
2009-06-26 01:32:38 +08:00
|
|
|
#define LL_MSG(x) ll_msgs[LL(x)]
|
|
|
|
#define TO(x) (((x) >> 8) & 0x1)
|
|
|
|
#define TO_MSG(x) to_msgs[TO(x)]
|
|
|
|
#define PP(x) (((x) >> 9) & 0x3)
|
|
|
|
#define PP_MSG(x) pp_msgs[PP(x)]
|
|
|
|
|
2010-09-22 22:08:37 +08:00
|
|
|
#define R4(x) (((x) >> 4) & 0xf)
|
|
|
|
#define R4_MSG(x) ((R4(x) < 9) ? rrrr_msgs[R4(x)] : "Wrong R4!")
|
2010-09-07 00:13:39 +08:00
|
|
|
|
2011-01-07 23:17:46 +08:00
|
|
|
/*
|
|
|
|
* F3x4C bits (MCi_STATUS' high half)
|
|
|
|
*/
|
|
|
|
#define NBSH_ERR_CPU_VAL BIT(24)
|
2009-07-24 19:51:42 +08:00
|
|
|
|
2010-08-18 21:11:35 +08:00
|
|
|
enum tt_ids {
|
|
|
|
TT_INSTR = 0,
|
|
|
|
TT_DATA,
|
|
|
|
TT_GEN,
|
|
|
|
TT_RESV,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ll_ids {
|
|
|
|
LL_RESV = 0,
|
|
|
|
LL_L1,
|
|
|
|
LL_L2,
|
|
|
|
LL_LG,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ii_ids {
|
|
|
|
II_MEM = 0,
|
|
|
|
II_RESV,
|
|
|
|
II_IO,
|
|
|
|
II_GEN,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum rrrr_ids {
|
|
|
|
R4_GEN = 0,
|
|
|
|
R4_RD,
|
|
|
|
R4_WR,
|
|
|
|
R4_DRD,
|
|
|
|
R4_DWR,
|
|
|
|
R4_IRD,
|
|
|
|
R4_PREF,
|
|
|
|
R4_EVICT,
|
|
|
|
R4_SNOOP,
|
|
|
|
};
|
|
|
|
|
2009-06-26 01:32:38 +08:00
|
|
|
extern const char *tt_msgs[];
|
|
|
|
extern const char *ll_msgs[];
|
|
|
|
extern const char *rrrr_msgs[];
|
|
|
|
extern const char *pp_msgs[];
|
|
|
|
extern const char *to_msgs[];
|
|
|
|
extern const char *ii_msgs[];
|
2009-07-24 19:51:42 +08:00
|
|
|
|
2010-08-18 21:11:35 +08:00
|
|
|
/*
|
|
|
|
* per-family decoder ops
|
|
|
|
*/
|
|
|
|
struct amd_decoder_ops {
|
2010-09-18 01:22:34 +08:00
|
|
|
bool (*dc_mce)(u16, u8);
|
2010-11-08 22:03:35 +08:00
|
|
|
bool (*ic_mce)(u16, u8);
|
2010-09-01 00:28:08 +08:00
|
|
|
bool (*nb_mce)(u16, u8);
|
2010-08-18 21:11:35 +08:00
|
|
|
};
|
|
|
|
|
2009-07-24 19:51:42 +08:00
|
|
|
void amd_report_gart_errors(bool);
|
2011-08-25 00:44:22 +08:00
|
|
|
void amd_register_ecc_decoder(void (*f)(int, struct mce *));
|
|
|
|
void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
|
|
|
|
void amd_decode_nb_mce(struct mce *);
|
2010-09-03 00:33:24 +08:00
|
|
|
int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data);
|
2009-07-24 19:51:42 +08:00
|
|
|
|
|
|
|
#endif /* _EDAC_MCE_AMD_H */
|