Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1 | #ifndef _EDAC_MCE_AMD_H |
| 2 | #define _EDAC_MCE_AMD_H |
| 3 | |
Borislav Petkov | 9cdeb40 | 2010-09-02 18:33:24 +0200 | [diff] [blame] | 4 | #include <linux/notifier.h> |
| 5 | |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 6 | #include <asm/mce.h> |
| 7 | |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 8 | #define ERROR_CODE(x) ((x) & 0xffff) |
| 9 | #define EXT_ERROR_CODE(x) (((x) >> 16) & 0x1f) |
Borislav Petkov | 5110dbd | 2009-06-25 19:51:04 +0200 | [diff] [blame] | 10 | #define EXT_ERR_MSG(x) ext_msgs[EXT_ERROR_CODE(x)] |
| 11 | |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 12 | #define LOW_SYNDROME(x) (((x) >> 15) & 0xff) |
| 13 | #define HIGH_SYNDROME(x) (((x) >> 24) & 0xff) |
| 14 | |
| 15 | #define TLB_ERROR(x) (((x) & 0xFFF0) == 0x0010) |
| 16 | #define MEM_ERROR(x) (((x) & 0xFF00) == 0x0100) |
| 17 | #define BUS_ERROR(x) (((x) & 0xF800) == 0x0800) |
| 18 | |
| 19 | #define TT(x) (((x) >> 2) & 0x3) |
| 20 | #define TT_MSG(x) tt_msgs[TT(x)] |
| 21 | #define II(x) (((x) >> 2) & 0x3) |
| 22 | #define II_MSG(x) ii_msgs[II(x)] |
| 23 | #define LL(x) (((x) >> 0) & 0x3) |
| 24 | #define LL_MSG(x) ll_msgs[LL(x)] |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 25 | #define TO(x) (((x) >> 8) & 0x1) |
| 26 | #define TO_MSG(x) to_msgs[TO(x)] |
| 27 | #define PP(x) (((x) >> 9) & 0x3) |
| 28 | #define PP_MSG(x) pp_msgs[PP(x)] |
| 29 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 30 | #define RRRR(x) (((x) >> 4) & 0xf) |
| 31 | #define RRRR_MSG(x) ((RRRR(x) < 9) ? rrrr_msgs[RRRR(x)] : "Wrong R4!") |
| 32 | |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 33 | #define K8_NBSH 0x4C |
| 34 | |
| 35 | #define K8_NBSH_VALID_BIT BIT(31) |
| 36 | #define K8_NBSH_OVERFLOW BIT(30) |
| 37 | #define K8_NBSH_UC_ERR BIT(29) |
| 38 | #define K8_NBSH_ERR_EN BIT(28) |
| 39 | #define K8_NBSH_MISCV BIT(27) |
| 40 | #define K8_NBSH_VALID_ERROR_ADDR BIT(26) |
| 41 | #define K8_NBSH_PCC BIT(25) |
| 42 | #define K8_NBSH_ERR_CPU_VAL BIT(24) |
| 43 | #define K8_NBSH_CECC BIT(14) |
| 44 | #define K8_NBSH_UECC BIT(13) |
| 45 | #define K8_NBSH_ERR_SCRUBER BIT(8) |
| 46 | |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 47 | extern const char *tt_msgs[]; |
| 48 | extern const char *ll_msgs[]; |
| 49 | extern const char *rrrr_msgs[]; |
| 50 | extern const char *pp_msgs[]; |
| 51 | extern const char *to_msgs[]; |
| 52 | extern const char *ii_msgs[]; |
| 53 | extern const char *ext_msgs[]; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 54 | |
| 55 | /* |
| 56 | * relevant NB regs |
| 57 | */ |
| 58 | struct err_regs { |
| 59 | u32 nbcfg; |
| 60 | u32 nbsh; |
| 61 | u32 nbsl; |
| 62 | u32 nbeah; |
| 63 | u32 nbeal; |
| 64 | }; |
| 65 | |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 66 | void amd_report_gart_errors(bool); |
Borislav Petkov | 7cfd4a8 | 2010-09-01 14:45:20 +0200 | [diff] [blame] | 67 | void amd_register_ecc_decoder(void (*f)(int, struct mce *, u32)); |
| 68 | void amd_unregister_ecc_decoder(void (*f)(int, struct mce *, u32)); |
| 69 | void amd_decode_nb_mce(int, struct mce *, u32); |
Borislav Petkov | 9cdeb40 | 2010-09-02 18:33:24 +0200 | [diff] [blame] | 70 | int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 71 | |
| 72 | #endif /* _EDAC_MCE_AMD_H */ |