diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2011-11-09 15:28:43 -0500 |
---|---|---|
committer | Borislav Petkov <bp@alien8.de> | 2012-03-19 07:02:46 -0400 |
commit | 11b0a31473edf74b70ab6f8fe857b61bff82d7cc (patch) | |
tree | 885ef488ec29909165ff5c6031e31f0248925683 /drivers/edac/amd64_edac.c | |
parent | f92cae45263b25cdb4c4d24e297e07945d3bc01b (diff) |
amd64_edac: Fix K8 revD and later chip select sizes
Fix DRAM chip select sizes calculation for K8, revisions D and E.
Reported-by: Niklas Söderlund <niklas.soderlund@ericsson.com
Link: http://lkml.kernel.org/r/1320849178-23340-1-git-send-email-niklas.soderlund@ericsson.com
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/amd64_edac.c')
-rw-r--r-- | drivers/edac/amd64_edac.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index b9424dcde906..03807283aca4 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -1132,12 +1132,36 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct, | |||
1132 | return ddr2_cs_size(cs_mode, dclr & WIDTH_128); | 1132 | return ddr2_cs_size(cs_mode, dclr & WIDTH_128); |
1133 | } | 1133 | } |
1134 | else if (pvt->ext_model >= K8_REV_D) { | 1134 | else if (pvt->ext_model >= K8_REV_D) { |
1135 | unsigned diff; | ||
1135 | WARN_ON(cs_mode > 10); | 1136 | WARN_ON(cs_mode > 10); |
1136 | 1137 | ||
1137 | if (cs_mode == 3 || cs_mode == 8) | 1138 | /* |
1138 | return 32 << (cs_mode - 1); | 1139 | * the below calculation, besides trying to win an obfuscated C |
1139 | else | 1140 | * contest, maps cs_mode values to DIMM chip select sizes. The |
1140 | return 32 << cs_mode; | 1141 | * mappings are: |
1142 | * | ||
1143 | * cs_mode CS size (mb) | ||
1144 | * ======= ============ | ||
1145 | * 0 32 | ||
1146 | * 1 64 | ||
1147 | * 2 128 | ||
1148 | * 3 128 | ||
1149 | * 4 256 | ||
1150 | * 5 512 | ||
1151 | * 6 256 | ||
1152 | * 7 512 | ||
1153 | * 8 1024 | ||
1154 | * 9 1024 | ||
1155 | * 10 2048 | ||
1156 | * | ||
1157 | * Basically, it calculates a value with which to shift the | ||
1158 | * smallest CS size of 32MB. | ||
1159 | * | ||
1160 | * ddr[23]_cs_size have a similar purpose. | ||
1161 | */ | ||
1162 | diff = cs_mode/3 + (unsigned)(cs_mode > 5); | ||
1163 | |||
1164 | return 32 << (cs_mode - diff); | ||
1141 | } | 1165 | } |
1142 | else { | 1166 | else { |
1143 | WARN_ON(cs_mode > 6); | 1167 | WARN_ON(cs_mode > 6); |