Attempts to write to APM_CNT IO port should always be guarded with a test to verify SMI handler has been installed. Immediate followup removes redundant HAVE_SMI_HANDLER tests. Change-Id: If3fb0f1a8b32076f1d9f3fea9f817dd4b093ad98 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41971 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
84 lines
2.8 KiB
Makefile
84 lines
2.8 KiB
Makefile
## SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
ramstage-y += smm_module_loader.c
|
|
ramstage-y += smi_trigger.c
|
|
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
|
$(eval $(call create_class_compiler,smm,x86_32))
|
|
$(eval $(call create_class_compiler,smmstub,x86_32))
|
|
else
|
|
$(eval $(call create_class_compiler,smm,x86_64))
|
|
$(eval $(call create_class_compiler,smmstub,x86_64))
|
|
endif
|
|
|
|
smmstub-generic-ccopts += -D__SMM__
|
|
smm-generic-ccopts += -D__SMM__
|
|
smm-c-deps:=$$(OPTION_TABLE_H)
|
|
|
|
$(obj)/smm/smm.o: $$(smm-objs) $(COMPILER_RT_smm)
|
|
$(LD_smm) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smm) --whole-archive --start-group $(smm-objs) --no-whole-archive $(COMPILER_RT_smm) --end-group
|
|
|
|
# change to the target path because objcopy will use the path name in its
|
|
# ELF symbol names.
|
|
$(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smm.manual): $(obj)/smm/smm
|
|
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
|
cd $(dir $<); $(OBJCOPY_smm) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
|
|
|
|
ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
|
|
ramstage-srcs += $(obj)/cpu/x86/smm/smm.manual
|
|
endif
|
|
|
|
ifeq ($(CONFIG_SMM_TSEG),y)
|
|
|
|
ramstage-y += tseg_region.c
|
|
romstage-y += tseg_region.c
|
|
postcar-y += tseg_region.c
|
|
|
|
smmstub-y += smm_stub.S
|
|
|
|
smm-y += smm_module_handler.c
|
|
|
|
ramstage-srcs += $(obj)/cpu/x86/smm/smmstub.manual
|
|
|
|
# SMM Stub Module. The stub is used as a trampoline for relocation and normal
|
|
# SMM handling.
|
|
$(obj)/smmstub/smmstub.o: $$(smmstub-objs) $(COMPILER_RT_smmstub)
|
|
$(LD_smmstub) -nostdlib -r -o $@ $(COMPILER_RT_FLAGS_smmstub) --whole-archive --start-group $(smmstub-objs) --no-whole-archive $(COMPILER_RT_smmstub) --end-group
|
|
|
|
# Link the SMM stub module with a 0-byte heap.
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
|
$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o, 0,x86_32))
|
|
else
|
|
$(eval $(call rmodule_link,$(obj)/smmstub/smmstub.elf, $(obj)/smmstub/smmstub.o, 0,x86_64))
|
|
endif
|
|
|
|
$(obj)/smmstub/smmstub: $(obj)/smmstub/smmstub.elf.rmod
|
|
$(OBJCOPY_smmstub) -O binary $< $@
|
|
|
|
$(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smmstub.manual): $(obj)/smmstub/smmstub
|
|
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
|
cd $(dir $<); $(OBJCOPY_smmstub) -I binary $(notdir $<) $(target-objcopy) $(abspath $@)
|
|
|
|
# C-based SMM handler.
|
|
|
|
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
|
|
$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_32))
|
|
else
|
|
$(eval $(call rmodule_link,$(obj)/smm/smm.elf, $(obj)/smm/smm.o, $(CONFIG_SMM_MODULE_HEAP_SIZE),x86_64))
|
|
endif
|
|
|
|
$(obj)/smm/smm: $(obj)/smm/smm.elf.rmod
|
|
$(OBJCOPY_smm) -O binary $< $@
|
|
|
|
else # CONFIG_SMM_TSEG
|
|
|
|
$(obj)/smm/smm: $(obj)/smm/smm.o $(src)/cpu/x86/smm/smm.ld
|
|
$(LD_smm) $(LDFLAGS_smm) -o $(obj)/smm/smm.elf -T $(src)/cpu/x86/smm/smm.ld $(obj)/smm/smm.o
|
|
$(NM_smm) -n $(obj)/smm/smm.elf | sort > $(obj)/smm/smm.map
|
|
$(OBJCOPY_smm) -O binary $(obj)/smm/smm.elf $@
|
|
|
|
smm-y += smmhandler.S
|
|
smm-y += smihandler.c
|
|
|
|
endif # CONFIG_SMM_TSEG
|