24 #include <linux/module.h>
27 #include <linux/bitops.h>
36 #define AMD8111_EDAC_REVISION " Ver: 1.0.0"
37 #define AMD8111_EDAC_MOD_STR "amd8111_edac"
39 #define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
54 ret = pci_read_config_dword(dev, reg, val32);
57 " PCI Access Read Error at 0x%x\n", reg);
66 ret = pci_read_config_byte(dev, reg, val8);
69 " PCI Access Read Error at 0x%x\n", reg);
72 static void edac_pci_write_dword(
struct pci_dev *dev,
int reg,
u32 val32)
76 ret = pci_write_config_dword(dev, reg, val32);
79 " PCI Access Write Error at 0x%x\n", reg);
82 static void edac_pci_write_byte(
struct pci_dev *dev,
int reg,
u8 val8)
86 ret = pci_write_config_byte(dev, reg, val8);
89 " PCI Access Write Error at 0x%x\n", reg);
169 static void amd8111_pci_bridge_check(
struct edac_pci_ctl_info *edac_dev)
177 if (val32 & PCI_STSCMD_CLEAR_MASK) {
179 "register on device %s\n", pci_info->
ctl_name);
195 "register on device %s\n", pci_info->
ctl_name);
197 (val32 & HT_LINK_LKFAIL) != 0);
209 "register on device %s\n", pci_info->
ctl_name);
211 (val32 & PCI_INTBRG_CTRL_DTSTAT) != 0);
221 if (val32 & MEM_LIMIT_CLEAR_MASK) {
223 "Error(s) in mem limit register on %s device\n",
226 "RTA: %d, STA: %d, MDPE: %d\n",
241 static struct resource *legacy_io_res;
242 static int at_compat_reg_broken;
243 #define LEGACY_NR_PORTS 1
256 "start %d, len %d\n", __func__,
263 at_compat_reg_broken = 1;
265 legacy_io_res =
NULL;
298 "Error(s) in IO control register on %s device\n",
310 if (at_compat_reg_broken == 0) {
330 .init = amd8111_lpc_bridge_init,
331 .exit = amd8111_lpc_bridge_exit,
332 .check = amd8111_lpc_bridge_check,
341 .ctl_name =
"AMD8111_PCI_Controller",
342 .init = amd8111_pci_bridge_init,
343 .exit = amd8111_pci_bridge_exit,
344 .check = amd8111_pci_bridge_check,
349 static int amd8111_dev_probe(
struct pci_dev *dev,
357 if (!dev_info->
dev) {
359 "vendor %x, device %x, name %s\n",
368 "vendor %x, device %x, name %s\n",
391 dev_info->
edac_dev->dev_name = dev_name(&dev_info->
dev->dev);
397 dev_info->
init(dev_info);
407 "vendor %x, device %x, name %s\n",
414 static void amd8111_dev_remove(
struct pci_dev *dev)
418 for (dev_info = amd8111_devices; dev_info->
err_dev; dev_info++)
419 if (dev_info->
dev->device == dev->
device)
431 dev_info->
exit(dev_info);
436 static int amd8111_pci_probe(
struct pci_dev *dev,
444 if (!pci_info->
dev) {
446 "vendor %x, device %x, name %s\n",
455 "vendor %x, device %x, name %s\n",
471 pci_info->
edac_dev->pvt_info = pci_info;
475 pci_info->
edac_dev->dev_name = dev_name(&pci_info->
dev->dev);
481 pci_info->
init(pci_info);
491 "vendor %x, device %x, name %s\n",
498 static void amd8111_pci_remove(
struct pci_dev *dev)
502 for (pci_info = amd8111_pcis; pci_info->
err_dev; pci_info++)
503 if (pci_info->
dev->device == dev->
device)
515 pci_info->
exit(pci_info);
536 static struct pci_driver amd8111_edac_dev_driver = {
537 .name =
"AMD8111_EDAC_DEV",
538 .probe = amd8111_dev_probe,
539 .remove = amd8111_dev_remove,
540 .id_table = amd8111_edac_dev_tbl,
559 static struct pci_driver amd8111_edac_pci_driver = {
560 .name =
"AMD8111_EDAC_PCI",
561 .probe = amd8111_pci_probe,
562 .remove = amd8111_pci_remove,
563 .id_table = amd8111_edac_pci_tbl,
566 static int __init amd8111_edac_init(
void)
576 val = pci_register_driver(&amd8111_edac_dev_driver);
577 val |= pci_register_driver(&amd8111_edac_pci_driver);
582 static void __exit amd8111_edac_exit(
void)