Blob Blame History Raw
commit 861350941f9a3fb76ebcae3e5a32b3cbec929d03
Author: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Date:   Tue Jun 26 16:50:52 2018 +0530

    vpd: Add vendor property to processor node
    
    Processor FRU vpd doesn't contain vendor detail. We have to parse
    module VPD to get vendor detail.
    
    Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
    Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
    Signed-off-by: Stewart Smith <stewart@linux.ibm.com>

diff --git a/hdata/hdata.h b/hdata/hdata.h
index 981affd4..426c9c98 100644
--- a/hdata/hdata.h
+++ b/hdata/hdata.h
@@ -50,6 +50,8 @@ extern const char *slca_get_vpd_name(uint16_t slca_index);
 extern const char *slca_get_loc_code_index(uint16_t slca_index);
 extern void slca_vpd_add_loc_code(struct dt_node *node, uint16_t slca_index);
 extern void slca_dt_add_sai_node(void);
+extern void dt_add_proc_vendor(struct dt_node *proc_node,
+			       const void *mvpd, unsigned int mvpd_sz);
 
 extern bool hservices_from_hdat(const void *fdt, size_t size);
 int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
diff --git a/hdata/spira.c b/hdata/spira.c
index d459df7c..189584d5 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -561,6 +561,8 @@ static bool add_xscom_sppcrd(uint64_t xscom_base)
 				dt_add_property(np, "ibm,module-vpd", vpd,
 						vpd_sz);
 				vpd_data_parse(np, vpd, vpd_sz);
+				if (vpd_node)
+					dt_add_proc_vendor(vpd_node, vpd, vpd_sz);
 			}
 		}
 
diff --git a/hdata/vpd.c b/hdata/vpd.c
index 98123e5a..129b5062 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -248,6 +248,21 @@ static struct dt_property *dt_add_prop_sanitize_val(struct dt_node *node,
 	return p;
 }
 
+/*
+ * OpenPower system does not provide processor vendor name under FRU VPD.
+ * Parse processor module VPD to get vendor detail
+ */
+void dt_add_proc_vendor(struct dt_node *proc_node,
+			const void *mvpd, unsigned int mvpd_sz)
+{
+	const void *kw;
+	uint8_t sz;
+
+	kw = vpd_find(mvpd, mvpd_sz, "VINI", "VN", &sz);
+	if (kw)
+		dt_add_prop_sanitize_val(proc_node, "vendor", kw, sz);
+}
+
 /*
  * For OpenPOWER, we only decipher OPFR records. While OP HDAT have VINI
  * records too, populating the fields in there is optional. Also, there