mce_amd.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef _EDAC_MCE_AMD_H
  2. #define _EDAC_MCE_AMD_H
  3. #include <linux/notifier.h>
  4. #include <asm/mce.h>
  5. #define EC(x) ((x) & 0xffff)
  6. #define XEC(x, mask) (((x) >> 16) & mask)
  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) & 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 R4(x) (((x) >> 4) & 0xf)
  23. #define R4_MSG(x) ((R4(x) < 9) ? rrrr_msgs[R4(x)] : "Wrong R4!")
  24. #define MCI_STATUS_DEFERRED BIT_64(44)
  25. #define MCI_STATUS_POISON BIT_64(43)
  26. enum tt_ids {
  27. TT_INSTR = 0,
  28. TT_DATA,
  29. TT_GEN,
  30. TT_RESV,
  31. };
  32. enum ll_ids {
  33. LL_RESV = 0,
  34. LL_L1,
  35. LL_L2,
  36. LL_LG,
  37. };
  38. enum ii_ids {
  39. II_MEM = 0,
  40. II_RESV,
  41. II_IO,
  42. II_GEN,
  43. };
  44. enum rrrr_ids {
  45. R4_GEN = 0,
  46. R4_RD,
  47. R4_WR,
  48. R4_DRD,
  49. R4_DWR,
  50. R4_IRD,
  51. R4_PREF,
  52. R4_EVICT,
  53. R4_SNOOP,
  54. };
  55. extern const char * const tt_msgs[];
  56. extern const char * const ll_msgs[];
  57. extern const char * const rrrr_msgs[];
  58. extern const char * const pp_msgs[];
  59. extern const char * const to_msgs[];
  60. extern const char * const ii_msgs[];
  61. /*
  62. * per-family decoder ops
  63. */
  64. struct amd_decoder_ops {
  65. bool (*mc0_mce)(u16, u8);
  66. bool (*mc1_mce)(u16, u8);
  67. };
  68. void amd_report_gart_errors(bool);
  69. void amd_register_ecc_decoder(void (*f)(int, struct mce *));
  70. void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
  71. int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data);
  72. #endif /* _EDAC_MCE_AMD_H */