Skip to content

Commit

Permalink
hdat: Add model-name property for OpenPower system
Browse files Browse the repository at this point in the history
Lets add model-name property for OpenPower system as well.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed Apr 5, 2017
1 parent 810aaf1 commit 54c4dd2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hdata/test/p8-840-spira.dts
Expand Up @@ -12,9 +12,9 @@
nest-frequency = <0x0 0x77359400>;
vendor = "IBM";
model = "8286-41A";
model-name = "IBM Power System S814";
system-id = "TU00163";
system-brand = "S0";
model-name = "IBM Power System S814";
ibm,hbrt-mini-fdt = <0xcafebeef 0x1000 0x31ce42d>;
reserved-ranges = <0x7 0xfd700000 0x0 0x100000 0x7 0xfd6a0000 0x0 0x60000 0x7 0xfd510000 0x0 0x190000>;
reserved-names = "ibm,hbrt-vpd-image", "ibm,hbrt-target-image", "ibm,hbrt-code-image";
Expand Down
2 changes: 1 addition & 1 deletion hdata/test/p81-811.spira.dts
Expand Up @@ -12,9 +12,9 @@
nest-frequency = <0x0 0x77359400>;
vendor = "IBM";
model = "8247-22L";
model-name = "IBM Power System S822L";
system-id = "1010C8A";
system-brand = "S0";
model-name = "IBM Power System S822L";
ibm,hbrt-mini-fdt = <0xcafebeef 0x1000 0xfad5bb>;
reserved-ranges = <0x1f 0xfd700000 0x0 0x100000 0x1f 0xfd6bd000 0x0 0x43000 0x1f 0xfd586000 0x0 0x137000>;
reserved-names = "ibm,hbrt-vpd-image", "ibm,hbrt-target-image", "ibm,hbrt-code-image";
Expand Down
2 changes: 1 addition & 1 deletion hdata/vpd-common.c
Expand Up @@ -28,7 +28,7 @@ static const struct machine_info machine_table[] = {
{"8286-42A", "IBM Power System S824"},
};

const struct machine_info *machine_info_lookup(char *mtm)
const struct machine_info *machine_info_lookup(const char *mtm)
{
int i;
for(i = 0; i < ARRAY_SIZE(machine_table); i++)
Expand Down
14 changes: 10 additions & 4 deletions hdata/vpd.c
Expand Up @@ -501,12 +501,17 @@ struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
return node;
}

static void dt_add_model_name(char *model)
static void dt_add_model_name(void)
{
const char *model_name = NULL;
const struct machine_info *mi;
const struct iplparams_sysparams *p;
const struct HDIF_common_hdr *iplp;
const struct dt_property *model;

model = dt_find_property(dt_root, "model");
if (!model)
goto def_model;

iplp = get_hdif(&spira.ntuples.ipl_parms, "IPLPMS");
if (!iplp)
Expand All @@ -521,12 +526,12 @@ static void dt_add_model_name(char *model)

def_model:
if (!model_name || model_name[0] == '\0') {
mi = machine_info_lookup(model);
mi = machine_info_lookup(model->prop);
if (mi) {
model_name = mi->name;
} else {
model_name = "Unknown";
prlog(PR_WARNING, "VPD: Model name %s not known\n", model);
prlog(PR_WARNING, "VPD: Model name %s not known\n", model->prop);
}
}

Expand Down Expand Up @@ -566,7 +571,6 @@ static void sysvpd_parse_legacy(const void *sysvpd, unsigned int sysvpd_sz)
if (str) {
memcpy(str, model, sz);
dt_add_property_string(dt_root, "model", str);
dt_add_model_name(str);
free(str);
}
} else
Expand Down Expand Up @@ -619,6 +623,8 @@ static void sysvpd_parse(void)
sysvpd_parse_opp(sysvpd, sysvpd_sz);
} else
sysvpd_parse_legacy(sysvpd, sysvpd_sz);

dt_add_model_name();
}

static void iokid_vpd_parse(const struct HDIF_common_hdr *iohub_hdr)
Expand Down
2 changes: 1 addition & 1 deletion include/vpd.h
Expand Up @@ -22,7 +22,7 @@ struct machine_info {
const char *name;
};

const struct machine_info *machine_info_lookup(char *mtm);
const struct machine_info *machine_info_lookup(const char *mtm);

const void *vpd_find_keyword(const void *rec, size_t rec_sz,
const char *kw, uint8_t *kw_size);
Expand Down

0 comments on commit 54c4dd2

Please sign in to comment.