Rob Barnes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45177 )
Change subject: soc/amd/picasso: Adjust for memory Mhz fraction ......................................................................
soc/amd/picasso: Adjust for memory Mhz fraction
Memory speed is given as an integer, but it some cases it has an implicit fractional speed. Specifically, speeds ending in 33 are implicitly 33.333 and speeds ending in 67 are implicitly 66.666. So when multiplying by 2 to get MT/s, the result needs to be rounded up or down by one to account for this implicit fraction.
BUG=b:167155849 TEST=None
Signed-off-by: Rob Barnes robbarnes@google.com Change-Id: Icc77c21932c68ee9f0ff0b8e35ae7b1a3732b322 --- M src/soc/amd/picasso/dmi.c 1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/45177/1
diff --git a/src/soc/amd/picasso/dmi.c b/src/soc/amd/picasso/dmi.c index 5189cd6..33c9e22 100644 --- a/src/soc/amd/picasso/dmi.c +++ b/src/soc/amd/picasso/dmi.c @@ -30,10 +30,20 @@ /** * TYPE17_DMI_INFO holds speed in MHz. * Change to MT/s by multiplying by 2. + * Round up/down by 1 to adjust for implict clock fraction. + * e.g. 1333 Mhz == 1333.333 Mhz == 2666.666 MT/s == 26667 MT/s */ dimm->configured_speed_mts = 2 * dmi17->ConfigSpeed; + if (dimm->configured_speed_mts % 100 == 66) + dimm->configured_speed_mts += 1; + else if (dimm->configured_speed_mts % 100 == 34) + dimm->configured_speed_mts -= 1;
dimm->max_speed_mts = 2 * dmi17->Speed; + if (dimm->max_speed_mts % 100 == 66) + dimm->max_speed_mts += 1; + else if (dimm->max_speed_mts % 100 == 34) + dimm->max_speed_mts -= 1;
dimm->rank_per_dimm = dmi17->Attributes;