aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/intel/x4x/raminit.c
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2016-11-26 02:03:25 +0100
committerMartin Roth <martinroth@google.com>2016-11-28 17:56:34 +0100
commit3c20906e42ed5bf7ef5202fa9eb38c574e43b688 (patch)
tree750851e2fe8c4729b004db3680ba936ffd71df6c /src/northbridge/intel/x4x/raminit.c
parentd85a71a75c35b5bf683939e320ff7a501f89f583 (diff)
nb/intel/x4x/raminit: Fix DIMM_IN_CHANNEL calculation
Fix-up for 696abfc nb/intel/x4x: Fix and deflate `dimm_config` in raminit It didn't fix the channel-number shifting issue as intended. The channel index is either 0 or 1. DIMMs are counted from 0 to 3 where 0..1 covers channel 0, and 2..3 covers channel 1. Since we have two DIMMs per channel, we have to multiply the channel index by 2 (or shift it left by 1) to get the index of the first DIMM in the channel. Finally, to get the offset of a DIMM in the channel we take its index modulo 2 (again, the number of DIMMs per channel). Change-Id: I2784b0cb655bfe823bf5fa48b722623dfca1ddc3 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/17612 Tested-by: build bot (Jenkins) Reviewed-by: Damien Zammit <damien@zamaudio.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/northbridge/intel/x4x/raminit.c')
-rw-r--r--src/northbridge/intel/x4x/raminit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/northbridge/intel/x4x/raminit.c b/src/northbridge/intel/x4x/raminit.c
index 0867c31e8e..122cab50ea 100644
--- a/src/northbridge/intel/x4x/raminit.c
+++ b/src/northbridge/intel/x4x/raminit.c
@@ -153,7 +153,8 @@ static void sdram_read_spds(struct sysinfo *s)
else
die("Dual-rank x16 not supported\n");
}
- s->dimm_config[chan] |= dimm_config << (i - chan) * 2;
+ s->dimm_config[chan] |=
+ dimm_config << (i % DIMMS_PER_CHANNEL) * 2;
}
printk(BIOS_DEBUG, " Config[CH%d] : %d\n", chan, s->dimm_config[chan]);
}