From c839b3704987a187afc2db5bc0b44b9523486308 Mon Sep 17 00:00:00 2001 From: Nikolai Vyssotski Date: Fri, 25 Jun 2021 11:15:38 -0500 Subject: soc/amd/common/fsp/dmi.c: Fix Type 17 DMI reporting With two versions of *speed_mhz_to_reported_mts() we need to call the correct one based on the reported memory type. BUG=b:184124605 TEST="dmidecode --type 17" in OS on Guybrush Signed-off-by: Nikolai Vyssotski Change-Id: I92e834097546e3ef7130830444a80f818bdea3d5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/55852 Reviewed-by: Rob Barnes Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/common/fsp/dmi.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/soc/amd/common/fsp/dmi.c b/src/soc/amd/common/fsp/dmi.c index b3eb5746db..61d43f7aae 100644 --- a/src/soc/amd/common/fsp/dmi.c +++ b/src/soc/amd/common/fsp/dmi.c @@ -15,6 +15,23 @@ #include #include #include +#include + +/** + * Convert DDR clock speed (based on memory type) in MHz to the standard reported speed in MT/s + */ +static uint16_t ddr_speed_mhz_to_reported_mts(uint16_t ddr_type, uint16_t speed) +{ + switch (ddr_type) { + case MEMORY_TYPE_DDR4: + return ddr4_speed_mhz_to_reported_mts(speed); + case MEMORY_TYPE_LPDDR4: + return lpddr4_speed_mhz_to_reported_mts(speed); + default: + printk(BIOS_ERR, "ERROR: Unknown memory type %x", ddr_type); + return 0; + } +} /** * Populate dimm_info using AGESA TYPE17_DMI_INFO. @@ -28,9 +45,10 @@ static void transfer_memory_info(const TYPE17_DMI_INFO *dmi17, dimm->ddr_type = dmi17->MemoryType; - dimm->configured_speed_mts = ddr4_speed_mhz_to_reported_mts(dmi17->ConfigSpeed); + dimm->configured_speed_mts = ddr_speed_mhz_to_reported_mts( + dmi17->MemoryType, dmi17->ConfigSpeed); - dimm->max_speed_mts = ddr4_speed_mhz_to_reported_mts(dmi17->Speed); + dimm->max_speed_mts = ddr_speed_mhz_to_reported_mts(dmi17->MemoryType, dmi17->Speed); dimm->rank_per_dimm = dmi17->Attributes; -- cgit v1.2.3