edac_mce_amd.h 1.8 KB

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