[Skiboot] [PATCH v2 1/5] hdata: Fix vpd parse

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Aug 28 17:17:59 AEST 2017


We detect vpd data format in vpd_parse() and set "op_platform" variable.
dt_add_vpd_node() depends on op_platform to select parser type.

There are places where we call dt_add_vpd_node() even before calling
vpd_parse(). And in such cases it will not parse vpd data properly.

This patch fixes above issue.

Fixes: 694546c1 (hdata/vpd: Parse the OpenPOWER OPFR record)
CC: Ananth N Mavinakayanahalli <ananth at linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hdata/vpd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/hdata/vpd.c b/hdata/vpd.c
index d7d57cd..0e23e29 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -23,8 +23,6 @@
 #include "hdata.h"
 #include <inttypes.h>
 
-static bool op_platform;
-
 struct card_info {
 	const char *ccin; 	/* Customer card identification number */
 	const char *description;
@@ -492,7 +490,7 @@ struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 	    && !dt_find_property(node, "ibm,vpd")) {
 		dt_add_property(node, "ibm,vpd", fruvpd, fruvpd_sz);
 
-		if (op_platform)
+		if (vpd_find_record(fruvpd, fruvpd_sz, "OPFR", NULL))
 			vpd_opfr_parse(node, fruvpd, fruvpd_sz);
 		else
 			vpd_vini_parse(node, fruvpd, fruvpd_sz);
@@ -607,10 +605,9 @@ static void sysvpd_parse(void)
 	}
 
 	/* Look for the new OpenPower "OSYS" first */
-	if (vpd_find_record(sysvpd, sysvpd_sz, "OSYS", NULL)) {
-		op_platform = true;
+	if (vpd_find_record(sysvpd, sysvpd_sz, "OSYS", NULL))
 		sysvpd_parse_opp(sysvpd, sysvpd_sz);
-	} else
+	else
 		sysvpd_parse_legacy(sysvpd, sysvpd_sz);
 
 	dt_add_model_name();
-- 
2.9.3



More information about the Skiboot mailing list