From 9dc62ea133d826cf88ccd29e579ea976257d5487 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Wed, 19 Jul 2017 15:45:14 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/20650 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- src/soc/intel/skylake/romstage/romstage_fsp20.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/soc/intel/skylake/romstage') diff --git a/src/soc/intel/skylake/romstage/romstage_fsp20.c b/src/soc/intel/skylake/romstage/romstage_fsp20.c index 9e871254cb..e439d73479 100644 --- a/src/soc/intel/skylake/romstage/romstage_fsp20.c +++ b/src/soc/intel/skylake/romstage/romstage_fsp20.c @@ -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 */ -- cgit v1.2.3