24 #include <linux/module.h>
26 #include <linux/pci.h>
31 #define MODULE_NAME "pasemi_edac"
33 #define MCCFG_MCEN 0x300
34 #define MCCFG_MCEN_MMC_EN 0x00000001
35 #define MCCFG_ERRCOR 0x388
36 #define MCCFG_ERRCOR_RNK_FAIL_DET_EN 0x00000100
37 #define MCCFG_ERRCOR_ECC_GEN_EN 0x00000010
38 #define MCCFG_ERRCOR_ECC_CRR_EN 0x00000001
39 #define MCCFG_SCRUB 0x384
40 #define MCCFG_SCRUB_RGLR_SCRB_EN 0x00000001
41 #define MCDEBUG_ERRCTL1 0x728
42 #define MCDEBUG_ERRCTL1_RFL_LOG_EN 0x00080000
43 #define MCDEBUG_ERRCTL1_MBE_LOG_EN 0x00040000
44 #define MCDEBUG_ERRCTL1_SBE_LOG_EN 0x00020000
45 #define MCDEBUG_ERRSTA 0x730
46 #define MCDEBUG_ERRSTA_RFL_STATUS 0x00000004
47 #define MCDEBUG_ERRSTA_MBE_STATUS 0x00000002
48 #define MCDEBUG_ERRSTA_SBE_STATUS 0x00000001
49 #define MCDEBUG_ERRCNT1 0x734
50 #define MCDEBUG_ERRCNT1_SBE_CNT_OVRFLO 0x00000080
51 #define MCDEBUG_ERRLOG1A 0x738
52 #define MCDEBUG_ERRLOG1A_MERR_TYPE_M 0x30000000
53 #define MCDEBUG_ERRLOG1A_MERR_TYPE_NONE 0x00000000
54 #define MCDEBUG_ERRLOG1A_MERR_TYPE_SBE 0x10000000
55 #define MCDEBUG_ERRLOG1A_MERR_TYPE_MBE 0x20000000
56 #define MCDEBUG_ERRLOG1A_MERR_TYPE_RFL 0x30000000
57 #define MCDEBUG_ERRLOG1A_MERR_BA_M 0x00700000
58 #define MCDEBUG_ERRLOG1A_MERR_BA_S 20
59 #define MCDEBUG_ERRLOG1A_MERR_CS_M 0x00070000
60 #define MCDEBUG_ERRLOG1A_MERR_CS_S 16
61 #define MCDEBUG_ERRLOG1A_SYNDROME_M 0x0000ffff
62 #define MCDRAM_RANKCFG 0x114
63 #define MCDRAM_RANKCFG_EN 0x00000001
64 #define MCDRAM_RANKCFG_TYPE_SIZE_M 0x000001c0
65 #define MCDRAM_RANKCFG_TYPE_SIZE_S 6
67 #define PASEMI_EDAC_NR_CSROWS 8
68 #define PASEMI_EDAC_NR_CHANS 1
69 #define PASEMI_EDAC_ERROR_GRAIN 64
71 static int last_page_in_mmc;
72 static int system_mmc_id;
114 mci->
csrows[cs]->first_page, 0, 0,
121 mci->
csrows[cs]->first_page, 0, 0,
129 errsta = pasemi_edac_get_error_info(mci);
131 pasemi_edac_process_error_info(mci, errsta);
134 static int pasemi_edac_init_csrows(
struct mem_ctl_info *mci,
143 for (index = 0; index < mci->
nr_csrows; index++) {
147 pci_read_config_dword(pdev,
174 "Unrecognized Rank Config. rankcfg=%u\n",
196 u32 errctl1, errcor, scrub, mcen;
198 pci_read_config_dword(pdev,
MCCFG_MCEN, &mcen);
214 layers[0].is_virt_csrow =
true;
217 layers[1].is_virt_csrow =
false;
237 mci->
ctl_name =
"pasemi,pwrficient-mc";
246 if (pasemi_edac_init_csrows(mci, pdev,
256 pasemi_edac_get_error_info(mci);
287 static struct pci_driver pasemi_edac_driver = {
289 .probe = pasemi_edac_probe,
291 .id_table = pasemi_edac_pci_tbl,
294 static int __init pasemi_edac_init(
void)
299 return pci_register_driver(&pasemi_edac_driver);
302 static void __exit pasemi_edac_exit(
void)