aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-08-05 19:27:15 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-10 10:44:55 -0400
commit4157d9f55435331deef01ba8a9a47f248c042fb2 (patch)
treea9b3d7934719326c55ad1545b42719abbc7a963c /drivers
parent2068def56c09f2b24e6de04a1b84757a0fb07947 (diff)
i7core_edac: fix error injection
There were two stupid error injection bugs introduced by wrong cut-and-paste: one at socket store, and another at the error inject register. The last one were causing the code to not work at all. While here, adds debug messages to allow seeing what registers are being set while sending error injection. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/i7core_edac.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index ab9d26ec19d7..f16aac253654 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -625,7 +625,7 @@ static int disable_inject(struct mem_ctl_info *mci)
625 return -ENODEV; 625 return -ENODEV;
626 626
627 pci_write_config_dword(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0], 627 pci_write_config_dword(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0],
628 MC_CHANNEL_ERROR_MASK, 0); 628 MC_CHANNEL_ERROR_INJECT, 0);
629 629
630 return 0; 630 return 0;
631} 631}
@@ -646,7 +646,7 @@ static ssize_t i7core_inject_socket_store(struct mem_ctl_info *mci,
646 if ((rc < 0) || (value >= pvt->sockets)) 646 if ((rc < 0) || (value >= pvt->sockets))
647 return -EIO; 647 return -EIO;
648 648
649 pvt->inject.section = (u32) value; 649 pvt->inject.socket = (u32) value;
650 return count; 650 return count;
651} 651}
652 652
@@ -872,6 +872,10 @@ static int write_and_test(struct pci_dev *dev, int where, u32 val)
872 u32 read; 872 u32 read;
873 int count; 873 int count;
874 874
875 debugf0("setting pci %02x:%02x.%x reg=%02x value=%08x\n",
876 dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn),
877 where, val);
878
875 for (count = 0; count < 10; count++) { 879 for (count = 0; count < 10; count++) {
876 if (count) 880 if (count)
877 msleep (100); 881 msleep (100);
@@ -882,8 +886,10 @@ static int write_and_test(struct pci_dev *dev, int where, u32 val)
882 return 0; 886 return 0;
883 } 887 }
884 888
885 debugf0("Error Injection Register 0x%02x: Tried to write 0x%08x, " 889 i7core_printk(KERN_ERR, "Error during set pci %02x:%02x.%x reg=%02x "
886 "but read: 0x%08x\n", where, val, read); 890 "write=%08x. Read=%08x\n",
891 dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn),
892 where, val, read);
887 893
888 return -EINVAL; 894 return -EINVAL;
889} 895}
@@ -983,15 +989,6 @@ static ssize_t i7core_inject_enable_store(struct mem_ctl_info *mci,
983 pci_write_config_dword(pvt->pci_noncore[pvt->inject.socket], 989 pci_write_config_dword(pvt->pci_noncore[pvt->inject.socket],
984 MC_CFG_CONTROL, 0x2); 990 MC_CFG_CONTROL, 0x2);
985 991
986#if 0
987 /* Zeroes error count registers */
988 pci_write_config_dword(pvt->pci_mcr[pvt->inject.socket][4],
989 MC_TEST_ERR_RCV1, 0);
990 pci_write_config_dword(pvt->pci_mcr[pvt->inject.socket][4],
991 MC_TEST_ERR_RCV0, 0);
992 pvt->ce_count_available[pvt->inject.socket] = 0;
993#endif
994
995 write_and_test(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0], 992 write_and_test(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0],
996 MC_CHANNEL_ADDR_MATCH, mask); 993 MC_CHANNEL_ADDR_MATCH, mask);
997 write_and_test(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0], 994 write_and_test(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0],
@@ -1001,7 +998,7 @@ static ssize_t i7core_inject_enable_store(struct mem_ctl_info *mci,
1001 MC_CHANNEL_ERROR_MASK, pvt->inject.eccmask); 998 MC_CHANNEL_ERROR_MASK, pvt->inject.eccmask);
1002 999
1003 write_and_test(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0], 1000 write_and_test(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0],
1004 MC_CHANNEL_ERROR_MASK, injectmask); 1001 MC_CHANNEL_ERROR_INJECT, injectmask);
1005 1002
1006 /* 1003 /*
1007 * This is something undocumented, based on my tests 1004 * This is something undocumented, based on my tests
@@ -1026,7 +1023,7 @@ static ssize_t i7core_inject_enable_show(struct mem_ctl_info *mci,
1026 u32 injectmask; 1023 u32 injectmask;
1027 1024
1028 pci_read_config_dword(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0], 1025 pci_read_config_dword(pvt->pci_ch[pvt->inject.socket][pvt->inject.channel][0],
1029 MC_CHANNEL_ERROR_MASK, &injectmask); 1026 MC_CHANNEL_ERROR_INJECT, &injectmask);
1030 1027
1031 debugf0("Inject error read: 0x%018x\n", injectmask); 1028 debugf0("Inject error read: 0x%018x\n", injectmask);
1032 1029