v3.2 patched up to upstream commit 62bce59f

Signed-off-by: Anton Arapov <arapov@gmail.com>
This commit is contained in:
Anton Arapov 2019-11-18 12:02:48 +01:00
parent cfc5b62077
commit 48d35dd3e4
19 changed files with 1183 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From fde47bb227b8fa817c88d7e10a8eb771c46de1df Mon Sep 17 00:00:00 2001
From: Charles Rose <Charles.Rose@dell.com>
Date: Mon, 22 Oct 2018 09:48:02 +0200
Subject: [PATCH 01/18] dmidecode: Fix Redfish Hostname print length
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.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dmidecode.c b/dmidecode.c
index a3e9d6c..7ac6438 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -3609,7 +3609,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec)
hname = out_of_spec;
hlen = strlen(out_of_spec);
}
- printf("%s\t\tRedfish Service Hostname: %*s\n", prefix, hlen, hname);
+ printf("%s\t\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname);
}
/*
--
2.24.0

View File

@ -0,0 +1,72 @@
From 82497fa02d60757c2cfa645cf89a79abb1435273 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 16 Nov 2018 11:18:25 +0100
Subject: [PATCH 02/18] dmidecode: Don't use memcpy on /dev/mem on arm64
On arm64, calling memcpy on /dev/mem will cause a bus error if the
start and the end of the buffer are not aligned on a 64-bit boundary.
Using option --no-sysfs triggers this.
Use a slow manual byte-by-byte copy in that case, to prevent the bus
error. This is only a fallback path (at least on Linux) and not
performance-critical anyway, as it is a one-time operation and DMI
tables are usually not too large.
This fixes bug #55026:
https://savannah.nongnu.org/bugs/index.php?55026
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
config.h | 5 +++++
util.c | 14 +++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/config.h b/config.h
index e39091f..4237355 100644
--- a/config.h
+++ b/config.h
@@ -26,4 +26,9 @@
#define ALIGNMENT_WORKAROUND
#endif
+/* Avoid unaligned memcpy on /dev/mem */
+#ifdef __aarch64__
+#define USE_SLOW_MEMCPY
+#endif
+
#endif
diff --git a/util.c b/util.c
index eeffdae..04aaadd 100644
--- a/util.c
+++ b/util.c
@@ -155,6 +155,18 @@ void *read_file(off_t base, size_t *max_len, const char *filename)
return p;
}
+static void safe_memcpy(void *dest, const void *src, size_t n)
+{
+#ifdef USE_SLOW_MEMCPY
+ size_t i;
+
+ for (i = 0; i < n; i++)
+ *((u8 *)dest + i) = *((const u8 *)src + i);
+#else
+ memcpy(dest, src, n);
+#endif
+}
+
/*
* Copy a physical memory chunk into a memory buffer.
* This function allocates memory.
@@ -214,7 +226,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem)
if (mmp == MAP_FAILED)
goto try_read;
- memcpy(p, (u8 *)mmp + mmoffset, len);
+ safe_memcpy(p, (u8 *)mmp + mmoffset, len);
if (munmap(mmp, mmoffset + len) == -1)
{
--
2.24.0

View File

@ -0,0 +1,53 @@
From c43afb47fcbadabe2655fe7863a1e2ea9af1446c Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 15 Jan 2019 12:59:00 +0100
Subject: [PATCH 03/18] dmidecode: Use the most appropriate unit for cache size
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.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 7ac6438..162e0c5 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1560,17 +1560,22 @@ static void dmi_cache_size(u16 code)
static void dmi_cache_size_2(u32 code)
{
+ u64 size;
+
if (code & 0x80000000)
{
code &= 0x7FFFFFFFLU;
- /* Use a more convenient unit for large cache size */
- if (code >= 0x8000)
- printf(" %u MB", code >> 4);
- else
- printf(" %u kB", code << 6);
+ size.l = code << 6;
+ size.h = code >> 26;
}
else
- printf(" %u kB", code);
+ {
+ size.l = code;
+ size.h = 0;
+ }
+
+ /* Use a more convenient unit for large cache size */
+ dmi_print_memory_size(size, 1);
}
static void dmi_cache_types(u16 code, const char *sep)
--
2.24.0

View File

