mce_amd.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 INT_ERROR(x) (((x) & 0xF4FF) == 0x0400)
  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) & 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 UU(x) (((x) >> 8) & 0x3)
  24. #define UU_MSG(x) uu_msgs[UU(x)]
  25. #define R4(x) (((x) >> 4) & 0xf)
  26. #define R4_MSG(x) ((R4(x) < 9) ? rrrr_msgs[R4(x)] : "Wrong R4!")
  27. extern const char * const pp_msgs[];
  28. enum tt_ids {
  29. TT_INSTR = 0,
  30. TT_DATA,
  31. TT_GEN,
  32. TT_RESV,
  33. };
  34. enum ll_ids {
  35. LL_RESV = 0,
  36. LL_L1,
  37. LL_L2,
  38. LL_LG,
  39. };
  40. enum ii_ids {
  41. II_MEM = 0,
  42. II_RESV,
  43. II_IO,
  44. II_GEN,
  45. };
  46. enum rrrr_ids {
  47. R4_GEN = 0,
  48. R4_RD,
  49. R4_WR,
  50. R4_DRD,
  51. R4_DWR,
  52. R4_IRD,
  53. R4_PREF,
  54. R4_EVICT,
  55. R4_SNOOP,
  56. };
  57. /*
  58. * per-family decoder ops
  59. */
  60. struct amd_decoder_ops {
  61. bool (*mc0_mce)(u16, u8);
  62. bool (*mc1_mce)(u16, u8);
  63. bool (*mc2_mce)(u16, u8);
  64. };
  65. void amd_report_gart_errors(bool);
  66. void amd_register_ecc_decoder(void (*f)(int, struct mce *));
  67. void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
  68. int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data);
  69. #endif /* _EDAC_MCE_AMD_H */