aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/edac/amd64_edac.c26
-rw-r--r--drivers/edac/amd64_edac.h2
2 files changed, 13 insertions, 15 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index c91733013b48..7a7bd7785ed4 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -970,10 +970,18 @@ static int k8_early_channel_count(struct amd64_pvt *pvt)
970 return (flag) ? 2 : 1; 970 return (flag) ? 2 : 1;
971} 971}
972 972
973static u64 k8_get_error_address(struct mem_ctl_info *mci, struct mce *m) 973/* On F10h and later ErrAddr is MC4_ADDR[47:1] */
974static u64 get_error_address(struct mce *m)
974{ 975{
975 /* ErrAddr[39:3] */ 976 u8 start_bit = 1;
976 return m->addr & GENMASK(3, 39); 977 u8 end_bit = 47;
978
979 if (boot_cpu_data.x86 == 0xf) {
980 start_bit = 3;
981 end_bit = 39;
982 }
983
984 return m->addr & GENMASK(start_bit, end_bit);
977} 985}
978 986
979static void read_dram_base_limit_regs(struct amd64_pvt *pvt, unsigned range) 987static void read_dram_base_limit_regs(struct amd64_pvt *pvt, unsigned range)
@@ -1127,11 +1135,6 @@ static int f10_dbam_to_chip_select(struct amd64_pvt *pvt, int cs_mode)
1127 return dbam_map[cs_mode]; 1135 return dbam_map[cs_mode];
1128} 1136}
1129 1137
1130static u64 f10_get_error_address(struct mem_ctl_info *mci, struct mce *m)
1131{
1132 return m->addr & GENMASK(1, 47);
1133}
1134
1135static void f10_read_dram_ctl_register(struct amd64_pvt *pvt) 1138static void f10_read_dram_ctl_register(struct amd64_pvt *pvt)
1136{ 1139{
1137 1140
@@ -1512,7 +1515,6 @@ static struct amd64_family_type amd64_family_types[] = {
1512 .f3_id = PCI_DEVICE_ID_AMD_K8_NB_MISC, 1515 .f3_id = PCI_DEVICE_ID_AMD_K8_NB_MISC,
1513 .ops = { 1516 .ops = {
1514 .early_channel_count = k8_early_channel_count, 1517 .early_channel_count = k8_early_channel_count,
1515 .get_error_address = k8_get_error_address,
1516 .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow, 1518 .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow,
1517 .dbam_to_cs = k8_dbam_to_chip_select, 1519 .dbam_to_cs = k8_dbam_to_chip_select,
1518 .read_dct_pci_cfg = k8_read_dct_pci_cfg, 1520 .read_dct_pci_cfg = k8_read_dct_pci_cfg,
@@ -1524,7 +1526,6 @@ static struct amd64_family_type amd64_family_types[] = {
1524 .f3_id = PCI_DEVICE_ID_AMD_10H_NB_MISC, 1526 .f3_id = PCI_DEVICE_ID_AMD_10H_NB_MISC,
1525 .ops = { 1527 .ops = {
1526 .early_channel_count = f1x_early_channel_count, 1528 .early_channel_count = f1x_early_channel_count,
1527 .get_error_address = f10_get_error_address,
1528 .read_dram_ctl_register = f10_read_dram_ctl_register, 1529 .read_dram_ctl_register = f10_read_dram_ctl_register,
1529 .map_sysaddr_to_csrow = f10_map_sysaddr_to_csrow, 1530 .map_sysaddr_to_csrow = f10_map_sysaddr_to_csrow,
1530 .dbam_to_cs = f10_dbam_to_chip_select, 1531 .dbam_to_cs = f10_dbam_to_chip_select,
@@ -1738,7 +1739,7 @@ static void amd64_handle_ce(struct mem_ctl_info *mci, struct mce *m)
1738 return; 1739 return;
1739 } 1740 }
1740 1741
1741 sys_addr = pvt->ops->get_error_address(mci, m); 1742 sys_addr = get_error_address(m);
1742 syndrome = extract_syndrome(m->status); 1743 syndrome = extract_syndrome(m->status);
1743 1744
1744 amd64_mc_err(mci, "CE ERROR_ADDRESS= 0x%llx\n", sys_addr); 1745 amd64_mc_err(mci, "CE ERROR_ADDRESS= 0x%llx\n", sys_addr);
@@ -1749,7 +1750,6 @@ static void amd64_handle_ce(struct mem_ctl_info *mci, struct mce *m)
1749/* Handle any Un-correctable Errors (UEs) */ 1750/* Handle any Un-correctable Errors (UEs) */
1750static void amd64_handle_ue(struct mem_ctl_info *mci, struct mce *m) 1751static void amd64_handle_ue(struct mem_ctl_info *mci, struct mce *m)
1751{ 1752{
1752 struct amd64_pvt *pvt = mci->pvt_info;
1753 struct mem_ctl_info *log_mci, *src_mci = NULL; 1753 struct mem_ctl_info *log_mci, *src_mci = NULL;
1754 int csrow; 1754 int csrow;
1755 u64 sys_addr; 1755 u64 sys_addr;
@@ -1763,7 +1763,7 @@ static void amd64_handle_ue(struct mem_ctl_info *mci, struct mce *m)
1763 return; 1763 return;
1764 } 1764 }
1765 1765
1766 sys_addr = pvt->ops->get_error_address(mci, m); 1766 sys_addr = get_error_address(m);
1767 1767
1768 /* 1768 /*
1769 * Find out which node the error address belongs to. This may be 1769 * Find out which node the error address belongs to. This may be
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index ba16535842ba..6ae8aa8cc178 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -444,8 +444,6 @@ extern struct mcidev_sysfs_attribute amd64_dbg_attrs[NUM_DBG_ATTRS],
444 */ 444 */
445struct low_ops { 445struct low_ops {
446 int (*early_channel_count) (struct amd64_pvt *pvt); 446 int (*early_channel_count) (struct amd64_pvt *pvt);
447
448 u64 (*get_error_address) (struct mem_ctl_info *mci, struct mce *m);
449 void (*read_dram_ctl_register) (struct amd64_pvt *pvt); 447 void (*read_dram_ctl_register) (struct amd64_pvt *pvt);
450 void (*map_sysaddr_to_csrow) (struct mem_ctl_info *mci, u64 sys_addr, 448 void (*map_sysaddr_to_csrow) (struct mem_ctl_info *mci, u64 sys_addr,
451 u16 syndrome); 449 u16 syndrome);