aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2011-01-19 14:35:12 -0500
committerBorislav Petkov <borislav.petkov@amd.com>2011-03-17 09:46:26 -0400
commita3b7db09a6d5a6b8d237766b0b320447bb609bc5 (patch)
tree0f9aa61dff86715af09aa700feb82ba5b8ac7878 /drivers/edac
parent87b3e0e6e43b7e92575b79ed05ab86d221323642 (diff)
amd64_edac: Adjust ECC symbol size to F15h
F15h has the same ECC symbol size options as F10h revD and later so adjust checks to that. Simplify code a bit. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/amd64_edac.c32
-rw-r--r--drivers/edac/amd64_edac.h2
2 files changed, 16 insertions, 18 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 0caf05e376cb..e4b2792062ea 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -824,7 +824,7 @@ static void dump_misc_regs(struct amd64_pvt *pvt)
824 824
825 amd64_debug_display_dimm_sizes(1, pvt); 825 amd64_debug_display_dimm_sizes(1, pvt);
826 826
827 amd64_info("using %s syndromes.\n", ((pvt->syn_type == 8) ? "x8" : "x4")); 827 amd64_info("using %s syndromes.\n", ((pvt->ecc_sym_sz == 8) ? "x8" : "x4"));
828 828
829 /* Only if NOT ganged does dclr1 have valid info */ 829 /* Only if NOT ganged does dclr1 have valid info */
830 if (!dct_ganging_enabled(pvt)) 830 if (!dct_ganging_enabled(pvt))
@@ -1778,20 +1778,20 @@ static int get_channel_from_ecc_syndrome(struct mem_ctl_info *mci, u16 syndrome)
1778 struct amd64_pvt *pvt = mci->pvt_info; 1778 struct amd64_pvt *pvt = mci->pvt_info;
1779 int err_sym = -1; 1779 int err_sym = -1;
1780 1780
1781 if (pvt->syn_type == 8) 1781 if (pvt->ecc_sym_sz == 8)
1782 err_sym = decode_syndrome(syndrome, x8_vectors, 1782 err_sym = decode_syndrome(syndrome, x8_vectors,
1783 ARRAY_SIZE(x8_vectors), 1783 ARRAY_SIZE(x8_vectors),
1784 pvt->syn_type); 1784 pvt->ecc_sym_sz);
1785 else if (pvt->syn_type == 4) 1785 else if (pvt->ecc_sym_sz == 4)
1786 err_sym = decode_syndrome(syndrome, x4_vectors, 1786 err_sym = decode_syndrome(syndrome, x4_vectors,
1787 ARRAY_SIZE(x4_vectors), 1787 ARRAY_SIZE(x4_vectors),
1788 pvt->syn_type); 1788 pvt->ecc_sym_sz);
1789 else { 1789 else {
1790 amd64_warn("Illegal syndrome type: %u\n", pvt->syn_type); 1790 amd64_warn("Illegal syndrome type: %u\n", pvt->ecc_sym_sz);
1791 return err_sym; 1791 return err_sym;
1792 } 1792 }
1793 1793
1794 return map_err_sym_to_channel(err_sym, pvt->syn_type); 1794 return map_err_sym_to_channel(err_sym, pvt->ecc_sym_sz);
1795} 1795}
1796 1796
1797/* 1797/*
@@ -1936,6 +1936,7 @@ static void free_mc_sibling_devs(struct amd64_pvt *pvt)
1936 */ 1936 */
1937static void read_mc_regs(struct amd64_pvt *pvt) 1937static void read_mc_regs(struct amd64_pvt *pvt)
1938{ 1938{
1939 struct cpuinfo_x86 *c = &boot_cpu_data;
1939 u64 msr_val; 1940 u64 msr_val;
1940 u32 tmp; 1941 u32 tmp;
1941 int range; 1942 int range;
@@ -1997,19 +1998,16 @@ static void read_mc_regs(struct amd64_pvt *pvt)
1997 amd64_read_dct_pci_cfg(pvt, DCHR1, &pvt->dchr1); 1998 amd64_read_dct_pci_cfg(pvt, DCHR1, &pvt->dchr1);
1998 } 1999 }
1999 2000
2000 if (boot_cpu_data.x86 >= 0x10) { 2001 pvt->ecc_sym_sz = 4;
2002
2003 if (c->x86 >= 0x10) {
2001 amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp); 2004 amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp);
2002 amd64_read_dct_pci_cfg(pvt, DBAM1, &pvt->dbam1); 2005 amd64_read_dct_pci_cfg(pvt, DBAM1, &pvt->dbam1);
2003 }
2004
2005 if (boot_cpu_data.x86 == 0x10 &&
2006 boot_cpu_data.x86_model > 7 &&
2007 /* F3x180[EccSymbolSize]=1 => x8 symbols */
2008 tmp & BIT(25))
2009 pvt->syn_type = 8;
2010 else
2011 pvt->syn_type = 4;
2012 2006
2007 /* F10h, revD and later can do x8 ECC too */
2008 if ((c->x86 > 0x10 || c->x86_model > 7) && tmp & BIT(25))
2009 pvt->ecc_sym_sz = 8;
2010 }
2013 dump_misc_regs(pvt); 2011 dump_misc_regs(pvt);
2014} 2012}
2015 2013
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 3f853ed684af..4de31c89c605 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -363,7 +363,7 @@ struct amd64_pvt {
363 u32 online_spare; /* On-Line spare Reg */ 363 u32 online_spare; /* On-Line spare Reg */
364 364
365 /* x4 or x8 syndromes in use */ 365 /* x4 or x8 syndromes in use */
366 u8 syn_type; 366 u8 ecc_sym_sz;
367 367
368 /* place to store error injection parameters prior to issue */ 368 /* place to store error injection parameters prior to issue */
369 struct error_injection injection; 369 struct error_injection injection;