diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2022-09-13 12:43:37 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-09-14 20:28:37 +0000 |
commit | 44807acaefc71cd4985779e742e6791cb9daf65d (patch) | |
tree | 1f751da65e05f617f2fee0f822c806b4c2fdf33d /src/soc | |
parent | 62cd5e86031415843b8a0429ec05cca11b528902 (diff) |
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>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/common/block/cpu/Makefile.inc | 2 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/cpu.c | 9 | ||||
-rw-r--r-- | src/soc/amd/common/block/cpu/noncar/cpu.c | 5 | ||||
-rw-r--r-- | src/soc/amd/stoneyridge/cpu.c | 6 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/soc/amd/common/block/cpu/Makefile.inc b/src/soc/amd/common/block/cpu/Makefile.inc index 34685689de..7541a9bd5b 100644 --- a/src/soc/amd/common/block/cpu/Makefile.inc +++ b/src/soc/amd/common/block/cpu/Makefile.inc @@ -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 diff --git a/src/soc/amd/common/block/cpu/cpu.c b/src/soc/amd/common/block/cpu/cpu.c new file mode 100644 index 0000000000..bece89bc72 --- /dev/null +++ b/src/soc/amd/common/block/cpu/cpu.c @@ -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); +} diff --git a/src/soc/amd/common/block/cpu/noncar/cpu.c b/src/soc/amd/common/block/cpu/noncar/cpu.c index 56d4eb0384..8fd371564e 100644 --- a/src/soc/amd/common/block/cpu/noncar/cpu.c +++ b/src/soc/amd/common/block/cpu/noncar/cpu.c @@ -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 */ diff --git a/src/soc/amd/stoneyridge/cpu.c b/src/soc/amd/stoneyridge/cpu.c index 7f71703f1c..e8519f8eae 100644 --- a/src/soc/amd/stoneyridge/cpu.c +++ b/src/soc/amd/stoneyridge/cpu.c @@ -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, |