mce_amd.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. /*
  25. * F3x4C bits (MCi_STATUS' high half)
  26. */
  27. #define NBSH_ERR_CPU_VAL BIT(24)
  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. extern const char * const tt_msgs[];
  58. extern const char * const ll_msgs[];
  59. extern const char * const rrrr_msgs[];
  60. extern const char * const pp_msgs[];
  61. extern const char * const to_msgs[];
  62. extern const char * const ii_msgs[];
  63. /*
  64. * per-family decoder ops
  65. */
  66. struct amd_decoder_ops {
  67. bool (*dc_mce)(u16, u8);
  68. bool (*ic_mce)(u16, u8);
  69. };
  70. void amd_report_gart_errors(bool);
  71. void amd_register_ecc_decoder(void (*f)(int, struct mce *));
  72. void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
  73. void amd_decode_nb_mce(struct mce *);
  74. int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data);
  75. #endif /* _EDAC_MCE_AMD_H */