18 #include <linux/module.h>
20 #include <linux/pci.h>
25 #define R82600_REVISION " Ver: 2.0.2"
26 #define EDAC_MOD_STR "r82600_edac"
28 #define r82600_printk(level, fmt, arg...) \
29 edac_printk(level, "r82600", fmt, ##arg)
31 #define r82600_mc_printk(mci, level, fmt, arg...) \
32 edac_mc_chipset_printk(mci, level, "r82600", fmt, ##arg)
44 #define R82600_NR_CSROWS 4
45 #define R82600_NR_CHANS 1
46 #define R82600_NR_DIMMS 4
48 #define R82600_BRIDGE_ID 0x8200
51 #define R82600_DRAMC 0x57
65 #define R82600_SDRAMC 0x76
89 #define R82600_EAP 0x80
123 #define R82600_DRBA 0x60
134 static bool disable_hardware_scrub;
136 static struct edac_pci_ctl_info *r82600_pci;
159 static int r82600_process_error_info(
struct mem_ctl_info *mci,
170 eapaddr = ((info->
eapr >> 12) & 0x7FFF) << 13;
172 syndrome = (info->
eapr >> 4) & 0xFF;
209 r82600_get_error_info(mci, &info);
210 r82600_process_error_info(mci, &info, 1);
213 static inline int ecc_enabled(
u8 dramcr)
215 return dramcr &
BIT(5);
225 u32 row_high_limit, row_high_limit_last;
226 u32 reg_sdram, ecc_on, row_base;
228 ecc_on = ecc_enabled(dramcr);
229 reg_sdram = dramcr &
BIT(4);
230 row_high_limit_last = 0;
232 for (index = 0; index < mci->
nr_csrows; index++) {
237 pci_read_config_byte(pdev,
R82600_DRBA + index, &drbar);
239 edac_dbg(1,
"Row=%d DRBA = %#0x\n", index, drbar);
241 row_high_limit = ((
u32) drbar << 24);
244 edac_dbg(1,
"Row=%d, Boundary Address=%#0x, Last = %#0x\n",
245 index, row_high_limit, row_high_limit_last);
248 if (row_high_limit == row_high_limit_last)
251 row_base = row_high_limit_last;
259 dimm->
grain = 1 << 14;
266 row_high_limit_last = row_high_limit;
270 static int r82600_probe1(
struct pci_dev *pdev,
int dev_idx)
277 u32 sdram_refresh_rate;
282 pci_read_config_dword(pdev,
R82600_EAP, &eapr);
283 scrub_disabled = eapr &
BIT(31);
284 sdram_refresh_rate = dramcr & (
BIT(0) |
BIT(1));
285 edac_dbg(2,
"sdram refresh rate = %#0x\n", sdram_refresh_rate);
286 edac_dbg(2,
"DRAMC register = %#0x\n", dramcr);
289 layers[0].is_virt_csrow =
true;
292 layers[1].is_virt_csrow =
false;
311 if (ecc_enabled(dramcr)) {
313 edac_dbg(3,
"mci = %p - Scrubbing disabled! EAP: %#0x\n",
324 r82600_init_csrows(mci, pdev, dramcr);
325 r82600_get_error_info(mci, &
discard);
331 edac_dbg(3,
"failed edac_mc_add_mc()\n");
337 if (disable_hardware_scrub) {
338 edac_dbg(3,
"Disabling Hardware Scrub (scrub on error)\n");
346 "%s(): Unable to create PCI control\n",
349 "%s(): PCI error report via EDAC not setup\n",
399 .probe = r82600_init_one,
401 .id_table = r82600_pci_tbl,
404 static int __init r82600_init(
void)
409 return pci_register_driver(&r82600_driver);
412 static void __exit r82600_exit(
void)
422 "on behalf of EADS Astrium");
427 "If set, disable the chipset's automatic scrub for CEs");