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>
This commit is contained in:
Felix Held 2023-03-07 23:47:22 +01:00
parent 337deb6408
commit 599052942c
2 changed files with 7 additions and 7 deletions

View File

@ -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,

View File

@ -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;