dmidecode/0002-dmioem-Decode-Dell-specific-DMI-type-218.patch
Lichen Liu 03b0d1462a
update to upstream fa268715
Resolves: RHEL-99252

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2025-10-14 13:48:30 +08:00

104 lines
2.6 KiB
Diff

From cb1100560615c2d015f3917fe48ea5b244e8fe31 Mon Sep 17 00:00:00 2001
From: Armin Wolf <W_Armin@gmx.de>
Date: Fri, 5 Jul 2024 14:30:05 +0200
Subject: [PATCH 02/45] dmioem: Decode Dell-specific DMI type 218
OEM DMI type 218 is used by the dell-smbios-base driver to retrieve
information about the Dell Token Interface. Include the available
information in the output of dmidecode.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
dmioem.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/dmioem.c b/dmioem.c
index 144bf3f..b6b0f49 100644
--- a/dmioem.c
+++ b/dmioem.c
@@ -38,6 +38,7 @@ enum DMI_VENDORS
{
VENDOR_UNKNOWN,
VENDOR_ACER,
+ VENDOR_DELL,
VENDOR_HP,
VENDOR_HPE,
VENDOR_IBM,
@@ -56,6 +57,8 @@ void dmi_set_vendor(const char *v, const char *p)
{
const struct { const char *str; enum DMI_VENDORS id; } vendor[] = {
{ "Acer", VENDOR_ACER },
+ { "Dell Computer Corporation", VENDOR_DELL },
+ { "Dell Inc.", VENDOR_DELL },
{ "HP", VENDOR_HP },
{ "Hewlett-Packard", VENDOR_HP },
{ "HPE", VENDOR_HPE },
@@ -129,6 +132,54 @@ static int dmi_decode_acer(const struct dmi_header *h)
return 1;
}
+/*
+ * Dell-specific data structures are decoded here.
+ */
+
+static void dmi_dell_token_interface(const struct dmi_header *h)
+{
+ int tokens = (h->length - 0x0B) / 0x06;
+ u8 *data = h->data;
+ u8 *token;
+
+ pr_attr("Command I/O Address", "0x%04x", WORD(data + 0x04));
+ pr_attr("Command I/O Code", "0x%02x", data[0x06]);
+ pr_attr("Supported Command Classes Bitmap", "0x%08x", DWORD(data + 0x07));
+
+ /*
+ * Final token is a terminator, so we ignore it.
+ */
+ if (tokens <= 1)
+ return;
+
+ pr_list_start("Tokens", NULL);
+ for (int i = 0; i < tokens - 1; i++)
+ {
+ token = data + 0x0B + 0x06 * i;
+ pr_list_item("0x%04hx (location 0x%04hx, value 0x%04hx)",
+ WORD(token + 0x00), WORD(token + 0x02),
+ WORD(token + 0x04));
+ }
+ pr_list_end();
+}
+
+static int dmi_decode_dell(const struct dmi_header *h)
+{
+ switch (h->type)
+ {
+ case 218:
+ pr_handle_name("Dell Token Interface");
+ if (h->length < 0x0B) break;
+ dmi_dell_token_interface(h);
+ break;
+
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
/*
* HPE-specific data structures are decoded here.
*
@@ -1708,6 +1759,8 @@ int dmi_decode_oem(const struct dmi_header *h)
return dmi_decode_hp(h);
case VENDOR_ACER:
return dmi_decode_acer(h);
+ case VENDOR_DELL:
+ return dmi_decode_dell(h);
case VENDOR_IBM:
case VENDOR_LENOVO:
return dmi_decode_ibm_lenovo(h);
--
2.47.0