Skip to content

Commit

Permalink
hdata: Fix vpd parse
Browse files Browse the repository at this point in the history
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: 694546c (hdata/vpd: Parse the OpenPOWER OPFR record)
CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed Sep 5, 2017
1 parent 789b0e3 commit 2a73bbe
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions hdata/vpd.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2a73bbe

Please sign in to comment.