From 54fa28efc3673c6f2632770e92ddb3beb7909fe4 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 7 Feb 2018 14:59:34 +0530 Subject: soc/intel/skylake: Clean up SMBIOS Table Type 17 creation * Add Memory Channel Status Enum for Channel detection. * Align > 80 characters per line. * Add hob_size == 0 check. Change-Id: I6ad99de53e280a3db431f706310e6cb22b8b3953 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/23636 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Aaron Durbin --- src/soc/intel/skylake/romstage/romstage_fsp20.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/soc/intel') diff --git a/src/soc/intel/skylake/romstage/romstage_fsp20.c b/src/soc/intel/skylake/romstage/romstage_fsp20.c index d4606a477a..98c78a582e 100644 --- a/src/soc/intel/skylake/romstage/romstage_fsp20.c +++ b/src/soc/intel/skylake/romstage/romstage_fsp20.c @@ -44,6 +44,13 @@ 0x8d, 0x09, 0x11, 0xcf, 0x8b, 0x9f, 0x03, 0x23 \ } +/* Memory Channel Present Status */ +enum { + CHANNEL_NOT_PRESENT, + CHANNEL_DISABLED, + CHANNEL_PRESENT +}; + /* Save the DIMM information for SMBIOS table 17 */ static void save_dimm_info(void) { @@ -56,13 +63,14 @@ static void save_dimm_info(void) struct dimm_info *dest_dimm; struct memory_info *mem_info; const MEMORY_INFO_DATA_HOB *memory_info_hob; - const uint8_t smbios_memory_info_guid[16] = FSP_SMBIOS_MEMORY_INFO_GUID; + const uint8_t smbios_memory_info_guid[16] = + FSP_SMBIOS_MEMORY_INFO_GUID; /* Locate the memory info HOB, presence validated by raminit */ memory_info_hob = fsp_find_extension_hob_by_guid(smbios_memory_info_guid, &hob_size); - if (memory_info_hob == NULL) { + if (memory_info_hob == NULL || hob_size == 0) { printk(BIOS_ERR, "SMBIOS MEMORY_INFO_DATA_HOB not found\n"); return; } @@ -84,7 +92,7 @@ static void save_dimm_info(void) ctrlr_info = &memory_info_hob->Controller[0]; for (channel = 0; channel < MAX_CH && index < dimm_max; channel++) { channel_info = &ctrlr_info->ChannelInfo[channel]; - if (channel_info->Status != 2) + if (channel_info->Status != CHANNEL_PRESENT) continue; for (dimm = 0; dimm < MAX_DIMM && index < dimm_max; dimm++) { src_dimm = &channel_info->DimmInfo[dimm]; -- cgit v1.2.3