linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] amd64_edac: fix size decoding error on K8
@ 2011-11-09 14:32 Niklas Söderlund
  2011-11-09 14:42 ` Borislav Petkov
  0 siblings, 1 reply; 9+ messages in thread
From: Niklas Söderlund @ 2011-11-09 14:32 UTC (permalink / raw)
  To: dougthompson, borislav.petkov
  Cc: linux-edac, linux-kernel, Niklas Söderlund

Use a lookup table to calculate the size of a chip select. The old
method of calculating size return erroneous values for some memory
configurations. The lookup table is transcribed from "DRAM CS
Address Mapping Register" [1], pages 88-89.

[1] BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD
    Opteron Processors - Revision 3.30 - doc #26094 - February 2006
    http://support.amd.com/us/Processor_TechDocs/26094.pdf

Signed-off-by: Niklas Söderlund <niklas.soderlund@ericsson.com>
---
 drivers/edac/amd64_edac.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 9a8bebc..396ea76 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1108,6 +1108,10 @@ static int ddr2_cs_size(unsigned i, bool dct_width)
 static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct,
 				  unsigned cs_mode)
 {
+	static const int rev_de_lookup[] = { 32, 64, 128, 128, 256, 512, 256,
+		512, 1024, 1024, 2048 };
+
+
 	u32 dclr = dct ? pvt->dclr1 : pvt->dclr0;
 
 	if (pvt->ext_model >= K8_REV_F) {
@@ -1116,11 +1120,7 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct,
 	}
 	else if (pvt->ext_model >= K8_REV_D) {
 		WARN_ON(cs_mode > 10);
-
-		if (cs_mode == 3 || cs_mode == 8)
-			return 32 << (cs_mode - 1);
-		else
-			return 32 << cs_mode;
+		return rev_de_lookup[cs_mode];
 	}
 	else {
 		WARN_ON(cs_mode > 6);
-- 
1.7.7.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-11-15  8:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 14:32 [PATCH] amd64_edac: fix size decoding error on K8 Niklas Söderlund
2011-11-09 14:42 ` Borislav Petkov
2011-11-09 15:13   ` Niklas Söderlund
2011-11-09 20:35     ` Borislav Petkov
2011-11-09 20:50       ` Tony Luck
2011-11-09 21:00         ` Borislav Petkov
2011-11-14 16:54           ` [PATCH] amd64_edac: Fix K8 revD and later chip select sizes Borislav Petkov
2011-11-15  8:10             ` Niklas Söderlund
2011-11-09 20:51       ` [PATCH] amd64_edac: fix size decoding error on K8 Nils Carlson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).