In record type 45, the Firmware Version and Firmware ID fields have
an associated format fields. Originally I thought thought this had
little value and decided not to decode them, but on second thought,
this might be useful in certain situations.

Signed-off-by: Jean Delvare <[email protected]>
---
 dmidecode.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

--- dmidecode.orig/dmidecode.c
+++ dmidecode/dmidecode.c
@@ -4473,6 +4473,38 @@ static void dmi_tpm_characteristics(u64
  * 7.46 Firmware Inventory Information (Type 45)
  */
 
+static const char *dmi_firmware_version_format(u8 code)
+{
+       /* 7.46.1 */
+       static const char *format[] = {
+               "Free-form string", /* 0x00 */
+               "Major.minor",
+               "C-style hexadecimal string (32-bit)",
+               "C-style hexadecimal string (64-bit)" /* 0x03 */
+       };
+
+       if (code <= 0x03)
+               return format[code];
+       if (code >= 0x80)
+               return "OEM-specific";
+       return out_of_spec;
+}
+
+static const char *dmi_firmware_id_format(u8 code)
+{
+       /* 7.46.2 */
+       static const char *format[] = {
+               "Free-form string", /* 0x00 */
+               "UEFI" /* 0x01 */
+       };
+
+       if (code <= 0x01)
+               return format[code];
+       if (code >= 0x80)
+               return "OEM-specific";
+       return out_of_spec;
+}
+
 static void dmi_firmware_characteristics(u16 code)
 {
        /* 7.46.3 */
@@ -5605,8 +5637,14 @@ static void dmi_decode(const struct dmi_
                        if (h->length < 0x18) break;
                        pr_attr("Firmware Component Name", "%s",
                                dmi_string(h, data[0x04]));
+                       if (!(opt.flags & FLAG_QUIET))
+                               pr_attr("Firmware Version Format", "%s",
+                                       
dmi_firmware_version_format(data[0x06]));
                        pr_attr("Firmware Version", "%s",
                                dmi_string(h, data[0x05]));
+                       if (!(opt.flags & FLAG_QUIET))
+                               pr_attr("Firmware ID Format", "%s",
+                                       dmi_firmware_id_format(data[0x08]));
                        pr_attr("Firmware ID", "%s", dmi_string(h, data[0x07]));
                        pr_attr("Release Date", "%s", dmi_string(h, 
data[0x09]));
                        pr_attr("Manufacturer", "%s", dmi_string(h, 
data[0x0A]));


-- 
Jean Delvare
SUSE L3 Support

Reply via email to