@ -0,0 +1,49 @@
From 941591e24564e4c6d6584dbaa868976f9e80e925 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 15 Jan 2019 12:59:08 +0100
Subject: [PATCH 04/18] dmidecode: Use dmi_cache_size_2 in dmi_cache_size
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.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 162e0c5..903ef35 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1550,14 +1550,6 @@ static const char *dmi_cache_location(u8 code)
return location[code];
}
-static void dmi_cache_size(u16 code)
-{
- if (code & 0x8000)
- printf(" %u kB", (code & 0x7FFF) << 6);
- else
- printf(" %u kB", code);
-}
-
static void dmi_cache_size_2(u32 code)
{
u64 size;
@@ -1578,6 +1570,11 @@ static void dmi_cache_size_2(u32 code)
dmi_print_memory_size(size, 1);
}
+static void dmi_cache_size(u16 code)
+{
+ dmi_cache_size_2((((u32)code & 0x8000LU) << 16) | (code & 0x7FFFLU));
+}
+
static void dmi_cache_types(u16 code, const char *sep)
{
/* 7.8.2 */
--
2.24.0

View File

@ -0,0 +1,38 @@
From 74dfb854b8199ddb0a27e89296fa565f4706cb9d Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 16 Jan 2019 09:04:55 +0100
Subject: [PATCH 05/18] dmidecode: Add "Logical non-volatile device" to the
memory device types
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.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 903ef35..91c6f62 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -2471,10 +2471,11 @@ static const char *dmi_memory_device_type(u8 code)
"LPDDR",
"LPDDR2",
"LPDDR3",
- "LPDDR4" /* 0x1E */
+ "LPDDR4",
+ "Logical non-volatile device" /* 0x1F */
};
- if (code >= 0x01 && code <= 0x1E)
+ if (code >= 0x01 && code <= 0x1F)
return type[code - 0x01];
return out_of_spec;
}
--
2.24.0

View File

@ -0,0 +1,42 @@
From 91d6ce2d1d2fa6fcedf8e5685bafdb0515317605 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 29 Jan 2019 14:11:38 +0100
Subject: [PATCH 06/18] dmidecode: Reformat the FILES section of the manual
page
List one file per line and use regular font for comments. This makes
the FILES section a lot more readable.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
man/dmidecode.8 | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index df861e1..33f7d33 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -1,4 +1,4 @@
-.TH DMIDECODE 8 "March 2012" "dmidecode"
+.TH DMIDECODE 8 "January 2019" "dmidecode"
.SH NAME
dmidecode \- \s-1DMI\s0 table decoder
.SH SYNOPSIS
@@ -258,8 +258,12 @@ The DMI table is located at offset 0x20.
.SH FILES
.I /dev/mem
-.I /sys/firmware/dmi/tables/smbios_entry_point (Linux only)
-.I /sys/firmware/dmi/tables/DMI (Linux only)
+.br
+.I /sys/firmware/dmi/tables/smbios_entry_point
+(Linux only)
+.br
+.I /sys/firmware/dmi/tables/DMI
+(Linux only)
.SH BUGS
More often than not, information contained in the \s-1DMI\s0 tables is inaccurate,
incomplete or simply wrong.
--
2.24.0

View File

