From 9bce894b7730013120d4c71f964d4cf8402cb956 Mon Sep 17 00:00:00 2001
From: Erwan Velu <e.velu@criteo.com>
Date: Mon, 7 Oct 2019 15:36:47 +0200
Subject: [PATCH 08/11] dmidecode: Adding bios-revision to -s option
Some hardware vendors like HPe use the Version field to store the
bios generation like (U30, U32, A40, ...). If you want to get the
"release" version of this bios generation, the bios revision field
must be considered.
A typical output of this kind of server looks like :
BIOS Information
Vendor: HPE
Version: A40
Release Date: 07/20/2019
[...]
BIOS Revision: 2.0
Firmware Revision: 1.45
Add a "bios-revision" entry into the '-s' option.
A typical usage of this feature looks like :
[root@host] dmidecode -s bios-revision
2.0
Signed-off-by: Erwan Velu <e.velu@criteo.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmidecode.c | 4 ++++
dmiopt.c | 1 +
man/dmidecode.8 | 1 +
3 files changed, 6 insertions(+)
diff --git a/dmidecode.c b/dmidecode.c
index cff7d3f1941d..e4cd6d8b8b20 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5082,6 +5082,10 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
key = (opt.string->type << 8) | offset;
switch (key)
{
+ case 0x015: /* -s bios-revision */
+ if (data[key - 1] != 0xFF && data[key] != 0xFF)
+ printf("%u.%u\n", data[key - 1], data[key]);
+ break;
case 0x108:
dmi_system_uuid(data + offset, ver);
printf("\n");
diff --git a/dmiopt.c b/dmiopt.c
index 2f285f34a96b..9ceb35a104bd 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -151,6 +151,7 @@ static const struct string_keyword opt_string_keyword[] = {
{ "bios-vendor", 0, 0x04 },
{ "bios-version", 0, 0x05 },
{ "bios-release-date", 0, 0x08 },
+ { "bios-revision", 0, 0x15 }, /* 0x14 and 0x15 */
{ "system-manufacturer", 1, 0x04 },
{ "system-product-name", 1, 0x05 },
{ "system-version", 1, 0x06 },
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index 1f6529d99e91..c3f87132d14c 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -74,6 +74,7 @@ displayed. Meta-data and handle references are hidden.
Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR.
\fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR,
\fBbios-version\fR, \fBbios-release-date\fR,
+\fBbios-revision\fR,
\fBsystem-manufacturer\fR, \fBsystem-product-name\fR,
\fBsystem-version\fR, \fBsystem-serial-number\fR,
\fBsystem-uuid\fR, \fBsystem-family\fR,
--
2.17.1