[Skiboot] [PATCH v2 2/5] hdata: Make vpd data parsing function global

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


Move VPD parsing code to separate function (vpd_data_parse())
and make it as global. So that we can call this function from
other files.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hdata/hdata.h |  2 ++
 hdata/vpd.c   | 14 +++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/hdata/hdata.h b/hdata/hdata.h
index 6da9b55..cab0626 100644
--- a/hdata/hdata.h
+++ b/hdata/hdata.h
@@ -30,6 +30,8 @@ extern void io_parse(void);
 extern struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 				       int indx_fru, int indx_vpd);
 extern void vpd_parse(void);
+extern void vpd_data_parse(struct dt_node *node,
+			   const void *fruvpd, u32 fruvpd_sz);
 
 extern struct dt_node *find_xscom_for_chip(uint32_t chip_id);
 extern uint32_t pcid_to_chip_id(uint32_t proc_chip_id);
diff --git a/hdata/vpd.c b/hdata/vpd.c
index 0e23e29..836869a 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -413,6 +413,14 @@ static struct dt_node *dt_create_vpd_node(struct dt_node *parent,
 	return node;
 }
 
+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
+		vpd_vini_parse(node, fruvpd, fruvpd_sz);
+}
+
 struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 				int indx_fru, int indx_vpd)
 {
@@ -489,11 +497,7 @@ struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 	if (vpd_valid(fruvpd, fruvpd_sz)
 	    && !dt_find_property(node, "ibm,vpd")) {
 		dt_add_property(node, "ibm,vpd", fruvpd, fruvpd_sz);
-
-		if (vpd_find_record(fruvpd, fruvpd_sz, "OPFR", NULL))
-			vpd_opfr_parse(node, fruvpd, fruvpd_sz);
-		else
-			vpd_vini_parse(node, fruvpd, fruvpd_sz);
+		vpd_data_parse(node, fruvpd, fruvpd_sz);
 	}
 
 	return node;
-- 
2.9.3



More information about the Skiboot mailing list