mce_amd.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef _EDAC_MCE_AMD_H
  2. #define _EDAC_MCE_AMD_H
  3. #include <linux/notifier.h>
  4. #include <asm/mce.h>
  5. #define BIT_64(n) (U64_C(1) << (n))
  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 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 R4(x) (((x) >> 4) & 0xf)
  24. #define R4_MSG(x) ((R4(x) < 9) ? rrrr_msgs[R4(x)] : "Wrong R4!")
  25. /*
  26. * F3x4C bits (MCi_STATUS' high half)
  27. */
  28. #define NBSH_ERR_CPU_VAL BIT(24)
  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. extern const char *tt_msgs[];
  59. extern const char *ll_msgs[];
  60. extern const char *rrrr_msgs[];
  61. extern const char *pp_msgs[];
  62. extern const char *to_msgs[];
  63. extern const char *ii_msgs[];
  64. /*
  65. * per-family decoder ops
  66. */
  67. struct amd_decoder_ops {
  68. bool (*dc_mce)(u16, u8);
  69. bool (*ic_mce)(u16, u8);
  70. bool (*nb_mce)(u16, u8);
  71. };
  72. void amd_report_gart_errors(bool);
  73. void amd_register_ecc_decoder(void (*f)(int, struct mce *, u32));
  74. void amd_unregister_ecc_decoder(void (*f)(int, struct mce *, u32));
  75. void amd_decode_nb_mce(int, struct mce *, u32);
  76. int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data);
  77. #endif /* _EDAC_MCE_AMD_H */