linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Linux I2C <linux-i2c@vger.kernel.org>
Subject: [PATCH 1/6] decode-dimms: Add preliminary DDR4 support
Date: Sun, 19 Nov 2017 13:33:52 +0100	[thread overview]
Message-ID: <20171119133352.732aacd6@endymion> (raw)
In-Reply-To: <20171119133309.67d4c596@endymion>

Recognize DDR4 memory as such, and print manufacturer information.
---
 eeprom/decode-dimms |   62 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 61 insertions(+), 1 deletion(-)

--- i2c-tools.orig/eeprom/decode-dimms	2017-11-17 11:21:42.644379702 +0100
+++ i2c-tools/eeprom/decode-dimms	2017-11-17 11:21:44.196398606 +0100
@@ -1702,6 +1702,17 @@ sub decode_ddr3_sdram($)
 
 }
 
+# Parameter: EEPROM bytes 0-127 (using 1-1)
+sub decode_ddr4_sdram($)
+{
+	my $bytes = shift;
+
+# SPD revision
+	printl_cond($bytes->[1] != 0xff, "SPD Revision",
+		    ($bytes->[1] >> 4) . "." . ($bytes->[1] & 0xf));
+
+}
+
 # Parameter: EEPROM bytes 0-127 (using 4-5)
 sub decode_direct_rambus($)
 {
@@ -1747,6 +1758,10 @@ sub decode_rambus($)
 	"DDR SDRAM"	=> \&decode_ddr_sdram,
 	"DDR2 SDRAM"	=> \&decode_ddr2_sdram,
 	"DDR3 SDRAM"	=> \&decode_ddr3_sdram,
+	"DDR4 SDRAM"	=> \&decode_ddr4_sdram,
+	"DDR4E SDRAM"	=> \&decode_ddr4_sdram,
+	"LPDDR4 SDRAM"	=> \&decode_ddr4_sdram,
+	"LPDDR4X SDRAM"	=> \&decode_ddr4_sdram,
 	"Direct Rambus"	=> \&decode_direct_rambus,
 	"Rambus"	=> \&decode_rambus,
 );
@@ -1819,6 +1834,35 @@ sub decode_ddr3_mfg_data($)
 		    sprintf("0x%02X%02X", $bytes->[146], $bytes->[147]));
 }
 
+# Parameter: EEPROM bytes 0-383 (using 320-351)
+sub decode_ddr4_mfg_data($)
+{
+	my $bytes = shift;
+
+	prints("Manufacturer Data");
+
+	printl("Module Manufacturer",
+	       manufacturer_ddr3($bytes->[320], $bytes->[321]));
+
+	printl_cond(spd_written(@{$bytes}[350..351]),
+		    "DRAM Manufacturer",
+		    manufacturer_ddr3($bytes->[350], $bytes->[351]));
+
+	printl_mfg_location_code($bytes->[322]);
+
+	printl_cond(spd_written(@{$bytes}[323..324]),
+		    "Manufacturing Date",
+		    manufacture_date($bytes->[323], $bytes->[324]));
+
+	printl_mfg_assembly_serial(@{$bytes}[325..328]);
+
+	printl("Part Number", part_number(@{$bytes}[329..348]));
+
+	printl_cond(spd_written(@{$bytes}[349]),
+		    "Revision Code",
+		    sprintf("0x%02X", $bytes->[349]));
+}
+
 # Parameter: EEPROM bytes 0-127 (using 64-98)
 sub decode_manufacturing_information($)
 {
@@ -1941,8 +1985,14 @@ sub read_hexdump($)
 sub spd_sizes($)
 {
 	my $bytes = shift;
+	my $type = $bytes->[2];
 
-	if ($bytes->[2] >= 9) {
+	if ($type == 12 || $type == 14 || $type == 16 || $type == 17) {
+		# DDR4
+		my $spd_len = 256 * (($bytes->[0] >> 4) & 7);
+		my $used = 128 * ($bytes->[0] & 15);
+		return ($spd_len, $used);
+	} elsif ($type >= 9) {
 		# For FB-DIMM and newer, decode number of bytes written
 		my $spd_len = ($bytes->[0] >> 4) & 7;
 		my $size = 64 << ($bytes->[0] & 15);
@@ -2285,6 +2335,9 @@ for $current (0 .. $#dimm) {
 			"DDR SGRAM", "DDR SDRAM",	# 6, 7
 			"DDR2 SDRAM", "FB-DIMM",	# 8, 9
 			"FB-DIMM Probe", "DDR3 SDRAM",	# 10, 11
+			"DDR4 SDRAM", "Reserved",	# 12, 13
+			"DDR4E SDRAM", "LPDDR3 SDRAM",	# 14, 15
+			"LPDDR4 SDRAM", "LPDDR4X SDRAM", # 16, 17
 		);
 		if ($bytes[2] < @type_list) {
 			$type = $type_list[$bytes[2]];
@@ -2300,6 +2353,13 @@ for $current (0 .. $#dimm) {
 		# Decode DDR3-specific manufacturing data in bytes
 		# 117-149
 		decode_ddr3_mfg_data(\@bytes)
+	} elsif ($type eq "DDR4 SDRAM" ||
+		 $type eq "DDR4E SDRAM" ||
+		 $type eq "LPDDR4 SDRAM" ||
+		 $type eq "LPDDR4X SDRAM") {
+		# Decode DDR4-specific manufacturing data in bytes
+		# 320-383
+		decode_ddr4_mfg_data(\@bytes)
 	} else {
 		# Decode next 35 bytes (64-98, common to most
 		# memory types)

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2017-11-19 12:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-19 12:33 [PATCH 0/6] decode-dimms: Add support for DDR4 SDRAM memory Jean Delvare
2017-11-19 12:33 ` Jean Delvare [this message]
2017-11-19 12:34 ` [PATCH 2/6] decode-dimms: Decode size and timings of DDR4 Jean Delvare
2017-11-19 12:34 ` [PATCH 3/6] decode-dimms: Decode misc parameters " Jean Delvare
2017-11-19 12:35 ` [PATCH 4/6] decode-dimms: Decode physical characteristics " Jean Delvare
2017-11-19 12:36 ` [PATCH 5/6] decode-dimms: Documentation update for DDR4 Jean Delvare
2017-11-19 12:37 ` [PATCH 6/6] decode-dimms: Verify the CRC of DDR4 data block 1 Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171119133352.732aacd6@endymion \
    --to=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).