linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware/dmi: Report DMI Bios & EC firmware release
@ 2020-02-07  8:35 Erwan Velu
  2020-02-11 13:21 ` Jean Delvare
  0 siblings, 1 reply; 5+ messages in thread
From: Erwan Velu @ 2020-02-07  8:35 UTC (permalink / raw)
  Cc: Erwan Velu, Jean Delvare, Masahiro Yamada, Michal Marek,
	Mattias Jacobsson, Andy Shevchenko, Andrew Lunn,
	Darren Hart (VMware),
	Changbin Du, Russell King, linux-kernel, linux-kbuild

Some vendors like HPe or Dell, encode the release version of their BIOS
in the "System BIOS {Major|Minor} Release" fields of Type 0.

This information is used to know which bios release actually runs.
It could be used for some quirks, debugging sessions or inventory tasks.

A typical output for a Dell system running the 65.27 bios is :
	[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release
	65.27
	[root@t1700 ~]#

Servers that have a BMC encode the release version of their firmware in the
 "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.

This information is used to know which BMC release actually runs.
It could be used for some quirks, debugging sessions or inventory tasks.

A typical output for a Dell system running the 3.75 bmc release is :
    [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/ec_firmware_release
    3.75
    [root@t1700 ~]#

Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
 drivers/firmware/dmi-id.c       |  6 ++++++
 drivers/firmware/dmi_scan.c     | 30 ++++++++++++++++++++++++++++++
 include/linux/mod_devicetable.h |  2 ++
 scripts/mod/file2alias.c        |  2 ++
 4 files changed, 40 insertions(+)

diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index ff39f64f2aae..ab9afe5af4bf 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -42,6 +42,8 @@ DEFINE_DMI_ATTR_WITH_SHOW(bios_vendor,		0444, DMI_BIOS_VENDOR);
 DEFINE_DMI_ATTR_WITH_SHOW(bios_version,		0444, DMI_BIOS_VERSION);
 DEFINE_DMI_ATTR_WITH_SHOW(bios_date,		0444, DMI_BIOS_DATE);
 DEFINE_DMI_ATTR_WITH_SHOW(sys_vendor,		0444, DMI_SYS_VENDOR);
+DEFINE_DMI_ATTR_WITH_SHOW(bios_release,         0444, DMI_BIOS_RELEASE);
+DEFINE_DMI_ATTR_WITH_SHOW(ec_firmware_release,  0444, DMI_EC_FIRMWARE_RELEASE);
 DEFINE_DMI_ATTR_WITH_SHOW(product_name,		0444, DMI_PRODUCT_NAME);
 DEFINE_DMI_ATTR_WITH_SHOW(product_version,	0444, DMI_PRODUCT_VERSION);
 DEFINE_DMI_ATTR_WITH_SHOW(product_serial,	0400, DMI_PRODUCT_SERIAL);
@@ -78,6 +80,8 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size)
 		{ "bvn", DMI_BIOS_VENDOR },
 		{ "bvr", DMI_BIOS_VERSION },
 		{ "bd",  DMI_BIOS_DATE },
+		{ "br",  DMI_BIOS_RELEASE },
+		{ "ecr", DMI_EC_FIRMWARE_RELEASE },
 		{ "svn", DMI_SYS_VENDOR },
 		{ "pn",  DMI_PRODUCT_NAME },
 		{ "pvr", DMI_PRODUCT_VERSION },
@@ -187,6 +191,8 @@ static void __init dmi_id_init_attr_table(void)
 	ADD_DMI_ATTR(bios_vendor,       DMI_BIOS_VENDOR);
 	ADD_DMI_ATTR(bios_version,      DMI_BIOS_VERSION);
 	ADD_DMI_ATTR(bios_date,         DMI_BIOS_DATE);
+	ADD_DMI_ATTR(bios_release,      DMI_BIOS_RELEASE);
+	ADD_DMI_ATTR(ec_firmware_release, DMI_EC_FIRMWARE_RELEASE);
 	ADD_DMI_ATTR(sys_vendor,        DMI_SYS_VENDOR);
 	ADD_DMI_ATTR(product_name,      DMI_PRODUCT_NAME);
 	ADD_DMI_ATTR(product_version,   DMI_PRODUCT_VERSION);
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 2045566d622f..51d81b87ed94 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -182,6 +182,34 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot,
 	dmi_ident[slot] = p;
 }
 
+static void __init dmi_save_release(const struct dmi_header *dm, int slot,
+		int index)
+{
+	const u8 *minor, *major;
+	char *s;
+
+	/* If the table doesn't have the field, let's return */
+	if (dmi_ident[slot] || dm->length < index)
+		return;
+
+	minor = (u8 *) dm + index;
+	major = (u8 *) dm + index - 1;
+
+	/* As per the spec, if the system doesn't support this field,
+	 * the value is FF
+	 */
+	if (*major == 0xFF && *minor == 0xFF)
+		return;
+
+	s = dmi_alloc(8);
+	if (!s)
+		return;
+
+	sprintf(s, "%u.%u", *major, *minor);
+
+	dmi_ident[slot] = s;
+}
+
 static void __init dmi_save_uuid(const struct dmi_header *dm, int slot,
 		int index)
 {
@@ -440,6 +468,8 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 		dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
 		dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
 		dmi_save_ident(dm, DMI_BIOS_DATE, 8);
+		dmi_save_release(dm, DMI_BIOS_RELEASE, 21);
+		dmi_save_release(dm, DMI_EC_FIRMWARE_RELEASE, 23);
 		break;
 	case 1:		/* System Information */
 		dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e3596db077dc..e1621c81cf44 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -532,6 +532,8 @@ enum dmi_field {
 	DMI_BIOS_VENDOR,
 	DMI_BIOS_VERSION,
 	DMI_BIOS_DATE,
+	DMI_BIOS_RELEASE,
+	DMI_EC_FIRMWARE_RELEASE,
 	DMI_SYS_VENDOR,
 	DMI_PRODUCT_NAME,
 	DMI_PRODUCT_VERSION,
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index c91eba751804..6c6c9953c488 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -936,6 +936,8 @@ static const struct dmifield {
 	{ "bvn", DMI_BIOS_VENDOR },
 	{ "bvr", DMI_BIOS_VERSION },
 	{ "bd",  DMI_BIOS_DATE },
+	{ "br",  DMI_BIOS_RELEASE },
+	{ "ecr", DMI_EC_FIRMWARE_RELEASE },
 	{ "svn", DMI_SYS_VENDOR },
 	{ "pn",  DMI_PRODUCT_NAME },
 	{ "pvr", DMI_PRODUCT_VERSION },
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] firmware/dmi: Report DMI Bios & EC firmware release
  2020-02-07  8:35 [PATCH] firmware/dmi: Report DMI Bios & EC firmware release Erwan Velu
@ 2020-02-11 13:21 ` Jean Delvare
  2020-02-11 13:31   ` Erwan Velu
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2020-02-11 13:21 UTC (permalink / raw)
  To: Erwan Velu
  Cc: Erwan Velu, Masahiro Yamada, Michal Marek, Mattias Jacobsson,
	Andy Shevchenko, Andrew Lunn, Darren Hart (VMware),
	Changbin Du, Russell King, linux-kernel, linux-kbuild

On Fri,  7 Feb 2020 09:35:47 +0100, Erwan Velu wrote:
> Some vendors like HPe or Dell, encode the release version of their BIOS
> in the "System BIOS {Major|Minor} Release" fields of Type 0.
> 
> This information is used to know which bios release actually runs.
> It could be used for some quirks, debugging sessions or inventory tasks.
> 
> A typical output for a Dell system running the 65.27 bios is :
> 	[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release
> 	65.27
> 	[root@t1700 ~]#
> 
> Servers that have a BMC encode the release version of their firmware in the
>  "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.
> 
> This information is used to know which BMC release actually runs.
> It could be used for some quirks, debugging sessions or inventory tasks.
> 
> A typical output for a Dell system running the 3.75 bmc release is :
>     [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/ec_firmware_release
>     3.75
>     [root@t1700 ~]#
> 
> Signed-off-by: Erwan Velu <e.velu@criteo.com>
> ---
>  drivers/firmware/dmi-id.c       |  6 ++++++
>  drivers/firmware/dmi_scan.c     | 30 ++++++++++++++++++++++++++++++
>  include/linux/mod_devicetable.h |  2 ++
>  scripts/mod/file2alias.c        |  2 ++
>  4 files changed, 40 insertions(+)
> (...)

Applied, thanks. Note that I went for "efr" as the shortcut string for
DMI_EC_FIRMWARE_RELEASE, which was your first choice and has my
preference.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] firmware/dmi: Report DMI Bios & EC firmware release
  2020-02-11 13:21 ` Jean Delvare
