cpu/intel/hyperthreading: Use cpuid_get_max_func()

Change-Id: I4b69b1d20b5a768c269d85f0ea23f79e02391a71
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58384
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
Kyösti Mälkki 2021-10-16 13:35:04 +03:00 committed by Felix Held
parent 5f4ae427ed
commit a000922e07
1 changed files with 5 additions and 3 deletions

View File

@ -19,24 +19,26 @@ bool intel_ht_sibling(void)
{
struct cpuid_result result;
unsigned int core_ids, apic_ids, threads;
unsigned int max_leaf;
if (!intel_ht_supported())
return false;
if (cpuid_eax(0) >= 0xb) {
max_leaf = cpuid_get_max_func();
if (max_leaf >= 0xb) {
result = cpuid_ext(0xb, 0);
const uint32_t div = 1 << (result.eax & 0x1f);
return result.edx % div > 0;
}
apic_ids = 1;
if (cpuid_eax(0) >= 1)
if (max_leaf >= 1)
apic_ids = (cpuid_ebx(1) >> 16) & 0xff;
if (apic_ids == 0)
apic_ids = 1;
core_ids = 1;
if (cpuid_eax(0) >= 4) {
if (max_leaf >= 4) {
result = cpuid_ext(4, 0);
core_ids += (result.eax >> 26) & 0x3f;
}