Commit fb79a50926b8abadf24ec15e0e61778fa2b7d10b
Committed by
Mauro Carvalho Chehab
1 parent
ef1e8d03b1
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
sb_edac: isolate TOLM retrieval
This is in preparation for the Ivy Bridge support. Signed-off-by: Aristeu Rozanski <arozansk@redhat.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Showing 1 changed file with 13 additions and 4 deletions Side-by-side Diff
drivers/edac/sb_edac.c
... | ... | @@ -273,9 +273,11 @@ |
273 | 273 | #define NUM_CHANNELS 4 |
274 | 274 | #define MAX_DIMMS 3 /* Max DIMMS per channel */ |
275 | 275 | |
276 | +struct sbridge_pvt; | |
276 | 277 | struct sbridge_info { |
277 | 278 | u32 mcmtr; |
278 | 279 | u32 rankcfgr; |
280 | + u64 (*get_tolm)(struct sbridge_pvt *pvt); | |
279 | 281 | }; |
280 | 282 | |
281 | 283 | struct sbridge_channel { |
... | ... | @@ -459,6 +461,15 @@ |
459 | 461 | kfree(sbridge_dev); |
460 | 462 | } |
461 | 463 | |
464 | +static u64 sbridge_get_tolm(struct sbridge_pvt *pvt) | |
465 | +{ | |
466 | + u32 reg; | |
467 | + | |
468 | + /* Address range is 32:28 */ | |
469 | + pci_read_config_dword(pvt->pci_sad1, TOLM, ®); | |
470 | + return GET_TOLM(reg); | |
471 | +} | |
472 | + | |
462 | 473 | /**************************************************************************** |
463 | 474 | Memory check routines |
464 | 475 | ****************************************************************************/ |
... | ... | @@ -633,10 +644,7 @@ |
633 | 644 | * Step 1) Get TOLM/TOHM ranges |
634 | 645 | */ |
635 | 646 | |
636 | - /* Address range is 32:28 */ | |
637 | - pci_read_config_dword(pvt->pci_sad1, TOLM, | |
638 | - ®); | |
639 | - pvt->tolm = GET_TOLM(reg); | |
647 | + pvt->tolm = pvt->info.get_tolm(pvt); | |
640 | 648 | tmp_mb = (1 + pvt->tolm) >> 20; |
641 | 649 | |
642 | 650 | mb = div_u64_rem(tmp_mb, 1000, &kb); |
... | ... | @@ -1661,6 +1669,7 @@ |
1661 | 1669 | mci->ctl_name = kasprintf(GFP_KERNEL, "Sandy Bridge Socket#%d", mci->mc_idx); |
1662 | 1670 | mci->dev_name = pci_name(sbridge_dev->pdev[0]); |
1663 | 1671 | mci->ctl_page_to_phys = NULL; |
1672 | + pvt->info.get_tolm = sbridge_get_tolm; | |
1664 | 1673 | |
1665 | 1674 | /* Set the function pointer to an actual operation function */ |
1666 | 1675 | mci->edac_check = sbridge_check_error; |