dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] dmidecode: Add support for type 44 entries


From: Armin Wolf
Subject: [PATCH 1/3] dmidecode: Add support for type 44 entries
Date: Tue, 19 Dec 2023 01:43:24 +0100

Type 44 is called "Processor Additional Information" and provides
additional information about the installed processor.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 dmidecode.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/dmidecode.c b/dmidecode.c
index 77cb2fc..d1b179b 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4331,6 +4331,51 @@ static void dmi_tpm_characteristics(u64 code)
                        pr_list_item("%s", characteristics[i - 2]);
 }

+/*
+ * 7.45 Processor Additional Information (Type 44)
+ */
+
+static void dmi_processor_specific_block(const u8 *data, u8 length)
+{
+       static const char *architectures[] = {
+               "Reserved",
+               "x86",
+               "x86-64",
+               "Intel Itanium",
+               "Aarch32",
+               "Aarch64",
+               "RV32",
+               "RV64",
+               "RV128",
+               "LoongArch32",
+               "LoongArch64" /* 0x0A */
+       };
+       u8 block_length, processor_type;
+       int i;
+
+       if (length < 0x02)
+               return;
+
+       block_length = data[0x00];
+       if (block_length + 0x02 > length)
+               block_length = length;
+
+       processor_type = data[0x01];
+       if (processor_type > 0x0A)
+               pr_attr("Processor Type", out_of_spec);
+       else
+               pr_attr("Processor Type", "%s", architectures[processor_type]);
+
+       if (block_length == 0)
+               return;
+
+       pr_list_start("Processor-Specific Data", NULL);
+       for (i = 0; i < block_length; i++)
+               pr_list_item("%02X", data[i + 0x02]);
+
+       pr_list_end();
+}
+
 /*
  * 7.46 Firmware Inventory Information (Type 45)
  */
@@ -5435,6 +5480,15 @@ static void dmi_decode(const struct dmi_header *h, u16 
ver)
                                DWORD(data + 0x1B));
                        break;

+               case 44: /* 7.45 Processor Additional Information */
+                       pr_handle_name("Processor Additional Information");
+                       if (h->length < 0x06)
+                               break;
+
+                       pr_attr("Referenced Handle", "0x%04X", WORD(data + 
0x04));
+                       dmi_processor_specific_block(data + 0x06, h->length - 
0x06);
+                       break;
+
                case 45: /* 7.46 Firmware Inventory Information */
                        pr_handle_name("Firmware Inventory Information");
                        if (h->length < 0x18) break;
--
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]