diff options
| author | Huang Shijie <shijie@os.amperecomputing.com> | 2021-06-17 12:41:16 +0000 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2021-06-30 11:27:26 +0200 |
| commit | 81d6de9166be0377458b91c2f636baf9315c56c6 (patch) | |
| tree | 266ec4e4bb01c9978d0a0803b179ff9c4c58aee7 /sys-utils/lscpu-arm.c | |
| parent | 5efc31f9d8c7c95a2895e8d10052be11a66ec569 (diff) | |
| download | util-linux-81d6de9166be0377458b91c2f636baf9315c56c6.tar.gz | |
lscpu: remove the old code
The file "/sys/firmware/dmi/tables/DMI" always exists.
The dmi_decode_cputype() can provide more information then arm_smbios_decode().
So remove it to tidy the code.
Before this patch, we can get the output from Centos 7.9 who has
"/sys/firmware/dmi/entries/4-0/raw" and "/sys/firmware/dmi/tables/DMI":
----------------------------------------------------
BIOS Vendor ID: Ampere(TM)
Model name: Neoverse-N1
BIOS Model name: Ampere(TM) Altra(TM) Processor
----------------------------------------------------
After this patch which uses "/sys/firmware/dmi/tables/DMI", in Centos 7.9, we get:
----------------------------------------------------
BIOS Vendor ID: Ampere(TM)
Model name: Neoverse-N1
BIOS Model name: Ampere(TM) Altra(TM) Processor Q00-00 CPU @ 2.8GHz
BIOS CPU family: 257
----------------------------------------------------
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Diffstat (limited to 'sys-utils/lscpu-arm.c')
| -rw-r--r-- | sys-utils/lscpu-arm.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c index 885aadc367..d52765f9d0 100644 --- a/sys-utils/lscpu-arm.c +++ b/sys-utils/lscpu-arm.c @@ -315,53 +315,9 @@ static int arm_rXpY_decode(struct lscpu_cputype *ct) return 0; } -#define PROC_MFR_OFFSET 0x07 -#define PROC_VERSION_OFFSET 0x10 - -/* - * Use firmware to get human readable names - */ -static int arm_smbios_decode(struct lscpu_cputype *ct) -{ - uint8_t data[8192]; - char buf[128], *str; - struct lscpu_dmi_header h; - int fd; - ssize_t rs; - - fd = open(_PATH_SYS_DMI_TYPE4, O_RDONLY); - if (fd < 0) - return fd; - - rs = read_all(fd, (char *) data, 8192); - close(fd); - - if (rs == -1) - return -1; - - to_dmi_header(&h, data); - - str = dmi_string(&h, data[PROC_MFR_OFFSET]); - if (str) { - xstrncpy(buf, str, 127); - ct->bios_vendor = xstrdup(buf); - } - - str = dmi_string(&h, data[PROC_VERSION_OFFSET]); - if (str) { - xstrncpy(buf, str, 127); - ct->bios_modelname = xstrdup(buf); - } - - return 0; -} - static void arm_decode(struct lscpu_cxt *cxt, struct lscpu_cputype *ct) { - /* use SMBIOS Type 4 data if available */ - if (!cxt->noalive && access(_PATH_SYS_DMI_TYPE4, R_OK) == 0) - arm_smbios_decode(ct); - else if (!cxt->noalive && access(_PATH_SYS_DMI, R_OK) == 0) + if (!cxt->noalive && access(_PATH_SYS_DMI, R_OK) == 0) dmi_decode_cputype(ct); arm_ids_decode(ct); |
