[Skiboot] [PATCH 3/3] device-tree vpd/xscom@: add more VPD to xscom@ nodes

Stewart Smith stewart at linux.ibm.com
Fri Apr 6 15:16:46 AEST 2018


From: Stewart Smith <stewart at linux.vnet.ibm.com>

Notably, add board-info and vendor (if in VPD), which is
expected by FWTS and was present on POWER8.

We get properties like:
serial-number    "YA1934092546"
board-info       "PROCESSOR MODULE"
part-number      "02AA863"
vendor           "IBM             "

This change will also affect what we put in the /vpd hierarchy,
but by making it more complete.

On POWER8 OpenPOWER systems, these were a mix of read from the VPD
by hostboot and added to the device tree and hard coded.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hdata/test/p8-840-spira.dts  |  2 ++
 hdata/test/p81-811.spira.dts |  4 ++++
 hdata/vpd.c                  | 41 ++++++++++++++++++++++-------------------
 3 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/hdata/test/p8-840-spira.dts b/hdata/test/p8-840-spira.dts
index 62a2f52bc327..1971e0044727 100644
--- a/hdata/test/p8-840-spira.dts
+++ b/hdata/test/p8-840-spira.dts
@@ -968,6 +968,7 @@
 		ibm,module-vpd = <0xcafebeef 0x10000 0xa502aa2f>;
 		part-number = "00KV631";
 		serial-number = "YA1932063562";
+		board-info = "06-WAY PROC CUOD";
 		ibm,ccm-node-id = <0x0>;
 		ibm,hw-card-id = <0x0>;
 		ibm,hw-module-id = <0x0>;
@@ -1033,6 +1034,7 @@
 		ibm,module-vpd = <0xcafebeef 0x10000 0x9f87fa41>;
 		part-number = "00KV631";
 		serial-number = "YA1932063562";
+		board-info = "06-WAY PROC CUOD";
 		ibm,ccm-node-id = <0x0>;
 		ibm,hw-card-id = <0x0>;
 		ibm,hw-module-id = <0x0>;
diff --git a/hdata/test/p81-811.spira.dts b/hdata/test/p81-811.spira.dts
index ba9b3551f630..eb9972fc7d0d 100644
--- a/hdata/test/p81-811.spira.dts
+++ b/hdata/test/p81-811.spira.dts
@@ -2187,6 +2187,7 @@
 		ibm,module-vpd = <0xcafebeef 0x10000 0x3e067c18>;
 		part-number = "00KV627";
 		serial-number = "YA1932096951";
+		board-info = "10-WAY PROC CUOD";
 		ibm,ccm-node-id = <0x0>;
 		ibm,hw-card-id = <0x0>;
 		ibm,hw-module-id = <0x0>;
@@ -2252,6 +2253,7 @@
 		ibm,module-vpd = <0xcafebeef 0x10000 0x1b85218f>;
 		part-number = "00KV627";
 		serial-number = "YA1932096951";
+		board-info = "10-WAY PROC CUOD";
 		ibm,ccm-node-id = <0x0>;
 		ibm,hw-card-id = <0x0>;
 		ibm,hw-module-id = <0x0>;
@@ -2314,6 +2316,7 @@
 		ibm,module-vpd = <0xcafebeef 0x10000 0x36f99ead>;
 		part-number = "00KV627";
 		serial-number = "YA1932096950";
+		board-info = "10-WAY PROC CUOD";
 		ibm,ccm-node-id = <0x0>;
 		ibm,hw-card-id = <0x0>;
 		ibm,hw-module-id = <0x1>;
@@ -2367,6 +2370,7 @@
 		ibm,module-vpd = <0xcafebeef 0x10000 0x65fe8f66>;
 		part-number = "00KV627";
 		serial-number = "YA1932096950";
+		board-info = "10-WAY PROC CUOD";
 		ibm,ccm-node-id = <0x0>;
 		ibm,hw-card-id = <0x0>;
 		ibm,hw-module-id = <0x1>;
