[PATCH 1/1] cmd: smbios: correct output for table type 4
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Sun Nov 16 11:39:34 CET 2025
In the QFW case the SMBIOS specification version is controlled by QEMU.
Field 'Thread Enable' is not available before SMBIOS v3.6.
We should not print the core, core enabled, and thread counts twice.
Use the appropriate based on the SMBIOS version.
Use decimal output which is easier to read for humans.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
cmd/smbios.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/cmd/smbios.c b/cmd/smbios.c
index 671c14e05b5..f9a352c107d 100644
--- a/cmd/smbios.c
+++ b/cmd/smbios.c
@@ -262,6 +262,8 @@ static const struct str_lookup_table md_tech_strings[] = {
{ SMBIOS_MD_TECH_OPTANE, "Intel Optane persistent memory" },
};
+static u16 smbios_version;
+
/**
* smbios_get_string() - get SMBIOS string from table
*
@@ -504,18 +506,23 @@ static void smbios_print_type4(struct smbios_type4 *table)
smbios_print_str("Serial Number", table, table->serial_number);
smbios_print_str("Asset Tag", table, table->asset_tag);
smbios_print_str("Part Number", table, table->part_number);
- printf("\tCore Count: 0x%02x\n", table->core_count);
- printf("\tCore Enabled: 0x%02x\n", table->core_enabled);
- printf("\tThread Count: 0x%02x\n", table->thread_count);
+ if (smbios_version < 0x0300) {
+ printf("\tCore Count: %d\n", table->core_count);
+ printf("\tCore Enabled: %d\n", table->core_enabled);
+ printf("\tThread Count: %d\n", table->thread_count);
+ } else {
+ printf("\tCore Count: %d\n", table->core_count2);
+ printf("\tCore Enabled: %d\n", table->core_enabled2);
+ printf("\tThread Count: %d\n", table->thread_count2);
+ }
printf("\tProcessor Characteristics: 0x%04x\n",
table->processor_characteristics);
smbios_print_lookup_str(processor_family_strings,
table->processor_family2,
ARRAY_SIZE(processor_family_strings),
"Processor Family 2");
- printf("\tCore Count 2: 0x%04x\n", table->core_count2);
- printf("\tCore Enabled 2: 0x%04x\n", table->core_enabled2);
- printf("\tThread Count 2: 0x%04x\n", table->thread_count2);
+ if (smbios_version < 0x0306)
+ return;
printf("\tThread Enabled: 0x%04x\n", table->thread_enabled);
}
@@ -719,6 +726,8 @@ static int do_smbios(struct cmd_tbl *cmdtp, int flag, int argc,
struct smbios3_entry *entry3 = entry;
table = (void *)(uintptr_t)entry3->struct_table_address;
+ smbios_version = ((u16)entry3->major_ver << 16) +
+ (u16)entry3->minor_ver;
snprintf(version, sizeof(version), "%d.%d.%d",
entry3->major_ver, entry3->minor_ver, entry3->doc_rev);
table = (void *)(uintptr_t)entry3->struct_table_address;
--
2.51.0
More information about the U-Boot
mailing list