]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lscpu: use sysfs for table access if available
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 12 Apr 2017 09:11:29 +0000 (10:11 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 18 Apr 2017 09:14:49 +0000 (11:14 +0200)
commit92a6392c41c11bcb49af9f129dfbd1fed651f044
tree031cdb362ee8fedd9e4c69ee9cd2b7082b8cfe11
parentecfeae90a2947fb82e19076131a3ef166374b249
lscpu: use sysfs for table access if available

On ARM systems, accessing SMBIOS tables via /dev/mem using read()
calls is not supported. The reason is that such tables are usually
located in EFI_RUNTIME_SERVICE_DATA memory, which is not covered
by the linear mapping on those systems, and so read() calls will
fail.

So instead, use the /sys/firmware/dmi/tables/DMI sysfs file, which
contains the entire structure table array, and will be available
on any recent Linux system, even on ones that only export the rev3
SMBIOS entry point, which is currently ignored by lscpu.

Note that the max 'num' value is inferred from the size. This is not
a limitation of the sysfs interface, but a limitation of the rev3
entry point, which no longer carries a number of array elements.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
sys-utils/lscpu-dmi.c