]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
amd64_edac: Fix syndrome calculation on K8
authorBorislav Petkov <borislav.petkov@amd.com>
Fri, 2 Jul 2010 15:02:43 +0000 (17:02 +0200)
committerBorislav Petkov <borislav.petkov@amd.com>
Fri, 2 Jul 2010 15:32:34 +0000 (17:32 +0200)
When calculating the DCT channel from the syndrome we need to know the
syndrome type (x4 vs x8). On F10h, this is read out from extended PCI
cfg space register F3x180 while on K8 we only support x4 syndromes and
don't have extended PCI config space anyway.

Make the code accessing F3x180 F10h only and fall back to x4 syndromes
on everything else.

Cc: <stable@kernel.org> # .33.x .34.x
Reported-by: Jeffrey Merkey <jeffmerkey@gmail.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
drivers/edac/amd64_edac.c

index cf17dbb8014f75bb0f5109c0008dda9f7c2a27cd..ac9f7985096db06f83302ada4bed9601c7287657 100644 (file)
@@ -1958,20 +1958,20 @@ static int get_channel_from_ecc_syndrome(struct mem_ctl_info *mci, u16 syndrome)
        u32 value = 0;
        int err_sym = 0;
 
-       amd64_read_pci_cfg(pvt->misc_f3_ctl, 0x180, &value);
+       if (boot_cpu_data.x86 == 0x10) {
 
-       /* F3x180[EccSymbolSize]=1, x8 symbols */
-       if (boot_cpu_data.x86 == 0x10 &&
-           boot_cpu_data.x86_model > 7 &&
-           value & BIT(25)) {
-               err_sym = decode_syndrome(syndrome, x8_vectors,
-                                         ARRAY_SIZE(x8_vectors), 8);
-               return map_err_sym_to_channel(err_sym, 8);
-       } else {
-               err_sym = decode_syndrome(syndrome, x4_vectors,
-                                         ARRAY_SIZE(x4_vectors), 4);
-               return map_err_sym_to_channel(err_sym, 4);
+               amd64_read_pci_cfg(pvt->misc_f3_ctl, 0x180, &value);
+
+               /* F3x180[EccSymbolSize]=1 => x8 symbols */
+               if (boot_cpu_data.x86_model > 7 &&
+                   value & BIT(25)) {
+                       err_sym = decode_syndrome(syndrome, x8_vectors,
+                                                 ARRAY_SIZE(x8_vectors), 8);
+                       return map_err_sym_to_channel(err_sym, 8);
+               }
        }
+       err_sym = decode_syndrome(syndrome, x4_vectors, ARRAY_SIZE(x4_vectors), 4);
+       return map_err_sym_to_channel(err_sym, 4);
 }
 
 /*