Blob Blame History Raw
From b381d53c1199895aecccad543210ae1d40534493 Mon Sep 17 00:00:00 2001
From: Deomid rojer Ryabkov <rojer9@fb.com>
Date: Mon, 26 Aug 2019 14:20:15 +0200
Subject: [PATCH 11/18] Use larger units for memory device and BIOS size

So, 8 MB instead of 8192 kB, 8 GB instead of 8192 MB.

Same principle as in c43afb47fcba ("dmidecode: Use the most
appropriate unit for cache size") applied to more fields.
---
 dmidecode.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/dmidecode.c b/dmidecode.c
index 9c1e9c4..5372c38 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -318,7 +318,10 @@ static void dmi_bios_rom_size(u8 code1, u16 code2)
 	};
 
 	if (code1 != 0xFF)
-		printf(" %u kB", (code1 + 1) << 6);
+	{
+		u64 s = { .l = (code1 + 1) << 6 };
+		dmi_print_memory_size(s, 1);
+	}
 	else
 		printf(" %u %s", code2 & 0x3FFF, unit[code2 >> 14]);
 }
@@ -2372,10 +2375,10 @@ static void dmi_memory_device_size(u16 code)
 		printf(" Unknown");
 	else
 	{
-		if (code & 0x8000)
-			printf(" %u kB", code & 0x7FFF);
-		else
-			printf(" %u MB", code);
+		u64 s = { .l = code & 0x7FFF };
+		if (!(code & 0x8000))
+			s.l <<= 10;
+		dmi_print_memory_size(s, 1);
 	}
 }
 
-- 
2.24.0