diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2010-12-23 08:07:18 -0500 |
---|---|---|
committer | Borislav Petkov <borislav.petkov@amd.com> | 2011-03-17 09:46:16 -0400 |
commit | a97fa68ec403e2761a37b28651de8fd9da8c5e1f (patch) | |
tree | 3f9e70f80e4cbe15f603547e2360438a41179cbe /drivers/edac | |
parent | c9f4f26eae096c39547139666e8af607c2447f94 (diff) |
amd64_edac: Cleanup NBCFG handling
The fact whether we are chipkill capable or not does not have any
bearing when computing the channel index on a ganged DCT configuration
so remove that. Also, simplify debug statements. Finally, remove old
error injection leftovers, while at it.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/amd64_edac.c | 45 | ||||
-rw-r--r-- | drivers/edac/amd64_edac.h | 9 |
2 files changed, 24 insertions, 30 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 9a8a31317071..dfa7ac7a4837 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -1011,7 +1011,7 @@ static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci, | |||
1011 | syndrome = extract_syndrome(err_info); | 1011 | syndrome = extract_syndrome(err_info); |
1012 | 1012 | ||
1013 | /* CHIPKILL enabled */ | 1013 | /* CHIPKILL enabled */ |
1014 | if (err_info->nbcfg & K8_NBCFG_CHIPKILL) { | 1014 | if (err_info->nbcfg & NBCFG_CHIPKILL) { |
1015 | channel = get_channel_from_ecc_syndrome(mci, syndrome); | 1015 | channel = get_channel_from_ecc_syndrome(mci, syndrome); |
1016 | if (channel < 0) { | 1016 | if (channel < 0) { |
1017 | /* | 1017 | /* |
@@ -1461,7 +1461,7 @@ static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci, | |||
1461 | * ganged. Otherwise @chan should already contain the channel at | 1461 | * ganged. Otherwise @chan should already contain the channel at |
1462 | * this point. | 1462 | * this point. |
1463 | */ | 1463 | */ |
1464 | if (dct_ganging_enabled(pvt) && (pvt->nbcfg & K8_NBCFG_CHIPKILL)) | 1464 | if (dct_ganging_enabled(pvt)) |
1465 | chan = get_channel_from_ecc_syndrome(mci, syndrome); | 1465 | chan = get_channel_from_ecc_syndrome(mci, syndrome); |
1466 | 1466 | ||
1467 | if (chan >= 0) | 1467 | if (chan >= 0) |
@@ -2050,14 +2050,13 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2050 | u32 val; | 2050 | u32 val; |
2051 | int i, empty = 1; | 2051 | int i, empty = 1; |
2052 | 2052 | ||
2053 | amd64_read_pci_cfg(pvt->F3, K8_NBCFG, &val); | 2053 | amd64_read_pci_cfg(pvt->F3, NBCFG, &val); |
2054 | 2054 | ||
2055 | pvt->nbcfg = val; | 2055 | pvt->nbcfg = val; |
2056 | pvt->ctl_error_info.nbcfg = val; | ||
2057 | 2056 | ||
2058 | debugf0("node %d, NBCFG=0x%08x[ChipKillEccCap: %d|DramEccEn: %d]\n", | 2057 | debugf0("node %d, NBCFG=0x%08x[ChipKillEccCap: %d|DramEccEn: %d]\n", |
2059 | pvt->mc_node_id, val, | 2058 | pvt->mc_node_id, val, |
2060 | !!(val & K8_NBCFG_CHIPKILL), !!(val & K8_NBCFG_ECC_ENABLE)); | 2059 | !!(val & NBCFG_CHIPKILL), !!(val & NBCFG_ECC_ENABLE)); |
2061 | 2060 | ||
2062 | for_each_chip_select(i, 0, pvt) { | 2061 | for_each_chip_select(i, 0, pvt) { |
2063 | csrow = &mci->csrows[i]; | 2062 | csrow = &mci->csrows[i]; |
@@ -2099,9 +2098,9 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2099 | /* | 2098 | /* |
2100 | * determine whether CHIPKILL or JUST ECC or NO ECC is operating | 2099 | * determine whether CHIPKILL or JUST ECC or NO ECC is operating |
2101 | */ | 2100 | */ |
2102 | if (pvt->nbcfg & K8_NBCFG_ECC_ENABLE) | 2101 | if (pvt->nbcfg & NBCFG_ECC_ENABLE) |
2103 | csrow->edac_mode = | 2102 | csrow->edac_mode = |
2104 | (pvt->nbcfg & K8_NBCFG_CHIPKILL) ? | 2103 | (pvt->nbcfg & NBCFG_CHIPKILL) ? |
2105 | EDAC_S4ECD4ED : EDAC_SECDED; | 2104 | EDAC_S4ECD4ED : EDAC_SECDED; |
2106 | else | 2105 | else |
2107 | csrow->edac_mode = EDAC_NONE; | 2106 | csrow->edac_mode = EDAC_NONE; |
@@ -2211,24 +2210,23 @@ static bool enable_ecc_error_reporting(struct ecc_settings *s, u8 nid, | |||
2211 | value |= mask; | 2210 | value |= mask; |
2212 | amd64_write_pci_cfg(F3, NBCTL, value); | 2211 | amd64_write_pci_cfg(F3, NBCTL, value); |
2213 | 2212 | ||
2214 | amd64_read_pci_cfg(F3, K8_NBCFG, &value); | 2213 | amd64_read_pci_cfg(F3, NBCFG, &value); |
2215 | 2214 | ||
2216 | debugf0("1: node %d, NBCFG=0x%08x[ChipKillEccCap: %d|DramEccEn: %d]\n", | 2215 | debugf0("1: node %d, NBCFG=0x%08x[DramEccEn: %d]\n", |
2217 | nid, value, | 2216 | nid, value, !!(value & NBCFG_ECC_ENABLE)); |
2218 | !!(value & K8_NBCFG_CHIPKILL), !!(value & K8_NBCFG_ECC_ENABLE)); | ||
2219 | 2217 | ||
2220 | if (!(value & K8_NBCFG_ECC_ENABLE)) { | 2218 | if (!(value & NBCFG_ECC_ENABLE)) { |
2221 | amd64_warn("DRAM ECC disabled on this node, enabling...\n"); | 2219 | amd64_warn("DRAM ECC disabled on this node, enabling...\n"); |
2222 | 2220 | ||
2223 | s->flags.nb_ecc_prev = 0; | 2221 | s->flags.nb_ecc_prev = 0; |
2224 | 2222 | ||
2225 | /* Attempt to turn on DRAM ECC Enable */ | 2223 | /* Attempt to turn on DRAM ECC Enable */ |
2226 | value |= K8_NBCFG_ECC_ENABLE; | 2224 | value |= NBCFG_ECC_ENABLE; |
2227 | amd64_write_pci_cfg(F3, K8_NBCFG, value); | 2225 | amd64_write_pci_cfg(F3, NBCFG, value); |
2228 | 2226 | ||
2229 | amd64_read_pci_cfg(F3, K8_NBCFG, &value); | 2227 | amd64_read_pci_cfg(F3, NBCFG, &value); |
2230 | 2228 | ||
2231 | if (!(value & K8_NBCFG_ECC_ENABLE)) { | 2229 | if (!(value & NBCFG_ECC_ENABLE)) { |
2232 | amd64_warn("Hardware rejected DRAM ECC enable," | 2230 | amd64_warn("Hardware rejected DRAM ECC enable," |
2233 | "check memory DIMM configuration.\n"); | 2231 | "check memory DIMM configuration.\n"); |
2234 | ret = false; | 2232 | ret = false; |
@@ -2239,9 +2237,8 @@ static bool enable_ecc_error_reporting(struct ecc_settings *s, u8 nid, | |||
2239 | s->flags.nb_ecc_prev = 1; | 2237 | s->flags.nb_ecc_prev = 1; |
2240 | } | 2238 | } |
2241 | 2239 | ||
2242 | debugf0("2: node %d, NBCFG=0x%08x[ChipKillEccCap: %d|DramEccEn: %d]\n", | 2240 | debugf0("2: node %d, NBCFG=0x%08x[DramEccEn: %d]\n", |
2243 | nid, value, | 2241 | nid, value, !!(value & NBCFG_ECC_ENABLE)); |
2244 | !!(value & K8_NBCFG_CHIPKILL), !!(value & K8_NBCFG_ECC_ENABLE)); | ||
2245 | 2242 | ||
2246 | return ret; | 2243 | return ret; |
2247 | } | 2244 | } |
@@ -2263,9 +2260,9 @@ static void restore_ecc_error_reporting(struct ecc_settings *s, u8 nid, | |||
2263 | 2260 | ||
2264 | /* restore previous BIOS DRAM ECC "off" setting we force-enabled */ | 2261 | /* restore previous BIOS DRAM ECC "off" setting we force-enabled */ |
2265 | if (!s->flags.nb_ecc_prev) { | 2262 | if (!s->flags.nb_ecc_prev) { |
2266 | amd64_read_pci_cfg(F3, K8_NBCFG, &value); | 2263 | amd64_read_pci_cfg(F3, NBCFG, &value); |
2267 | value &= ~K8_NBCFG_ECC_ENABLE; | 2264 | value &= ~NBCFG_ECC_ENABLE; |
2268 | amd64_write_pci_cfg(F3, K8_NBCFG, value); | 2265 | amd64_write_pci_cfg(F3, NBCFG, value); |
2269 | } | 2266 | } |
2270 | 2267 | ||
2271 | /* restore the NB Enable MCGCTL bit */ | 2268 | /* restore the NB Enable MCGCTL bit */ |
@@ -2291,9 +2288,9 @@ static bool ecc_enabled(struct pci_dev *F3, u8 nid) | |||
2291 | u8 ecc_en = 0; | 2288 | u8 ecc_en = 0; |
2292 | bool nb_mce_en = false; | 2289 | bool nb_mce_en = false; |
2293 | 2290 | ||
2294 | amd64_read_pci_cfg(F3, K8_NBCFG, &value); | 2291 | amd64_read_pci_cfg(F3, NBCFG, &value); |
2295 | 2292 | ||
2296 | ecc_en = !!(value & K8_NBCFG_ECC_ENABLE); | 2293 | ecc_en = !!(value & NBCFG_ECC_ENABLE); |
2297 | amd64_info("DRAM ECC %s.\n", (ecc_en ? "enabled" : "disabled")); | 2294 | amd64_info("DRAM ECC %s.\n", (ecc_en ? "enabled" : "disabled")); |
2298 | 2295 | ||
2299 | nb_mce_en = amd64_nb_mce_bank_enabled_on_node(nid); | 2296 | nb_mce_en = amd64_nb_mce_bank_enabled_on_node(nid); |
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index fc609d1164a8..6c52736b09f2 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h | |||
@@ -246,9 +246,9 @@ | |||
246 | */ | 246 | */ |
247 | #define NBCTL 0x40 | 247 | #define NBCTL 0x40 |
248 | 248 | ||
249 | #define K8_NBCFG 0x44 | 249 | #define NBCFG 0x44 |
250 | #define K8_NBCFG_CHIPKILL BIT(23) | 250 | #define NBCFG_CHIPKILL BIT(23) |
251 | #define K8_NBCFG_ECC_ENABLE BIT(22) | 251 | #define NBCFG_ECC_ENABLE BIT(22) |
252 | 252 | ||
253 | #define K8_NBSL 0x48 | 253 | #define K8_NBSL 0x48 |
254 | 254 | ||
@@ -420,9 +420,6 @@ struct amd64_pvt { | |||
420 | /* x4 or x8 syndromes in use */ | 420 | /* x4 or x8 syndromes in use */ |
421 | u8 syn_type; | 421 | u8 syn_type; |
422 | 422 | ||
423 | /* temp storage for when input is received from sysfs */ | ||
424 | struct err_regs ctl_error_info; | ||
425 | |||
426 | /* place to store error injection parameters prior to issue */ | 423 | /* place to store error injection parameters prior to issue */ |
427 | struct error_injection injection; | 424 | struct error_injection injection; |
428 | 425 | ||