summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-02-08 22:23:54 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-02-09 21:32:15 +0000
commitdd2f3fa533eb8f7537aa480b20d9bbf61f01d6a7 (patch)
treed17a8cc4e58991bb9cc316883ffc48c3fc226618 /src/soc/amd/common
parentcf6dc7d3a147ef39de84e33d2ce43c103a6b831b (diff)
soc/amd/picasso/cpu: move get_cpu_count to common code
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I0690787f492d764a20a4219822eb10fb5cd86de0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50406 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/cpu/noncar/Makefile.inc1
-rw-r--r--src/soc/amd/common/block/cpu/noncar/cpu.c9
-rw-r--r--src/soc/amd/common/block/include/amdblocks/cpu.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/cpu/noncar/Makefile.inc b/src/soc/amd/common/block/cpu/noncar/Makefile.inc
index dd959417f1..808679dfea 100644
--- a/src/soc/amd/common/block/cpu/noncar/Makefile.inc
+++ b/src/soc/amd/common/block/cpu/noncar/Makefile.inc
@@ -3,6 +3,7 @@ ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_NONCAR),y)
bootblock-y += pre_c.S
bootblock-y += write_resume_eip.c
romstage-y += memmap.c
+ramstage-y += cpu.c
ramstage-y += memmap.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_NONCAR
diff --git a/src/soc/amd/common/block/cpu/noncar/cpu.c b/src/soc/amd/common/block/cpu/noncar/cpu.c
new file mode 100644
index 0000000000..7c1daf96f1
--- /dev/null
+++ b/src/soc/amd/common/block/cpu/noncar/cpu.c
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <amdblocks/cpu.h>
+#include <cpu/cpu.h>
+
+int get_cpu_count(void)
+{
+ return 1 + (cpuid_ecx(0x80000008) & 0xff);
+}
diff --git a/src/soc/amd/common/block/include/amdblocks/cpu.h b/src/soc/amd/common/block/include/amdblocks/cpu.h
index 0a93643e2a..50300d5a0f 100644
--- a/src/soc/amd/common/block/include/amdblocks/cpu.h
+++ b/src/soc/amd/common/block/include/amdblocks/cpu.h
@@ -3,6 +3,7 @@
#ifndef AMD_BLOCK_CPU_H
#define AMD_BLOCK_CPU_H
+int get_cpu_count(void);
void write_resume_eip(void);
#endif /* AMD_BLOCK_CPU_H */