arch/x86/smbios: Correct SMBIOS type 4 max speed

Now smbios type 4 max speed field will use the maximum speed of
processor itself if CPUID value can be accessed. However, this field
should be the maximum processor speed supported by the system. Here
we use smbios_cpu_get_max_speed_mhz only to get correct value.

Tested=Execute "dmidecode -t 4" to check max speed is correct.

Signed-off-by: Tim Chu <Tim.Chu@quantatw.com>
Change-Id: Iae8e01a5e455709a57d60a840f279685c8aab80f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48636
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Tim Chu 2020-12-14 21:44:40 -08:00 committed by Patrick Georgi
parent 9853e42a8e
commit 40d45996d8
1 changed files with 3 additions and 2 deletions

View File

@ -686,15 +686,16 @@ static int smbios_write_type4(unsigned long *current, int handle)
t->processor_upgrade = get_socket_type(); t->processor_upgrade = get_socket_type();
len = t->length + smbios_string_table_len(t->eos); len = t->length + smbios_string_table_len(t->eos);
if (cpu_have_cpuid() && cpuid_get_max_func() >= 0x16) { if (cpu_have_cpuid() && cpuid_get_max_func() >= 0x16) {
t->max_speed = cpuid_ebx(0x16);
t->current_speed = cpuid_eax(0x16); /* base frequency */ t->current_speed = cpuid_eax(0x16); /* base frequency */
t->external_clock = cpuid_ecx(0x16); t->external_clock = cpuid_ecx(0x16);
} else { } else {
t->max_speed = smbios_cpu_get_max_speed_mhz();
t->current_speed = smbios_cpu_get_current_speed_mhz(); t->current_speed = smbios_cpu_get_current_speed_mhz();
t->external_clock = smbios_processor_external_clock(); t->external_clock = smbios_processor_external_clock();
} }
/* This field identifies a capability for the system, not the processor itself. */
t->max_speed = smbios_cpu_get_max_speed_mhz();
if (cpu_have_cpuid()) { if (cpu_have_cpuid()) {
res = cpuid(1); res = cpuid(1);