summaryrefslogtreecommitdiff
path: root/src/cpu/intel/common/hyperthreading.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-10-16 13:35:04 +0300
committerFelix Held <felix-coreboot@felixheld.de>2021-10-18 12:29:24 +0000
commita000922e077ec906c39c5e07ba2e38feefd5b8c0 (patch)
tree2948c53c80c0f0005089aef9c9fb05f4c667eb4b /src/cpu/intel/common/hyperthreading.c
parent5f4ae427edaef5e6c7dd2f22b574041d9d5dcb36 (diff)
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>
Diffstat (limited to 'src/cpu/intel/common/hyperthreading.c')
-rw-r--r--src/cpu/intel/common/hyperthreading.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cpu/intel/common/hyperthreading.c b/src/cpu/intel/common/hyperthreading.c
index 2936770cc3..3297b381b3 100644
--- a/src/cpu/intel/common/hyperthreading.c
+++ b/src/cpu/intel/common/hyperthreading.c
@@ -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;
}