Francois Toguo Fotso has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31863
Change subject: src/arch: An upgrade of SMBIOS to latest version 3.2 ......................................................................
src/arch: An upgrade of SMBIOS to latest version 3.2
This is the second of 2 patches upgrading the SMBIOS interface to the latest 3.2 First patch is in mosys. Newer required fields are added to various types definitions
BUG=NONE TEST=Boot to OS
Signed-off-by: Francois Toguo francois.toguo.fotso@intel.com Change-Id: Idd2675ddd7196300019057f80a51bdd3b0e5b4e1 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 64 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/31863/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 7d3cfae..6e474a4 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -328,6 +328,17 @@ t->handle = *handle; *handle += 1; t->length = sizeof(struct smbios_type17) - 2; + t->memory_technology = MEMORY_TECHNOLOGY_UNKNOWN; + t->operating_mode_capability = MEMORY_OPERATING_MODE_CAP_UNKNOWN; + t->fw_version = 0xff; + t->manufacturer_id = dimm->mod_id; + t->product_id = 0x0000; + t->sub_ctrl_manufacturer_id = 0x0000; + t->sub_ctrl_product_id = 0x0000; + t->non_volatile_size = 0xffffffffffffffff; + t->volatile_size = 0xffffffffffffffff; + t->cache_size = 0xffffffffffffffff; + t->logical_size = 0xffffffffffffffff; return t->length + smbios_string_table_len(t->eos); }
@@ -537,6 +548,40 @@ return len; }
+u16 __weak smbios_processor_core_count(void) { + u16 core_count = 0; + int ecx = 0; + + while (1) { + struct cpuid_result leaf_b; + leaf_b = cpuid_ext(0xb, ecx); + if ((leaf_b.ecx & 0xff00) == 0x0200) { + core_count = leaf_b.ebx & 0xffff; + break; + } + ecx++; + } + + return core_count; +} + +u16 __weak smbios_processor_thread_count(void) { + u16 thread_count = 0; + int ecx = 0; + + while (1) { + struct cpuid_result leaf_b; + leaf_b = cpuid_ext(0xb, ecx); + if ((leaf_b.ecx & 0xff00) == 0x0100) { + thread_count = leaf_b.ebx & 0xffff; + break; + } + ecx++; + } + + return thread_count; +} + static int smbios_write_type4(unsigned long *current, int handle) { struct cpuid_result res; @@ -560,13 +605,25 @@ t->processor_version = smbios_processor_name(t->eos); t->processor_family = (res.eax > 0) ? 0x0c : 0x6; t->processor_type = 3; /* System Processor */ - if (((res.ebx >> 16) & 0xffff) > 255) { + + u16 core_count = smbios_processor_core_count(); + u16 thread_count = smbios_processor_thread_count(); + + if (core_count > 255) { t->core_count = 0xff; - t->core_count2 = (res.ebx >> 16) & 0xffff; + t->core_count2 = core_count; } else { - t->core_count = (res.ebx >> 16) & 0xff; - t->core_count2 = (res.ebx >> 16) & 0x00ff; + t->core_count = core_count & 0x00ff; + t->core_count2 = 0x00ff; } + if (thread_count > 255) { + t->thread_count = 0xff; + t->thread_count2 = thread_count; + } else { + t->thread_count = thread_count & 0x00ff; + t->thread_count2 = 0x00ff; + } + t->l1_cache_handle = 0xffff; t->l2_cache_handle = 0xffff; t->l3_cache_handle = 0xffff; diff --git a/src/include/smbios.h b/src/include/smbios.h index 4937dd6..24011ed 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -48,6 +48,8 @@
const char *smbios_mainboard_sku(void); u8 smbios_mainboard_enclosure_type(void); +u16 smbios_processor_core_count(void); +u16 smbios_processor_thread_count(void); #ifdef CONFIG_MAINBOARD_FAMILY const char *smbios_mainboard_family(void); #endif @@ -424,7 +426,7 @@ u8 header_format; u8 log_type_descriptors; u8 log_type_descriptor_length; - log_type_descriptor descriptor[0]; + log_type_descriptor descriptor[256]; u8 eos[2]; } __packed;