aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorAristeu Rozanski <arozansk@redhat.com>2013-10-30 12:26:59 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-11-14 13:43:17 -0500
commit8fd6a43ac9300c2451823f390c0301770973bc36 (patch)
treecbdccb7671828fd07ed304daf6224c805c52ba02 /drivers/edac
parent5f8a1b8a7b55937842c1c6b03c002134aacd7393 (diff)
sb_edac: isolate TOHM retrieval
This is preparation of Ivy Bridge support. Signed-off-by: Aristeu Rozanski <arozansk@redhat.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/sb_edac.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index cc4fe466236e..4ec4957b484c 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -278,6 +278,7 @@ struct sbridge_info {
278 u32 mcmtr; 278 u32 mcmtr;
279 u32 rankcfgr; 279 u32 rankcfgr;
280 u64 (*get_tolm)(struct sbridge_pvt *pvt); 280 u64 (*get_tolm)(struct sbridge_pvt *pvt);
281 u64 (*get_tohm)(struct sbridge_pvt *pvt);
281}; 282};
282 283
283struct sbridge_channel { 284struct sbridge_channel {
@@ -470,6 +471,14 @@ static u64 sbridge_get_tolm(struct sbridge_pvt *pvt)
470 return GET_TOLM(reg); 471 return GET_TOLM(reg);
471} 472}
472 473
474static u64 sbridge_get_tohm(struct sbridge_pvt *pvt)
475{
476 u32 reg;
477
478 pci_read_config_dword(pvt->pci_sad1, TOHM, &reg);
479 return GET_TOHM(reg);
480}
481
473/**************************************************************************** 482/****************************************************************************
474 Memory check routines 483 Memory check routines
475 ****************************************************************************/ 484 ****************************************************************************/
@@ -651,9 +660,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
651 edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm); 660 edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm);
652 661
653 /* Address range is already 45:25 */ 662 /* Address range is already 45:25 */
654 pci_read_config_dword(pvt->pci_sad1, TOHM, 663 pvt->tohm = pvt->info.get_tohm(pvt);
655 &reg);
656 pvt->tohm = GET_TOHM(reg);
657 tmp_mb = (1 + pvt->tohm) >> 20; 664 tmp_mb = (1 + pvt->tohm) >> 20;
658 665
659 mb = div_u64_rem(tmp_mb, 1000, &kb); 666 mb = div_u64_rem(tmp_mb, 1000, &kb);
@@ -1670,6 +1677,7 @@ static int sbridge_register_mci(struct sbridge_dev *sbridge_dev)
1670 mci->dev_name = pci_name(sbridge_dev->pdev[0]); 1677 mci->dev_name = pci_name(sbridge_dev->pdev[0]);
1671 mci->ctl_page_to_phys = NULL; 1678 mci->ctl_page_to_phys = NULL;
1672 pvt->info.get_tolm = sbridge_get_tolm; 1679 pvt->info.get_tolm = sbridge_get_tolm;
1680 pvt->info.get_tohm = sbridge_get_tohm;
1673 1681
1674 /* Set the function pointer to an actual operation function */ 1682 /* Set the function pointer to an actual operation function */
1675 mci->edac_check = sbridge_check_error; 1683 mci->edac_check = sbridge_check_error;