@ -0,0 +1,45 @@
From 72fa3909cfabe8822e2b8709e5d324008f55022a Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 29 Jan 2019 14:11:42 +0100
Subject: [PATCH 07/18] dmidecode: Document how the UUID fields are interpreted
There has always been a lot of confusion about the byte order of UUID
fields. While dmidecode is doing "the right thing", documenting it
can't hurt.
This should address bug #55510:
https://savannah.nongnu.org/bugs/index.php?55510
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
man/dmidecode.8 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index 33f7d33..52100a8 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -256,6 +256,20 @@ It is crafted to hard-code the table address at offset 0x20.
.IP \(bu "\w'\(bu'u+1n"
The DMI table is located at offset 0x20.
+.SH UUID FORMAT
+There is some ambiguity about how to interpret the UUID fields prior to SMBIOS
+specification version 2.6. There was no mention of byte swapping, and RFC 4122
+says that no byte swapping should be applied by default. However, SMBIOS
+specification version 2.6 (and later) explicitly states that the first 3 fields
+of the UUID should be read as little-endian numbers (byte-swapped).
+Furthermore, it implies that the same was already true for older versions of
+the specification, even though it was not mentioned. In practice, many hardware
+vendors were not byte-swapping the UUID. So, in order to preserve
+compatibility, it was decided to interpret the UUID fields according to RFC
+4122 (no byte swapping) when the SMBIOS version is older than 2.6, and to
+interpret the first 3 fields as little-endian (byte-swapped) when the SMBIOS
+version is 2.6 or later. The Linux kernel follows the same logic.
+
.SH FILES
.I /dev/mem
.br
--
2.24.0

View File

@ -0,0 +1,246 @@
From ae28cbb12fc80f62230ad06cb44ad0aaaa9e2048 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 29 Jan 2019 14:11:46 +0100
Subject: [PATCH 08/18] Use comments to separate sections in manual pages
Blank lines are interpreted as actual blank lines in manual pages.
Use comments instead to visually separate sections. Otherwise an
extra blank like is inserted before every section.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
man/biosdecode.8 | 11 ++++++++---
man/dmidecode.8 | 18 +++++++++++-------
man/ownership.8 | 10 +++++++---
man/vpddecode.8 | 12 +++++++-----
4 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/man/biosdecode.8 b/man/biosdecode.8
index a96eb68..cf7d4db 100644
--- a/man/biosdecode.8
+++ b/man/biosdecode.8
@@ -1,10 +1,12 @@
.TH BIOSDECODE 8 "February 2007" "dmidecode"
+.\"
.SH NAME
biosdecode \- \s-1BIOS\s0 information decoder
+.\"
.SH SYNOPSIS
.B biosdecode
.RB [ OPTIONS ]
-
+.\"
.SH DESCRIPTION
.B biosdecode
parses the \s-1BIOS\s0 memory and prints information about all structures (or
@@ -54,7 +56,7 @@ started its life as a part of
.B dmidecode
but as more entry point types were added, it was moved to a different
program.
-
+.\"
.SH OPTIONS
.TP
.BR "-d" ", " "--dev-mem FILE"
@@ -68,17 +70,20 @@ Display usage information and exit
.TP
.BR "-V" ", " "--version"
Display the version and exit
-
+.\"
.SH FILES
.I /dev/mem
+.\"
.SH BUGS
Most of the time,
.B biosdecode
prints too much information (you don't really care about addresses)
or not enough (because it doesn't follow pointers and has no lookup
tables).
+.\"
.SH AUTHORS
Alan Cox, Jean Delvare
+.\"
.SH "SEE ALSO"
.BR dmidecode (8),
.BR mem (4),
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index 52100a8..1f6529d 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -1,10 +1,12 @@
.TH DMIDECODE 8 "January 2019" "dmidecode"
+.\"
.SH NAME
dmidecode \- \s-1DMI\s0 table decoder
+.\"
.SH SYNOPSIS
.B dmidecode
.RB [ OPTIONS ]
-
+.\"
.SH DESCRIPTION
.B dmidecode
is a tool for dumping a computer's \s-1DMI\s0 (some say \s-1SMBIOS\s0) table
@@ -58,7 +60,7 @@ displayed value.
Decoded values. The information presented of course depends on the type
of record. Here, we learn about the board's manufacturer, model, version
and serial number.
-
+.\"
.SH OPTIONS
.TP
.BR "-d" ", " "--dev-mem FILE"
@@ -158,10 +160,9 @@ is run on a system with BIOS that boasts new SMBIOS specification, which
is not supported by the tool yet, it will print out relevant message in
addition to requested data on the very top of the output. Thus informs the
output data is not reliable.
-
+.\"
.SH "DMI TYPES"
The \s-1SMBIOS\s0 specification defines the following \s-1DMI\s0 types:
-
.TS
r l
__
@@ -246,7 +247,7 @@ dmidecode --type 0,13
dmidecode --type bios
.IP \(bu
dmidecode --type BIOS
-
+.\"
.SH BINARY DUMP FILE FORMAT
The binary dump files generated by --dump-bin and read using --from-dump
are formatted as follows:
@@ -255,7 +256,7 @@ The SMBIOS or DMI entry point is located at offset 0x00.
It is crafted to hard-code the table address at offset 0x20.
.IP \(bu "\w'\(bu'u+1n"
The DMI table is located at offset 0x20.
-
+.\"
.SH UUID FORMAT
There is some ambiguity about how to interpret the UUID fields prior to SMBIOS
specification version 2.6. There was no mention of byte swapping, and RFC 4122
@@ -269,7 +270,7 @@ compatibility, it was decided to interpret the UUID fields according to RFC
4122 (no byte swapping) when the SMBIOS version is older than 2.6, and to
interpret the first 3 fields as little-endian (byte-swapped) when the SMBIOS
version is 2.6 or later. The Linux kernel follows the same logic.
-
+.\"
.SH FILES
.I /dev/mem
.br
@@ -278,11 +279,14 @@ version is 2.6 or later. The Linux kernel follows the same logic.
.br
.I /sys/firmware/dmi/tables/DMI
(Linux only)
+.\"
.SH BUGS
More often than not, information contained in the \s-1DMI\s0 tables is inaccurate,
incomplete or simply wrong.
+.\"
.SH AUTHORS
Alan Cox, Jean Delvare
+.\"
.SH "SEE ALSO"
.BR biosdecode (8),
.BR mem (4),
diff --git a/man/ownership.8 b/man/ownership.8
index f24ef94..71ed788 100644
--- a/man/ownership.8
+++ b/man/ownership.8
@@ -1,10 +1,12 @@
.TH OWNERSHIP 8 "February 2005" "dmidecode"
+.\"
.SH NAME
ownership \- Compaq ownership tag retriever
+.\"
.SH SYNOPSIS
.B ownership
.RB [ OPTIONS ]
-
+.\"
.SH DESCRIPTION
.B ownership
retrieves and prints the "ownership tag" that can be set on Compaq
@@ -14,7 +16,7 @@ package,
.B ownership
doesn't print any version information, nor labels, but only the raw
ownership tag. This should help its integration in scripts.
-
+.\"
.SH OPTIONS
.TP
.BR "-d" ", " "--dev-mem FILE"
@@ -25,11 +27,13 @@ Display usage information and exit
.TP
.BR "-V" ", " "--version"
Display the version and exit
-
+.\"
.SH FILES
.I /dev/mem
+.\"
.SH AUTHOR
Jean Delvare
+.\"
.SH "SEE ALSO"
.BR biosdecode (8),
.BR dmidecode (8),
diff --git a/man/vpddecode.8 b/man/vpddecode.8
index c9e4acf..1cc2b76 100644
--- a/man/vpddecode.8
+++ b/man/vpddecode.8
@@ -1,10 +1,12 @@
.TH VPDDECODE 8 "February 2007" "dmidecode"
+.\"
.SH NAME
vpddecode \- \s-1VPD\s0 structure decoder
+.\"
.SH SYNOPSIS
.B vpddecode
.RB [ OPTIONS ]
-
+.\"
.SH DESCRIPTION
.B vpddecode
prints the "vital product data" information that can be found in almost
@@ -17,19 +19,17 @@ Box Serial Number
Motherboard Serial Number
.IP \(bu
Machine Type/Model
-
.PP
Some systems have these additional items:
.IP \(bu "\w'\(bu'u+1n"
BIOS Release Date
.IP \(bu
Default Flash Image File Name
-
.PP
Note that these additional items are not documented by IBM, so this is
guess work, and as such should not be blindly trusted. Feedback about
the accuracy of these labels is welcome.
-
+.\"
.SH OPTIONS
.TP
.BR "-d" ", " "--dev-mem FILE"
@@ -62,11 +62,13 @@ Display usage information and exit
.TP
.BR "-V" ", " "--version"
Display the version and exit
-
+.\"
.SH FILES
.I /dev/mem
+.\"
.SH AUTHOR
Jean Delvare
+.\"
.SH "SEE ALSO"
.BR biosdecode (8),
.BR dmidecode (8),
--
2.24.0

View File

@ -0,0 +1,28 @@
From 2d7fbeac6c6a9f097dc930e808a4f017f11f3c58 Mon Sep 17 00:00:00 2001
From: Claudio Fontana <claudio.fontana@gliwa.com>
Date: Fri, 19 Apr 2019 10:01:22 +0200
Subject: [PATCH 09/18] dmidecode: Add missing standard include
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.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dmidecode.c b/dmidecode.c
index 91c6f62..21bfd65 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -66,6 +66,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
+#include <sys/socket.h>
#ifdef __FreeBSD__
#include <errno.h>
--
2.24.0

View File

@ -0,0 +1,65 @@
From e12ec26e19e02281d3e7258c3aabb88a5cf5ec1d Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 26 Aug 2019 14:20:15 +0200
Subject: [PATCH 10/18] dmidecode: Only scan /dev/mem for entry point on x86
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.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 21bfd65..9c1e9c4 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -2,7 +2,7 @@
* DMI Decode
*
* Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
- * Copyright (C) 2002-2018 Jean Delvare <jdelvare@suse.de>
+ * Copyright (C) 2002-2019 Jean Delvare <jdelvare@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -5538,7 +5538,7 @@ int main(int argc, char * const argv[])
off_t fp;
size_t size;
int efi;
- u8 *buf;
+ u8 *buf = NULL;
/*
* We don't want stdout and stderr to be mixed up if both are
@@ -5642,7 +5642,7 @@ int main(int argc, char * const argv[])
printf("Failed to get SMBIOS data from sysfs.\n");
}
- /* Next try EFI (ia64, Intel-based Mac) */
+ /* Next try EFI (ia64, Intel-based Mac, arm64) */
efi = address_from_efi(&fp);
switch (efi)
{
@@ -5675,6 +5675,7 @@ int main(int argc, char * const argv[])
goto done;
memory_scan:
+#if defined __i386__ || defined __x86_64__
if (!(opt.flags & FLAG_QUIET))
printf("Scanning %s for entry point.\n", opt.devmem);
/* Fallback to memory scan (x86, x86_64) */
@@ -5717,6 +5718,7 @@ int main(int argc, char * const argv[])
}
}
}
+#endif
done:
if (!found && !(opt.flags & FLAG_QUIET))
--
2.24.0

View File

@ -0,0 +1,47 @@
From b381d53c1199895aecccad543210ae1d40534493 Mon Sep 17 00:00:00 2001
From: Deomid rojer Ryabkov <rojer9@fb.com>
Date: Mon, 26 Aug 2019 14:20:15 +0200
Subject: [PATCH 11/18] Use larger units for memory device and BIOS size
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.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 9c1e9c4..5372c38 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -318,7 +318,10 @@ static void dmi_bios_rom_size(u8 code1, u16 code2)
};
if (code1 != 0xFF)
- printf(" %u kB", (code1 + 1) << 6);
+ {
+ u64 s = { .l = (code1 + 1) << 6 };
+ dmi_print_memory_size(s, 1);
+ }
else
printf(" %u %s", code2 & 0x3FFF, unit[code2 >> 14]);
}
@@ -2372,10 +2375,10 @@ static void dmi_memory_device_size(u16 code)
printf(" Unknown");
else
{
- if (code & 0x8000)
- printf(" %u kB", code & 0x7FFF);
- else
- printf(" %u MB", code);
+ u64 s = { .l = code & 0x7FFF };
+ if (!(code & 0x8000))
+ s.l <<= 10;
+ dmi_print_memory_size(s, 1);
}
}
--
2.24.0

View File

@ -0,0 +1,37 @@
From 1d0db85949a5bdd96375f6131d393a11204302a6 Mon Sep 17 00:00:00 2001
From: Deomid rojer Ryabkov <rojer9@fb.com>
Date: Mon, 26 Aug 2019 14:20:15 +0200
Subject: [PATCH 12/18] Fix formatting of TPM table output
Added missing newlines.
Fixes: 48a8132058a0 ("dmidecode: Add support for structure type 43 (TPM Device)")
---
dmidecode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 5372c38..cff7d3f 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4997,7 +4997,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
printf("\tVendor ID:");
dmi_tpm_vendor_id(data + 0x04);
printf("\n");
- printf("\tSpecification Version: %d.%d", data[0x08], data[0x09]);
+ printf("\tSpecification Version: %d.%d\n", data[0x08], data[0x09]);
switch (data[0x08])
{
case 0x01:
@@ -5020,7 +5020,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
*/
break;
}
- printf("\tDescription: %s", dmi_string(h, data[0x12]));
+ printf("\tDescription: %s\n", dmi_string(h, data[0x12]));
printf("\tCharacteristics:\n");
dmi_tpm_characteristics(QWORD(data + 0x13), "\t\t");
if (h->length < 0x1F) break;
--
2.24.0

View File

@ -0,0 +1,77 @@
From 9bce894b7730013120d4c71f964d4cf8402cb956 Mon Sep 17 00:00:00 2001
From: Erwan Velu <e.velu@criteo.com>
Date: Mon, 7 Oct 2019 15:36:47 +0200
Subject: [PATCH 13/18] dmidecode: Adding bios-revision to -s option
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>
---
dmidecode.c | 4 ++++
dmiopt.c | 1 +
man/dmidecode.8 | 1 +
3 files changed, 6 insertions(+)
diff --git a/dmidecode.c b/dmidecode.c
index cff7d3f..e4cd6d8 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5082,6 +5082,10 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
key = (opt.string->type << 8) | offset;
switch (key)
{
+ case 0x015: /* -s bios-revision */
+ if (data[key - 1] != 0xFF && data[key] != 0xFF)
+ printf("%u.%u\n", data[key - 1], data[key]);
+ break;
case 0x108:
dmi_system_uuid(data + offset, ver);
printf("\n");
diff --git a/dmiopt.c b/dmiopt.c
index 2f285f3..9ceb35a 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -151,6 +151,7 @@ static const struct string_keyword opt_string_keyword[] = {
{ "bios-vendor", 0, 0x04 },
{ "bios-version", 0, 0x05 },
{ "bios-release-date", 0, 0x08 },
+ { "bios-revision", 0, 0x15 }, /* 0x14 and 0x15 */
{ "system-manufacturer", 1, 0x04 },
{ "system-product-name", 1, 0x05 },
{ "system-version", 1, 0x06 },
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index 1f6529d..c3f8713 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -74,6 +74,7 @@ displayed. Meta-data and handle references are hidden.
Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR.
\fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR,
\fBbios-version\fR, \fBbios-release-date\fR,
+\fBbios-revision\fR,
\fBsystem-manufacturer\fR, \fBsystem-product-name\fR,
\fBsystem-version\fR, \fBsystem-serial-number\fR,
\fBsystem-uuid\fR, \fBsystem-family\fR,
--
2.24.0

View File

@ -0,0 +1,66 @@
From 3a455213068eb3a3572908c77fafae35e5360998 Mon Sep 17 00:00:00 2001
From: Erwan Velu <e.velu@criteo.com>
Date: Mon, 7 Oct 2019 15:36:47 +0200
Subject: [PATCH 14/18] dmidecode: Adding firmware-revision support to -s
option
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.c | 4 ++++
dmiopt.c | 1 +
man/dmidecode.8 | 2 +-
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dmidecode.c b/dmidecode.c
index e4cd6d8..aef18f8 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5086,6 +5086,10 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
if (data[key - 1] != 0xFF && data[key] != 0xFF)
printf("%u.%u\n", data[key - 1], data[key]);
break;
+ case 0x017: /* -s firmware-revision */
+ if (data[key - 1] != 0xFF && data[key] != 0xFF)
+ printf("%u.%u\n", data[key - 1], data[key]);
+ break;
case 0x108:
dmi_system_uuid(data + offset, ver);
printf("\n");
diff --git a/dmiopt.c b/dmiopt.c
index 9ceb35a..1c3b760 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -152,6 +152,7 @@ static const struct string_keyword opt_string_keyword[] = {
{ "bios-version", 0, 0x05 },
{ "bios-release-date", 0, 0x08 },
{ "bios-revision", 0, 0x15 }, /* 0x14 and 0x15 */
+ { "firmware-revision", 0, 0x17 }, /* 0x16 and 0x17 */
{ "system-manufacturer", 1, 0x04 },
{ "system-product-name", 1, 0x05 },
{ "system-version", 1, 0x06 },
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index c3f8713..4602088 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -74,7 +74,7 @@ displayed. Meta-data and handle references are hidden.
Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR.
\fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR,
\fBbios-version\fR, \fBbios-release-date\fR,
-\fBbios-revision\fR,
+\fBbios-revision\fR, \fBfirmware-revision\fR,
\fBsystem-manufacturer\fR, \fBsystem-product-name\fR,
\fBsystem-version\fR, \fBsystem-serial-number\fR,
\fBsystem-uuid\fR, \fBsystem-family\fR,
--
2.24.0

View File

@ -0,0 +1,36 @@
From fd08479625b5845e4d725ab628628f7ebfccc407 Mon Sep 17 00:00:00 2001
From: Prabhakar pujeri <Prabhakar.Pujeri@dell.com>
Date: Tue, 15 Oct 2019 14:24:46 +0200
Subject: [PATCH 15/18] dmidecode: Fix System Slot Information for PCIe SSD
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.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index aef18f8..68bfa45 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1906,10 +1906,12 @@ static const char *dmi_slot_length(u8 code)
"Other", /* 0x01 */
"Unknown",
"Short",
- "Long" /* 0x04 */
+ "Long",
+ "2.5\" drive form factor",
+ "3.5\" drive form factor" /* 0x06 */
};
- if (code >= 0x01 && code <= 0x04)
+ if (code >= 0x01 && code <= 0x06)
return length[code - 0x01];
return out_of_spec;
}
--
2.24.0

25
0016-Typo.patch Normal file
View File

@ -0,0 +1,25 @@
From a808e6ef4ebc96b8f66ad13bd3caab32aa05505d Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 16 Oct 2019 15:35:42 +0200
Subject: [PATCH 16/18] Typo
---
dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dmidecode.c b/dmidecode.c
index 68bfa45..bdf1185 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1901,7 +1901,7 @@ static const char *dmi_slot_current_usage(u8 code)
static const char *dmi_slot_length(u8 code)
{
- /* 7.1O.4 */
+ /* 7.10.4 */
static const char *length[] = {
"Other", /* 0x01 */
"Unknown",
--
2.24.0

View File

@ -0,0 +1,136 @@
From 3fa833fd78ff5eb74f9459e061e26e063ed648d5 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 23 Oct 2019 12:44:13 +0200
Subject: [PATCH 17/18] dmidecode: Add enumerated values from SMBIOS 3.3.0
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>
---
dmidecode.c | 44 +++++++++++++++++++++++++++++++++++---------
1 file changed, 35 insertions(+), 9 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index bdf1185..8e53535 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -936,6 +936,10 @@ static const char *dmi_processor_family(const struct dmi_header *h, u16 ver)
{ 0x140, "WinChip" },
{ 0x15E, "DSP" },
{ 0x1F4, "Video Processor" },
+
+ { 0x200, "RV32" },
+ { 0x201, "RV64" },
+ { 0x202, "RV128" },
};
/*
* Note to developers: when adding entries to this list, check if
@@ -1821,6 +1825,9 @@ static const char *dmi_slot_type(u8 code)
"PCI Express Mini 52-pin without bottom-side keep-outs",
"PCI Express Mini 76-pin" /* 0x23 */
};
+ static const char *type_0x30[] = {
+ "CXL FLexbus 1.0" /* 0x30 */
+ };
static const char *type_0xA0[] = {
"PC-98/C20", /* 0xA0 */
"PC-98/C24",
@@ -1844,7 +1851,14 @@ static const char *dmi_slot_type(u8 code)
"PCI Express 3 x2",
"PCI Express 3 x4",
"PCI Express 3 x8",
- "PCI Express 3 x16" /* 0xB6 */
+ "PCI Express 3 x16",
+ out_of_spec, /* 0xB7 */
+ "PCI Express 4",
+ "PCI Express 4 x1",
+ "PCI Express 4 x2",
+ "PCI Express 4 x4",
+ "PCI Express 4 x8",
+ "PCI Express 4 x16" /* 0xBD */
};
/*
* Note to developers: when adding entries to these lists, check if
@@ -1853,7 +1867,9 @@ static const char *dmi_slot_type(u8 code)
if (code >= 0x01 && code <= 0x23)
return type[code - 0x01];
- if (code >= 0xA0 && code <= 0xB6)
+ if (code == 0x30)
+ return type_0x30[code - 0x30];
+ if (code >= 0xA0 && code <= 0xBD)
return type_0xA0[code - 0xA0];
return out_of_spec;
}
@@ -1957,6 +1973,12 @@ static void dmi_slot_id(u8 code1, u8 code2, u8 type, const char *prefix)
case 0xB4: /* PCI Express 3 */
case 0xB5: /* PCI Express 3 */
case 0xB6: /* PCI Express 3 */
+ case 0xB8: /* PCI Express 4 */
+ case 0xB9: /* PCI Express 4 */
+ case 0xBA: /* PCI Express 4 */
+ case 0xBB: /* PCI Express 4 */
+ case 0xBC: /* PCI Express 4 */
+ case 0xBD: /* PCI Express 4 */
printf("%sID: %u\n", prefix, code1);
break;
case 0x07: /* PCMCIA */
@@ -2298,12 +2320,13 @@ static const char *dmi_memory_array_location(u8 code)
"PC-98/C20 Add-on Card", /* 0xA0 */
"PC-98/C24 Add-on Card",
"PC-98/E Add-on Card",
- "PC-98/Local Bus Add-on Card" /* 0xA3 */
+ "PC-98/Local Bus Add-on Card",
+ "CXL Flexbus 1.0" /* 0xA4 */
};
if (code >= 0x01 && code <= 0x0A)
return location[code - 0x01];
- if (code >= 0xA0 && code <= 0xA3)
+ if (code >= 0xA0 && code <= 0xA4)
return location_0xA0[code - 0xA0];
return out_of_spec;
}
@@ -2426,10 +2449,11 @@ static const char *dmi_memory_device_form_factor(u8 code)
"RIMM",
"SODIMM",
"SRIMM",
- "FB-DIMM" /* 0x0F */
+ "FB-DIMM",
+ "Die" /* 0x10 */
};
- if (code >= 0x01 && code <= 0x0F)
+ if (code >= 0x01 && code <= 0x10)
return form_factor[code - 0x01];
return out_of_spec;
}
@@ -2478,10 +2502,12 @@ static const char *dmi_memory_device_type(u8 code)
"LPDDR2",
"LPDDR3",
"LPDDR4",
- "Logical non-volatile device" /* 0x1F */
+ "Logical non-volatile device",
+ "HBM",
+ "HBM2" /* 0x21 */
};
- if (code >= 0x01 && code <= 0x1F)
+ if (code >= 0x01 && code <= 0x21)
return type[code - 0x01];
return out_of_spec;
}
@@ -2537,7 +2563,7 @@ static void dmi_memory_technology(u8 code)
"NVDIMM-N",
"NVDIMM-F",
"NVDIMM-P",
- "Intel persistent memory" /* 0x07 */
+ "Intel Optane DC persistent memory" /* 0x07 */
};
if (code >= 0x01 && code <= 0x07)
printf(" %s", technology[code - 0x01]);
--
2.24.0

