db7f50
From 941591e24564e4c6d6584dbaa868976f9e80e925 Mon Sep 17 00:00:00 2001
db7f50
From: Jean Delvare <jdelvare@suse.de>
db7f50
Date: Tue, 15 Jan 2019 12:59:08 +0100
db7f50
Subject: [PATCH 3/4] dmidecode: Use dmi_cache_size_2 in dmi_cache_size
db7f50
db7f50
Redirect dmi_cache_size() to dmi_cache_size_2() so that the cache
db7f50
size is always reported using the most appropriate unit, even if the
db7f50
BIOS does not populate the 32-bit cache size fields.
db7f50
db7f50
Signed-off-by: Jean Delvare <jdelvare@suse.de>
db7f50
Acked-by: Neil Horman <nhorman@tuxdriver.com>
db7f50
---
db7f50
 dmidecode.c | 13 +++++--------
db7f50
 1 file changed, 5 insertions(+), 8 deletions(-)
db7f50
db7f50
diff --git a/dmidecode.c b/dmidecode.c
db7f50
index 162e0c5..903ef35 100644
db7f50
--- a/dmidecode.c
db7f50
+++ b/dmidecode.c
db7f50
@@ -1550,14 +1550,6 @@ static const char *dmi_cache_location(u8 code)
db7f50
 	return location[code];
db7f50
 }
db7f50
 
db7f50
-static void dmi_cache_size(u16 code)
db7f50
-{
db7f50
-	if (code & 0x8000)
db7f50
-		printf(" %u kB", (code & 0x7FFF) << 6);
db7f50
-	else
db7f50
-		printf(" %u kB", code);
db7f50
-}
db7f50
-
db7f50
 static void dmi_cache_size_2(u32 code)
db7f50
 {
db7f50
 	u64 size;
db7f50
@@ -1578,6 +1570,11 @@ static void dmi_cache_size_2(u32 code)
db7f50
 	dmi_print_memory_size(size, 1);
db7f50
 }
db7f50
 
db7f50
+static void dmi_cache_size(u16 code)
db7f50
+{
db7f50
+	dmi_cache_size_2((((u32)code & 0x8000LU) << 16) | (code & 0x7FFFLU));
db7f50
+}
db7f50
+
db7f50
 static void dmi_cache_types(u16 code, const char *sep)
db7f50
 {
db7f50
 	/* 7.8.2 */
db7f50
-- 
db7f50
2.17.1
db7f50