diff --git a/hdata/vpd.c b/hdata/vpd.c
index 038569af072a..76bc15bc184c 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -234,27 +234,27 @@ static void vpd_opfr_parse(struct dt_node *node,
 
 	/* Vendor Name */
 	kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "VN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "vendor"))
 		dt_add_property_nstr(node, "vendor", kw, sz);
 
 	/* FRU Description */
 	kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "DR", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "description"))
 		dt_add_property_nstr(node, "description", kw, sz);
 
 	/* Part number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "VP", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "part-number"))
 		dt_add_property_nstr(node, "part-number", kw, sz);
 
 	/* Serial number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "VS", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "serial-number"))
 		dt_add_property_nstr(node, "serial-number", kw, sz);
 
 	/* Build date in BCD */
 	kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "MB", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "build-date"))
 		dt_add_property_nstr(node, "build-date", kw, sz);
 
 	return;
@@ -271,12 +271,12 @@ static void vpd_vrml_parse(struct dt_node *node,
 
 	/* Part number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VRML", "PN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "part-number"))
 		dt_add_property_nstr(node, "part-number", kw, sz);
 
 	/* Serial number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VRML", "SN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "serial-number"))
 		dt_add_property_nstr(node, "serial-number", kw, sz);
 
 	return;
@@ -291,47 +291,47 @@ static void vpd_vini_parse(struct dt_node *node,
 
 	/* FRU Stocking Part Number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "FN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "fru-number"))
 		dt_add_property_nstr(node, "fru-number", kw, sz);
 
 	/* Serial Number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "SN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "serial-number"))
 		dt_add_property_nstr(node, "serial-number", kw, sz);
 
 	/* Part Number */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "PN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "part-number"))
 		dt_add_property_nstr(node, "part-number", kw, sz);
 
 	/* Vendor Name */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "VN", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "vendor"))
 		dt_add_property_nstr(node, "vendor", kw, sz);
 
 	/* CCIN Extension */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "CE", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "ccin-extension"))
 		dt_add_property_nstr(node, "ccin-extension", kw, sz);
 
 	/* HW Version info */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "HW", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "hw-version"))
 		dt_add_property_nstr(node, "hw-version", kw, sz);
 
 	/* Card type info */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "CT", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "card-type"))
 		dt_add_property_nstr(node, "card-type", kw, sz);
 
 	/* HW characteristics info */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "B3", &sz);
-	if (kw)
+	if (kw && !dt_find_property(node, "hw-characteristics"))
 		dt_add_property_nstr(node, "hw-characteristics", kw, sz);
 
 	/* Customer Card Identification Number (CCIN) */
 	kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "CC", &sz);
-	if (kw) {
+	if (kw && !dt_find_property(node, "ccin")) {
 		dt_add_property_nstr(node, "ccin", kw, sz);
 
 		cinfo = card_info_lookup((char *)kw);
@@ -366,12 +366,15 @@ static bool valid_child_entry(const struct slca_entry *entry)
 
 void vpd_data_parse(struct dt_node *node, const void *fruvpd, u32 fruvpd_sz)
 {
+	/*
+	 * Whatever gets found first stays, if there's duplicates,
+	 * first in wins.
+	 */
 	if (vpd_find_record(fruvpd, fruvpd_sz, "OPFR", NULL))
 		vpd_opfr_parse(node, fruvpd, fruvpd_sz);
-	else if (vpd_find_record(fruvpd, fruvpd_sz, "VRML", NULL))
+	if (vpd_find_record(fruvpd, fruvpd_sz, "VRML", NULL))
 		vpd_vrml_parse(node, fruvpd, fruvpd_sz);
-	else
-		vpd_vini_parse(node, fruvpd, fruvpd_sz);
+	vpd_vini_parse(node, fruvpd, fruvpd_sz);
 }
 
 /* Create the /vpd node and add its children */
-- 
2.14.3



More information about the Skiboot mailing list