diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2022-11-04 13:27:07 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-04-11 16:02:09 +0000 |
commit | 8b8400a889abadbbd2156d4a35a27203068766f1 (patch) | |
tree | 7825fbe13877b703230eb35c9b269345e743bc4a /src/soc/intel/common | |
parent | d9b938b0cf2da9278ddef3287156569789d39cae (diff) |
drivers/fsp2_0/mp_service_ppi: Use struct device to fill in buffer
Now the CPU topology is filled in struct device during mp_init.
Change-Id: I7322b43f5b95dda5fbe81e7427f5269c9d6f8755
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69223
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r-- | src/soc/intel/common/block/cpu/cpulib.c | 63 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/cpulib.h | 4 |
2 files changed, 0 insertions, 67 deletions
diff --git a/src/soc/intel/common/block/cpu/cpulib.c b/src/soc/intel/common/block/cpu/cpulib.c index 3f0ee674f4..c317e05854 100644 --- a/src/soc/intel/common/block/cpu/cpulib.c +++ b/src/soc/intel/common/block/cpu/cpulib.c @@ -15,23 +15,6 @@ #include <soc/soc_chip.h> #include <types.h> -#define CPUID_EXTENDED_CPU_TOPOLOGY 0x0b -#define LEVEL_TYPE_CORE 2 -#define LEVEL_TYPE_SMT 1 - -#define CPUID_CPU_TOPOLOGY(x, val) \ - (((val) >> CPUID_CPU_TOPOLOGY_##x##_SHIFT) & CPUID_CPU_TOPOLOGY_##x##_MASK) - -#define CPUID_CPU_TOPOLOGY_LEVEL_TYPE_SHIFT 0x8 -#define CPUID_CPU_TOPOLOGY_LEVEL_TYPE_MASK 0xff -#define CPUID_CPU_TOPOLOGY_LEVEL(res) CPUID_CPU_TOPOLOGY(LEVEL_TYPE, (res).ecx) - -#define CPUID_CPU_TOPOLOGY_LEVEL_BITS_SHIFT 0x0 -#define CPUID_CPU_TOPOLOGY_LEVEL_BITS_MASK 0x1f -#define CPUID_CPU_TOPOLOGY_THREAD_BITS(res) CPUID_CPU_TOPOLOGY(LEVEL_BITS, (res).eax) -#define CPUID_CPU_TOPOLOGY_CORE_BITS(res, threadbits) \ - ((CPUID_CPU_TOPOLOGY(LEVEL_BITS, (res).eax)) - threadbits) - #define CPUID_PROCESSOR_FREQUENCY 0X16 #define CPUID_HYBRID_INFORMATION 0x1a @@ -481,52 +464,6 @@ int get_valid_prmrr_size(void) return valid_size; } -/* Get number of bits for core ID and SMT ID */ -static void get_cpu_core_thread_bits(uint32_t *core_bits, uint32_t *thread_bits) -{ - struct cpuid_result cpuid_regs; - int level_num, cpu_id_op = 0; - const uint32_t cpuid_max_func = cpuid_get_max_func(); - - /* Assert if extended CPU topology not supported */ - assert(cpuid_max_func >= CPUID_EXTENDED_CPU_TOPOLOGY); - - cpu_id_op = CPUID_EXTENDED_CPU_TOPOLOGY; - - *core_bits = level_num = 0; - cpuid_regs = cpuid_ext(cpu_id_op, level_num); - - /* Sub-leaf index 0 enumerates SMT level, if not assert */ - assert(CPUID_CPU_TOPOLOGY_LEVEL(cpuid_regs) == LEVEL_TYPE_SMT); - - *thread_bits = CPUID_CPU_TOPOLOGY_THREAD_BITS(cpuid_regs); - do { - level_num++; - cpuid_regs = cpuid_ext(cpu_id_op, level_num); - if (CPUID_CPU_TOPOLOGY_LEVEL(cpuid_regs) == LEVEL_TYPE_CORE) { - *core_bits = CPUID_CPU_TOPOLOGY_CORE_BITS(cpuid_regs, *thread_bits); - break; - } - /* Stop when level type is invalid i.e 0 */ - } while (CPUID_CPU_TOPOLOGY_LEVEL(cpuid_regs)); -} - -void get_cpu_topology_from_apicid(uint32_t apicid, uint8_t *package, - uint8_t *core, uint8_t *thread) -{ - - uint32_t core_bits, thread_bits; - - get_cpu_core_thread_bits(&core_bits, &thread_bits); - - if (package) - *package = apicid >> (thread_bits + core_bits); - if (core) - *core = (apicid >> thread_bits) & ((1 << core_bits) - 1); - if (thread) - *thread = apicid & ((1 << thread_bits) - 1); -} - static void sync_core_prmrr(void) { static msr_t msr_base, msr_mask; diff --git a/src/soc/intel/common/block/include/intelblocks/cpulib.h b/src/soc/intel/common/block/include/intelblocks/cpulib.h index 38c43d8c8f..cbc9e449de 100644 --- a/src/soc/intel/common/block/include/intelblocks/cpulib.h +++ b/src/soc/intel/common/block/include/intelblocks/cpulib.h @@ -183,10 +183,6 @@ int get_valid_prmrr_size(void); */ void enable_pm_timer_emulation(void); -/* Derive core, package and thread information from lapic ID */ -void get_cpu_topology_from_apicid(uint32_t apicid, uint8_t *package, - uint8_t *core, uint8_t *thread); - /* * Initialize core PRMRR * |