Morgan Jang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43789 )
Change subject: mb/ocp/deltalake: Update SMBIOS type 4 -- Processor Information for Deltalake platform ......................................................................
mb/ocp/deltalake: Update SMBIOS type 4 -- Processor Information for Deltalake platform
TEST=Exectue "dmidecode -t 4" to check if the processor information is correct for Deltalake platform
Change-Id: I5d075bb297f2e71a2545ab6ad82304a825ed7d19 --- M src/arch/x86/smbios.c M src/include/smbios.h M src/mainboard/ocp/deltalake/Kconfig M src/mainboard/ocp/deltalake/ramstage.c 4 files changed, 131 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/43789/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 3c5799b..4b2bb80 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -21,6 +21,7 @@ #endif #include <drivers/vpd/vpd.h> #include <stdlib.h> +#include <intelblocks/cpulib.h>
#define update_max(len, max_len, stmt) \ do { \ @@ -603,10 +604,47 @@ return 0x13; if (CONFIG(CPU_INTEL_SOCKET_LGA775)) return 0x15; + if (CONFIG(CPU_INTEL_SOCKET_LGA3647_1)) + return 0x36;
return 0x02; /* Unknown */ }
+unsigned int __weak smbios_processor_voltage(void) +{ + return 0; +} + +unsigned int __weak smbios_processor_external_clock(void) +{ + return 0; +} + +unsigned int __weak smbios_processor_status(void) +{ + return 0; +} + +unsigned int __weak smbios_processor_thread_count(void) +{ + return 0; +} + +unsigned int __weak smbios_processor_characteristics(void) +{ + return 0; +} + +unsigned int __weak smbios_processor_family(void) +{ + struct cpuid_result res; + + if (cpu_have_cpuid()) + res = cpuid(1); + + return (res.eax > 0) ? 0x0c : 0x6; +} + static int smbios_write_type1(unsigned long *current, int handle) { struct smbios_type1 *t = (struct smbios_type1 *)*current; @@ -706,7 +744,7 @@ t->processor_id[1] = res.edx; t->processor_manufacturer = smbios_cpu_vendor(t->eos); t->processor_version = smbios_processor_name(t->eos); - t->processor_family = (res.eax > 0) ? 0x0c : 0x6; + t->processor_family = smbios_processor_family(); t->processor_type = 3; /* System Processor */ /* * If CPUID leaf 11 is available, calculate "core count" by dividing @@ -743,6 +781,13 @@ t->max_speed = smbios_cpu_get_max_speed_mhz(); t->current_speed = smbios_cpu_get_current_speed_mhz(); } + + t->voltage = smbios_processor_voltage(); + t->external_clock = smbios_processor_external_clock(); + t->status = smbios_processor_status(); + t->thread_count = smbios_processor_thread_count(); + t->processor_characteristics = smbios_processor_characteristics(); + *current += len; return len; } diff --git a/src/include/smbios.h b/src/include/smbios.h index ed09d64..6223e07 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -54,6 +54,14 @@ const char *smbios_chassis_serial_number(void); const char *smbios_processor_serial_number(void);
+unsigned int smbios_processor_voltage(void); +unsigned int smbios_processor_external_clock(void); +unsigned int smbios_processor_status(void); +unsigned int smbios_processor_thread_count(void); +unsigned int smbios_processor_characteristics(void); +unsigned int smbios_processor_family(void); + + /* Used by mainboard to add port information of type 8 */ struct port_information; int smbios_write_type8(unsigned long *current, int *handle, diff --git a/src/mainboard/ocp/deltalake/Kconfig b/src/mainboard/ocp/deltalake/Kconfig index b4e88b5..c10e5a3 100644 --- a/src/mainboard/ocp/deltalake/Kconfig +++ b/src/mainboard/ocp/deltalake/Kconfig @@ -38,4 +38,8 @@ string default "src/mainboard/$(CONFIG_MAINBOARD_DIR)/board.fmd"
+config CPU_INTEL_SOCKET_LGA3647_1 + bool + default y + endif # BOARD_OCP_DELTALAKE diff --git a/src/mainboard/ocp/deltalake/ramstage.c b/src/mainboard/ocp/deltalake/ramstage.c index 88f89b5..31fb735 100644 --- a/src/mainboard/ocp/deltalake/ramstage.c +++ b/src/mainboard/ocp/deltalake/ramstage.c @@ -8,6 +8,7 @@ #include <soc/lewisburg_pch_gpio_defs.h> #include <soc/ramstage.h> #include <stdio.h> +#include <intelblocks/cpulib.h>
#include "ipmi.h"
@@ -70,6 +71,78 @@ } }
+unsigned int smbios_processor_voltage(void) +{ + struct cpuid_result res; + int voltage_in_mv; + + res.eax = 0; + + if (cpu_have_cpuid()) + res = cpuid(1); + + if ((res.eax >> 8 & 0x3F) == 0xF) + voltage_in_mv = 3000; + else + voltage_in_mv = 1600; + + return ((voltage_in_mv * 10) / 1000) | BIT7; +} + +unsigned int smbios_processor_external_clock(void) +{ + return 100; +} + +unsigned int smbios_processor_status(void) +{ + /* DeltaLake is one-socket platform, so hardcode it. */ + return 0x41; /* Populated and enabled */ +} + +unsigned int smbios_processor_thread_count(void) +{ + unsigned int core_count = 0, thread_count = 0; + + cpu_read_topology(&core_count, &thread_count); + + return thread_count * CONFIG_MAX_SOCKET; +} + +unsigned int smbios_processor_characteristics(void) +{ + struct cpuid_result res; + uint16_t characteristics; + + /* 64-bit Capable, Multi-Core, Power/Performance Control */ + characteristics = BIT2 + BIT3 + BIT7; + + if (cpu_have_cpuid()) { + res = cpuid(1); + + if ((res.ecx) & BIT5) + characteristics |= BIT6; /* Enhanced Virtualization */ + + if ((res.edx) & BIT28) + characteristics |= BIT4; /* Hardware Thread */ + + if (((cpuid_eax(0x80000000) - 0x80000000) + 1) > 2) { + res = cpuid(0x80000001); + + if ((res.edx) & BIT20) + characteristics |= BIT5; /* Execute Protection */ + } + + } + + return characteristics; +} + +unsigned int smbios_processor_family(void) +{ + return 0xb3; /* Xeon */ +} + static void mainboard_enable(struct device *dev) { dev->ops->get_smbios_strings = dl_oem_smbios_strings,