diff options
-rw-r--r-- | drivers/edac/amd64_edac.c | 38 | ||||
-rw-r--r-- | drivers/edac/amd64_edac.h | 2 |
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 7a7bd7785ed4..9ea1bb4a51e3 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -1331,6 +1331,42 @@ static int f10_lookup_addr_in_dct(u64 in_addr, u32 nid, u8 dct) | |||
1331 | return cs_found; | 1331 | return cs_found; |
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | /* | ||
1335 | * See F2x10C. Non-interleaved graphics framebuffer memory under the 16G is | ||
1336 | * swapped with a region located at the bottom of memory so that the GPU can use | ||
1337 | * the interleaved region and thus two channels. | ||
1338 | */ | ||
1339 | static u64 f10_swap_interleaved_region(struct amd64_pvt *pvt, u64 sys_addr) | ||
1340 | { | ||
1341 | u32 swap_reg, swap_base, swap_limit, rgn_size, tmp_addr; | ||
1342 | |||
1343 | if (boot_cpu_data.x86 == 0x10) { | ||
1344 | /* only revC3 and revE have that feature */ | ||
1345 | if (boot_cpu_data.x86_model < 4 || | ||
1346 | (boot_cpu_data.x86_model < 0xa && | ||
1347 | boot_cpu_data.x86_mask < 3)) | ||
1348 | return sys_addr; | ||
1349 | } | ||
1350 | |||
1351 | amd64_read_dct_pci_cfg(pvt, SWAP_INTLV_REG, &swap_reg); | ||
1352 | |||
1353 | if (!(swap_reg & 0x1)) | ||
1354 | return sys_addr; | ||
1355 | |||
1356 | swap_base = (swap_reg >> 3) & 0x7f; | ||
1357 | swap_limit = (swap_reg >> 11) & 0x7f; | ||
1358 | rgn_size = (swap_reg >> 20) & 0x7f; | ||
1359 | tmp_addr = sys_addr >> 27; | ||
1360 | |||
1361 | if (!(sys_addr >> 34) && | ||
1362 | (((tmp_addr >= swap_base) && | ||
1363 | (tmp_addr <= swap_limit)) || | ||
1364 | (tmp_addr < rgn_size))) | ||
1365 | return sys_addr ^ (u64)swap_base << 27; | ||
1366 | |||
1367 | return sys_addr; | ||
1368 | } | ||
1369 | |||
1334 | /* For a given @dram_range, check if @sys_addr falls within it. */ | 1370 | /* For a given @dram_range, check if @sys_addr falls within it. */ |
1335 | static int f10_match_to_this_node(struct amd64_pvt *pvt, int range, | 1371 | static int f10_match_to_this_node(struct amd64_pvt *pvt, int range, |
1336 | u64 sys_addr, int *nid, int *chan_sel) | 1372 | u64 sys_addr, int *nid, int *chan_sel) |
@@ -1352,6 +1388,8 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int range, | |||
1352 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) | 1388 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) |
1353 | return -EINVAL; | 1389 | return -EINVAL; |
1354 | 1390 | ||
1391 | sys_addr = f10_swap_interleaved_region(pvt, sys_addr); | ||
1392 | |||
1355 | dct_sel_base = dct_sel_baseaddr(pvt); | 1393 | dct_sel_base = dct_sel_baseaddr(pvt); |
1356 | 1394 | ||
1357 | /* | 1395 | /* |
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 6ae8aa8cc178..85e3acbc087a 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h | |||
@@ -239,6 +239,8 @@ | |||
239 | #define dct_dram_enabled(pvt) ((pvt)->dct_sel_lo & BIT(8)) | 239 | #define dct_dram_enabled(pvt) ((pvt)->dct_sel_lo & BIT(8)) |
240 | #define dct_memory_cleared(pvt) ((pvt)->dct_sel_lo & BIT(10)) | 240 | #define dct_memory_cleared(pvt) ((pvt)->dct_sel_lo & BIT(10)) |
241 | 241 | ||
242 | #define SWAP_INTLV_REG 0x10c | ||
243 | |||
242 | #define DCT_SEL_HI 0x114 | 244 | #define DCT_SEL_HI 0x114 |
243 | 245 | ||
244 | /* | 246 | /* |