diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2023-03-07 23:47:22 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-03-09 23:12:56 +0000 |
commit | 599052942c30ea994ecd6b75edc9434af6834b5c (patch) | |
tree | 68dc498e3bc8eaa174fc2b4c579852ee7c5efcd1 /src/soc | |
parent | 337deb64087ebb2a645446473842c5776ac3f892 (diff) |
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 <felix-coreboot@felixheld.de>
Change-Id: I05946f163112ff93f33139f6c43fed5820fd0a3c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73615
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/common/block/cpu/cpu.c | 7 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/noncar/cpu.c | 7 |
2 files changed, 7 insertions, 7 deletions
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 <acpi/acpi.h> #include <amdblocks/cpu.h> +#include <cpu/amd/cpuid.h> #include <cpu/cpu.h> #include <device/device.h> @@ -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 <amdblocks/cpu.h> -#include <cpu/amd/cpuid.h> #include <cpu/cpu.h> #include <cpu/x86/msr.h> #include <cpu/amd/msr.h> @@ -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; |