From 3cc20202de705baf45e58dfecf5937044d0b5c10 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Tue, 3 May 2022 18:37:32 +0200 Subject: soc/intel/xeon_sp/cpx: Allow creating meminfo for empty DIMM slots Introduce the mainboard-defined `mainboard_dimm_slot_exists()` function to allow creating SMBIOS type 17 entries for unpopulated DIMM slots. Change-Id: I1d9c41dd7d981842ca6f0294d9e6b0fedc0c98e4 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/64036 Reviewed-by: Jonathan Zhang Tested-by: build bot (Jenkins) --- src/soc/intel/xeon_sp/cpx/ddr.c | 5 +++++ src/soc/intel/xeon_sp/cpx/include/soc/ddr.h | 4 +++- src/soc/intel/xeon_sp/cpx/romstage.c | 18 +++++++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/soc/intel/xeon_sp/cpx/ddr.c b/src/soc/intel/xeon_sp/cpx/ddr.c index 0fa36ab6c9..990711f090 100644 --- a/src/soc/intel/xeon_sp/cpx/ddr.c +++ b/src/soc/intel/xeon_sp/cpx/ddr.c @@ -82,3 +82,8 @@ uint16_t get_max_memory_speed(uint32_t commonTck) else return 800; } + +__weak bool mainboard_dimm_slot_exists(uint8_t socket, uint8_t channel, uint8_t slot) +{ + return false; +} diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/ddr.h b/src/soc/intel/xeon_sp/cpx/include/soc/ddr.h index 61a5ebe338..0ef6ded124 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/ddr.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/ddr.h @@ -3,7 +3,7 @@ #ifndef _CPX_DDR_H_ #define _CPX_DDR_H_ -#include +#include /* DDR_*_TCK_MIN are in picoseconds */ #define DDR_800_TCK_MIN 2500 @@ -48,4 +48,6 @@ uint16_t get_max_memory_speed(uint32_t commonTck); uint32_t get_ddr_voltage(uint8_t DdrVoltage); +bool mainboard_dimm_slot_exists(uint8_t socket, uint8_t channel, uint8_t slot); + #endif /* _CPX_DDR_H_ */ diff --git a/src/soc/intel/xeon_sp/cpx/romstage.c b/src/soc/intel/xeon_sp/cpx/romstage.c index c0ecd65301..43a74e20a9 100644 --- a/src/soc/intel/xeon_sp/cpx/romstage.c +++ b/src/soc/intel/xeon_sp/cpx/romstage.c @@ -81,7 +81,7 @@ void save_dimm_info(void) struct memory_info *mem_info; const struct SystemMemoryMapHob *hob; MEMMAP_DIMM_DEVICE_INFO_STRUCT src_dimm; - int dimm_max, index = 0; + int dimm_max, index = 0, num_dimms = 0; uint32_t vdd_voltage; hob = get_system_memory_map(); @@ -134,13 +134,25 @@ void save_dimm_info(void) src_dimm.actKeyByte2, 0); index++; + num_dimms++; + } else if (mainboard_dimm_slot_exists(0, ch, dimm)) { + if (index >= dimm_max) { + printk(BIOS_WARNING, "Too many DIMMs info for %s.\n", + __func__); + return; + } + dest_dimm = &mem_info->dimm[index]; + dest_dimm->dimm_size = 0; + dest_dimm->channel_num = ch; + dest_dimm->dimm_num = dimm; + index++; } } } - /* Save available DIMM information */ + /* Save available DIMM slot information */ mem_info->dimm_cnt = index; - printk(BIOS_DEBUG, "%d DIMMs found\n", mem_info->dimm_cnt); + printk(BIOS_DEBUG, "%d out of %d DIMMs found\n", num_dimms, mem_info->dimm_cnt); } static void set_cmos_mrc_cold_boot_flag(bool cold_boot_required) -- cgit v1.2.3