[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH 2/2] dmidecode: Use dmi_cache_size_2 in dmi_cache_siz
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH 2/2] dmidecode: Use dmi_cache_size_2 in dmi_cache_size |
Date: |
Tue, 11 Dec 2018 21:03:29 +0100 |
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 <address@hidden>
---
dmidecode.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
--- dmidecode.orig/dmidecode.c 2018-12-11 12:55:34.948912010 +0100
+++ dmidecode/dmidecode.c 2018-12-11 12:59:35.952591088 +0100
@@ -1550,14 +1550,6 @@ static const char *dmi_cache_location(u8
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 */
--
Jean Delvare
SUSE L3 Support