28 #include <linux/module.h>
30 #include <linux/pci.h>
35 #define E7XXX_REVISION " Ver: 2.0.2"
36 #define EDAC_MOD_STR "e7xxx_edac"
38 #define e7xxx_printk(level, fmt, arg...) \
39 edac_printk(level, "e7xxx", fmt, ##arg)
41 #define e7xxx_mc_printk(mci, level, fmt, arg...) \
42 edac_mc_chipset_printk(mci, level, "e7xxx", fmt, ##arg)
44 #ifndef PCI_DEVICE_ID_INTEL_7205_0
45 #define PCI_DEVICE_ID_INTEL_7205_0 0x255d
48 #ifndef PCI_DEVICE_ID_INTEL_7205_1_ERR
49 #define PCI_DEVICE_ID_INTEL_7205_1_ERR 0x2551
52 #ifndef PCI_DEVICE_ID_INTEL_7500_0
53 #define PCI_DEVICE_ID_INTEL_7500_0 0x2540
56 #ifndef PCI_DEVICE_ID_INTEL_7500_1_ERR
57 #define PCI_DEVICE_ID_INTEL_7500_1_ERR 0x2541
60 #ifndef PCI_DEVICE_ID_INTEL_7501_0
61 #define PCI_DEVICE_ID_INTEL_7501_0 0x254c
64 #ifndef PCI_DEVICE_ID_INTEL_7501_1_ERR
65 #define PCI_DEVICE_ID_INTEL_7501_1_ERR 0x2541
68 #ifndef PCI_DEVICE_ID_INTEL_7505_0
69 #define PCI_DEVICE_ID_INTEL_7505_0 0x2550
72 #ifndef PCI_DEVICE_ID_INTEL_7505_1_ERR
73 #define PCI_DEVICE_ID_INTEL_7505_1_ERR 0x2551
76 #define E7XXX_NR_CSROWS 8
77 #define E7XXX_NR_DIMMS 8
80 #define E7XXX_DRB 0x60
81 #define E7XXX_DRA 0x70
92 #define E7XXX_DRC 0x7C
97 #define E7XXX_TOLM 0xC4
98 #define E7XXX_REMAPBASE 0xC6
99 #define E7XXX_REMAPLIMIT 0xC8
102 #define E7XXX_DRAM_FERR 0x80
103 #define E7XXX_DRAM_NERR 0x82
104 #define E7XXX_DRAM_CELOG_ADD 0xA0
111 #define E7XXX_DRAM_UELOG_ADD 0xB0
118 #define E7XXX_DRAM_CELOG_SYNDROME 0xD0
149 static struct edac_pci_ctl_info *e7xxx_pci;
154 .ctl_name =
"E7500"},
157 .ctl_name =
"E7501"},
160 .ctl_name =
"E7505"},
163 .ctl_name =
"E7205"},
167 static inline int e7xxx_find_channel(
u16 syndrome)
171 if ((syndrome & 0xff00) == 0)
174 if ((syndrome & 0x00ff) == 0)
177 if ((syndrome & 0xf000) == 0 || (syndrome & 0x0f00) == 0)
201 return pvt->
tolm - 1;
215 page = error_1b >> 6;
221 channel = e7xxx_find_channel(syndrome);
223 row, channel, -1,
"e7xxx CE",
"");
226 static void process_ce_no_info(
struct mem_ctl_info *mci)
230 "e7xxx CE log register overflow",
"");
235 u32 error_2b, block_page;
242 block_page = error_2b >> 6;
246 row, -1, -1,
"e7xxx UE",
"");
249 static void process_ue_no_info(
struct mem_ctl_info *mci)
254 "e7xxx UE log register overflow",
"");
257 static void e7xxx_get_error_info(
struct mem_ctl_info *mci,
285 static int e7xxx_process_error_info(
struct mem_ctl_info *mci,
298 process_ce(mci, info);
305 process_ue(mci, info);
313 process_ce_no_info(mci);
315 process_ce(mci, info);
324 process_ue_no_info(mci);
326 process_ue(mci, info);
338 e7xxx_get_error_info(mci, &info);
339 e7xxx_process_error_info(mci, &info, 1);
343 static inline int dual_channel_active(
u32 drc,
int dev_idx)
345 return (dev_idx ==
E7501) ? ((drc >> 22) & 0x1) : 1;
349 static inline int drb_granularity(
u32 drc,
int dev_idx)
352 return (dev_idx ==
E7501) ? ((drc >> 18) & 0x3) : 1;
356 int dev_idx,
u32 drc)
358 unsigned long last_cumul_size;
361 u32 dra, cumul_size, nr_pages;
362 int drc_chan, drc_drbg, drc_ddim, mem_dev;
367 pci_read_config_dword(pdev,
E7XXX_DRA, &dra);
368 drc_chan = dual_channel_active(drc, dev_idx);
369 drc_drbg = drb_granularity(drc, dev_idx);
370 drc_ddim = (drc >> 20) & 0x3;
378 for (index = 0; index < mci->
nr_csrows; index++) {
380 mem_dev = (dra >> (index * 4 + 3)) & 0x1;
383 pci_read_config_byte(pdev,
E7XXX_DRB + index, &value);
385 cumul_size = value << (25 + drc_drbg -
PAGE_SHIFT);
386 edac_dbg(3,
"(%d) cumul_size 0x%x\n", index, cumul_size);
387 if (cumul_size == last_cumul_size)
392 nr_pages = cumul_size - last_cumul_size;
393 last_cumul_size = cumul_size;
400 if (drc_chan && mem_dev) {
410 for (j = 0; j < drc_chan + 1; j++) {
413 dimm->
nr_pages = nr_pages / (drc_chan + 1);
414 dimm->
grain = 1 << 12;
422 static int e7xxx_probe1(
struct pci_dev *pdev,
int dev_idx)
434 pci_read_config_dword(pdev,
E7XXX_DRC, &drc);
436 drc_chan = dual_channel_active(drc, dev_idx);
447 layers[0].is_virt_csrow =
true;
449 layers[1].size = drc_chan + 1;
450 layers[1].is_virt_csrow =
false;
465 pvt->
dev_info = &e7xxx_devs[dev_idx];
471 "vendor %x device 0x%x (broken BIOS?)\n",
481 e7xxx_init_csrows(mci, pdev, dev_idx, drc);
483 edac_dbg(3,
"tolm, remapbase, remaplimit\n");
485 pci_read_config_word(pdev,
E7XXX_TOLM, &pci_data);
486 pvt->
tolm = ((
u32) pci_data) << 4;
492 "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->
tolm,
496 e7xxx_get_error_info(mci, &
discard);
502 edac_dbg(3,
"failed edac_mc_add_mc()\n");
510 "%s(): Unable to create PCI control\n",
513 "%s(): PCI error report via EDAC not setup\n",
581 .probe = e7xxx_init_one,
583 .id_table = e7xxx_pci_tbl,
586 static int __init e7xxx_init(
void)
591 return pci_register_driver(&e7xxx_driver);
594 static void __exit e7xxx_exit(
void)
603 MODULE_AUTHOR(
"Linux Networx (http://lnxi.com) Thayne Harbaugh et al\n"
604 "Based on.work by Dan Hollis et al");