summaryrefslogtreecommitdiff
path: root/src/cpu/x86/Makefile.inc
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-05-24 08:46:09 +0200
committerLean Sheng Tan <sheng.tan@9elements.com>2023-04-06 15:19:00 +0000
commit71bc9f0eba4fce8ffa2b0b90e388f3596ffb6a5d (patch)
tree55a6762b4b59e78f88a365cc2203a62749293965 /src/cpu/x86/Makefile.inc
parent21ca7753bf619f1de8dca79fd1113a9c22335f11 (diff)
cpu/x86/mp_init.c: Generate a C header to get start32 offset
In the current design the relocatable parameters are used to know the offset of the 32bit startpoint. This requires back and forward interaction between the stub, the loader and the mp init code. This makes the code hard to read. This is static information known at buildtime, so a better way to deal with this is to generate a header that contains this offset. Change-Id: Ic01badd2af11a6e1dbc27c8e928916fedf104b5b Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64625 Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu/x86/Makefile.inc')
-rw-r--r--src/cpu/x86/Makefile.inc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index 3ef3a90313..2381b6fa20 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -8,6 +8,20 @@ subdirs-$(CONFIG_ARCH_BOOTBLOCK_X86_64) += 64bit
subdirs-y += cache
subdirs-$(CONFIG_PARALLEL_MP) += name
+
+ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
+$(obj)/ramstage/cpu/x86/smm_start32_offset.h: $(dir)/smm_start32_offset.h.template $(obj)/smmstub/smmstub.elf
+ cp $< $@.temp
+ sed -i 's/##START32_OFFSET##/0x'$$($(NM_smmstub) -an $(obj)/smmstub/smmstub.elf | grep smm_trampolin | cut -d' ' -f1)'/' $@.temp
+ mv $@.temp $@
+else
+$(obj)/ramstage/cpu/x86/smm_start32_offset.h: $(dir)/smm_start32_offset.h.template
+ cp $< $@.temp
+ sed -i 's/##START32_OFFSET##/0x0/' $@.temp
+ mv $@.temp $@
+endif
+
+$(call src-to-obj,ramstage,$(dir)/mp_init.c): $(obj)/ramstage/cpu/x86/smm_start32_offset.h
ramstage-$(CONFIG_PARALLEL_MP) += mp_init.c
ramstage-y += backup_default_smm.c