From 599052942c30ea994ecd6b75edc9434af6834b5c Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 7 Mar 2023 23:47:22 +0100 Subject: soc/amd/common/cpu: move get_threads_per_core from noncar to common code The get_threads_per_core function isn't specific to the non-CAR CPUs and also applies for Stoneyridge and even for family 16h model 30h outside of soc/amd, so move it from the non-CAR-specific cpu.c file to the common AMD SoC cpu.c file. Signed-off-by: Felix Held Change-Id: I05946f163112ff93f33139f6c43fed5820fd0a3c Reviewed-on: https://review.coreboot.org/c/coreboot/+/73615 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Fred Reitberger --- src/soc/amd/common/block/cpu/cpu.c | 7 +++++++ src/soc/amd/common/block/cpu/noncar/cpu.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/soc/amd/common') diff --git a/src/soc/amd/common/block/cpu/cpu.c b/src/soc/amd/common/block/cpu/cpu.c index 1e1915f98f..bce0fc3ad6 100644 --- a/src/soc/amd/common/block/cpu/cpu.c +++ b/src/soc/amd/common/block/cpu/cpu.c @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -10,6 +11,12 @@ int get_cpu_count(void) return 1 + (cpuid_ecx(0x80000008) & 0xff); } +unsigned int get_threads_per_core(void) +{ + return 1 + ((cpuid_ebx(CPUID_EBX_CORE_ID) & CPUID_EBX_THREADS_MASK) + >> CPUID_EBX_THREADS_SHIFT); +} + struct device_operations amd_cpu_bus_ops = { .read_resources = noop_read_resources, .set_resources = noop_set_resources, diff --git a/src/soc/amd/common/block/cpu/noncar/cpu.c b/src/soc/amd/common/block/cpu/noncar/cpu.c index 8151b964d0..3f78aa4211 100644 --- a/src/soc/amd/common/block/cpu/noncar/cpu.c +++ b/src/soc/amd/common/block/cpu/noncar/cpu.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include -#include #include #include #include @@ -13,12 +12,6 @@ unsigned int smbios_processor_family(struct cpuid_result res) return 0x6b; /* Zen */ } -unsigned int get_threads_per_core(void) -{ - return 1 + ((cpuid_ebx(CPUID_EBX_CORE_ID) & CPUID_EBX_THREADS_MASK) - >> CPUID_EBX_THREADS_SHIFT); -} - void set_cstate_io_addr(void) { msr_t cst_addr; -- cgit v1.2.3