summaryrefslogtreecommitdiff
path: root/src/arch/x86/smbios.c
diff options
context:
space:
mode:
authorAndrey Petrov <anpetrov@fb.com>2019-10-23 15:31:51 -0700
committerAndrey Petrov <anpetrov@fb.com>2019-10-28 18:27:24 +0000
commit2e032f07df0d4ff5c1d9814b82ed32820cb0ee59 (patch)
treea97ffca5f06e540ffc9abe8cf758cb545bedeb01 /src/arch/x86/smbios.c
parentb8eaa6a5848d8d055a9b124b1b49e9dd774e7611 (diff)
downloadcoreboot-2e032f07df0d4ff5c1d9814b82ed32820cb0ee59.tar.xz
arch/x86: Populate more fields in SMBIOS type 4
If CPUID leaf 0x16 is available (Skylake and later) use it to obtain current and maximum speed. Otherwise call weak function that can be provided elsewhere (cpu/soc/mainboard). Also, populate "core enabled" with the same value as "core count". TEST=tested on OCP Monolake with dmidecode -t processor Change-Id: Ie5d88dacae6623dfa0ceb3ca1bb5eeff2adda103 Signed-off-by: Andrey Petrov <anpetrov@fb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36283 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'src/arch/x86/smbios.c')
-rw-r--r--src/arch/x86/smbios.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 4eb8726137..5edf3c6e0c 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -522,6 +522,16 @@ void __weak smbios_system_set_uuid(u8 *uuid)
/* leave all zero */
}
+unsigned int __weak smbios_cpu_get_max_speed_mhz(void)
+{
+ return 0; /* Unknown */
+}
+
+unsigned int __weak smbios_cpu_get_current_speed_mhz(void)
+{
+ return 0; /* Unknown */
+}
+
const char *__weak smbios_system_sku(void)
{
return "";
@@ -648,11 +658,20 @@ static int smbios_write_type4(unsigned long *current, int handle)
t->processor_family = (res.eax > 0) ? 0x0c : 0x6;
t->processor_type = 3; /* System Processor */
t->core_count = (res.ebx >> 16) & 0xff;
+ /* Assume we enable all the cores always, capped only by MAX_CPUS */
+ t->core_enabled = MAX(t->core_count, CONFIG_MAX_CPUS);
t->l1_cache_handle = 0xffff;
t->l2_cache_handle = 0xffff;
t->l3_cache_handle = 0xffff;
t->processor_upgrade = get_socket_type();
len = t->length + smbios_string_table_len(t->eos);
+ if (cpu_have_cpuid() && cpuid_get_max_func() >= 0x16) {
+ t->max_speed = cpuid_ebx(0x16);
+ t->current_speed = cpuid_eax(0x16); /* base frequency */
+ } else {
+ t->max_speed = smbios_cpu_get_max_speed_mhz();
+ t->current_speed = smbios_cpu_get_current_speed_mhz();
+ }
*current += len;
return len;
}