Skip to content

Commit 3761322

Browse files
committed
dmidecode: Add support for extended BIOS ROM size
Add support for the "Extended BIOS ROM Size" field introduced in SMBIOS specification version 3.1.0. Signed-off-by: Jean Delvare <jdelvare@suse.de>
1 parent aa66327 commit 3761322

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2017-04-27 Jean Delvare <jdelvare@suse.de>
2+
3+
Update to support SMBIOS specification version 3.1.0.
4+
5+
* dmidecode.c: Add support for extended BIOS ROM size (DMI type 0).
6+
17
2017-04-11 Jean Delvare <jdelvare@suse.de>
28

39
* util.c: Don't leak a file descriptor in function read_file.

dmidecode.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,18 @@ static void dmi_bios_runtime_size(u32 code)
295295
printf(" %u kB", code >> 10);
296296
}
297297

298+
static void dmi_bios_rom_size(u8 code1, u16 code2)
299+
{
300+
static const char *unit[4] = {
301+
"MB", "GB", out_of_spec, out_of_spec
302+
};
303+
304+
if (code1 != 0xFF)
305+
printf(" %u kB", (code1 + 1) << 6);
306+
else
307+
printf(" %u %s", code2 & 0x3FFF, unit[code2 >> 14]);
308+
}
309+
298310
static void dmi_bios_characteristics(u64 code, const char *prefix)
299311
{
300312
/* 7.1.1 */
@@ -3271,8 +3283,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
32713283
dmi_bios_runtime_size((0x10000 - WORD(data + 0x06)) << 4);
32723284
printf("\n");
32733285
}
3274-
printf("\tROM Size: %u kB\n",
3275-
(data[0x09] + 1) << 6);
3286+
printf("\tROM Size:");
3287+
dmi_bios_rom_size(data[0x09], h->length < 0x1A ? 16 : WORD(data + 0x18));
3288+
printf("\n");
32763289
printf("\tCharacteristics:\n");
32773290
dmi_bios_characteristics(QWORD(data + 0x0A), "\t\t");
32783291
if (h->length < 0x13) break;

0 commit comments

Comments
 (0)