@ 2020-02-11 13:31   ` Erwan Velu
  2020-05-11 17:10     ` Erwan Velu
  0 siblings, 1 reply; 5+ messages in thread
From: Erwan Velu @ 2020-02-11 13:31 UTC (permalink / raw)
  To: Jean Delvare, Erwan Velu
  Cc: Masahiro Yamada, Michal Marek, Mattias Jacobsson,
	Andy Shevchenko, Andrew Lunn, Darren Hart (VMware),
	Changbin Du, Russell King, linux-kernel, linux-kbuild

No issue with that.

Thanks for applying.

Erwan,

On 11/02/2020 14:21, Jean Delvare wrote:
> On Fri,  7 Feb 2020 09:35:47 +0100, Erwan Velu wrote:
>> Some vendors like HPe or Dell, encode the release version of their BIOS
>> in the "System BIOS {Major|Minor} Release" fields of Type 0.
>>
>> This information is used to know which bios release actually runs.
>> It could be used for some quirks, debugging sessions or inventory tasks.
>>
>> A typical output for a Dell system running the 65.27 bios is :
>> 	[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release
>> 	65.27
>> 	[root@t1700 ~]#
>>
>> Servers that have a BMC encode the release version of their firmware in the
>>   "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.
>>
>> This information is used to know which BMC release actually runs.
>> It could be used for some quirks, debugging sessions or inventory tasks.
>>
>> A typical output for a Dell system running the 3.75 bmc release is :
>>      [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/ec_firmware_release
>>      3.75
>>      [root@t1700 ~]#
>>
>> Signed-off-by: Erwan Velu <e.velu@criteo.com>
>> ---
>>   drivers/firmware/dmi-id.c       |  6 ++++++
>>   drivers/firmware/dmi_scan.c     | 30 ++++++++++++++++++++++++++++++
>>   include/linux/mod_devicetable.h |  2 ++
>>   scripts/mod/file2alias.c        |  2 ++
>>   4 files changed, 40 insertions(+)
>> (...)
> Applied, thanks. Note that I went for "efr" as the shortcut string for
> DMI_EC_FIRMWARE_RELEASE, which was your first choice and has my
> preference.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] firmware/dmi: Report DMI Bios & EC firmware release
  2020-02-11 13:31   ` Erwan Velu
@ 2020-05-11 17:10     ` Erwan Velu
  2020-05-12  7:37       ` Jean Delvare
  0 siblings, 1 reply; 5+ messages in thread
From: Erwan Velu @ 2020-05-11 17:10 UTC (permalink / raw)
  To: Erwan Velu
  Cc: Jean Delvare, Masahiro Yamada, Michal Marek, Mattias Jacobsson,
	Andy Shevchenko, Andrew Lunn, Darren Hart (VMware),
	Changbin Du, Russell King, open list, linux-kbuild

Jean, I don't see my patches in the 5.7-rc series.
Is there anything wrong with them ?

Le mar. 11 févr. 2020 à 14:31, Erwan Velu <e.velu@criteo.com> a écrit :
>
> No issue with that.
>
> Thanks for applying.
>
> Erwan,
>
> On 11/02/2020 14:21, Jean Delvare wrote:
> > On Fri,  7 Feb 2020 09:35:47 +0100, Erwan Velu wrote:
> >> Some vendors like HPe or Dell, encode the release version of their BIOS
> >> in the "System BIOS {Major|Minor} Release" fields of Type 0.
> >>
> >> This information is used to know which bios release actually runs.
> >> It could be used for some quirks, debugging sessions or inventory tasks.
> >>
> >> A typical output for a Dell system running the 65.27 bios is :
> >>      [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release
> >>      65.27
> >>      [root@t1700 ~]#
> >>
> >> Servers that have a BMC encode the release version of their firmware in the
> >>   "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.
> >>
> >> This information is used to know which BMC release actually runs.
> >> It could be used for some quirks, debugging sessions or inventory tasks.
> >>
> >> A typical output for a Dell system running the 3.75 bmc release is :
> >>      [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/ec_firmware_release
> >>      3.75
> >>      [root@t1700 ~]#
> >>
> >> Signed-off-by: Erwan Velu <e.velu@criteo.com>
> >> ---
> >>   drivers/firmware/dmi-id.c       |  6 ++++++
> >>   drivers/firmware/dmi_scan.c     | 30 ++++++++++++++++++++++++++++++
> >>   include/linux/mod_devicetable.h |  2 ++
> >>   scripts/mod/file2alias.c        |  2 ++
> >>   4 files changed, 40 insertions(+)
> >> (...)
> > Applied, thanks. Note that I went for "efr" as the shortcut string for
> > DMI_EC_FIRMWARE_RELEASE, which was your first choice and has my
> > preference.
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] firmware/dmi: Report DMI Bios & EC firmware release
  2020-05-11 17:10     ` Erwan Velu
@ 2020-05-12  7:37       ` Jean Delvare
  0 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2020-05-12  7:37 UTC (permalink / raw)
  To: Erwan Velu
  Cc: Erwan Velu, Masahiro Yamada, Michal Marek, Mattias Jacobsson,
	Andy Shevchenko, Andrew Lunn, Darren Hart (VMware),
	Changbin Du, Russell King, open list, linux-kbuild

Hi Erwan,

On Mon, 11 May 2020 19:10:52 +0200, Erwan Velu wrote:
> Jean, I don't see my patches in the 5.7-rc series.
> Is there anything wrong with them ?

Nothing wrong with your patch, but unfortunately I missed the merge
window and sent my pull request a few days too late, so it was not
accepted. Your patch is still in my pending queue:

http://jdelvare.nerim.net/devel/linux/jdelvare-dmi/

and therefore included in every linux-next snapshot, but it won't be
merged in v5.7, you'll have to wait for v5.8.

This is entirely my fault and I am sorry about that.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-12  7:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07  8:35 [PATCH] firmware/dmi: Report DMI Bios & EC firmware release Erwan Velu
2020-02-11 13:21 ` Jean Delvare
2020-02-11 13:31   ` Erwan Velu
2020-05-11 17:10     ` Erwan Velu
2020-05-12  7:37       ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).