soc/amd/picasso: Convert DDR4 MHz to MT/s correctly

Memory speed is given as an integer in MHz. In some cases it has
an implicit fractional speed, so simply multiplying by 2 is not
sufficient.

Use method from dram/ddr4.c instead.

BUG=b:167155849
TEST=Boot ezkinil, check output of 'mosys memory spd print all'
     and dmidecode -t17
BRANCH=Zork

Signed-off-by: Rob Barnes <robbarnes@google.com>
Change-Id: Icc77c21932c68ee9f0ff0b8e35ae7b1a3732b322
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Rob Barnes 2020-09-14 07:51:51 -06:00 committed by Aaron Durbin
parent a01ee36288
commit e5aa5ae1ba
1 changed files with 3 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include <lib.h>
#include <dimm_info_util.h>
#include <vendorcode/amd/fsp/picasso/dmi_info.h>
#include <device/dram/ddr4.h>
/**
* Populate dimm_info using AGESA TYPE17_DMI_INFO.
@ -27,13 +28,9 @@ static void transfer_memory_info(const TYPE17_DMI_INFO *dmi17,
dimm->ddr_type = dmi17->MemoryType;
/**
* TYPE17_DMI_INFO holds speed in MHz.
* Change to MT/s by multiplying by 2.
*/
dimm->configured_speed_mts = 2 * dmi17->ConfigSpeed;
dimm->configured_speed_mts = ddr4_speed_mhz_to_reported_mts(dmi17->ConfigSpeed);
dimm->max_speed_mts = 2 * dmi17->Speed;
dimm->max_speed_mts = ddr4_speed_mhz_to_reported_mts(dmi17->Speed);
dimm->rank_per_dimm = dmi17->Attributes;