mce_amd.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 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 TO(x) (((x) >> 8) & 0x1)
  19. #define TO_MSG(x) to_msgs[TO(x)]
  20. #define PP(x) (((x) >> 9) & 0x3)
  21. #define PP_MSG(x) pp_msgs[PP(x)]
  22. #define RRRR(x) (((x) >> 4) & 0xf)
  23. #define RRRR_MSG(x) ((RRRR(x) < 9) ? rrrr_msgs[RRRR(x)] : "Wrong R4!")
  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. enum tt_ids {
  37. TT_INSTR = 0,
  38. TT_DATA,
  39. TT_GEN,
  40. TT_RESV,
  41. };
  42. enum ll_ids {
  43. LL_RESV = 0,
  44. LL_L1,
  45. LL_L2,
  46. LL_LG,
  47. };
  48. enum ii_ids {
  49. II_MEM = 0,
  50. II_RESV,
  51. II_IO,
  52. II_GEN,
  53. };
  54. enum rrrr_ids {
  55. R4_GEN = 0,
  56. R4_RD,
  57. R4_WR,
  58. R4_DRD,
  59. R4_DWR,
  60. R4_IRD,
  61. R4_PREF,
  62. R4_EVICT,
  63. R4_SNOOP,
  64. };
  65. extern const char *tt_msgs[];
  66. extern const char *ll_msgs[];
  67. extern const char *rrrr_msgs[];
  68. extern const char *pp_msgs[];
  69. extern const char *to_msgs[];
  70. extern const char *ii_msgs[];
  71. /*
  72. * relevant NB regs
  73. */
  74. struct err_regs {
  75. u32 nbcfg;
  76. u32 nbsh;
  77. u32 nbsl;
  78. u32 nbeah;
  79. u32 nbeal;
  80. };
  81. /*
  82. * per-family decoder ops
  83. */
  84. struct amd_decoder_ops {
  85. bool (*dc_mce)(u16);
  86. bool (*ic_mce)(u16);
  87. bool (*nb_mce)(u16, u8);
  88. };
  89. void amd_report_gart_errors(bool);
  90. void amd_register_ecc_decoder(void (*f)(int, struct mce *, u32));
  91. void amd_unregister_ecc_decoder(void (*f)(int, struct mce *, u32));
  92. void amd_decode_nb_mce(int, struct mce *, u32);
  93. int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data);
  94. #endif /* _EDAC_MCE_AMD_H */