aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd64_edac.c
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2011-01-10 08:37:27 -0500
committerBorislav Petkov <borislav.petkov@amd.com>2011-03-17 09:46:19 -0400
commit700466249f9bb787165da64d2615cee456d88751 (patch)
tree35fc0e5a32b5d0d2da3b42bcc7380c06ce4cbade /drivers/edac/amd64_edac.c
parentf192c7b16c98839c1945733f1013f75daec5f380 (diff)
amd64_edac: Unify get_error_address
The address bits from MC4_STATUS differ only between K8 and the rest so no need for a per-family method. No functional change. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/amd64_edac.c')
-rw-r--r--drivers/edac/amd64_edac.c26
1 files changed, 13 insertions, 13 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