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

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