aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/x86/Makefile.mk
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2024-01-18 10:48:28 -0700
committerFelix Singer <service+coreboot-gerrit@felixsinger.de>2024-01-24 08:35:01 +0000
commitb028636d02f63881e4663ff0f1ae435c00865615 (patch)
tree48e10e684a531b378e975a42e24dde46c1639ae5 /src/cpu/x86/Makefile.mk
parent4f1786dcacbcb09bd09638616e8aa1b60125d626 (diff)
cpu: Rename Makefiles from .inc to .mk
The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I552d487978906f5ea74c3d0d85373fe5b2de3f38 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80068 Reviewed-by: Michael Niewöhner <foss@mniewoehner.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Diffstat (limited to 'src/cpu/x86/Makefile.mk')
-rw-r--r--src/cpu/x86/Makefile.mk71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/cpu/x86/Makefile.mk b/src/cpu/x86/Makefile.mk
new file mode 100644
index 0000000000..9e9b837417
--- /dev/null
+++ b/src/cpu/x86/Makefile.mk
@@ -0,0 +1,71 @@
+## SPDX-License-Identifier: GPL-2.0-only
+
+subdirs-y += lapic
+subdirs-y += mtrr
+subdirs-y += pae
+subdirs-$(CONFIG_HAVE_SMI_HANDLER) += smm
+subdirs-$(CONFIG_UDELAY_TSC) += tsc
+# Use ARCH_BOOTBLOCK_X86_64 as a proxy for knowing if 64bit is going to be used
+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
+ramstage-y += smi_trigger.c
+smm-y += smi_trigger.c
+
+subdirs-$(CONFIG_CPU_INTEL_COMMON_SMM) += ../intel/smm
+
+bootblock-y += entry32.S
+bootblock-y += entry16.S
+bootblock-y += reset16.S
+
+additional-dirs += $(obj)/cpu/x86
+
+SIPI_ELF=$(obj)/cpu/x86/sipi_vector.elf
+SIPI_RMOD=$(SIPI_ELF).rmod
+SIPI_BIN=$(SIPI_ELF:.elf=)
+SIPI_DOTO=$(SIPI_ELF:.elf=.o)
+
+ifeq ($(CONFIG_HAVE_RAMSTAGE),y)
+TARGET_STAGE=ramstage
+else ifeq ($(CONFIG_RAMPAYLOAD),y)
+TARGET_STAGE=postcar
+else
+$(error Halting the build due to unknown TARGET_STAGE select)
+endif
+
+ifeq ($(CONFIG_PARALLEL_MP),y)
+$(TARGET_STAGE)-srcs += $(SIPI_BIN).manual
+endif
+rmodules_$(ARCH-$(TARGET_STAGE)-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
+
+$(SIPI_DOTO): $(call src-to-obj,rmodules_$(ARCH-$(TARGET_STAGE)-y),src/cpu/x86/sipi_vector.S)
+ $(LD_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -nostdlib -r -o $@ $^
+
+$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO), 0,$(ARCH-$(TARGET_STAGE)-y)))
+
+$(SIPI_BIN): $(SIPI_RMOD)
+ $(OBJCOPY_$(TARGET_STAGE)) -O binary $< $@
+
+$(call src-to-obj,$(TARGET_STAGE),$(SIPI_BIN).manual): $(SIPI_BIN)
+ @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
+ cd $(dir $<); $(OBJCOPY_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
+
+ramstage-y += topology.c