dmidecode/0004-dmidecode-Use-dmi_cache_size_2-in-dmi_cache_size.patch
Anton Arapov 48d35dd3e4 v3.2 patched up to upstream commit 62bce59f
Signed-off-by: Anton Arapov <arapov@gmail.com>
2019-11-18 12:03:01 +01:00

50 lines
1.3 KiB
Diff

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