[coreboot-gerrit] New patch to review for coreboot: intel raminit: fix timB high adjust calculation

Patrick Rudolph (siro@das-labor.org) gerrit at coreboot.org
Sun Jul 12 12:34:10 CEST 2015


Patrick Rudolph (siro at das-labor.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10889

-gerrit

commit d12f201508f2b1fa690f0a297440190b9aeb4830
Author: Patrick Rudolph <siro at das-labor.org>
Date:   Sun Jul 12 12:17:21 2015 +0200

    intel raminit: fix timB high adjust calculation
    
    Issue observed:
    Any memory DIMM placed in channel0 slots stops at "c320c discovery failed".
    The same memory DIMM works when placed in channel1 slots.
    
    Test system:
     * Intel Pentium CPU G2130
     * Gigabyte GA-B75M-D3H
     * DIMMs:
      * elixir 1GB 1Rx8 PC3-10600U M2Y1G64CB88A5N
      * crucial 2GB 256Mx64 CT2566aBA160BJ
      * corsair 8GB CMZ16GX3M2A1866C9
    
    Problem description:
    In case of good timmings (all bits are set) an offset of 3*64 was applied.
    The following test (c320c discovery) failed only on those byte-lanes.
    
    Adding an offset of zero resolves this issue.
    The system boots with every DIMM tested placed in Channel0 slots.
    
    Simplified the remaining code to allow more offsets to be returned.
    
    Change-Id: Iea426ea4470640ce254f16e958a395644ff1a55c
    Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
 src/northbridge/intel/sandybridge/raminit_native.c | 29 +++++++++++++---------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/northbridge/intel/sandybridge/raminit_native.c b/src/northbridge/intel/sandybridge/raminit_native.c
index 0c98b7a..dc3168c 100644
--- a/src/northbridge/intel/sandybridge/raminit_native.c
+++ b/src/northbridge/intel/sandybridge/raminit_native.c
@@ -2283,18 +2283,23 @@ static void discover_timB(ramctr_timing * ctrl, int channel, int slotrank)
 static int get_timB_high_adjust(u64 val)
 {
 	int i;
-	if (val >= 0xfffffffffffff000LL)
-		return 3;
-	if (val >= 0xfffffffffff00000LL)
-		return -1;
-	if (val >= 0xfffffff000000000LL)
-		return -2;
-	if (val >= 0xfff0000000000000LL)
-		return -3;
-
-	for (i = 0; i < 8; i++)
-		if (val >> (8 * (7 - i) + 4))
-			return i;
+
+	/* good */
+	if (val == 0xffffffffffffffffLL)
+		return 0;
+
+	if (val >= 0xf000000000000000LL) {
+		/* needs negative adjustment */
+		for (i = 0; i < 8; i++)
+			if (val << (8 * (7 - i) + 4))
+				return -i;
+	} else {
+		/* needs positive adjustment */
+		for (i = 0; i < 8; i++)
+			if (val >> (8 * (7 - i) + 4))
+				return i;
+	}
+
 	return 8;
 }
 



More information about the coreboot-gerrit mailing list