soc/intel/skylake: Fix broken memory info HOB scanning

It looks like this code was written with completely different semantics
in mind. Controllers, channels and DIMMs are all presented in their phy-
sical order (i.e. gaps are not closed). So we have to look at the whole
structure and not only the first n respective entries.

Change-Id: I8a9039f73f1befdd09c1fc8e17cd3f6e08e0cd47
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/20650
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2017-07-19 15:45:14 +02:00 committed by Nico Huber
parent fb66e81e6c
commit 9dc62ea133
1 changed files with 5 additions and 7 deletions

View File

@ -79,17 +79,15 @@ static void save_dimm_info(void)
index = 0;
dimm_max = ARRAY_SIZE(mem_info->dimm);
ctrlr_info = &memory_info_hob->Controller[0];
for (channel = 0; channel < ctrlr_info->ChannelCount; channel++) {
if (index >= dimm_max)
break;
for (channel = 0; channel < MAX_CH && index < dimm_max; channel++) {
channel_info = &ctrlr_info->Channel[channel];
for (dimm = 0; dimm < channel_info->DimmCount; dimm++) {
if (index >= dimm_max)
break;
if (channel_info->Status != 2)
continue;
for (dimm = 0; dimm < MAX_DIMM && index < dimm_max; dimm++) {
src_dimm = &channel_info->Dimm[dimm];
dest_dimm = &mem_info->dimm[index];
if (!src_dimm->DimmCapacity)
if (src_dimm->Status != DIMM_PRESENT)
continue;
/* Populate the DIMM information */