View File

@ -0,0 +1,50 @@
From 62bce59fed14c1cf57ce6cb7b208a9fccda3f4a5 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 23 Oct 2019 12:44:20 +0200
Subject: [PATCH 18/18] dmidecode: Decode system slot base bus width and peers
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.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dmidecode.c b/dmidecode.c
index 8e53535..8ebd862 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -2033,6 +2033,16 @@ static void dmi_slot_segment_bus_func(u16 code1, u8 code2, u8 code3, const char
prefix, code1, code2, code3 >> 3, code3 & 0x7);
}
+static void dmi_slot_peers(u8 n, const u8 *data, const char *prefix)
+{
+ int i;
+
+ for (i = 1; i <= n; i++, data += 5)
+ printf("%sPeer Device %d: %04x:%02x:%02x.%x (Width %u)\n",
+ prefix, i, WORD(data), data[2], data[3] >> 3,
+ data[3] & 0x07, data[4]);
+}
+
/*
* 7.11 On Board Devices Information (Type 10)
*/
@@ -4213,6 +4223,11 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
dmi_slot_characteristics(data[0x0B], data[0x0C], "\t\t");
if (h->length < 0x11) break;
dmi_slot_segment_bus_func(WORD(data + 0x0D), data[0x0F], data[0x10], "\t");
+ if (h->length < 0x13) break;
+ printf("\tData Bus Width: %u\n", data[0x11]);
+ printf("\tPeer Devices: %u\n", data[0x12]);
+ if (h->length - 0x13 >= data[0x12] * 5)
+ dmi_slot_peers(data[0x12], data + 0x13, "\t");
break;
case 10: /* 7.11 On Board Devices Information */
--
2.24.0

