Blame SOURCES/0037-devtree-Add-part-and-serial-number-info-to-memory-ba.patch

99c779
From e296a0e6f5d88029d561ba2eef0d39b5cc96cbd3 Mon Sep 17 00:00:00 2001
99c779
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
99c779
Date: Tue, 29 Nov 2016 12:12:37 +0530
99c779
Subject: [PATCH 37/43] devtree: Add part and serial number info to memory bank
99c779
99c779
SPD has both part number and serial number information. Presently
99c779
we are displaying part number info under serial numbers. Instead
99c779
use Product field for part number and display proper serial number
99c779
under serial field.
99c779
99c779
Signed-off-by: Jack Miller <jack@codezen.org>
99c779
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
99c779
---
99c779
 src/core/device-tree.cc | 9 ++++++++-
99c779
 1 file changed, 8 insertions(+), 1 deletion(-)
99c779
99c779
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
99c779
index e224024..41034e5 100644
99c779
--- a/src/core/device-tree.cc
99c779
+++ b/src/core/device-tree.cc
99c779
@@ -763,6 +763,7 @@ static void add_memory_bank_spd(string path, hwNode & bank)
99c779
   unsigned char week_offset;
99c779
   unsigned char partno_offset;
99c779
   unsigned char ver_offset;
99c779
+  unsigned char serial_offset;
99c779
   int fd;
99c779
   size_t len = 0;
99c779
   dimminfo_buf dimminfo;
99c779
@@ -798,6 +799,7 @@ static void add_memory_bank_spd(string path, hwNode & bank)
99c779
     week_offset = 0x79;
99c779
     partno_offset = 0x80;
99c779
     ver_offset = 0x01;
99c779
+    serial_offset = 0x7a;
99c779
 
99c779
     switch ((dimminfo[0x8] >> 3) & 0x3) // DDR3 error detection and correction scheme
99c779
     {
99c779
@@ -850,6 +852,7 @@ static void add_memory_bank_spd(string path, hwNode & bank)
99c779
     week_offset = 0x5e;
99c779
     partno_offset = 0x49;
99c779
     ver_offset = 0x3e;
99c779
+    serial_offset = 0x5f;
99c779
 
99c779
     switch (dimminfo[0xb] & 0x3) // DDR2 error detection and correction scheme
99c779
     {
99c779
@@ -872,12 +875,16 @@ static void add_memory_bank_spd(string path, hwNode & bank)
99c779
     "%02X%02X,%02X %02X,%02X", dimminfo[rev_offset1],
99c779
     dimminfo[rev_offset2], dimminfo[year_offset], dimminfo[week_offset],
99c779
     dimminfo[mfg_loc_offset]);
99c779
-  bank.setSerial(string((char *) &dimminfo[partno_offset], 18));
99c779
+  bank.setProduct(string((char *) &dimminfo[partno_offset], 18));
99c779
   bank.setVersion(dimmversion);
99c779
 
99c779
+  unsigned long serial = be_long(&dimminfo[serial_offset]);
99c779
   int version = dimminfo[ver_offset];
99c779
   char buff[32];
99c779
 
99c779
+  snprintf(buff, sizeof(buff), "0x%lx", serial);
99c779
+  bank.setSerial(buff);
99c779
+
99c779
   snprintf(buff, sizeof(buff), "spd-%d.%d", (version & 0xF0) >> 4, version & 0x0F);
99c779
   bank.addCapability(buff);
99c779
 }
99c779
-- 
99c779
2.10.2
99c779