soc/amd/common: Add common function to get cpu count

This is the same for all supported AMD hardware.

Change-Id: Ic6b954308dbb4c5a2050f1eb8f15acb41d0b81bd
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67617
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Arthur Heymans 2022-09-13 12:43:37 +02:00 committed by Felix Held
commit 44807acaef
9 changed files with 21 additions and 21 deletions

View file

@ -1,5 +1,7 @@
subdirs-y += ./*
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_UCODE) += update_microcode.c
romstage-y += cpu.c
ramstage-y += cpu.c
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_UCODE),y)
define add-ucode-as-cbfs

View file

@ -0,0 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/cpu.h>
#include <amdblocks/cpu.h>
int get_cpu_count(void)
{
return 1 + (cpuid_ecx(0x80000008) & 0xff);
}

View file

@ -8,11 +8,6 @@
#include <smbios.h>
#include <soc/iomap.h>
int get_cpu_count(void)
{
return 1 + (cpuid_ecx(0x80000008) & 0xff);
}
unsigned int smbios_processor_family(struct cpuid_result res)
{
return 0x6b; /* Zen */

View file

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <amdblocks/cpu.h>
#include <amdblocks/iomap.h>
#include <amdblocks/mca.h>
#include <amdblocks/reset.h>
@ -42,11 +43,6 @@ static void pre_mp_init(void)
x86_mtrr_check();
}
static int get_cpu_count(void)
{
return 1 + (cpuid_ecx(0x80000008) & 0xff);
}
static const struct mp_ops mp_ops = {
.pre_mp_init = pre_mp_init,
.get_cpu_count = get_cpu_count,