1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _EDAC_MCE_AMD_H
3 #define _EDAC_MCE_AMD_H
5 #include <linux/notifier.h>
9 #define EC(x) ((x) & 0xffff)
10 #define XEC(x, mask) (((x) >> 16) & mask)
12 #define LOW_SYNDROME(x) (((x) >> 15) & 0xff)
13 #define HIGH_SYNDROME(x) (((x) >> 24) & 0xff)
15 #define TLB_ERROR(x) (((x) & 0xFFF0) == 0x0010)
16 #define MEM_ERROR(x) (((x) & 0xFF00) == 0x0100)
17 #define BUS_ERROR(x) (((x) & 0xF800) == 0x0800)
18 #define INT_ERROR(x) (((x) & 0xF4FF) == 0x0400)
20 #define TT(x) (((x) >> 2) & 0x3)
21 #define TT_MSG(x) tt_msgs[TT(x)]
22 #define II(x) (((x) >> 2) & 0x3)
23 #define II_MSG(x) ii_msgs[II(x)]
24 #define LL(x) ((x) & 0x3)
25 #define LL_MSG(x) ll_msgs[LL(x)]
26 #define TO(x) (((x) >> 8) & 0x1)
27 #define TO_MSG(x) to_msgs[TO(x)]
28 #define PP(x) (((x) >> 9) & 0x3)
29 #define PP_MSG(x) pp_msgs[PP(x)]
30 #define UU(x) (((x) >> 8) & 0x3)
31 #define UU_MSG(x) uu_msgs[UU(x)]
33 #define R4(x) (((x) >> 4) & 0xf)
34 #define R4_MSG(x) ((R4(x) < 9) ? rrrr_msgs[R4(x)] : "Wrong R4!")
36 extern const char * const pp_msgs[];
72 * per-family decoder ops
74 struct amd_decoder_ops {
75 bool (*mc0_mce)(u16, u8);
76 bool (*mc1_mce)(u16, u8);
77 bool (*mc2_mce)(u16, u8);
80 void amd_report_gart_errors(bool);
81 void amd_register_ecc_decoder(void (*f)(int, struct mce *));
82 void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
84 #endif /* _EDAC_MCE_AMD_H */