firmware/dmi_scan: Add dmi_save_release to save releases fields
Subsystems (2)
PATCH 1/3 firmware/dmi_scan: Add dmi_save_release to save releases fields
In DMI type 0, there is several fields that encodes a release. The dmi_save_release() function have the logic to check if the field is valid. If so, it reports the actual value.
--- drivers/firmware/dmi_scan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/firmware/dmi_scan.c +26 -0
@@ -181,6 +181,32 @@ 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 *d; +char *s; + +// If the table doesn't have the field, let's return +if (dmi_ident[slot] || dm->length < index) +return ; + + d = (u8 *) dm + index; + +// As per the specification, +// if the system doesn't have the field, the value is FF +if (d[0 ] ==0xFF ) +return ; + + s =dmi_alloc (4 ); +if (!s) +return ; + +sprintf (s,"%u" , d[0 ]); + + dmi_ident[slot] = s; +} +static void __init dmi_save_uuid (const struct dmi_header *dm,int slot,int index) {
Signature · 1 line
2.21.0
PATCH 2/3 firmware/dmi: Report DMI Bios release
Some vendors like HPe or Dell, encodes the release version of their BIOS in the "System BIOS {Major|Minor} Release" fields of Type 0.
This information is useful to know which release of the bios is actually running. It could be used for some quirks, debugging sessions or inventory tasks.
This patch extract these 2 fields in DMI_BIOS_MAJOR_RELEASE & DMI_BIOS_MINOR_RELEASE.
A typical output for a Dell system running the 65.27 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release_major 65 [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release_minor 27 [root@t1700 ~]#
--- drivers/firmware/dmi-id.c | 6 ++++++ drivers/firmware/dmi_scan.c | 2 ++ include/linux/mod_devicetable.h | 2 ++ scripts/mod/file2alias.c | 2 ++ 4 files changed, 12 insertions(+)
drivers/firmware/dmi-id.c +6 -0
@@ -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_major,0444 ,DMI_BIOS_MAJOR_RELEASE ); +DEFINE_DMI_ATTR_WITH_SHOW (bios_release_minor,0444 ,DMI_BIOS_MINOR_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 }, + { "bjr", DMI_BIOS_MAJOR_RELEASE }, + { "bmr", DMI_BIOS_MINOR_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_major,DMI_BIOS_MAJOR_RELEASE ); +ADD_DMI_ATTR (bios_release_minor,DMI_BIOS_MINOR_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 );
drivers/firmware/dmi_scan.c +2 -0
@@ -464,6 +464,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_MAJOR_RELEASE ,20 ); +dmi_save_release (dm,DMI_BIOS_MINOR_RELEASE ,21 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );
include/linux/mod_devicetable.h +2 -0
@@ -532,6 +532,8 @@ enum dmi_field {DMI_BIOS_VENDOR ,DMI_BIOS_VERSION ,DMI_BIOS_DATE , +DMI_BIOS_MAJOR_RELEASE , +DMI_BIOS_MINOR_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,
scripts/mod/file2alias.c +2 -0
@@ -931,6 +931,8 @@ static const struct dmifield { { "bvn", DMI_BIOS_VENDOR }, { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, + { "bjr", DMI_BIOS_MAJOR_RELEASE }, + { "bmr", DMI_BIOS_MINOR_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
Signature · 1 line
2.21.0
Re: [PATCH 2/3] firmware/dmi: Report DMI Bios release
Quoted 1 line · Erwan Velu
Some vendors like HPe or Dell, encodes the release version of their BIOS
encodes -> encode
Quoted 7 lines
in the "System BIOS {Major|Minor} Release" fields of Type 0.
This information is useful to know which release of the bios is actually running. It could be used for some quirks, debugging sessions or inventory tasks.
This patch extract these 2 fields in
DMI_BIOS_MAJOR_RELEASE&DMI_BIOS_MINOR_RELEASE.
Quoted 7 lines
A typical output for a Dell system running the 65.27 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release_major 65 [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release_minor 27 [root@t1700 ~]#
I don't think we want two fields. This adds quite some overhead, and they are not independent from each other anyway. I'd rather have one field with the values combined:
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/bios_release 65.27 [root@t1700 ~]#
This would also be in line with how it was implemented in dmidecode. Is there any reason to NOT go that route?
Signature · 2 lines
Jean Delvare SUSE L3 Support
Re: [PATCH 2/3] firmware/dmi: Report DMI Bios release
Quoted 2 lines · Jean Delvare
This would also be in line with how it was implemented in dmidecode. Is there any reason to NOT go that route?
The main reason was I though it would be easier to compare releases by splitting major & minor.
That is probably overkill, so I'll stick to the usual way to represent a release in V2.
Thanks for the review,
Erwan,
PATCH 3/3 firmware/dmi: Report DMI Embedded Firmware release
In reply to Erwan VeluServers that have a BMC encodes the release version of their firmware in the "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.
This information is useful to know which release of the BMC is actually running. It could be used for some quirks, debugging sessions or inventory tasks.
This patch extract these 2 fields in DMI_EMBEDDED_FW_MAJOR_RELEASE & DMI_EMBEDDED_FW_MINOR_RELEASE
A typical output for a Dell system running the 3.75 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release_major
3
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release_minor
75
[root@t1700 ~]#--- drivers/firmware/dmi-id.c | 10 ++++++++-- drivers/firmware/dmi_scan.c | 2 ++ include/linux/mod_devicetable.h | 2 ++ scripts/mod/file2alias.c | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-)
drivers/firmware/dmi-id.c +8 -2
@@ -42,8 +42,10 @@ 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_major,0444 ,DMI_BIOS_MAJOR_RELEASE ); -DEFINE_DMI_ATTR_WITH_SHOW (bios_release_minor,0444 ,DMI_BIOS_MINOR_RELEASE ); +DEFINE_DMI_ATTR_WITH_SHOW (bios_release_major,0444 ,DMI_BIOS_MAJOR_RELEASE ); +DEFINE_DMI_ATTR_WITH_SHOW (bios_release_minor,0444 ,DMI_BIOS_MINOR_RELEASE ); +DEFINE_DMI_ATTR_WITH_SHOW (fw_release_major,0444 ,DMI_EMBEDDED_FW_MAJOR_RELEASE ); +DEFINE_DMI_ATTR_WITH_SHOW (fw_release_minor,0444 ,DMI_EMBEDDED_FW_MINOR_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 );
@@ -82,6 +84,8 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size) { "bd", DMI_BIOS_DATE }, { "bjr", DMI_BIOS_MAJOR_RELEASE }, { "bmr", DMI_BIOS_MINOR_RELEASE }, + { "efj", DMI_EMBEDDED_FW_MAJOR_RELEASE }, + { "efm", DMI_EMBEDDED_FW_MINOR_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
@@ -193,6 +197,8 @@ static void __init dmi_id_init_attr_table(void)ADD_DMI_ATTR (bios_date,DMI_BIOS_DATE );ADD_DMI_ATTR (bios_release_major,DMI_BIOS_MAJOR_RELEASE );ADD_DMI_ATTR (bios_release_minor,DMI_BIOS_MINOR_RELEASE ); +ADD_DMI_ATTR (fw_release_major,DMI_EMBEDDED_FW_MAJOR_RELEASE ); +ADD_DMI_ATTR (fw_release_minor,DMI_EMBEDDED_FW_MINOR_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 );
drivers/firmware/dmi_scan.c +2 -0
@@ -466,6 +466,8 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)dmi_save_ident (dm,DMI_BIOS_DATE ,8 );dmi_save_release (dm,DMI_BIOS_MAJOR_RELEASE ,20 );dmi_save_release (dm,DMI_BIOS_MINOR_RELEASE ,21 ); +dmi_save_release (dm,DMI_EMBEDDED_FW_MAJOR_RELEASE ,22 ); +dmi_save_release (dm,DMI_EMBEDDED_FW_MINOR_RELEASE ,23 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );
include/linux/mod_devicetable.h +2 -0
@@ -534,6 +534,8 @@ enum dmi_field {DMI_BIOS_DATE ,DMI_BIOS_MAJOR_RELEASE ,DMI_BIOS_MINOR_RELEASE , +DMI_EMBEDDED_FW_MAJOR_RELEASE , +DMI_EMBEDDED_FW_MINOR_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,
scripts/mod/file2alias.c +2 -0
@@ -933,6 +933,8 @@ static const struct dmifield { { "bd", DMI_BIOS_DATE }, { "bjr", DMI_BIOS_MAJOR_RELEASE }, { "bmr", DMI_BIOS_MINOR_RELEASE }, + { "efj", DMI_EMBEDDED_FW_MAJOR_RELEASE }, + { "efm", DMI_EMBEDDED_FW_MINOR_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
Signature · 1 line
2.21.0
Re: [PATCH 3/3] firmware/dmi: Report DMI Embedded Firmware release
Quoted 8 lines · Erwan Velu
Servers that have a BMC encodes the release version of their firmware in the "Embedded Controller Firmware {Major|Minor} Release" fields of Type 0.
This information is useful to know which release of the BMC is actually running. It could be used for some quirks, debugging sessions or inventory tasks.
This patch extract these 2 fields in
DMI_EMBEDDED_FW_MAJOR_RELEASE&DMI_EMBEDDED_FW_MINOR_RELEASE
Quoted 7 lines
A typical output for a Dell system running the 3.75 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release_major 3 [root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release_minor 75 [root@t1700 ~]#
Same comment here as for previous patch, obviously.
Additionally, please run scripts/checkpatch.pl on your patch before you resubmit, and address all the problems reported.
Thanks,
Signature · 2 lines
Jean Delvare SUSE L3 Support
Hi Erwan,
Sorry for the late answer.
Quoted 1 line · Erwan Velu
In DMI type 0, there is several fields that encodes a release.
is -> are
encodes -> encode
Quoted 7 lines
The
dmi_save_release()function have the logic to check if the field is valid. If so, it reports the actual value.Signed-off-by Erwan Velu <[email protected]>--- drivers/firmware/dmi_scan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
This patch introduces a warning:
drivers/firmware/dmi_scan.c:185:20: warning: ‘dmi_save_release’ defined but not used [-Wunused-function]
static void __init dmi_save_release(const struct dmi_header *dm, int slot,
^~~~~~~~~~~~~~~~
because you add a static function with no user. I understand that you add a use later in the series, but it's not OK to introduce a warning even if temporary. It also makes little sense to split the changes that way as there is no way to cherry-pick one of the patches without the rest. And it makes things more difficult to review too, as I can't possibly judge if this function if right without also seeing where is will be called and how.
So, please merge all the changes into a single patch.
Quoted 5 lines
drivers/firmware/dmi_scan.c +0
-0
drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 190
Quoted 10 lines
drivers/firmware/dmi_scan.c +7
-0@@ -181,6 +181,32 @@ 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 *d; +char *s; + +// If the table doesn't have the field, let's return
Please stick to C89-style comments (/* */) as used everywhere else in this file.
drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 199
Quoted 9 lines
drivers/firmware/dmi_scan.c +9
-0+if (dmi_ident[slot] || dm->length < index) +return ; + + d = (u8 *) dm + index; + +// As per the specification, +// if the system doesn't have the field, the value is FF +if (d[0 ] ==0xFF ) +return ;
That's not exactly what the specification says. It says:
"If the system does not support the use of [the System BIOS Major Release] field, the value is 0FFh for both this field and the System BIOS Minor Release field." So unused is when both fields are 0xFF. You can't test them independently.
Same goes for the Embedded Controller Firmware Release fields, even if it is worded differently, the logic is the same.
Quoted 13 lines
drivers/firmware/dmi_scan.c +10
-0+ + s =dmi_alloc (4 ); +if (!s) +return ; + +sprintf (s,"%u" , d[0 ]); + + dmi_ident[slot] = s; +} +static void __init dmi_save_uuid (const struct dmi_header *dm,int slot,int index) {
Signature · 2 lines
Jean Delvare SUSE L3 Support
Got all your points, sending a V2 with the fixes you asked.
Quoted 83 lines · Jean Delvare
Hi Erwan,
Sorry for the late answer.
Quoted 1 line · Erwan Velu
In DMI type 0, there is several fields that encodes a release.
is -> are
encodes -> encodeQuoted 7 lines
The
dmi_save_release()function have the logic to check if the field is valid. If so, it reports the actual value.Signed-off-by Erwan Velu <[email protected]>--- drivers/firmware/dmi_scan.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)This patch introduces a warning:
drivers/firmware/dmi_scan.c:185:20: warning: ‘dmi_save_release’ defined but not used [-Wunused-function]
static void__initdmi_save_release(const structdmi_header*dm, int slot,^~~~~~~~~~~~~~~~because you add a static function with no user. I understand that you add a use later in the series, but it's not OK to introduce a warning even if temporary. It also makes little sense to split the changes that way as there is no way to cherry-pick one of the patches without the rest. And it makes things more difficult to review too, as I can't possibly judge if this function if right without also seeing where is will be called and how.
So, please merge all the changes into a single patch.
Quoted 5 lines
drivers/firmware/dmi_scan.c +0
-0drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 190
Quoted 10 lines
drivers/firmware/dmi_scan.c +7
-0@@ -181,6 +181,32 @@ 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 *d; +char *s; + +// If the table doesn't have the field, let's return Please stick to C89-style comments (/* */) as used everywhere else in this file.
drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 199
Quoted 9 lines
drivers/firmware/dmi_scan.c +9
-0+if (dmi_ident[slot] || dm->length < index) +return ; + + d = (u8 *) dm + index; + +// As per the specification, +// if the system doesn't have the field, the value is FF +if (d[0 ] ==0xFF ) +return ;That's not exactly what the specification says. It says:
"If the system does not support the use of [the System BIOS Major Release] field, the value is 0FFh for both this field and the System BIOS Minor Release field." So unused is when both fields are
0xFF. You can't test them independently.Same goes for the Embedded Controller Firmware Release fields, even if it is worded differently, the logic is the same.
Quoted 13 lines
drivers/firmware/dmi_scan.c +10
-0+ + s =dmi_alloc (4 ); +if (!s) +return ; + +sprintf (s,"%u" , d[0 ]); + + dmi_ident[slot] = s; +} +static void __init dmi_save_uuid (const struct dmi_header *dm,int slot,int index) {
PATCH 1/2 firmware/dmi: Report DMI Bios release
In reply to Erwan VeluSome 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 ~]#
This commit add dmi_save_release() function have the logic to check if the field is valid. If so, it reports the actual value.
--- drivers/firmware/dmi-id.c | 3 +++ drivers/firmware/dmi_scan.c | 29 +++++++++++++++++++++++++++++ include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 1 + 4 files changed, 34 insertions(+)
drivers/firmware/dmi-id.c +3 -0
@@ -42,6 +42,7 @@ 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 (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 +79,7 @@ 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 }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
@@ -187,6 +189,7 @@ 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 (sys_vendor,DMI_SYS_VENDOR );ADD_DMI_ATTR (product_name,DMI_PRODUCT_NAME );ADD_DMI_ATTR (product_version,DMI_PRODUCT_VERSION );
drivers/firmware/dmi_scan.c +29 -0
@@ -181,6 +181,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[0 ] ==0xFF && minor[0 ] ==0xFF ) +return ; + + s =dmi_alloc (4 ); +if (!s) +return ; + +sprintf (s,"%u.%u" , major[0 ], minor[0 ]); + + dmi_ident[slot] = s; +} +static void __init dmi_save_uuid (const struct dmi_header *dm,int slot,int index) {
@@ -438,6 +466,7 @@ 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 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );
include/linux/mod_devicetable.h +1 -0
@@ -532,6 +532,7 @@ enum dmi_field {DMI_BIOS_VENDOR ,DMI_BIOS_VERSION ,DMI_BIOS_DATE , +DMI_BIOS_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,
scripts/mod/file2alias.c +1 -0
@@ -936,6 +936,7 @@ static const struct dmifield { { "bvn", DMI_BIOS_VENDOR }, { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, + { "br", DMI_BIOS_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
Signature · 1 line
2.23.0
PATCH 2/2 firmware/dmi: Report DMI Embedded Firmware release
Servers that have a BMC encodes the release version of their firmwarein 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 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release
3.75
[root@t1700 ~]#--- drivers/firmware/dmi-id.c | 3 +++ drivers/firmware/dmi_scan.c | 1 + include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 1 + 4 files changed, 6 insertions(+)
drivers/firmware/dmi-id.c +3 -0
@@ -43,6 +43,7 @@ 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 (fw_release,0444 ,DMI_EMBEDDED_FW_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 );
@@ -80,6 +81,7 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size) { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, { "br", DMI_BIOS_RELEASE }, + { "efr", DMI_EMBEDDED_FW_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
@@ -190,6 +192,7 @@ static void __init dmi_id_init_attr_table(void)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 (fw_release,DMI_EMBEDDED_FW_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 );
drivers/firmware/dmi_scan.c +1 -0
@@ -467,6 +467,7 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)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_EMBEDDED_FW_RELEASE ,23 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );
include/linux/mod_devicetable.h +1 -0
@@ -533,6 +533,7 @@ enum dmi_field {DMI_BIOS_VERSION ,DMI_BIOS_DATE ,DMI_BIOS_RELEASE , +DMI_EMBEDDED_FW_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,
scripts/mod/file2alias.c +1 -0
@@ -937,6 +937,7 @@ static const struct dmifield { { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, { "br", DMI_BIOS_RELEASE }, + { "efr", DMI_EMBEDDED_FW_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
Signature · 1 line
2.23.0
Re: [PATCH 2/2] firmware/dmi: Report DMI Embedded Firmware release
Quoted 1 line · Erwan Velu
Servers that have a BMC encodes the release version of their firmwarein the
encodes -> encode
firmwarein -> firmware in
Quoted 24 lines
"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 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release 3.75 [root@t1700 ~]#Signed-off-by Erwan Velu <[email protected]>--- drivers/firmware/dmi-id.c | 3 +++ drivers/firmware/dmi_scan.c | 1 + include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 1 + 4 files changed, 6 insertions(+)drivers/firmware/dmi-id.c +0
-0
drivers/firmware/dmi-id.c DEFINE_DMI_ATTR_WITH_SHOW(bios_version, 0444, DMI_BIOS_VERSION); · line 46
Quoted 4 lines
drivers/firmware/dmi-id.c +1
-0@@ -43,6 +43,7 @@ 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 (fw_release,0444 ,DMI_EMBEDDED_FW_RELEASE );
I suggest naming the define DMI_EC_FIRMWARE_RELEASE. "EC" is the commonly accepted abbreviation for "embedded controller". "FW" on the other hand is ambiguous as it can stand for firmware but also firewire or firewall.
Likewise I think the sysfs attribute should be named "ec_firmware_release".
Quoted 48 lines
drivers/firmware/dmi-id.c +2
-0DEFINE_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 );@@ -80,6 +81,7 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size) { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, { "br", DMI_BIOS_RELEASE }, + { "efr", DMI_EMBEDDED_FW_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },@@ -190,6 +192,7 @@ static void __init dmi_id_init_attr_table(void)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 (fw_release,DMI_EMBEDDED_FW_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 );drivers/firmware/dmi_scan.c +1
-0@@ -467,6 +467,7 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)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_EMBEDDED_FW_RELEASE ,23 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );include/linux/mod_devicetable.h +1
-0@@ -533,6 +533,7 @@ enum dmi_field {DMI_BIOS_VERSION ,DMI_BIOS_DATE ,DMI_BIOS_RELEASE , +DMI_EMBEDDED_FW_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,scripts/mod/file2alias.c +0
-0
scripts/mod/file2alias.c static const struct dmifield { · line 943
Quoted 7 lines
scripts/mod/file2alias.c +1
-0@@ -937,6 +937,7 @@ static const struct dmifield { { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, { "br", DMI_BIOS_RELEASE }, + { "efr", DMI_EMBEDDED_FW_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
Also, as already mentioned during my first review, please merge both patches together. They touch exactly the same areas, they are doing basically the same thing, and will never be backported individually, so splitting them creates more paperwork with no benefit.
Signature · 2 lines
Jean Delvare SUSE L3 Support
Re: [PATCH 2/2] firmware/dmi: Report DMI Embedded Firmware release
Thanks for the feedback Jean.
I will update the patch accordingly.
Quoted 108 lines · Jean Delvare
Quoted 1 line · Erwan Velu
Servers that have a BMC encodes the release version of their firmwarein the
encodes -> encode
firmwarein -> firmware inQuoted 24 lines
"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 bios is :
[root@t1700 ~]# cat /sys/devices/virtual/dmi/id/fw_release 3.75 [root@t1700 ~]#Signed-off-by Erwan Velu <[email protected]>--- drivers/firmware/dmi-id.c | 3 +++ drivers/firmware/dmi_scan.c | 1 + include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 1 + 4 files changed, 6 insertions(+)drivers/firmware/dmi-id.c +0
-0drivers/firmware/dmi-id.c DEFINE_DMI_ATTR_WITH_SHOW(bios_version, 0444, DMI_BIOS_VERSION); · line 46
Quoted 4 lines
drivers/firmware/dmi-id.c +1
-0@@ -43,6 +43,7 @@ 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 (fw_release,0444 ,DMI_EMBEDDED_FW_RELEASE );I suggest naming the define
DMI_EC_FIRMWARE_RELEASE. "EC" is the commonly accepted abbreviation for "embedded controller". "FW" on the other hand is ambiguous as it can stand for firmware but also firewire or firewall.Likewise I think the sysfs attribute should be named "
ec_firmware_release".Quoted 48 lines
drivers/firmware/dmi-id.c +2
-0DEFINE_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 );@@ -80,6 +81,7 @@ static ssize_t get_modalias(char *buffer, size_t buffer_size) { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, { "br", DMI_BIOS_RELEASE }, + { "efr", DMI_EMBEDDED_FW_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },@@ -190,6 +192,7 @@ static void __init dmi_id_init_attr_table(void)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 (fw_release,DMI_EMBEDDED_FW_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 );drivers/firmware/dmi_scan.c +1
-0@@ -467,6 +467,7 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)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_EMBEDDED_FW_RELEASE ,23 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );include/linux/mod_devicetable.h +1
-0@@ -533,6 +533,7 @@ enum dmi_field {DMI_BIOS_VERSION ,DMI_BIOS_DATE ,DMI_BIOS_RELEASE , +DMI_EMBEDDED_FW_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,scripts/mod/file2alias.c +0
-0scripts/mod/file2alias.c static const struct dmifield { · line 943
Quoted 7 lines
scripts/mod/file2alias.c +1
-0@@ -937,6 +937,7 @@ static const struct dmifield { { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, { "br", DMI_BIOS_RELEASE }, + { "efr", DMI_EMBEDDED_FW_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },Also, as already mentioned during my first review, please merge both patches together. They touch exactly the same areas, they are doing basically the same thing, and will never be backported individually, so splitting them creates more paperwork with no benefit.
--
Jean Delvare
SUSE L3 Support
Re: [PATCH 2/2] firmware/dmi: Report DMI Embedded Firmware release
In reply to Jean DelvareOn 06/02/2020 13:24, Jean Delvare wrote:
[...]
Quoted 4 lines
Also, as already mentioned during my first review, please merge both patches together. They touch exactly the same areas, they are doing basically the same thing, and will never be backported individually, so splitting them creates more paperwork with no benefit.
Jean,
I applied all your recommendations and submitted a new version of the patch.
Hope you'll like it this way.
Erwan,
Re: [PATCH 1/2] firmware/dmi: Report DMI Bios release
In reply to Erwan VeluHi Erwan,
Once again, sorry for the late answer.
Quoted 66 lines · Erwan Velu
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 ~]#This commit add
dmi_save_release()function have the logic to check if the field is valid. If so, it reports the actual value.Signed-off-by Erwan Velu <[email protected]>--- drivers/firmware/dmi-id.c | 3 +++ drivers/firmware/dmi_scan.c | 29 +++++++++++++++++++++++++++++ include/linux/mod_devicetable.h | 1 + scripts/mod/file2alias.c | 1 + 4 files changed, 34 insertions(+)drivers/firmware/dmi-id.c +3
-0@@ -42,6 +42,7 @@ 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 (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 +79,7 @@ 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 }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },@@ -187,6 +189,7 @@ 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 (sys_vendor,DMI_SYS_VENDOR );ADD_DMI_ATTR (product_name,DMI_PRODUCT_NAME );ADD_DMI_ATTR (product_version,DMI_PRODUCT_VERSION );drivers/firmware/dmi_scan.c +7
-0@@ -181,6 +181,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 */
drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 200
Quoted 10 lines
drivers/firmware/dmi_scan.c +10
-0+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[0 ] ==0xFF && minor[0 ] ==0xFF )
When using a pointer to a single entity, the common practice is to use *major rather than major[0].
drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 203
Quoted 3 lines
drivers/firmware/dmi_scan.c +3
-0+return ; + + s =dmi_alloc (4 );
4 bytes (3 + 1) were enough when you encoded a single byte. Now that you encode 2 bytes separates by a dot, you need 8 (3 + 1 + 3 + 1).
drivers/firmware/dmi_scan.c static void __init dmi_save_ident(const struct dmi_header *dm, int slot, · line 207
Quoted 4 lines
drivers/firmware/dmi_scan.c +4
-0+if (!s) +return ; + +sprintf (s,"%u.%u" , major[0 ], minor[0 ]);
Here too, *major would be preferred.
Quoted 39 lines
drivers/firmware/dmi_scan.c +5
-0+ + dmi_ident[slot] = s; +} +static void __init dmi_save_uuid (const struct dmi_header *dm,int slot,int index) {@@ -438,6 +466,7 @@ 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 );break ;case 1 :/* System Information */ dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );include/linux/mod_devicetable.h +1
-0@@ -532,6 +532,7 @@ enum dmi_field {DMI_BIOS_VENDOR ,DMI_BIOS_VERSION ,DMI_BIOS_DATE , +DMI_BIOS_RELEASE ,DMI_SYS_VENDOR ,DMI_PRODUCT_NAME , DMI_PRODUCT_VERSION,scripts/mod/file2alias.c +1
-0@@ -936,6 +936,7 @@ static const struct dmifield { { "bvn", DMI_BIOS_VENDOR }, { "bvr", DMI_BIOS_VERSION }, { "bd", DMI_BIOS_DATE }, + { "br", DMI_BIOS_RELEASE }, { "svn", DMI_SYS_VENDOR }, { "pn", DMI_PRODUCT_NAME }, { "pvr", DMI_PRODUCT_VERSION },
Signature · 2 lines
Jean Delvare SUSE L3 Support