View File

@ -1,10 +1,28 @@
Summary: Tool to analyse BIOS DMI data
Name: dmidecode
Version: 3.2
Release: 3%{?dist}
Release: 4%{?dist}
Epoch: 1
License: GPLv2+
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
Patch0: 0001-dmidecode-Fix-Redfish-Hostname-print-length.patch
Patch1: 0002-dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch
Patch2: 0003-dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch
Patch3: 0004-dmidecode-Use-dmi_cache_size_2-in-dmi_cache_size.patch
Patch4: 0005-dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch
Patch5: 0006-dmidecode-Reformat-the-FILES-section-of-the-manual-p.patch
Patch6: 0007-dmidecode-Document-how-the-UUID-fields-are-interpret.patch
Patch7: 0008-Use-comments-to-separate-sections-in-manual-pages.patch
Patch8: 0009-dmidecode-Add-missing-standard-include.patch
Patch9: 0010-dmidecode-Only-scan-dev-mem-for-entry-point-on-x86.patch
Patch10: 0011-Use-larger-units-for-memory-device-and-BIOS-size.patch
Patch11: 0012-Fix-formatting-of-TPM-table-output.patch
Patch12: 0013-dmidecode-Adding-bios-revision-to-s-option.patch
Patch13: 0014-dmidecode-Adding-firmware-revision-support-to-s-opti.patch
Patch14: 0015-dmidecode-Fix-System-Slot-Information-for-PCIe-SSD.patch
Patch15: 0016-Typo.patch
Patch16: 0017-dmidecode-Add-enumerated-values-from-SMBIOS-3.3.0.patch
Patch17: 0018-dmidecode-Decode-system-slot-base-bus-width-and-peer.patch
URL: http://www.nongnu.org/dmidecode/
BuildRequires: gcc make
ExclusiveArch: %{ix86} x86_64 ia64 aarch64
@ -22,6 +40,24 @@ I/O ports (e.g. serial, parallel, USB).
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%build
make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}"
@ -42,6 +78,9 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-
%{_mandir}/man8/*
%changelog
* Mon Nov 18 2019 Anton Arapov <aarapov@redhat.com> - 1:3.2-4
- v3.2 patched up to upstream commit 62bce59f
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild