summaryrefslogtreecommitdiff
path: root/dmidecode.c
Commit message (Collapse)AuthorAgeFilesLines
...
* dmidecode: Add helper function pr_subattrJean Delvare2020-04-011-32/+36
| | | | | | Print all second-level attributes through a helper function pr_subattr. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add helper functions pr_list_start/item/endJean Delvare2020-04-011-114/+146
| | | | | | | | | Print lists through helper functions. pr_list_start() starts the list, with an optional value. pr_list_item() prints a single item. pr_list_end() is a no-op for plain text output, but is in place in anticipation of supporting other output formats such as HTML. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add helper function pr_attrJean Delvare2020-04-011-714/+643
| | | | | | Print all first-level attributes through a helper function pr_attr. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add helper function pr_handle_nameJean Delvare2020-04-011-50/+49
| | | | | | | Print the name of each handle type through a helper function pr_handle_name. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add helper function pr_handleJean Delvare2020-04-011-2/+1
| | | | | | Print the handle information through a helper function pr_handle. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add helper function pr_infoJean Delvare2020-04-011-15/+15
| | | | | | Print all info messages through a helper function pr_info. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add helper function pr_commentJean Delvare2020-04-011-16/+17
| | | | | | Print all comments through a helper function pr_comment. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Refactor ASCII filtering of DMI stringsJean Delvare2020-03-231-28/+32
| | | | | | | | | | Split dmi_string into 3 functions to make it more modular. ASCII filtering is an explicit option now to give the caller more control. Use the new functions in dmi_dump to avoid reimplementing the ASCII filtering and printing characters one by one. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Move type 42 warning messages to stderrJean Delvare2020-03-231-4/+6
| | | | | | | | | | Write warning messages about invalid type 42 structures to stderr as we do for all other warning messages. Also include the handle and record numbers in these warning messages to make the problem easier to analyze. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Reduce the indentation of type 42 structuresJean Delvare2020-03-231-20/+20
| | | | | | | | There is no reason to indent the device information that much in type 42 structures. Remove the extra level of indentation for consistency and readability. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Code indentation fixesJean Delvare2020-03-231-2/+2
| | | | Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Fix the alignment of type 25 nameJean Delvare2020-03-231-1/+1
| | | | | | No tabulation needed before DMI structure names. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Simplify the formatting of memory error statusJean Delvare2020-03-231-9/+10
| | | | | | | Make the logic more simple so that we always report the status on a single line. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Don't choke on invalid processor voltageJean Delvare2020-03-231-2/+2
| | | | | | | | If the processor voltage encoding has some of the reserved bits set and none of the proper bits set, print it as "Unknown" instead of an empty field. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Print type 33 name unconditionallyJean Delvare2020-03-231-1/+1
| | | | | | | Even if a type 33 structure is too short, we can still display its type name as we do for all other structure types. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Decode system slot base bus width and peersJean Delvare2019-10-231-0/+15
| | | | | | | | SMBIOS version 3.2.0 added extra fields are the end of structure type 9. Decode these extra fields (base data bus width and peers) when present. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add enumerated values from SMBIOS 3.3.0Jean Delvare2019-10-231-9/+35
| | | | | | | | Add all the enumerated values from the SMBIOS 3.3.0 specification update that was released last month. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
* TypoJean Delvare2019-10-161-1/+1
|
* dmidecode: Fix System Slot Information for PCIe SSDPrabhakar pujeri2019-10-151-2/+4
| | | | | | | | Output for type 9 show <out of spec> for PCIe SSD. SMBIOS spec table 48 describes 2.5" and 3.5" PCIe SSD formats. Signed-off-by: Prabhakar pujeri <prabhakar.pujeri@dell.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Adding firmware-revision support to -s optionErwan Velu2019-10-071-0/+4
| | | | | | | | | | | | | | Most of servers like HPe, QCT, report the BMC version via the Firmware Revision field. Add an option to the -s to export this information directly. A typical usage of this feature looks like: [root@host ~]$ dmidecode -s firmware-revision 3.93 Signed-off-by: Erwan Velu <e.velu@criteo.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Adding bios-revision to -s optionErwan Velu2019-10-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some hardware vendors like HPe use the Version field to store the bios generation like (U30, U32, A40, ...). If you want to get the "release" version of this bios generation, the bios revision field must be considered. A typical output of this kind of server looks like : BIOS Information Vendor: HPE Version: A40 Release Date: 07/20/2019 [...] BIOS Revision: 2.0 Firmware Revision: 1.45 Add a "bios-revision" entry into the '-s' option. A typical usage of this feature looks like : [root@host] dmidecode -s bios-revision 2.0 Signed-off-by: Erwan Velu <e.velu@criteo.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* Fix formatting of TPM table outputDeomid rojer Ryabkov2019-08-261-2/+2
| | | | | | Added missing newlines. Fixes: 48a8132058a0 ("dmidecode: Add support for structure type 43 (TPM Device)")
* Use larger units for memory device and BIOS sizeDeomid rojer Ryabkov2019-08-261-5/+8
| | | | | | | So, 8 MB instead of 8192 kB, 8 GB instead of 8192 MB. Same principle as in c43afb47fcba ("dmidecode: Use the most appropriate unit for cache size") applied to more fields.
* dmidecode: Only scan /dev/mem for entry point on x86Jean Delvare2019-08-261-3/+5
| | | | | | | | | x86 is the only architecture which can have a DMI entry point scanned from /dev/mem. Do not attempt it on other architectures, because not only it can't work, but it can even cause the system to reboot. This fixes support request #109697: https://savannah.nongnu.org/support/?109697
* dmidecode: Add missing standard includeClaudio Fontana2019-04-191-0/+1
| | | | | | | AF_INET requires sys/socket.h, fixes build on QNX 7.0. Signed-off-by: Claudio Fontana <claudio.fontana@gliwa.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add "Logical non-volatile device" to the memory device typesJean Delvare2019-01-161-2/+3
| | | | | | | | | | When adding support for non-volative memory, we forgot to add "Logical non-volatile device" to the list of memory types. This causes NVDIMM modules to show up as <OUT OF SPEC>. Fix the problem by adding the missing enumerated value. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
* dmidecode: Use dmi_cache_size_2 in dmi_cache_sizeJean Delvare2019-01-151-8/+5
| | | | | | | | | Redirect dmi_cache_size() to dmi_cache_size_2() so that the cache size is always reported using the most appropriate unit, even if the BIOS does not populate the 32-bit cache size fields. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Neil Horman <nhorman@tuxdriver.com>
* dmidecode: Use the most appropriate unit for cache sizeJean Delvare2019-01-151-6/+11
| | | | | | | | | | | As newer CPUs have larger and larger cache, using kB to represent the cache size is getting less convenient. Reuse the same function we have for system memory size so that large units will be used as appropriate. For example, a cache size reported as "20 MB" looks nicer than as "20480 kB". Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Neil Horman <nhorman@tuxdriver.com>
* dmidecode: Fix Redfish Hostname print lengthCharles Rose2018-10-221-1/+1
| | | | | | | | | Redfish Hostname prints beyond hlen characters. Fix it. Signed-off-by: Charles Rose <charles.rose@dell.com> Fixes: 78539b06117c ("dmidecode: Parse Modern Management Controller blocks") Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Remaining support for SMBIOS 3.2.0Jean Delvare2018-09-131-13/+21
| | | | | | | | | | | Add the remaining misc items for full SMBIOS 3.2.0 support: * Add new processor and socket enumerated values (DMI type 4) * Add new port connector enumerated value (DMI type 8) * Add new system slot state and property (DMI type 9) * Rename "Configured Clock Speed" to “Configured Memory Speed” (DMI type 17) Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Parse Modern Management Controller blocksNeil Horman2018-09-121-14/+390
| | | | | | | | | | | | | Starting with version 3.2.0 the SMBIOS specification defined in more detail the contents of the management controller type. DMTF further reserved values to define the Redfish host interface specification. Update dmidecode to properly parse and present that information. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: aarapov@redhat.com CC: jarod@redhat.com CC: elliott@hpe.com Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Validate structure completeness before decodingJean Delvare2018-08-011-17/+22
| | | | | | | | | | | | | | | Ensure that the whole DMI structure fits in the announced table length before performing any action on it. Otherwise we might end up reading beyond the end of our memory buffer. This bug was discovered by Lionel Debroux using the AFL fuzzer and AddressSanitizer. Its probability is very low, as it requires a DMI table corrupted in one of two very specific ways to trigger. This bug exists since dmidecode version 2.9, although it is hard to test because option --from-dump was only introduced in version 2.10. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Avoid OOB read on invalid entry point lengthJean Delvare2018-08-011-0/+18
| | | | | | | | | | Don't let the entry point checksum verification run beyond the end of the buffer holding it (32 bytes). This bug was discovered by Lionel Debroux using the AFL fuzzer and AddressSanitizer. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add option to filter output based upon handleJerry Hoemann2018-07-031-0/+2
| | | | | | | | Add option "--handle HANDLE" to dmiopt to allow user to filter output to only those entry that matches HANDLE. Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Extensions to Memory Device (Type 17)Jerry Hoemann2018-06-201-0/+110
| | | | | | | | The DSP0134 v3.2.0 extended the Memory Device (Type 17) structure starting at offset 28h continuing to 4Ch to reflect persistent memory. Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Use lowercase letters for UUIDJean Delvare2018-04-161-2/+2
| | | | | | | | RFC 4122 asks for letters a-f in UUID to be lowercase. Follow this recommendation. This closes bug #53569: https://savannah.nongnu.org/bugs/index.php?53569
* dmidecode: Fix firmware version of TPM deviceJean Delvare2018-01-311-1/+1
| | | | | | | | Both the operator (detected by clang, reported by Xorg) and the mask for the minor firmware version field of TPM devices were wrong. Signed-off-by: Jean Delvare <jdelvare@suse.de> Fixes: 48a8132058a0 ("dmidecode: Add support for structure type 43 (TPM Device)")
* dmidecode: Share common EFI codeJean Delvare2017-11-301-7/+8
| | | | Avoid duplicating code between OS-specific paths.
* UEFI support on FreeBSDAlexey Dokuchaev2017-11-301-0/+33
| | | | | | | | | | | | | | | Currently, dmidecode(8) does not work on FreeBSD booted in UEFI mode. Previously it was understandable, since there are no things like Linuxish /proc/efi/systab or /sys/firmware/efi/systab to read from under FreeBSD. However, 7 months ago, ambrisko@ had added support for exposing the SMBIOS anchor base address via kernel environment: https://svnweb.freebsd.org/base?view=revision&revision=307326 I've patched dmidecode.c to try to get the address from hint.smbios.0.mem and fall back to traditional address space scanning. I've tested it both on EFI (amd64 laptop) and non-EFI (i386 desktop) machines.
* dmidecode: New option --oem-stringJean Delvare2017-05-231-0/+15
| | | | | | | Add a new option to extract OEM strings, like we already have for many other strings. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add new enumerated values for processorsJean Delvare2017-04-271-5/+7
| | | | | | | | Add 1 new enumerated value for processor families and 1 new enumerated value for processor upgrades from SMBIOS specification version 3.1.1. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add support for 3-digit versionsJean Delvare2017-04-271-9/+12
| | | | | | | | The version of the SMBIOS specification being implemented includes the 3rd digit since version 3.0.0, so we should use it when comparing with what dmidecode supports. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: SMBIOS 3.1.0 is fully supported nowJean Delvare2017-04-271-2/+2
| | | | | | All pieces of the SMBIOS 3.1.0 specification are supported now. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add support for structure type 43 (TPM Device)Jean Delvare2017-04-271-3/+98
| | | | | | | SMBIOS 3.1.0 introduces a new structure type (43) for TPM devices. Add support for it. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Clarify the memory speed unitJean Delvare2017-04-271-1/+1
| | | | | | | Change the memory speed unit from MHz to MT/s as advised by version 3.1.0 of the SMBIOS specification. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add Mini PCIe system slot enumerated valuesJean Delvare2017-04-271-2/+8
| | | | | | | Add 3 new enumerated values for system slots from SMBIOS specification version 3.1.0. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add support for large cache sizesJean Delvare2017-04-271-2/+23
| | | | | | | Add support for the "Maximum Cache Size 2" and "Installed Cache Size 2" fields introduced in SMBIOS specification version 3.1.0. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Decode the MIDR register on ARM processorsJean Delvare2017-04-271-1/+17
| | | | | | | Version 3.1.0 of the SMBIOS specification says that the Processor ID field maps to the MIDR register on ARM processors, decode it. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Don't assume 8-bit processor family in dmi_processor_idJean Delvare2017-04-271-7/+14
| | | | | | | The processor family code can be 16-bit since SMBIOS version 2.6, add support for this possibility to function dmi_processor_id. Signed-off-by: Jean Delvare <jdelvare@suse.de>
* dmidecode: Add new enumerated values for processorsJean Delvare2017-04-271-5/+18
| | | | | | | | Add 6 new enumerated values for processor families and 7 new enumerated values for processor upgrades from SMBIOS specification version 3.1.0. Signed-off-by: Jean Delvare <jdelvare@suse.de>