Skip to content

Commit 7f4730d

Browse files
Vasant Hegdestewartsmith
authored andcommitted
hdat: Grab system model name from HDAT when available
Latest spec added system model information to IPL PARAMS ntuple. Grab this information when available instead of using hardcoded table (machine_table). Its better to parse all IPL params in one place. But on P8 we depend on model information ..which we get from sysvpd_parse(). Hence for now I've added code inside sysvpd_parse(). Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent 5b5dc42 commit 7f4730d

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

hdata/vpd.c

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,38 @@ struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
599599
return node;
600600
}
601601

602+
static void dt_add_model_name(char *model)
603+
{
604+
const char *model_name = NULL;
605+
const struct machine_info *mi;
606+
const struct iplparams_sysparams *p;
607+
const struct HDIF_common_hdr *iplp;
608+
609+
iplp = get_hdif(&spira.ntuples.ipl_parms, "IPLPMS");
610+
if (!iplp)
611+
goto def_model;
612+
613+
p = HDIF_get_idata(iplp, IPLPARAMS_SYSPARAMS, NULL);
614+
if (!CHECK_SPPTR(p))
615+
goto def_model;
616+
617+
if (be16_to_cpu(iplp->version) >= 0x60)
618+
model_name = p->sys_type_str;
619+
620+
def_model:
621+
if (!model_name || model_name[0] == '\0') {
622+
mi = machine_info_lookup(model);
623+
if (mi) {
624+
model_name = mi->name;
625+
} else {
626+
model_name = "Unknown";
627+
prlog(PR_WARNING, "VPD: Model name %s not known\n", model);
628+
}
629+
}
630+
631+
dt_add_property_string(dt_root, "model-name", model_name);
632+
}
633+
602634
static void sysvpd_parse(void)
603635
{
604636
const char *model;
@@ -612,7 +644,6 @@ static void sysvpd_parse(void)
612644
struct dt_node *dt_vpd;
613645
const struct spira_fru_id *fru_id;
614646
struct HDIF_common_hdr *sysvpd_hdr;
615-
const struct machine_info *mi;
616647

617648
sysvpd_hdr = get_hdif(&spira.ntuples.system_vpd, SYSVPD_HDIF_SIG);
618649
if (!sysvpd_hdr)
@@ -641,13 +672,8 @@ static void sysvpd_parse(void)
641672
goto no_sysvpd;
642673
memcpy(str, model, sz);
643674
dt_add_property_string(dt_root, "model", str);
644-
mi = machine_info_lookup(str);
645-
if (mi) {
646-
dt_add_property_string(dt_root, "model-name", mi->name);
647-
} else {
648-
dt_add_property_string(dt_root, "model-name", "Unknown");
649-
prlog(PR_WARNING, "VPD: Model name %s not known\n", str);
650-
}
675+
676+
dt_add_model_name(str);
651677

652678
free(str);
653679

0 commit comments

Comments
 (0)