public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: Yazen Ghannam <yazen.ghannam@amd.com>,
	x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
	Jean Delvare <jdelvare@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	"Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table
Date: Sun, 14 Dec 2025 12:53:07 -0600	[thread overview]
Message-ID: <20251214185309.152614-4-superm1@kernel.org> (raw)
In-Reply-To: <20251214185309.152614-1-superm1@kernel.org>

Type 40 entries (Additional information) are summarized in section
7.41 as part of the SMBIOS specification.  Save these entries when
decoding the DMI tables.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
 drivers/firmware/dmi_scan.c | 46 +++++++++++++++++++++++++++++++++++++
 include/linux/dmi.h         |  7 ++++++
 2 files changed, 53 insertions(+)

diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 80aded4c778bc..f7b7ed1d872e8 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -393,6 +393,48 @@ static void __init dmi_save_dev_pciaddr(int instance, int segment, int bus,
 	list_add(&dev->dev.list, &dmi_devices);
 }
 
+static void __init dmi_save_additional(const struct dmi_additional_info *info)
+{
+	const char *strings;
+	const u8 *data;
+	int count = 0;
+	int i;
+
+	if (!info || info->header.length < 5 + info->count * 5)
+		return;
+
+	data = info->entries;
+	strings = (const char *)(data + info->count * 5);
+
+	for (i = 0; i < info->count; i++) {
+		u8 entry_length = data[i * 5];
+		u8 string_num = data[i * 5 + 4];
+		const char *string_ptr;
+		char *value;
+		int len;
+
+		if (entry_length < 5 || string_num == 0)
+			continue;
+
+		string_ptr = dmi_string_nosave(&info->header, string_num);
+		if (!string_ptr || !*string_ptr)
+			continue;
+
+		len = strlen(string_ptr);
+		if (len == 0)
+			continue;
+
+		value = dmi_alloc(len + 1);
+		if (!value)
+			continue;
+
+		strscpy(value, string_ptr, len + 1);
+
+		dmi_save_one_device(DMI_DEV_TYPE_ADDITIONAL, value);
+		count++;
+	}
+}
+
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
 	const char *name;
@@ -526,8 +568,12 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 	case DMI_ENTRY_IPMI_DEV:
 		dmi_save_ipmi_device(dm);
 		break;
+	case DMI_ENTRY_ADDITIONAL:
+		dmi_save_additional((const struct dmi_additional_info *)dm);
+		break;
 	case DMI_ENTRY_ONBOARD_DEV_EXT:
 		dmi_save_extended_devices(dm);
+		break;
 	}
 }
 
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a809b5095c259..3fc3d334b321d 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -24,6 +24,7 @@ enum dmi_device_type {
 	DMI_DEV_TYPE_OEM_STRING = -2,
 	DMI_DEV_TYPE_DEV_ONBOARD = -3,
 	DMI_DEV_TYPE_DEV_SLOT = -4,
+	DMI_DEV_TYPE_ADDITIONAL = -5,
 };
 
 enum dmi_entry_type {
@@ -87,6 +88,12 @@ struct dmi_device {
 	void *device_data;	/* Type specific data */
 };
 
+struct dmi_additional_info {
+	struct dmi_header header;
+	u8 count;
+	u8 entries[];
+} __packed;
+
 #ifdef CONFIG_DMI
 
 struct dmi_dev_onboard {
-- 
2.43.0


  parent reply	other threads:[~2025-12-14 18:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-14 18:53 [PATCH 0/5] Parse SMBIOS additional entries Mario Limonciello (AMD)
2025-12-14 18:53 ` [PATCH 1/5] firmware: dmi: Correct an indexing error in dmi.h Mario Limonciello (AMD)
2025-12-15 21:11   ` Yazen Ghannam
2025-12-15 21:24     ` Mario Limonciello
2025-12-14 18:53 ` [PATCH 2/5] firmware: dmi: Adjust dmi_decode() to use enums Mario Limonciello (AMD)
2025-12-15 21:12   ` Yazen Ghannam
2025-12-14 18:53 ` Mario Limonciello (AMD) [this message]
2025-12-15  4:31   ` [PATCH 3/5] firmware: dmi: Read additional information when decoding DMI table kernel test robot
2025-12-15  5:06   ` kernel test robot
2025-12-15 12:47   ` kernel test robot
2025-12-14 18:53 ` [PATCH 4/5] firmware: dmi: Add debugfs for additional information entries Mario Limonciello (AMD)
2025-12-14 18:53 ` [PATCH 5/5] x86/amd_node: Output the AGESA version to the logs Mario Limonciello (AMD)
2025-12-15 21:23   ` Yazen Ghannam
2025-12-15 21:25     ` Mario Limonciello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251214185309.152614-4-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jdelvare@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox