aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2011-01-17 09:59:58 -0500
committerBorislav Petkov <borislav.petkov@amd.com>2011-03-17 09:46:22 -0400
commitb15f0fcab1ab85c773c9fa235c76e6ce90b7462e (patch)
treeeb68a43d4df1b34da9ecc67ea26bc51df174aeef /drivers/edac
parent355fba600549cfcfab227f928eab3ccae444ec8e (diff)
amd64_edac: Adjust sys_addr to chip select conversion routine to F15h
F15h sys_addr to chip select mapping is almost identical to F10h's so reuse that. Rename functions on that path accordingly. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/amd64_edac.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index e4ad09110b96..1cd82f9efb77 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1171,7 +1171,7 @@ static void f10_read_dram_ctl_register(struct amd64_pvt *pvt)
1171 * Determine channel (DCT) based on the interleaving mode: F10h BKDG, 2.8.9 Memory 1171 * Determine channel (DCT) based on the interleaving mode: F10h BKDG, 2.8.9 Memory
1172 * Interleaving Modes. 1172 * Interleaving Modes.
1173 */ 1173 */
1174static u8 f10_determine_channel(struct amd64_pvt *pvt, u64 sys_addr, 1174static u8 f1x_determine_channel(struct amd64_pvt *pvt, u64 sys_addr,
1175 bool hi_range_sel, u8 intlv_en) 1175 bool hi_range_sel, u8 intlv_en)
1176{ 1176{
1177 u32 dct_sel_high = (pvt->dct_sel_lo >> 1) & 1; 1177 u32 dct_sel_high = (pvt->dct_sel_lo >> 1) & 1;
@@ -1209,7 +1209,7 @@ static u8 f10_determine_channel(struct amd64_pvt *pvt, u64 sys_addr,
1209} 1209}
1210 1210
1211/* Convert the sys_addr to the normalized DCT address */ 1211/* Convert the sys_addr to the normalized DCT address */
1212static u64 f10_get_norm_dct_addr(struct amd64_pvt *pvt, int range, 1212static u64 f1x_get_norm_dct_addr(struct amd64_pvt *pvt, int range,
1213 u64 sys_addr, bool hi_rng, 1213 u64 sys_addr, bool hi_rng,
1214 u32 dct_sel_base_addr) 1214 u32 dct_sel_base_addr)
1215{ 1215{
@@ -1286,7 +1286,7 @@ static int f10_process_possible_spare(struct amd64_pvt *pvt, u8 dct, int csrow)
1286 * -EINVAL: NOT FOUND 1286 * -EINVAL: NOT FOUND
1287 * 0..csrow = Chip-Select Row 1287 * 0..csrow = Chip-Select Row
1288 */ 1288 */
1289static int f10_lookup_addr_in_dct(u64 in_addr, u32 nid, u8 dct) 1289static int f1x_lookup_addr_in_dct(u64 in_addr, u32 nid, u8 dct)
1290{ 1290{
1291 struct mem_ctl_info *mci; 1291 struct mem_ctl_info *mci;
1292 struct amd64_pvt *pvt; 1292 struct amd64_pvt *pvt;
@@ -1332,7 +1332,7 @@ static int f10_lookup_addr_in_dct(u64 in_addr, u32 nid, u8 dct)
1332 * swapped with a region located at the bottom of memory so that the GPU can use 1332 * swapped with a region located at the bottom of memory so that the GPU can use
1333 * the interleaved region and thus two channels. 1333 * the interleaved region and thus two channels.
1334 */ 1334 */
1335static u64 f10_swap_interleaved_region(struct amd64_pvt *pvt, u64 sys_addr) 1335static u64 f1x_swap_interleaved_region(struct amd64_pvt *pvt, u64 sys_addr)
1336{ 1336{
1337 u32 swap_reg, swap_base, swap_limit, rgn_size, tmp_addr; 1337 u32 swap_reg, swap_base, swap_limit, rgn_size, tmp_addr;
1338 1338
@@ -1364,7 +1364,7 @@ static u64 f10_swap_interleaved_region(struct amd64_pvt *pvt, u64 sys_addr)
1364} 1364}
1365 1365
1366/* For a given @dram_range, check if @sys_addr falls within it. */ 1366/* For a given @dram_range, check if @sys_addr falls within it. */
1367static int f10_match_to_this_node(struct amd64_pvt *pvt, int range, 1367static int f1x_match_to_this_node(struct amd64_pvt *pvt, int range,
1368 u64 sys_addr, int *nid, int *chan_sel) 1368 u64 sys_addr, int *nid, int *chan_sel)
1369{ 1369{
1370 int cs_found = -EINVAL; 1370 int cs_found = -EINVAL;
@@ -1395,7 +1395,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range,
1395 return -EINVAL; 1395 return -EINVAL;
1396 } 1396 }
1397 1397
1398 sys_addr = f10_swap_interleaved_region(pvt, sys_addr); 1398 sys_addr = f1x_swap_interleaved_region(pvt, sys_addr);
1399 1399
1400 dct_sel_base = dct_sel_baseaddr(pvt); 1400 dct_sel_base = dct_sel_baseaddr(pvt);
1401 1401
@@ -1408,9 +1408,9 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range,
1408 ((sys_addr >> 27) >= (dct_sel_base >> 11))) 1408 ((sys_addr >> 27) >= (dct_sel_base >> 11)))
1409 high_range = true; 1409 high_range = true;
1410 1410
1411 channel = f10_determine_channel(pvt, sys_addr, high_range, intlv_en); 1411 channel = f1x_determine_channel(pvt, sys_addr, high_range, intlv_en);
1412 1412
1413 chan_addr = f10_get_norm_dct_addr(pvt, range, sys_addr, 1413 chan_addr = f1x_get_norm_dct_addr(pvt, range, sys_addr,
1414 high_range, dct_sel_base); 1414 high_range, dct_sel_base);
1415 1415
1416 /* Remove node interleaving, see F1x120 */ 1416 /* Remove node interleaving, see F1x120 */
@@ -1440,7 +1440,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range,
1440 1440
1441 debugf1(" Normalized DCT addr: 0x%llx\n", chan_addr); 1441 debugf1(" Normalized DCT addr: 0x%llx\n", chan_addr);
1442 1442
1443 cs_found = f10_lookup_addr_in_dct(chan_addr, node_id, channel); 1443 cs_found = f1x_lookup_addr_in_dct(chan_addr, node_id, channel);
1444 1444
1445 if (cs_found >= 0) { 1445 if (cs_found >= 0) {
1446 *nid = node_id; 1446 *nid = node_id;
@@ -1449,7 +1449,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range,
1449 return cs_found; 1449 return cs_found;
1450} 1450}
1451 1451
1452static int f10_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr, 1452static int f1x_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr,
1453 int *node, int *chan_sel) 1453 int *node, int *chan_sel)
1454{ 1454{
1455 int range, cs_found = -EINVAL; 1455 int range, cs_found = -EINVAL;
@@ -1462,7 +1462,7 @@ static int f10_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr,
1462 if ((get_dram_base(pvt, range) <= sys_addr) && 1462 if ((get_dram_base(pvt, range) <= sys_addr) &&
1463 (get_dram_limit(pvt, range) >= sys_addr)) { 1463 (get_dram_limit(pvt, range) >= sys_addr)) {
1464 1464
1465 cs_found = f10_match_to_this_node(pvt, range, 1465 cs_found = f1x_match_to_this_node(pvt, range,
1466 sys_addr, node, 1466 sys_addr, node,
1467 chan_sel); 1467 chan_sel);
1468 if (cs_found >= 0) 1468 if (cs_found >= 0)
@@ -1479,14 +1479,14 @@ static int f10_translate_sysaddr_to_cs(struct amd64_pvt *pvt, u64 sys_addr,
1479 * The @sys_addr is usually an error address received from the hardware 1479 * The @sys_addr is usually an error address received from the hardware
1480 * (MCX_ADDR). 1480 * (MCX_ADDR).
1481 */ 1481 */
1482static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr, 1482static void f1x_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr,
1483 u16 syndrome) 1483 u16 syndrome)
1484{ 1484{
1485 struct amd64_pvt *pvt = mci->pvt_info; 1485 struct amd64_pvt *pvt = mci->pvt_info;
1486 u32 page, offset; 1486 u32 page, offset;
1487 int nid, csrow, chan = 0; 1487 int nid, csrow, chan = 0;
1488 1488
1489 csrow = f10_translate_sysaddr_to_cs(pvt, sys_addr, &nid, &chan); 1489 csrow = f1x_translate_sysaddr_to_cs(pvt, sys_addr, &nid, &chan);
1490 1490
1491 if (csrow < 0) { 1491 if (csrow < 0) {
1492 edac_mc_handle_ce_no_info(mci, EDAC_MOD_STR); 1492 edac_mc_handle_ce_no_info(mci, EDAC_MOD_STR);
@@ -1580,7 +1580,7 @@ static struct amd64_family_type amd64_family_types[] = {
1580 .ops = { 1580 .ops = {
1581 .early_channel_count = f1x_early_channel_count, 1581 .early_channel_count = f1x_early_channel_count,
1582 .read_dram_ctl_register = f10_read_dram_ctl_register, 1582 .read_dram_ctl_register = f10_read_dram_ctl_register,
1583 .map_sysaddr_to_csrow = f10_map_sysaddr_to_csrow, 1583 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1584 .dbam_to_cs = f10_dbam_to_chip_select, 1584 .dbam_to_cs = f10_dbam_to_chip_select,
1585 .read_dct_pci_cfg = f10_read_dct_pci_cfg, 1585 .read_dct_pci_cfg = f10_read_dct_pci_cfg,
1586 } 1586 }
@@ -1589,6 +1589,7 @@ static struct amd64_family_type amd64_family_types[] = {
1589 .ctl_name = "F15h", 1589 .ctl_name = "F15h",
1590 .ops = { 1590 .ops = {
1591 .early_channel_count = f1x_early_channel_count, 1591 .early_channel_count = f1x_early_channel_count,
1592 .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow,
1592 .read_dct_pci_cfg = f15_read_dct_pci_cfg, 1593 .read_dct_pci_cfg = f15_read_dct_pci_cfg,
1593 } 1594 }
1594 }, 1595 },