edac_mce_amd.h 2.0 KB

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