]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu-arm: Add "BIOS Vendor ID" and "BIOS Model name" to show the SMBIOS information.
authorMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Fri, 13 Nov 2020 09:06:26 +0000 (10:06 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 13 Nov 2020 09:06:26 +0000 (10:06 +0100)
After commit: 367c85c47 ("lscpu: use SMBIOS tables on ARM for lscpu"),
Model name for A64FX shows like as:

   Model name:       461F0010

That's because 367c85c47 changes to get the modelname from Processor
Version of SMBIOS.

To fix that, use the hard corded table to show the "Model name" and
add two new lines; "BIOS Vendor ID" and "BIOS Model name" to show the
SMBIOS information.

lscpu shows the SMBIOS information when root user runs it because
accessing the SMBIOS information requires root privilege.

[kzak@redhat.com: - port the patch to new lscpu code]

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-arm.c
sys-utils/lscpu.c
sys-utils/lscpu.h

index 73c8b45f324ea98873bc985a53dd572badb33bd6..1cbc9775faad3b820c86504c72c0653b8cf2d894 100644 (file)
@@ -283,7 +283,7 @@ done:
 }
 
 /* use "rXpY" string as stepping */
-static int arm_decode_rXpY(struct lscpu_cputype *ct)
+static int arm_rXpY_decode(struct lscpu_cputype *ct)
 {
        int impl, revision, variant;
        char *end = NULL;
@@ -340,13 +340,13 @@ static int arm_smbios_decode(struct lscpu_cputype *ct)
        str = dmi_string(&h, data[PROC_MFR_OFFSET]);
        if (str) {
                xstrncpy(buf, str, 127);
-               ct->vendor = xstrdup(buf);
+               ct->bios_vendor = xstrdup(buf);
        }
 
        str = dmi_string(&h, data[PROC_VERSION_OFFSET]);
        if (str) {
                xstrncpy(buf, str, 127);
-               ct->modelname = xstrdup(buf);
+               ct->bios_modelname = xstrdup(buf);
        }
 
        return 0;
@@ -354,17 +354,12 @@ static int arm_smbios_decode(struct lscpu_cputype *ct)
 
 static void arm_decode(struct lscpu_cxt *cxt, struct lscpu_cputype *ct)
 {
-       int rc = -1;
-
-       /* use SMBIOS Type 4 data if available, else fall back to manual
-        * decoding using the tables above
-        */
+       /* use SMBIOS Type 4 data if available */
        if (!cxt->noalive && access(_PATH_SYS_DMI_TYPE4, R_OK) == 0)
-               rc = arm_smbios_decode(ct);
-       if (rc)
-               arm_ids_decode(ct);
+               arm_smbios_decode(ct);
 
-        arm_decode_rXpY(ct);
+       arm_ids_decode(ct);
+       arm_rXpY_decode(ct);
 }
 
 void lscpu_decode_arm(struct lscpu_cxt *cxt)
index ef655ec42916817509d7ceca48b9716ea5cc0e87..93b0860d3fd0ec096ba2fcc6493b627e4292294e 100644 (file)
@@ -831,12 +831,10 @@ print_summary_cputype(struct lscpu_cxt *cxt,
                     struct libscols_table *tb,
                     struct libscols_line *sec)
 {
-       if (ct->modelname) {
-               struct libscols_line *tmp = add_summary_s(tb, sec, _("Model name:"), ct->modelname);
-               if (!sec)
-                       sec= tmp;
-       }
-
+       if (ct->modelname)
+               sec = add_summary_s(tb, sec, _("Model name:"), ct->modelname);
+       if (ct->bios_modelname)
+               add_summary_s(tb, sec, _("BIOS Model name:"), ct->bios_modelname);
        if (ct->machinetype)
                add_summary_s(tb, sec, _("Machine type:"), ct->machinetype);
        if (ct->family)
@@ -983,16 +981,16 @@ static void print_summary(struct lscpu_cxt *cxt)
                                           _("Off-line CPU(s) list:"), set);
                cpuset_free(set);
        }
+       sec = NULL;
 
        /* Section: cpu type description */
        if (ct->vendor)
                sec = add_summary_s(tb, NULL, _("Vendor ID:"), ct->vendor);
+       if (ct->bios_vendor)
+               add_summary_s(tb, sec, _("BIOS Vendor ID:"), ct->bios_vendor);
 
-       for (i = 0; i < cxt->ncputypes; i++) {
-               print_summary_cputype(cxt, cxt->cputypes[i],
-                                       tb, cxt->ncputypes == 1 ? sec : NULL);
-
-       }
+       for (i = 0; i < cxt->ncputypes; i++)
+               print_summary_cputype(cxt, cxt->cputypes[i], tb, sec);
        sec = NULL;
 
        /* Section: vitualiazation */
index 013d58f3c614462b912e698edaf4b5facb08f6f5..465bd3fe24636792c82b0ef4332cd83023db04a7 100644 (file)
@@ -58,10 +58,12 @@ struct lscpu_cputype {
 
        char    *vendor;
        int     vendor_id;      /* created by lscpu_decode_arm() */
+       char    *bios_vendor;   /* aarch64 */
        char    *machinetype;   /* s390 */
        char    *family;
        char    *model;
        char    *modelname;
+       char    *bios_modelname; /* aarch64 */
        char    *revision;      /* alternative for model (ppc) */
        char    *stepping;
        char    *bogomips;