summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2019-09-03 11:14:10 +0200
committerJean Delvare <jdelvare@suse.de>2019-09-03 11:14:10 +0200
commitecd987aa6d126830bb0b5bfbd67240c9568b441f (patch)
tree6bed70fab5888fdddf20dcad67def0944fd47a17
parent3ec23ced30f80e365c60cacf620a5847231c3ceb (diff)
downloadi2c-tools-git-ecd987aa6d126830bb0b5bfbd67240c9568b441f.tar.gz
decode-dimms: Round DDR4 speed properly
The cycle time of high-speed memory modules is stored rounded. We already have a heuristic to un-round it and display the expected speed for DDR3 modules. Use the same heuristic for DDR4. For example this will make PC4-17000 memory properly displayed as operating at 2133 MHz instead of 2132 MHz. As a side effect, this fixes a bug where the maximum speed wouldn't be listed in section "Timings at Standard Speeds" if it had been computed incorrectly due to the rounded cycle time. Signed-off-by: Jean Delvare <jdelvare@suse.de>
-rwxr-xr-xeeprom/decode-dimms30
1 files changed, 21 insertions, 9 deletions
diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms
index 7414992..c2fd253 100755
--- a/eeprom/decode-dimms
+++ b/eeprom/decode-dimms
@@ -1554,6 +1554,24 @@ use constant DDR3_REGISTERED => 2;
use constant DDR3_CLOCKED => 3;
use constant DDR3_LOAD_REDUCED => 4;
+sub ddr3_adjust_ctime($$)
+{
+ my ($ctime, $ftb) = @_;
+ my $ii;
+
+ # Starting with DDR3-1866, vendors may start approximating the
+ # minimum cycle time. Try to guess what they really meant so
+ # that the reported speed matches the standard.
+ for ($ii = 7; $ii < 15; $ii++) {
+ if ($ctime > 7.5/$ii - $ftb/1000 && $ctime < 7.5/$ii + $ftb/1000) {
+ $ctime = 7.5/$ii;
+ last;
+ }
+ }
+
+ return $ctime;
+}
+
# Parameter: EEPROM bytes 0-127 (using 1-68)
sub decode_ddr3_sdram($)
{
@@ -1600,15 +1618,7 @@ sub decode_ddr3_sdram($)
prints("Memory Characteristics");
$ctime = ddr3_mtb_ftb($bytes->[12], $bytes->[34], $mtb, $ftb);
- # Starting with DDR3-1866, vendors may start approximating the
- # minimum cycle time. Try to guess what they really meant so
- # that the reported speed matches the standard.
- for ($ii = 7; $ii < 15; $ii++) {
- if ($ctime > 7.5/$ii - $ftb/1000 && $ctime < 7.5/$ii + $ftb/1000) {
- $ctime = 7.5/$ii;
- last;
- }
- }
+ $ctime = ddr3_adjust_ctime($ctime, $ftb);
my $ddrclk = 2 * (1000 / $ctime);
my $tbits = 1 << (($bytes->[8] & 7) + 3);
@@ -1874,7 +1884,9 @@ sub decode_ddr4_sdram($)
prints("Memory Characteristics");
$ctime = ddr4_mtb_ftb($bytes->[18], $bytes->[125], $mtb, $ftb);
+ $ctime = ddr3_adjust_ctime($ctime, $ftb);
$ctime_max = ddr4_mtb_ftb($bytes->[19], $bytes->[124], $mtb, $ftb);
+ $ctime_max = ddr3_adjust_ctime($ctime_max, $ftb);
my $ddrclk = 2 * (1000 / $ctime);
my $tbits = 8 << ($bytes->[13] & 7);