[Skiboot] [PATCH] hdata/vpd: add support for parsing CPU VRML records

Robert Lippert roblip at gmail.com
Thu Nov 16 09:59:14 AEDT 2017


Allows skiboot to parse out the processor part/serial numbers
on OpenPOWER P9 machines.

Change-Id: Ie22a3c50d32f480671334b4b6c820476e29301c9
Signed-off-by: Robert Lippert <rlippert at google.com>
---
 hdata/vpd.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/hdata/vpd.c b/hdata/vpd.c
index 6abbd59bb..d114e6b71 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -260,6 +260,28 @@ static void vpd_opfr_parse(struct dt_node *node,
 	return;
 }
 
+/*
+ * For CPUs, parse the VRML data.
+ */
+static void vpd_vrml_parse(struct dt_node *node,
+		const void *fruvpd, unsigned int fruvpd_sz)
+{
+	const void *kw;
+	uint8_t sz;
+
+	/* Part number */
+	kw = vpd_find(fruvpd, fruvpd_sz, "VRML", "PN", &sz);
+	if (kw)
+		dt_add_property_nstr(node, "part-number", kw, sz);
+
+	/* Serial number */
+	kw = vpd_find(fruvpd, fruvpd_sz, "VRML", "SN", &sz);
+	if (kw)
+		dt_add_property_nstr(node, "serial-number", kw, sz);
+
+	return;
+}
+
 static void vpd_vini_parse(struct dt_node *node,
 			   const void *fruvpd, unsigned int fruvpd_sz)
 {
@@ -341,6 +363,8 @@ void vpd_data_parse(struct dt_node *node, const void *fruvpd, u32 fruvpd_sz)
 {
 	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))
+		vpd_vrml_parse(node, fruvpd, fruvpd_sz);
 	else
 		vpd_vini_parse(node, fruvpd, fruvpd_sz);
 }
-- 
2.15.0.448.gf294e3d99a-goog



More information about the Skiboot mailing list