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

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