summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2020-11-23 16:54:05 +0100
committerFelix Held <felix-coreboot@felixheld.de>2020-11-30 16:28:13 +0000
commit84eb61c32c4ca3f01e17cb4a4e9287821646f5cb (patch)
tree07a6d0d1506e0e75788d9dbc84b5d8cfa1ab74a8 /src/soc/amd/common
parent21cdf0de086e045988b93b6030f8faa5127f5cdf (diff)
soc/amd: move assembly part of non-CAR bootblock to common directory
There will be more files added to the common non-CAR Makefile.inc, so use an ifeq statement there. Change-Id: I1f71954d27fbf10725387a0e95bc57f5040024cc Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47880 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/cpu/Makefile.inc1
-rw-r--r--src/soc/amd/common/block/cpu/noncar/Makefile.inc1
-rw-r--r--src/soc/amd/common/block/cpu/noncar/pre_c.S54
3 files changed, 56 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/cpu/Makefile.inc b/src/soc/amd/common/block/cpu/Makefile.inc
index df2ccfaa2e..6298f3b746 100644
--- a/src/soc/amd/common/block/cpu/Makefile.inc
+++ b/src/soc/amd/common/block/cpu/Makefile.inc
@@ -1 +1,2 @@
subdirs-$(CONFIG_SOC_AMD_COMMON_BLOCK_CAR) += car
+subdirs-$(CONFIG_SOC_AMD_COMMON_BLOCK_NONCAR) += noncar
diff --git a/src/soc/amd/common/block/cpu/noncar/Makefile.inc b/src/soc/amd/common/block/cpu/noncar/Makefile.inc
new file mode 100644
index 0000000000..d6b8b52711
--- /dev/null
+++ b/src/soc/amd/common/block/cpu/noncar/Makefile.inc
@@ -0,0 +1 @@
+bootblock-y += pre_c.S
diff --git a/src/soc/amd/common/block/cpu/noncar/pre_c.S b/src/soc/amd/common/block/cpu/noncar/pre_c.S
new file mode 100644
index 0000000000..6fae1ed1cb
--- /dev/null
+++ b/src/soc/amd/common/block/cpu/noncar/pre_c.S
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <cpu/x86/post_code.h>
+
+.global bootblock_resume_entry
+bootblock_resume_entry:
+ post_code(0xb0)
+
+ /* Get an early timestamp */
+ rdtsc
+ movd %eax, %mm1
+ movd %edx, %mm2
+
+ /* Fall through to bootblock_pre_c_entry */
+
+/*
+ * on entry:
+ * mm0: BIST (ignored)
+ * mm2_mm1: timestamp at bootblock_protected_mode_entry
+ */
+
+.global bootblock_pre_c_entry
+bootblock_pre_c_entry:
+ post_code(0xa0)
+
+ /* Clear .bss section */
+ cld
+ xor %eax, %eax
+ movl $(_ebss), %ecx
+ movl $(_bss), %edi
+ sub %edi, %ecx
+ shrl $2, %ecx
+ rep stosl
+
+ movl $_eearlyram_stack, %esp
+
+ /* Align the stack and keep aligned for call to bootblock_c_entry() */
+ and $0xfffffff0, %esp
+ sub $8, %esp
+
+ movd %mm2, %eax
+ pushl %eax /* tsc[63:32] */
+ movd %mm1, %eax
+ pushl %eax /* tsc[31:0] */
+
+ post_code(0xa2)
+
+ call bootblock_c_entry
+ /* Never reached */
+
+.halt_forever:
+ post_code(POST_DEAD_CODE)
+ hlt
+ jmp .halt_forever