3540f1
From 5dc17273139ccc6b21cdd0ada66c81ca1c8ebeaf 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 08/11] dmidecode: Adding firmware-revision support to -s
3540f1
 option
3540f1
3540f1
Most of servers like HPe, QCT, report the BMC version via the
3540f1
Firmware Revision field. Add an option to the -s to export this
3540f1
information directly.
3540f1
3540f1
A typical usage of this feature looks like:
3540f1
3540f1
	[root@host ~]$ dmidecode -s firmware-revision
3540f1
	3.93
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 | 2 +-
3540f1
 3 files changed, 6 insertions(+), 1 deletion(-)
3540f1
3540f1
diff --git a/dmidecode.c b/dmidecode.c
3540f1
index bc438defdb72..1ce6ba52291a 100644
3540f1
--- a/dmidecode.c
3540f1
+++ b/dmidecode.c
3540f1
@@ -5083,6 +5083,10 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
3540f1
 			if (data[key - 1] != 0xFF && data[key] != 0xFF)
3540f1
 				printf("%u.%u\n", data[key - 1], data[key]);
3540f1
 			break;
3540f1
+		case 0x017: /* -s firmware-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 9ceb35a104bd..1c3b7607df2f 100644
3540f1
--- a/dmiopt.c
3540f1
+++ b/dmiopt.c
3540f1
@@ -152,6 +152,7 @@ static const struct string_keyword opt_string_keyword[] = {
3540f1
 	{ "bios-version", 0, 0x05 },
3540f1
 	{ "bios-release-date", 0, 0x08 },
3540f1
 	{ "bios-revision", 0, 0x15 },		/* 0x14 and 0x15 */
3540f1
+	{ "firmware-revision", 0, 0x17 },	/* 0x16 and 0x17 */
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 c3f87132d14c..4602088115d2 100644
3540f1
--- a/man/dmidecode.8
3540f1
+++ b/man/dmidecode.8
3540f1
@@ -74,7 +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
+\fBbios-revision\fR, \fBfirmware-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