16 #include <linux/module.h>
18 #include <linux/pci.h>
23 #define I82875P_REVISION " Ver: 2.0.2"
24 #define EDAC_MOD_STR "i82875p_edac"
26 #define i82875p_printk(level, fmt, arg...) \
27 edac_printk(level, "i82875p", fmt, ##arg)
29 #define i82875p_mc_printk(mci, level, fmt, arg...) \
30 edac_mc_chipset_printk(mci, level, "i82875p", fmt, ##arg)
32 #ifndef PCI_DEVICE_ID_INTEL_82875_0
33 #define PCI_DEVICE_ID_INTEL_82875_0 0x2578
36 #ifndef PCI_DEVICE_ID_INTEL_82875_6
37 #define PCI_DEVICE_ID_INTEL_82875_6 0x257e
41 #define I82875P_NR_DIMMS 8
42 #define I82875P_NR_CSROWS(nr_chans) (I82875P_NR_DIMMS / (nr_chans))
45 #define I82875P_EAP 0x58
51 #define I82875P_DERRSYN 0x5c
56 #define I82875P_DES 0x5d
62 #define I82875P_ERRSTS 0xc8
77 #define I82875P_ERRCMD 0xca
93 #define I82875P_PCICMD6 0x04
108 #define I82875P_BAR6 0x10
119 #define I82875P_DRB_SHIFT 26
120 #define I82875P_DRB 0x00
126 #define I82875P_DRA 0x10
139 #define I82875P_DRC 0x68
178 .ctl_name =
"i82875p"},
181 static struct pci_dev *mci_pdev;
185 static struct edac_pci_ctl_info *i82875p_pci;
201 if (!(info->
errsts & 0x0081))
224 static int i82875p_process_error_info(
struct mem_ctl_info *mci,
230 multi_chan = mci->
csrows[0]->nr_channels - 1;
232 if (!(info->
errsts & 0x0081))
241 "UE overwrote CE",
"");
248 if (info->
errsts & 0x0080)
256 row, multi_chan ? (info->
des & 0x1) : 0,
257 -1,
"i82875p CE",
"");
267 i82875p_get_error_info(mci, &info);
268 i82875p_process_error_info(mci, &info, 1);
272 static int i82875p_setup_overfl_dev(
struct pci_dev *pdev,
281 *ovrfl_window =
NULL;
290 pci_write_bits8(pdev, 0xf4, 0x2, 0x2);
299 "%s(): pci_bus_add_device() Failed\n",
309 "device\n", __func__);
321 if (window ==
NULL) {
342 static inline int dual_channel_active(
u32 drc)
344 return (drc >> 21) & 0x1;
347 static void i82875p_init_csrows(
struct mem_ctl_info *mci,
353 unsigned nr_chans = dual_channel_active(drc) + 1;
354 unsigned long last_cumul_size;
360 drc_ddim = (drc >> 18) & 0x1;
369 for (index = 0; index < mci->
nr_csrows; index++) {
374 edac_dbg(3,
"(%d) cumul_size 0x%x\n", index, cumul_size);
375 if (cumul_size == last_cumul_size)
380 nr_pages = cumul_size - last_cumul_size;
381 last_cumul_size = cumul_size;
383 for (j = 0; j < nr_chans; j++) {
386 dimm->
nr_pages = nr_pages / nr_chans;
387 dimm->
grain = 1 << 12;
395 static int i82875p_probe1(
struct pci_dev *pdev,
int dev_idx)
411 if (i82875p_setup_overfl_dev(pdev, &ovrfl_pdev, &ovrfl_window))
414 nr_chans = dual_channel_active(drc) + 1;
418 layers[0].is_virt_csrow =
true;
420 layers[1].size = nr_chans;
421 layers[1].is_virt_csrow =
false;
443 i82875p_init_csrows(mci, pdev, ovrfl_window, drc);
444 i82875p_get_error_info(mci, &
discard);
450 edac_dbg(3,
"failed edac_mc_add_mc()\n");
458 "%s(): Unable to create PCI control\n",
461 "%s(): PCI error report via EDAC not setup\n",
495 if (mci_pdev ==
NULL)
543 .probe = i82875p_init_one,
545 .id_table = i82875p_pci_tbl,
548 static int __init i82875p_init(
void)
557 pci_rc = pci_register_driver(&i82875p_driver);
562 if (mci_pdev ==
NULL) {
567 edac_dbg(0,
"875p pci_get_device fail\n");
572 pci_rc = i82875p_init_one(mci_pdev, i82875p_pci_tbl);
587 if (mci_pdev !=
NULL)
593 static void __exit i82875p_exit(
void)
597 i82875p_remove_one(mci_pdev);
608 MODULE_AUTHOR(
"Linux Networx (http://lnxi.com) Thayne Harbaugh");