From abf46dad00973eb3e8894e5c657fea1d9252611d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 05 2019 20:21:02 +0000 Subject: import dmidecode-3.2-3.el8 --- diff --git a/SOURCES/0001-dmidecode-Fix-Redfish-Hostname-print-length.patch b/SOURCES/0001-dmidecode-Fix-Redfish-Hostname-print-length.patch new file mode 100644 index 0000000..1a4f2bd --- /dev/null +++ b/SOURCES/0001-dmidecode-Fix-Redfish-Hostname-print-length.patch @@ -0,0 +1,32 @@ +From fde47bb227b8fa817c88d7e10a8eb771c46de1df Mon Sep 17 00:00:00 2001 +From: Charles Rose +Date: Mon, 22 Oct 2018 09:48:02 +0200 +Subject: [PATCH 1/5] dmidecode: Fix Redfish Hostname print length + +Redfish Hostname prints beyond hlen characters. Fix it. + +Signed-off-by: Charles Rose +Fixes: 78539b06117c ("dmidecode: Parse Modern Management Controller blocks") +Acked-by: Neil Horman +Signed-off-by: Jean Delvare +Signed-off-by: Lianbo Jiang +--- + dmidecode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dmidecode.c b/dmidecode.c +index a3e9d6c16bc2..7ac6438a23db 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.17.1 + diff --git a/SOURCES/0002-dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch b/SOURCES/0002-dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch new file mode 100644 index 0000000..440d6be --- /dev/null +++ b/SOURCES/0002-dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch @@ -0,0 +1,73 @@ +From 82497fa02d60757c2cfa645cf89a79abb1435273 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Fri, 16 Nov 2018 11:18:25 +0100 +Subject: [PATCH 2/5] 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 +Signed-off-by: Lianbo Jiang +--- + config.h | 5 +++++ + util.c | 14 +++++++++++++- + 2 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/config.h b/config.h +index e39091fde502..423735537fa8 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 eeffdae8e536..04aaadd5b913 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.17.1 + diff --git a/SOURCES/0003-dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch b/SOURCES/0003-dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch new file mode 100644 index 0000000..d415a91 --- /dev/null +++ b/SOURCES/0003-dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch @@ -0,0 +1,54 @@ +From c43afb47fcbadabe2655fe7863a1e2ea9af1446c Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Tue, 15 Jan 2019 12:59:00 +0100 +Subject: [PATCH 3/5] 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 +Acked-by: Neil Horman +Signed-off-by: Lianbo Jiang +--- + dmidecode.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 7ac6438a23db..162e0c50ba26 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.17.1 + diff --git a/SOURCES/0004-dmidecode-Use-dmi_cache_size_2-in-dmi_cache_size.patch b/SOURCES/0004-dmidecode-Use-dmi_cache_size_2-in-dmi_cache_size.patch new file mode 100644 index 0000000..74b43b2 --- /dev/null +++ b/SOURCES/0004-dmidecode-Use-dmi_cache_size_2-in-dmi_cache_size.patch @@ -0,0 +1,50 @@ +From 941591e24564e4c6d6584dbaa868976f9e80e925 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Tue, 15 Jan 2019 12:59:08 +0100 +Subject: [PATCH 4/5] 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 +Acked-by: Neil Horman +Signed-off-by: Lianbo Jiang +--- + dmidecode.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 162e0c50ba26..903ef356ea9e 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.17.1 + diff --git a/SOURCES/0005-dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch b/SOURCES/0005-dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch new file mode 100644 index 0000000..279384c --- /dev/null +++ b/SOURCES/0005-dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch @@ -0,0 +1,39 @@ +From 74dfb854b8199ddb0a27e89296fa565f4706cb9d Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Wed, 16 Jan 2019 09:04:55 +0100 +Subject: [PATCH 5/5] 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 . Fix the problem +by adding the missing enumerated value. + +Signed-off-by: Jean Delvare +Reviewed-by: Jerry Hoemann +Signed-off-by: Lianbo Jiang +--- + dmidecode.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 903ef356ea9e..91c6f622e3d0 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.17.1 + diff --git a/SPECS/dmidecode.spec b/SPECS/dmidecode.spec index 2eb5096..80c41a6 100644 --- a/SPECS/dmidecode.spec +++ b/SPECS/dmidecode.spec @@ -1,11 +1,18 @@ Summary: Tool to analyse BIOS DMI data Name: dmidecode Version: 3.2 -Release: 1%{?dist} +Release: 3%{?dist} Epoch: 1 License: GPLv2+ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz URL: http://www.nongnu.org/dmidecode/ + +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 + BuildRequires: gcc make ExclusiveArch: %{ix86} x86_64 ia64 aarch64 @@ -22,6 +29,11 @@ I/O ports (e.g. serial, parallel, USB). %prep %setup -q +%patch0 -p1 -b .fix_Redfish_print +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" @@ -42,6 +54,14 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install- %{_mandir}/man8/* %changelog +* Mon Apr 22 2019 Lianbo Jiang - 1:3.2-3 +- Add "Logical non-volatile device" to the memory device types +- Resolves: rhbz#1664573 + +* Mon Apr 15 2019 Lianbo Jiang - 1:3.2-2 +- add CI gating test. +- Resolves: rhbz#1680617 + * Wed Sep 19 2018 Lianbo Jiang - 1:3.2-1 - update to upstream dmidecode-3.2 - Resolves: rhbz#1628211