From 881075c79be4706a2b3bcd5a75eb659b0e394fce Mon Sep 17 00:00:00 2001
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Date: Mon, 23 Apr 2018 16:41:40 +0530
Subject: [PATCH] spd: Print dimm rank information
Print DIMM rank information under configuration. Supported for
DDR3 and DDR4.
Sample output:
*-bank:1
description: RDIMM DDR4 2666 MHz (0.4ns)
product: M393A2G40EB2-CTD
......
configuration: errordetection=ecc rank=1
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
src/core/device-tree.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
index 642b3c54ece1..a510e4bea726 100644
--- a/src/core/device-tree.cc
+++ b/src/core/device-tree.cc
@@ -862,6 +862,7 @@ static void add_memory_bank_spd(string path, hwNode & bank)
close(fd);
if (dimminfo[2] >= 9) {
+ int rank_offset;
double ns;
char vendor[5];
const char *type, *mod_type;
@@ -878,6 +879,7 @@ static void add_memory_bank_spd(string path, hwNode & bank)
partno_offset = 0x149;
bus_width_offset = 0x0d;
serial_offset = 0x145;
+ rank_offset = 0xc;
/*
* There is no other valid values for the medium- and fine- timebase
@@ -896,6 +898,7 @@ static void add_memory_bank_spd(string path, hwNode & bank)
partno_offset = 0x80;
serial_offset = 0x7a;
bus_width_offset = 0x08;
+ rank_offset = 0x7;
ns = (dimminfo[0xc] / 2) * (dimminfo[0xa] / (float) dimminfo[0xb]);
snprintf(vendor, sizeof(vendor), "%x%x", dimminfo[0x76], dimminfo[0x75]);
@@ -913,6 +916,9 @@ static void add_memory_bank_spd(string path, hwNode & bank)
break;
}
+ // Add DIMM rank
+ bank.setConfig("rank", ((dimminfo[rank_offset] >> 3) & 0x7) + 1);
+
bank.setClock(1000000000 / ns);
bank.setVendor(jedec_resolve(vendor));
--
2.17.1