Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _EDAC_MCE_AMD_H
0003 #define _EDAC_MCE_AMD_H
0004 
0005 #include <linux/notifier.h>
0006 
0007 #include <asm/mce.h>
0008 
0009 #define EC(x)               ((x) & 0xffff)
0010 
0011 #define LOW_SYNDROME(x)         (((x) >> 15) & 0xff)
0012 #define HIGH_SYNDROME(x)        (((x) >> 24) & 0xff)
0013 
0014 #define TLB_ERROR(x)            (((x) & 0xFFF0) == 0x0010)
0015 #define MEM_ERROR(x)            (((x) & 0xFF00) == 0x0100)
0016 #define BUS_ERROR(x)            (((x) & 0xF800) == 0x0800)
0017 #define INT_ERROR(x)            (((x) & 0xF4FF) == 0x0400)
0018 
0019 #define TT(x)               (((x) >> 2) & 0x3)
0020 #define TT_MSG(x)           tt_msgs[TT(x)]
0021 #define II(x)               (((x) >> 2) & 0x3)
0022 #define II_MSG(x)           ii_msgs[II(x)]
0023 #define LL(x)               ((x) & 0x3)
0024 #define LL_MSG(x)           ll_msgs[LL(x)]
0025 #define TO(x)               (((x) >> 8) & 0x1)
0026 #define TO_MSG(x)           to_msgs[TO(x)]
0027 #define PP(x)               (((x) >> 9) & 0x3)
0028 #define PP_MSG(x)           pp_msgs[PP(x)]
0029 #define UU(x)               (((x) >> 8) & 0x3)
0030 #define UU_MSG(x)           uu_msgs[UU(x)]
0031 
0032 #define R4(x)               (((x) >> 4) & 0xf)
0033 #define R4_MSG(x)           ((R4(x) < 9) ?  rrrr_msgs[R4(x)] : "Wrong R4!")
0034 
0035 extern const char * const pp_msgs[];
0036 
0037 enum tt_ids {
0038     TT_INSTR = 0,
0039     TT_DATA,
0040     TT_GEN,
0041     TT_RESV,
0042 };
0043 
0044 enum ll_ids {
0045     LL_RESV = 0,
0046     LL_L1,
0047     LL_L2,
0048     LL_LG,
0049 };
0050 
0051 enum ii_ids {
0052     II_MEM = 0,
0053     II_RESV,
0054     II_IO,
0055     II_GEN,
0056 };
0057 
0058 enum rrrr_ids {
0059     R4_GEN  = 0,
0060     R4_RD,
0061     R4_WR,
0062     R4_DRD,
0063     R4_DWR,
0064     R4_IRD,
0065     R4_PREF,
0066     R4_EVICT,
0067     R4_SNOOP,
0068 };
0069 
0070 /*
0071  * per-family decoder ops
0072  */
0073 struct amd_decoder_ops {
0074     bool (*mc0_mce)(u16, u8);
0075     bool (*mc1_mce)(u16, u8);
0076     bool (*mc2_mce)(u16, u8);
0077 };
0078 
0079 void amd_register_ecc_decoder(void (*f)(int, struct mce *));
0080 void amd_unregister_ecc_decoder(void (*f)(int, struct mce *));
0081 
0082 #endif /* _EDAC_MCE_AMD_H */