Blame SOURCES/0007-dmidecode-Adding-bios-revision-to-s-option.patch

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