|
|
38ce75 |
From c43afb47fcbadabe2655fe7863a1e2ea9af1446c Mon Sep 17 00:00:00 2001
|
|
|
38ce75 |
From: Jean Delvare <jdelvare@suse.de>
|
|
|
38ce75 |
Date: Tue, 15 Jan 2019 12:59:00 +0100
|
|
|
38ce75 |
Subject: [PATCH 2/4] dmidecode: Use the most appropriate unit for cache size
|
|
|
38ce75 |
|
|
|
38ce75 |
As newer CPUs have larger and larger cache, using kB to represent the
|
|
|
38ce75 |
cache size is getting less convenient. Reuse the same function we have
|
|
|
38ce75 |
for system memory size so that large units will be used as
|
|
|
38ce75 |
appropriate. For example, a cache size reported as "20 MB" looks nicer
|
|
|
38ce75 |
than as "20480 kB".
|
|
|
38ce75 |
|
|
|
38ce75 |
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
|
38ce75 |
Acked-by: Neil Horman <nhorman@tuxdriver.com>
|
|
|
38ce75 |
---
|
|
|
38ce75 |
dmidecode.c | 17 +++++++++++------
|
|
|
38ce75 |
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
38ce75 |
|
|
|
38ce75 |
diff --git a/dmidecode.c b/dmidecode.c
|
|
|
38ce75 |
index 7ac6438..162e0c5 100644
|
|
|
38ce75 |
--- a/dmidecode.c
|
|
|
38ce75 |
+++ b/dmidecode.c
|
|
|
38ce75 |
@@ -1560,17 +1560,22 @@ static void dmi_cache_size(u16 code)
|
|
|
38ce75 |
|
|
|
38ce75 |
static void dmi_cache_size_2(u32 code)
|
|
|
38ce75 |
{
|
|
|
38ce75 |
+ u64 size;
|
|
|
38ce75 |
+
|
|
|
38ce75 |
if (code & 0x80000000)
|
|
|
38ce75 |
{
|
|
|
38ce75 |
code &= 0x7FFFFFFFLU;
|
|
|
38ce75 |
- /* Use a more convenient unit for large cache size */
|
|
|
38ce75 |
- if (code >= 0x8000)
|
|
|
38ce75 |
- printf(" %u MB", code >> 4);
|
|
|
38ce75 |
- else
|
|
|
38ce75 |
- printf(" %u kB", code << 6);
|
|
|
38ce75 |
+ size.l = code << 6;
|
|
|
38ce75 |
+ size.h = code >> 26;
|
|
|
38ce75 |
}
|
|
|
38ce75 |
else
|
|
|
38ce75 |
- printf(" %u kB", code);
|
|
|
38ce75 |
+ {
|
|
|
38ce75 |
+ size.l = code;
|
|
|
38ce75 |
+ size.h = 0;
|
|
|
38ce75 |
+ }
|
|
|
38ce75 |
+
|
|
|
38ce75 |
+ /* Use a more convenient unit for large cache size */
|
|
|
38ce75 |
+ dmi_print_memory_size(size, 1);
|
|
|
38ce75 |
}
|
|
|
38ce75 |
|
|
|
38ce75 |
static void dmi_cache_types(u16 code, const char *sep)
|
|
|
38ce75 |
--
|
|
|
38ce75 |
2.17.1
|
|
|
38ce75 |
|