1 ## SPDX-License-Identifier: GPL-2.0-only
3 ramstage-y
+= smm_module_loader.c
4 ramstage-
$(CONFIG_SMM_PCI_RESOURCE_STORE
) += pci_resource_store.c
6 smm-
$(CONFIG_SMM_PCI_RESOURCE_STORE
) += pci_resource_store.c
8 ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32
),y
)
9 $(eval
$(call create_class_compiler
,smm
,x86_32
))
10 $(eval
$(call create_class_compiler
,smmstub
,x86_32
))
12 $(eval
$(call create_class_compiler
,smm
,x86_64
))
13 $(eval
$(call create_class_compiler
,smmstub
,x86_64
))
16 smmstub-generic-ccopts
+= -D__SMM__
17 smm-generic-ccopts
+= -D__SMM__
18 smm-c-deps
+=$$(OPTION_TABLE_H
)
20 $(obj
)/smm
/smm.a
: $$(smm-objs
)
21 $(AR_smm
) rcsT
$@.tmp
$(filter-out %.
ld, $(smm-objs
))
25 # change to the target path because objcopy will use the path name in its
27 $(call src-to-obj
,ramstage
,$(obj
)/cpu
/x86
/smm
/smm.manual
): $(obj
)/smm
/smm
28 @printf
" OBJCOPY $(subst $(obj)/,,$(@))\n"
29 cd
$(dir $<); $(OBJCOPY_smm
) -I binary
$(notdir $<) $(target-objcopy
) $(abspath
$@
)
31 ifeq ($(CONFIG_HAVE_SMI_HANDLER
),y
)
32 ramstage-srcs
+= $(obj
)/cpu
/x86
/smm
/smm.manual
37 ramstage-y
+= tseg_region.c
38 romstage-y
+= tseg_region.c
39 postcar-y
+= tseg_region.c
41 ifeq ($(CONFIG_PARALLEL_MP
),y
)
43 smmstub-y
+= smm_stub.S
45 smm-y
+= smm_module_handler.c
47 ramstage-srcs
+= $(obj
)/cpu
/x86
/smm
/smmstub.manual
49 # SMM Stub Module. The stub is used as a trampoline for relocation and normal
51 $(obj
)/smmstub
/smmstub.o
: $$(smmstub-objs
) $(COMPILER_RT_smmstub
)
52 $(LD_smmstub
) -nostdlib
-r
-o
$@
$(COMPILER_RT_FLAGS_smmstub
) --whole-archive
--start-group
$(smmstub-objs
) --no-whole-archive
$(COMPILER_RT_smmstub
) --end-group
54 ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32
),y
)
55 $(eval
$(call rmodule_link
,$(obj
)/smmstub
/smmstub.elf
, $(obj
)/smmstub
/smmstub.o
,x86_32
))
57 $(eval
$(call rmodule_link
,$(obj
)/smmstub
/smmstub.elf
, $(obj
)/smmstub
/smmstub.o
,x86_64
))
60 $(obj
)/smmstub
/smmstub
: $(obj
)/smmstub
/smmstub.elf.rmod
61 $(OBJCOPY_smmstub
) -O binary
$< $@
63 $(call src-to-obj
,ramstage
,$(obj
)/cpu
/x86
/smm
/smmstub.manual
): $(obj
)/smmstub
/smmstub
64 @printf
" OBJCOPY $(subst $(obj)/,,$(@))\n"
65 cd
$(dir $<); $(OBJCOPY_smmstub
) -I binary
$(notdir $<) $(target-objcopy
) $(abspath
$@
)
67 # C-based SMM handler.
69 ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32
),y
)
70 $(eval
$(call rmodule_link
,$(obj
)/smm
/smm.elf
, $(obj
)/smm
/smm.a
,x86_32
))
72 $(eval
$(call rmodule_link
,$(obj
)/smm
/smm.elf
, $(obj
)/smm
/smm.a
,x86_64
))
75 $(obj
)/smm
/smm
: $(obj
)/smm
/smm.elf.rmod
76 $(OBJCOPY_smm
) -O binary
$< $@