Parse SMBIOS additional entries
Subsystems (2)
v3 cover Parse SMBIOS additional entries
The SMBIOS additional entries on AMD Zen4+ systems running an AGESA based BIOS contain information about the AGESA version which can be useful for matching the software stack when debugging an issue.
Add support for parsing this from SMBIOS tables and output it into the logs at bootup. Additionally export the information to debugfs in case users are interested in any other strings.
v3:
* Drop / merge patches from feedback
* Don't save additional strings, only show AGESA string if found
Mario Limonciello (1):
firmware: dmi: Add pr_fmt() for dmi_scan.c
Mario Limonciello (AMD) (4):
firmware: dmi: Correct an indexing error in dmi.h
firmware: dmi: Adjust dmi_decode() to use enums
firmware: dmi: Add missing DMI entry types
firmware: dmi: Read additional information when decoding DMI table
drivers/firmware/dmi_scan.c | 61 +++++++++++++++++++++++++++++-------- include/linux/dmi.h | 12 ++++++++ 2 files changed, 60 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/5 firmware: dmi: Correct an indexing error in dmi.h
The entries later in enum dmi_entry_type don't match the SMBIOS specification. The entry for type 33: 64-Bit Memory Error Information is not present and thus the index for all later entries is incorrect.
Add the missing type 33 entry.
---
v3:
* Rename to DMI_ENTRY_64_MEM_ERROR (Jean)
--- include/linux/dmi.h | 1 + 1 file changed, 1 insertion(+)
include/linux/dmi.h +1 -0
@@ -60,6 +60,7 @@ enum dmi_entry_type {DMI_ENTRY_OOB_REMOTE_ACCESS ,DMI_ENTRY_BIS_ENTRY ,DMI_ENTRY_SYSTEM_BOOT , +DMI_ENTRY_64_MEM_ERROR ,DMI_ENTRY_MGMT_DEV ,DMI_ENTRY_MGMT_DEV_COMPONENT , DMI_ENTRY_MGMT_DEV_THRES,
Signature · 1 line
2.43.0
PATCH v3 2/5 firmware: dmi: Adjust dmi_decode() to use enums
In reply to Mario Limonciello (AMD)dmi_decode() has hardcoded values with comments for each DMI entry type. The same information is already in dmi.h though, so drop the comments and use the definitions instead.
---
v3:
* pick up tag (Jean)
--- drivers/firmware/dmi_scan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/firmware/dmi_scan.c +9 -9
@@ -484,14 +484,14 @@ static void __init dmi_memdev_walk(void)static void __init dmi_decode (const struct dmi_header *dm,void *dummy) {switch (dm->type) { -case 0 :/* BIOS Information */ +case DMI_ENTRY_BIOS :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 );dmi_save_release (dm,DMI_EC_FIRMWARE_RELEASE ,23 );break ; -case 1 :/* System Information */ +case DMI_ENTRY_SYSTEM :dmi_save_ident (dm,DMI_SYS_VENDOR ,4 );dmi_save_ident (dm,DMI_PRODUCT_NAME ,5 );dmi_save_ident (dm,DMI_PRODUCT_VERSION ,6 );
@@ -500,33 +500,33 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy)dmi_save_ident (dm,DMI_PRODUCT_SKU ,25 );dmi_save_ident (dm,DMI_PRODUCT_FAMILY ,26 );break ; -case 2 :/* Base Board Information */ +case DMI_ENTRY_BASEBOARD :dmi_save_ident (dm,DMI_BOARD_VENDOR ,4 );dmi_save_ident (dm,DMI_BOARD_NAME ,5 );dmi_save_ident (dm,DMI_BOARD_VERSION ,6 );dmi_save_ident (dm,DMI_BOARD_SERIAL ,7 );dmi_save_ident (dm,DMI_BOARD_ASSET_TAG ,8 );break ; -case 3 :/* Chassis Information */ +case DMI_ENTRY_CHASSIS :dmi_save_ident (dm,DMI_CHASSIS_VENDOR ,4 );dmi_save_type (dm,DMI_CHASSIS_TYPE ,5 );dmi_save_ident (dm,DMI_CHASSIS_VERSION ,6 );dmi_save_ident (dm,DMI_CHASSIS_SERIAL ,7 );dmi_save_ident (dm,DMI_CHASSIS_ASSET_TAG ,8 );break ; -case 9 :/* System Slots */ +case DMI_ENTRY_SYSTEM_SLOT :dmi_save_system_slot (dm);break ; -case 10 :/* Onboard Devices Information */ +case DMI_ENTRY_ONBOARD_DEVICE :dmi_save_devices (dm);break ; -case 11 :/* OEM Strings */ +case DMI_ENTRY_OEMSTRINGS :dmi_save_oem_strings_devices (dm);break ; -case 38 :/* IPMI Device Information */ +case DMI_ENTRY_IPMI_DEV :dmi_save_ipmi_device (dm);break ; -case 41 :/* Onboard Devices Extended Information */ +case DMI_ENTRY_ONBOARD_DEV_EXT :dmi_save_extended_devices (dm); } }
Signature · 1 line
2.43.0
PATCH v3 3/5 firmware: dmi: Add missing DMI entry types
In reply to Mario Limonciello (AMD)Type 42 through type 46 entry types are missing from the definitions in the dmi_entry_type enum.
---
v3:
* Add tag (Jean)
--- include/linux/dmi.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/dmi.h +4 -0
@@ -70,6 +70,10 @@ enum dmi_entry_type {DMI_ENTRY_ADDITIONAL ,DMI_ENTRY_ONBOARD_DEV_EXT ,DMI_ENTRY_MGMT_CONTROLLER_HOST , +DMI_ENTRY_TPM_DEVICE , +DMI_ENTRY_PROCESSOR_ADDITIONAL , +DMI_ENTRY_FIRMWARE_INVENTORY , +DMI_ENTRY_STRING_PROPERTY ,DMI_ENTRY_INACTIVE =126 , DMI_ENTRY_END_OF_TABLE = 127, };
Signature · 1 line
2.43.0
PATCH v3 4/5 firmware: dmi: Add pr_fmt() for dmi_scan.c
In reply to Mario Limonciello (AMD)From: Mario Limonciello <[email protected]>
Several prints inconsistently use DMI: or dmi: or nothing. To make it clear which prints come from dmi_scan.c, add a pr_fmt macro.
--- drivers/firmware/dmi_scan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/firmware/dmi_scan.c +7 -4
@@ -1,4 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only + +#define pr_fmt (fmt) "DMI: " fmt +#include <linux/types.h> #include <linux/string.h> #include <linux/init.h>
@@ -634,7 +637,7 @@ static int __init dmi_present(const u8 *buf) dmi_ver >> 16, (dmi_ver >> 8) & 0xFF); }dmi_format_ids (dmi_ids_string,sizeof (dmi_ids_string)); -pr_info ("DMI: %s\n" , dmi_ids_string); +pr_info ("%s\n" , dmi_ids_string);return 0 ; } }
@@ -663,7 +666,7 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_ver >>16 , (dmi_ver >>8 ) &0xFF , dmi_ver & 0xFF);dmi_format_ids (dmi_ids_string,sizeof (dmi_ids_string)); -pr_info ("DMI: %s\n" , dmi_ids_string); +pr_info ("%s\n" , dmi_ids_string);return 0 ; } }
@@ -810,7 +813,7 @@ static int __init dmi_init(void)kobject_del (tables_kobj);kobject_put (tables_kobj); err: -pr_err ("dmi: Firmware registration failed.\n" ); +pr_err ("Firmware registration failed.\n" );return ret; }
@@ -831,7 +834,7 @@ void __init dmi_setup(void)return ;dmi_memdev_walk (); -pr_info ("DMI: Memory slots populated: %d/%d\n" , +pr_info ("Memory slots populated: %d/%d\n" , dmi_memdev_populated_nr, dmi_memdev_nr);dump_stack_set_arch_desc ("%s" , dmi_ids_string); }
Signature · 1 line
2.43.0
PATCH v3 5/5 firmware: dmi: Read additional information when decoding DMI table
In reply to Mario Limonciello (AMD)Type 40 entries (Additional information) are summarized in section 7.41 as part of the SMBIOS specification. These entries aren't all interesting enough to save, but on some AMD Zen systems the AGESA version is stored here and can be useful to save into debugging logs for cross referencing issues when reported.
---
v3:
* Merge patch to show AGESA version (Jean)
* Don't save strings (Jean)
* Avoid out of bounds (Jean)
--- drivers/firmware/dmi_scan.c | 32 ++++++++++++++++++++++++++++++++ include/linux/dmi.h | 7 +++++++ 2 files changed, 39 insertions(+)
drivers/firmware/dmi_scan.c +32 -0
@@ -396,6 +396,34 @@ static void __init dmi_save_dev_pciaddr(int instance, int segment, int bus,list_add (&dev->dev.list, &dmi_devices); } +static void __init dmi_scan_additional (const struct dmi_additional_info *info) +{ +const u8 *data; +int i; + +if (!info || info->header.length <5 ) +return ; + + data = info->entries; + +for (i =0 ; i < info->count; i++) { +u8 string_num = data[i *5 +4 ]; +const char *string_ptr; +int len; + + string_ptr =dmi_string_nosave (&info->header, string_num); +if (!string_ptr || !*string_ptr) +continue ; + + len =strlen (string_ptr); +if (len ==0 ) +continue ; + +if (!strncmp (string_ptr,"AGESA" ,5 )) +pr_info ("%s\n" , string_ptr); + } +} +static void __init dmi_save_extended_devices (const struct dmi_header *dm) {const char *name;
@@ -529,8 +557,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_scan_additional ((const struct dmi_additional_info *)dm); +break ;case DMI_ENTRY_ONBOARD_DEV_EXT :dmi_save_extended_devices (dm); +break ; } }
include/linux/dmi.h +7 -0
@@ -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 {
@@ -91,6 +92,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 {
Signature · 1 line
2.43.0
Quoted 12 lines · Mario Limonciello (AMD)
The SMBIOS additional entries on AMD Zen4+ systems running an AGESA based BIOS contain information about the AGESA version which can be useful for matching the software stack when debugging an issue.
Add support for parsing this from SMBIOS tables and output it into the logs at bootup. Additionally export the information to debugfs in case users are interested in any other strings.
v3:
* Drop / merge patches from feedback
* Don't save additional strings, only show AGESA string if found
Quoted 9 lines
Mario Limonciello (1):
firmware: dmi: Addpr_fmt()fordmi_scan.cMario Limonciello (AMD) (4):
firmware: dmi: Correct an indexing error indmi.h
firmware: dmi: Adjustdmi_decode()to use enums
firmware: dmi: Add missing DMI entry types
firmware: dmi: Read additional information when decoding DMI table
One patch is authored with a different email. Is this intentional?
Not a problem, but wanted to ask just in case.
Thanks,
Yazen
Quoted 23 lines · Yazen Ghannam
Quoted 12 lines · Mario Limonciello (AMD)
The SMBIOS additional entries on AMD Zen4+ systems running an AGESA based BIOS contain information about the AGESA version which can be useful for matching the software stack when debugging an issue.
Add support for parsing this from SMBIOS tables and output it into the logs at bootup. Additionally export the information to debugfs in case users are interested in any other strings.
v3:
* Drop / merge patches from feedback
* Don't save additional strings, only show AGESA string if foundQuoted 9 lines
Mario Limonciello (1):
firmware: dmi: Addpr_fmt()fordmi_scan.cMario Limonciello (AMD) (4):
firmware: dmi: Correct an indexing error indmi.h
firmware: dmi: Adjustdmi_decode()to use enums
firmware: dmi: Add missing DMI entry types
firmware: dmi: Read additional information when decoding DMI table
Quoted 4 lines
One patch is authored with a different email. Is this intentional?
Not a problem, but wanted to ask just in case.
It was an oversight because I worked on two different machines and forgot I had git configured differently when I made the commits.
If there are other changes needed for the series I'll fix it in next version, otherwise leaving it as is is totally fine for me.
Re: [PATCH v3 3/5] firmware: dmi: Add missing DMI entry types
In reply to Mario Limonciello (AMD)Quoted 1 line · Mario Limonciello (AMD)
Type 42 through type 46 entry types are missing from the
Should be 43 through 46.
Thanks,
Yazen
Quoted 31 lines
definitions in the
dmi_entry_typeenum.Suggested-by Yazen Ghannam <[email protected]>Reviewed-by Jean Delvare <[email protected]>Signed-off-by Mario Limonciello (AMD) <[email protected]>---
v3:
* Add tag (Jean)--- include/linux/dmi.h | 4 ++++ 1 file changed, 4 insertions(+)include/linux/dmi.h +4
-0@@ -70,6 +70,10 @@ enum dmi_entry_type {DMI_ENTRY_ADDITIONAL ,DMI_ENTRY_ONBOARD_DEV_EXT ,DMI_ENTRY_MGMT_CONTROLLER_HOST , +DMI_ENTRY_TPM_DEVICE , +DMI_ENTRY_PROCESSOR_ADDITIONAL , +DMI_ENTRY_FIRMWARE_INVENTORY , +DMI_ENTRY_STRING_PROPERTY ,DMI_ENTRY_INACTIVE =126 , DMI_ENTRY_END_OF_TABLE = 127, };Signature · 1 line
2.43.0
Re: [PATCH v3 4/5] firmware: dmi: Add pr_fmt() for dmi_scan.c
In reply to Mario Limonciello (AMD)Quoted 52 lines · Mario Limonciello (AMD)
From: Mario Limonciello <[email protected]>
Several prints inconsistently use DMI: or dmi: or nothing. To make it clear which prints come from
dmi_scan.c, add apr_fmtmacro.Signed-off-by Mario Limonciello <[email protected]>--- drivers/firmware/dmi_scan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/firmware/dmi_scan.c +6
-3@@ -1,4 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only + +#define pr_fmt (fmt) "DMI: " fmt +#include <linux/types.h> #include <linux/string.h> #include <linux/init.h> @@ -634,7 +637,7 @@ static int __init dmi_present(const u8 *buf) dmi_ver >> 16, (dmi_ver >> 8) & 0xFF); }dmi_format_ids (dmi_ids_string,sizeof (dmi_ids_string)); -pr_info ("DMI: %s\n" , dmi_ids_string); +pr_info ("%s\n" , dmi_ids_string);return 0 ; } }@@ -663,7 +666,7 @@ static int __init dmi_smbios3_present(const u8 *buf) dmi_ver >>16 , (dmi_ver >>8 ) &0xFF , dmi_ver & 0xFF);dmi_format_ids (dmi_ids_string,sizeof (dmi_ids_string)); -pr_info ("DMI: %s\n" , dmi_ids_string); +pr_info ("%s\n" , dmi_ids_string);return 0 ; } }@@ -810,7 +813,7 @@ static int __init dmi_init(void)kobject_del (tables_kobj);kobject_put (tables_kobj); err: -pr_err ("dmi: Firmware registration failed.\n" ); +pr_err ("Firmware registration failed.\n" );return ret; }
drivers/firmware/dmi_scan.c void __init dmi_setup(void) · line 840
Quoted 8 lines
drivers/firmware/dmi_scan.c +1
-1@@ -831,7 +834,7 @@ void __init dmi_setup(void)return ;dmi_memdev_walk (); -pr_info ("DMI: Memory slots populated: %d/%d\n" , +pr_info ("Memory slots populated: %d/%d\n" , dmi_memdev_populated_nr, dmi_memdev_nr);dump_stack_set_arch_desc ("%s" , dmi_ids_string); }
What about dropping "DMI" from this one too?
pr_info("DMI not present or invalid.\n");Thanks,
Yazen
Re: [PATCH v3 5/5] firmware: dmi: Read additional information when decoding DMI table
In reply to Mario Limonciello (AMD)Quoted 6 lines · Mario Limonciello (AMD)
Type 40 entries (Additional information) are summarized in section 7.41 as part of the SMBIOS specification. These entries aren't all interesting enough to save, but on some AMD Zen systems the AGESA version is stored here and can be useful to save into debugging logs for cross referencing issues when reported.
Should have imperative voice.
Quoted 76 lines
Signed-off-by Mario Limonciello (AMD) <[email protected]>---
v3:
* Merge patch to show AGESA version (Jean)
* Don't save strings (Jean)
* Avoid out of bounds (Jean)--- drivers/firmware/dmi_scan.c | 32 ++++++++++++++++++++++++++++++++ include/linux/dmi.h | 7 +++++++ 2 files changed, 39 insertions(+)drivers/firmware/dmi_scan.c +32
-0@@ -396,6 +396,34 @@ static void __init dmi_save_dev_pciaddr(int instance, int segment, int bus,list_add (&dev->dev.list, &dmi_devices); } +static void __init dmi_scan_additional (const struct dmi_additional_info *info) +{ +const u8 *data; +int i; + +if (!info || info->header.length <5 ) +return ; + + data = info->entries; + +for (i =0 ; i < info->count; i++) { +u8 string_num = data[i *5 +4 ]; +const char *string_ptr; +int len; + + string_ptr =dmi_string_nosave (&info->header, string_num); +if (!string_ptr || !*string_ptr) +continue ; + + len =strlen (string_ptr); +if (len ==0 ) +continue ; + +if (!strncmp (string_ptr,"AGESA" ,5 )) +pr_info ("%s\n" , string_ptr); + } +} +static void __init dmi_save_extended_devices (const struct dmi_header *dm) {const char *name;@@ -529,8 +557,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_scan_additional ((const struct dmi_additional_info *)dm); +break ;case DMI_ENTRY_ONBOARD_DEV_EXT :dmi_save_extended_devices (dm); +break ; } }include/linux/dmi.h +1
-0@@ -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 {
include/linux/dmi.h struct dmi_device { · line 99
Quoted 8 lines
include/linux/dmi.h +5
-0@@ -91,6 +92,12 @@ struct dmi_device {void *device_data;/* Type specific data */ }; +struct dmi_additional_info { +struct dmi_header header; +u8 count; +u8 entries[]; +} __packed;
This is wrong. The "entries" are not u8. They are structs with this format:
Table 119 – Additional Information Entry format
struct dmi_additional_info_entry {
u8 length;
u16 handle;
u8 offset;
u8 string
/* Variable length "Value" */
} __packed; ACPI tables do this a lot. So there are examples of iterating over variable length entries.
Thanks,
Yazen
Re: [PATCH v3 5/5] firmware: dmi: Read additional information when decoding DMI table
Quoted 2 lines · Yazen Ghannam
On Sat, Jan 10, 2026 at 07:48:34AM -0600, Mario Limonciello (AMD) wrote:
[...]
Quoted 2 lines
ACPI tables do this a lot. So there are examples of iterating over variable length entries.
Here's another implementation. What do you think?
Thanks,
Yazen
From c76f27e5d55570bb25bcefc3365fb3a1852bcad3 Mon Sep 17 00:00:00 2001
From: Yazen Ghannam <[email protected]>
Date: Mon, 19 Jan 2026 18:33:09 +0000
Subject: [PATCH] x86/CPU/AMD: Print AGESA string from DMI additional
information entry
Type 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +53 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h>
@@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p) +{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end; + +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/ +if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/* +* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length; + +do { +struct dmi_a_info_entry *entry; +const char *string_ptr; + + entry = (struct dmi_a_info_entry *)next; + +/* +* Not much can be done to validate data. At least the entry +* length shouldn't be 0. +*/ +if (!entry->length) +return ; + + string_ptr =dmi_string_nosave (&info->header, entry->str_num); + +/* Only one AGESA string is expected. */ +if (!strncmp (string_ptr,"AGESA" ,5 )) { +pr_info ("%s\n" , string_ptr); +break ; + } + + next += entry->length; + }while (end - next >=DMI_A_INFO_ENT_MIN_SIZE ); +} + +static __init int print_dmi_agesa (void ) +{ +dmi_walk (amd_dmi_scan_additional,NULL ); +return 0 ; +} +late_initcall (print_dmi_agesa);
drivers/firmware/dmi_scan.c +2 -1
@@ -47,7 +47,7 @@ static struct dmi_memdev_info {static int dmi_memdev_nr;static int dmi_memdev_populated_nr__initdata ; -static const char *__init dmi_string_nosave (const struct dmi_header *dm,u8 s) +const char *dmi_string_nosave (const struct dmi_header *dm,u8 s) {const u8 *bp = ((u8 *) dm) + dm->length;const u8 *nsp;
@@ -66,6 +66,7 @@ static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)return dmi_empty_string; } +EXPORT_SYMBOL_GPL (dmi_string_nosave);static const char *__init dmi_string (const struct dmi_header *dm,u8 s) {
include/linux/dmi.h +18 -0
@@ -91,6 +91,21 @@ struct dmi_device {void *device_data;/* Type specific data */ }; +#define DMI_A_INFO_ENT_MIN_SIZE 0x6 +struct dmi_a_info_entry { +u8 length; +u16 handle; +u8 offset; +u8 str_num; +u8 value[]; +} __packed; + +#define DMI_A_INFO_MIN_SIZE 0xB +struct dmi_a_info { +struct dmi_header header; +u8 count; +} __packed; +#ifdef CONFIG_DMI struct dmi_dev_onboard {
@@ -120,6 +135,7 @@ extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);extern u64 dmi_memdev_size (u16 handle);extern u8 dmi_memdev_type (u16 handle);extern u16 dmi_memdev_handle (int slot); +const char *dmi_string_nosave (const struct dmi_header *dm,u8 s);#else
@@ -153,6 +169,8 @@ static inline u8 dmi_memdev_type(u16 handle) { return 0x0; }static inline u16 dmi_memdev_handle (int slot) {return 0xffff ; }static inline const struct dmi_system_id *dmi_first_match (const struct dmi_system_id *list) {return NULL ; } +static inline const char * +dmi_string_nosave (const struct dmi_header *dm,u8 s) {return NULL ; }#endif
Signature · 1 line
2.52.0
Re: [PATCH v3 5/5] firmware: dmi: Read additional information when decoding DMI table
Quoted 10 lines · Yazen Ghannam
Quoted 2 lines · Yazen Ghannam
On Sat, Jan 10, 2026 at 07:48:34AM -0600, Mario Limonciello (AMD) wrote:
[...]
Quoted 2 lines
ACPI tables do this a lot. So there are examples of iterating over variable length entries.
Here's another implementation. What do you think?
Oh you beat me to it, been busy this week.
I do like that we can localize the printing code to amd.c. I'll test it and let you know if it works.
If it does; I'll roll it into the series.
Quoted 163 lines
Thanks,
YazenFrom
c76f27e5d55570bb25bcefc3365fb3a1852bcad3Mon Sep 17 00:00:00 2001
From: Yazen Ghannam <[email protected]>
Date: Mon, 19 Jan 2026 18:33:09 +0000
Subject: [PATCH] x86/CPU/AMD: Print AGESA string from DMI additional
information entryType 40 entries (Additional Information) are summarized in section 7.41 as part of the SMBIOS specification. Generally, these entries aren't interesting to save.
However on some AMD Zen systems, the AGESA version is stored here. This is useful to save to the kernel message logs for debugging. It can be used to cross-reference issues.
Implement an iterator for the Additional Information entries. Use this to find and print the AGESA string. Do so in AMD code, since the use case is AMD-specific.
Originally-by "Mario Limonciello (AMD)" <[email protected]>Signed-off-by Yazen Ghannam <[email protected]>--- arch/x86/kernel/cpu/amd.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/firmware/dmi_scan.c | 3 ++- include/linux/dmi.h | 18 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/amd.c +53
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/export.h> #include <linux/bitops.h> +#include <linux/dmi.h> #include <linux/elf.h> #include <linux/mm.h> #include <linux/kvm_types.h> @@ -1404,3 +1405,55 @@ static __init int print_s5_reset_status_mmio(void)return 0 ; }late_initcall (print_s5_reset_status_mmio); + +static void __init amd_dmi_scan_additional (const struct dmi_header *d,void *p) +{ +struct dmi_a_info *info = (struct dmi_a_info *)d; +void *next, *end; + +/* +* DMI Additional Info table has a 'count' field. But it's not very +* helpful since the entries are variable length. So don't use it. +*/ +if (info->header.type !=DMI_ENTRY_ADDITIONAL || + info->header.length <DMI_A_INFO_MIN_SIZE ) +return ; + +/* +* Get the first entry. +* The minimum table size guarantees at least one entry is present. +*/ + next = (void *)(info +1 ); + end = (void *)info + info->header.length; + +do { +struct dmi_a_info_entry *entry; +const char *string_ptr; + + entry = (struct dmi_a_info_entry *)next; + +/* +* Not much can be done to validate data. At least the entry +* length shouldn't be 0. +*/ +if (!entry->length) +return ; + + string_ptr =dmi_string_nosave (&info->header, entry->str_num); + +/* Only one AGESA string is expected. */ +if (!strncmp (string_ptr,"AGESA" ,5 )) { +pr_info ("%s\n" , string_ptr); +break ; + } + + next += entry->length; + }while (end - next >=DMI_A_INFO_ENT_MIN_SIZE ); +} + +static __init int print_dmi_agesa (void ) +{ +dmi_walk (amd_dmi_scan_additional,NULL ); +return 0 ; +} +late_initcall (print_dmi_agesa);drivers/firmware/dmi_scan.c +2
-1@@ -47,7 +47,7 @@ static struct dmi_memdev_info {static int dmi_memdev_nr;static int dmi_memdev_populated_nr__initdata ; -static const char *__init dmi_string_nosave (const struct dmi_header *dm,u8 s) +const char *dmi_string_nosave (const struct dmi_header *dm,u8 s) {const u8 *bp = ((u8 *) dm) + dm->length;const u8 *nsp;@@ -66,6 +66,7 @@ static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)return dmi_empty_string; } +EXPORT_SYMBOL_GPL (dmi_string_nosave);static const char *__init dmi_string (const struct dmi_header *dm,u8 s) {include/linux/dmi.h +18
-0@@ -91,6 +91,21 @@ struct dmi_device {void *device_data;/* Type specific data */ }; +#define DMI_A_INFO_ENT_MIN_SIZE 0x6 +struct dmi_a_info_entry { +u8 length; +u16 handle; +u8 offset; +u8 str_num; +u8 value[]; +} __packed; + +#define DMI_A_INFO_MIN_SIZE 0xB +struct dmi_a_info { +struct dmi_header header; +u8 count; +} __packed; +#ifdef CONFIG_DMI struct dmi_dev_onboard {@@ -120,6 +135,7 @@ extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);extern u64 dmi_memdev_size (u16 handle);extern u8 dmi_memdev_type (u16 handle);extern u16 dmi_memdev_handle (int slot); +const char *dmi_string_nosave (const struct dmi_header *dm,u8 s);#else @@ -153,6 +169,8 @@ static inline u8 dmi_memdev_type(u16 handle) { return 0x0; }static inline u16 dmi_memdev_handle (int slot) {return 0xffff ; }static inline const struct dmi_system_id *dmi_first_match (const struct dmi_system_id *list) {return NULL ; } +static inline const char * +dmi_string_nosave (const struct dmi_header *dm,u8 s) {return NULL ; }#endif
Re: [PATCH v3 5/5] firmware: dmi: Read additional information when decoding DMI table
Quoted 10 lines · Mario Limonciello
Quoted 9 lines · Yazen Ghannam
Quoted 2 lines · Yazen Ghannam
On Sat, Jan 10, 2026 at 07:48:34AM -0600, Mario Limonciello (AMD) wrote:
[...]
Quoted 2 lines
ACPI tables do this a lot. So there are examples of iterating over variable length entries.
Quoted 9 lines
Quoted 1 line
Here's another implementation. What do you think?
Oh you beat me to it, been busy this week.
I do like that we can localize the printing code to
amd.c. I'll test it and let you know if it works.If it does; I'll roll it into the series.
Good deal, thanks!
[...]
Quoted 9 lines
Quoted 9 lines
arch/x86/kernel/cpu/amd.c +9
-0+ + string_ptr =dmi_string_nosave (&info->header, entry->str_num); + +/* Only one AGESA string is expected. */ +if (!strncmp (string_ptr,"AGESA" ,5 )) { +pr_info ("%s\n" , string_ptr); +break ; + } +
[...]
Quoted 2 lines
include/linux/dmi.h static inline u8 dmi_memdev_type(u16 handle) { return 0x0; } · line 173
Quoted 2 lines
include/linux/dmi.h +2
-0+static inline const char * +dmi_string_nosave (const struct dmi_header *dm,u8 s) {return NULL ; }
Found a bug. :/
The default return value should be "dmi_empty_string".
Thanks,
Yazen