mce_amd.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _EDAC_MCE_AMD_H
  3. #define _EDAC_MCE_AMD_H
  4. #include <linux/notifier.h>
  5. #include <asm/mce.h>
  6. #define EC(x) ((x) & 0xffff)
  7. #define XEC(x, mask) (((x) >> 16) & mask)
  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 INT_ERROR(x) (((x) & 0xF4FF) == 0x0400)
  14. #define TT(x) (((x) >> 2) & 0x3)
  15. #define TT_MSG(x) tt_msgs[TT(x)]
  16. #define II(x) (((x) >> 2) & 0x3)
  17. #define II_MSG(x) ii_msgs[II(x)]
  18. #define LL(x) ((x) & 0x3)
  19. #define LL_MSG(x) ll_msgs[LL(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 UU(x) (((x) >> 8) & 0x3)
  25. #define UU_MSG(x) uu_msgs[UU(x)]
  26. #define R4(x) (((x) >> 4) & 0xf)
  27. #define R4_MSG(x) ((R4(x) < 9) ? rrrr_msgs[R4(x)] : "Wrong R4!")
  28. extern const char * const pp_msgs[];
  29. enum tt_ids {
  30. TT_INSTR = 0,
  31. TT_DATA,
  32. TT_GEN,
  33. TT_RESV,
  34. };
  35. enum ll_ids {
  36. LL_RESV = 0,
  37. LL_L1,
  38. LL_L2,
  39. LL_LG,
  40. };
  41. enum ii_ids {
  42. II_MEM = 0,
  43. II_RESV,
  44. II_IO,
  45. II_GEN,
  46. };
  47. enum rrrr_ids {
  48. R4_GEN = 0,
  49. R4_RD,
  50. R4_WR,
  51. R4_DRD,
  52. R4_DWR,
  53. R4_IRD,
  54. R4_PREF,
  55. R4_EVICT,
  56. R4_SNOOP,
  57. };
  58. /*
  59. * per-family decoder ops
  60. */
  61. struct amd_decoder_ops {
  62. bool (*mc0_mce)(u16, u8);
  63. bool (*mc1_mce)(u16, u8);
  64. bool (*mc2_mce)(u16, u8);
  65. };
  66. void amd_report_gart_errors(bool);
  67. void amd_register_ecc_decoder(void (*f)(int, struct mce *));
  68. void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
  69. #endif /* _EDAC_MCE_AMD_H */