1## SPDX-License-Identifier: GPL-2.0-only 2 3subdirs-y += lapic 4subdirs-y += mtrr 5subdirs-y += pae 6subdirs-$(CONFIG_HAVE_SMI_HANDLER) += smm 7subdirs-$(CONFIG_UDELAY_TSC) += tsc 8# Use ARCH_BOOTBLOCK_X86_64 as a proxy for knowing if 64bit is going to be used 9subdirs-$(CONFIG_ARCH_BOOTBLOCK_X86_64) += 64bit 10subdirs-y += cache 11 12subdirs-$(CONFIG_PARALLEL_MP) += name 13 14ifeq ($(CONFIG_HAVE_SMI_HANDLER),y) 15$(obj)/ramstage/cpu/x86/smm_start32_offset.h: $(dir)/smm_start32_offset.h.template $(obj)/smmstub/smmstub.elf 16 cp $< $@.temp 17 sed -i 's/##START32_OFFSET##/0x'$$($(NM_smmstub) -an $(obj)/smmstub/smmstub.elf | grep smm_trampolin | cut -d' ' -f1)'/' $@.temp 18 mv $@.temp $@ 19else 20$(obj)/ramstage/cpu/x86/smm_start32_offset.h: $(dir)/smm_start32_offset.h.template 21 cp $< $@.temp 22 sed -i 's/##START32_OFFSET##/0x0/' $@.temp 23 mv $@.temp $@ 24endif 25 26$(call src-to-obj,ramstage,$(dir)/mp_init.c): $(obj)/ramstage/cpu/x86/smm_start32_offset.h 27ramstage-$(CONFIG_PARALLEL_MP) += mp_init.c 28 29ramstage-y += backup_default_smm.c 30ramstage-y += smi_trigger.c 31smm-y += smi_trigger.c 32 33subdirs-$(CONFIG_CPU_INTEL_COMMON_SMM) += ../intel/smm 34 35bootblock-y += entry32.S 36bootblock-y += entry16.S 37bootblock-y += reset16.S 38 39additional-dirs += $(obj)/cpu/x86 40 41SIPI_ELF=$(obj)/cpu/x86/sipi_vector.elf 42SIPI_RMOD=$(SIPI_ELF).rmod 43SIPI_BIN=$(SIPI_ELF:.elf=) 44SIPI_DOTO=$(SIPI_ELF:.elf=.o) 45 46ifeq ($(CONFIG_HAVE_RAMSTAGE),y) 47TARGET_STAGE=ramstage 48else ifeq ($(CONFIG_RAMPAYLOAD),y) 49TARGET_STAGE=postcar 50else 51$(error Halting the build due to unknown TARGET_STAGE select) 52endif 53 54ifeq ($(CONFIG_PARALLEL_MP),y) 55$(TARGET_STAGE)-srcs += $(SIPI_BIN).manual 56endif 57rmodules_$(ARCH-$(TARGET_STAGE)-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S 58 59$(SIPI_DOTO): $(call src-to-obj,rmodules_$(ARCH-$(TARGET_STAGE)-y),src/cpu/x86/sipi_vector.S) 60 $(LD_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -nostdlib -r -o $@ $^ 61 62$(eval $(call rmodule_link,$(SIPI_ELF), $(SIPI_DOTO),$(ARCH-$(TARGET_STAGE)-y))) 63 64$(SIPI_BIN): $(SIPI_RMOD) 65 $(OBJCOPY_$(TARGET_STAGE)) -O binary $< $@ 66 67$(call src-to-obj,$(TARGET_STAGE),$(SIPI_BIN).manual): $(SIPI_BIN) 68 @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" 69 cd $(dir $<); $(OBJCOPY_rmodules_$(ARCH-$(TARGET_STAGE)-y)) -I binary $(notdir $<) $(target-objcopy) $(abspath $@) 70 71ramstage-y += topology.c 72