soc/intel/tigerlake: Utilize vbt data size Kconfig option
[coreboot.git] / src / lib / Makefile.inc
blobc228f2a9f476855feaeca3f3a54d83dfda871314
1 # SPDX-License-Identifier: GPL-2.0-only
3 subdirs-y += gnat
5 ifeq ($(CONFIG_UBSAN),y)
6 ramstage-y += ubsan.c
7 CFLAGS_ramstage += -fsanitize=undefined
8 endif
10 # Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used.
11 CFLAGS_asan += -fsanitize=kernel-address --param asan-use-shadow-offset-callback=1 \
12                 --param asan-stack=1 -fsanitize-address-use-after-scope \
13                 --param asan-instrumentation-with-call-threshold=0 \
14                 --param use-after-scope-direct-emission-threshold=0
16 ifeq ($(CONFIG_ASAN_IN_ROMSTAGE),y)
17 romstage-y += asan.c
18 CFLAGS_asan += --param asan-globals=0
19 CFLAGS_romstage += $(CFLAGS_asan)
20 # Allow memory access without __asan_load and __asan_store checks.
21 $(obj)/romstage/lib/asan.o: CFLAGS_asan =
22 endif
24 ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y)
25 ramstage-y += asan.c
26 CFLAGS_asan += --param asan-globals=1
27 CFLAGS_ramstage += $(CFLAGS_asan)
28 $(obj)/ramstage/lib/asan.o: CFLAGS_asan =
29 endif
31 decompressor-y += decompressor.c
32 $(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4
33 $(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4
34 # Must reset CCACHE_EXTRAFILES or make applies it transitively to dependencies.
35 $(objcbfs)/bootblock.lz4: CCACHE_EXTRAFILES=
37 decompressor-y += delay.c
38 decompressor-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
39 decompressor-y += memchr.c
40 decompressor-y += memcmp.c
41 decompressor-y += prog_ops.c
42 decompressor-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
44 bootblock-y += bootblock.c
45 bootblock-y += prog_loaders.c
46 bootblock-y += prog_ops.c
47 bootblock-y += cbfs.c
48 bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
49 bootblock-y += libgcc.c
50 bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c
52 bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
54 bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
55 bootblock-y += delay.c
56 bootblock-y += memchr.c
57 bootblock-y += memcmp.c
58 bootblock-y += boot_device.c
59 bootblock-y += fmap.c
61 verstage-y += prog_loaders.c
62 verstage-y += prog_ops.c
63 verstage-y += delay.c
64 verstage-y += cbfs.c
65 verstage-y += halt.c
66 verstage-y += fmap.c
67 verstage-y += libgcc.c
68 verstage-y += memcmp.c
69 verstage-y += string.c
71 verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
72 verstage-y += boot_device.c
73 verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
75 verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
76 verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
78 romstage-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
79 romstage-y += prog_loaders.c
80 romstage-y += prog_ops.c
81 romstage-y += memchr.c
82 romstage-y += memcmp.c
83 $(foreach arch,$(ARCH_SUPPORTED),\
84             $(eval rmodules_$(arch)-y += memcmp.c) \
85             $(eval rmodules_$(arch)-y += rmodule.ld))
87 romstage-y += fmap.c
88 romstage-y += delay.c
89 romstage-y += cbfs.c
90 romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
91 romstage-y += libgcc.c
92 romstage-y += memrange.c
93 romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
94 ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
95 romstage-y += ramtest.c
96 romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
97 ramstage-y += region_file.c
98 romstage-y += region_file.c
99 ramstage-y += romstage_handoff.c
100 romstage-y += romstage_handoff.c
101 romstage-y += selfboot.c
102 romstage-y += stack.c
103 romstage-y += rtc.c
104 ramstage-y += rtc.c
106 romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
107 romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
109 romstage-y += compute_ip_checksum.c
110 ifeq ($(CONFIG_COMPILER_GCC),y)
111 bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c
112 verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c
113 romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
114 ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
115 smm-y += gcc.c
116 endif
118 romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
120 ramstage-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
121 ramstage-y += prog_loaders.c
122 ramstage-y += prog_ops.c
123 ramstage-y += hardwaremain.c
124 ramstage-y += selfboot.c
125 ramstage-y += coreboot_table.c
126 ramstage-y += bootmem.c
127 ramstage-y += fmap.c
128 ramstage-y += memchr.c
129 ramstage-y += memcmp.c
130 ramstage-y += malloc.c
131 ramstage-y += dimm_info_util.c
132 ramstage-y += delay.c
133 ramstage-y += fallback_boot.c
134 ramstage-y += compute_ip_checksum.c
135 ramstage-y += cbfs.c
136 ramstage-y += lzma.c lzmadecode.c
137 ramstage-y += stack.c
138 ramstage-y += hexstrtobin.c
139 ramstage-y += wrdd.c
140 ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
141 ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c
142 ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
143 ramstage-$(CONFIG_TRACE) += trace.c
144 postcar-$(CONFIG_TRACE) += trace.c
145 ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
146 ramstage-$(CONFIG_COVERAGE) += libgcov.c
147 ramstage-y += edid.c
148 ifneq ($(CONFIG_NO_EDID_FILL_FB),y)
149 ramstage-y += edid_fill_fb.c
150 endif
151 ramstage-y += memrange.c
152 ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
153 ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
154 ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
155 ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
156 ramstage-y += b64_decode.c
157 ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c
158 ramstage-y += list.c
159 ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
160 ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c
161 ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
163 romstage-y += cbmem_common.c
164 romstage-y += imd_cbmem.c
165 romstage-y += imd.c
167 ramstage-y += cbmem_common.c
168 ramstage-y += imd_cbmem.c
169 ramstage-y += imd.c
171 postcar-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
172 postcar-y += cbmem_common.c
173 postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
174 postcar-y += imd_cbmem.c
175 postcar-y += imd.c
176 postcar-y += romstage_handoff.c
178 bootblock-y += hexdump.c
179 postcar-y += hexdump.c
180 ramstage-y += hexdump.c
181 romstage-y += hexdump.c
182 verstage-y += hexdump.c
183 smm-y += hexdump.c
185 bootblock-$(CONFIG_FW_CONFIG) += fw_config.c
186 verstage-$(CONFIG_FW_CONFIG) += fw_config.c
187 romstage-$(CONFIG_FW_CONFIG) += fw_config.c
188 ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
190 bootblock-$(CONFIG_ESPI_DEBUG) += espi_debug.c
191 verstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
192 romstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
193 ramstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
195 bootblock-$(CONFIG_REG_SCRIPT) += reg_script.c
196 verstage-$(CONFIG_REG_SCRIPT) += reg_script.c
197 romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
198 ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
200 ramstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
201 romstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
202 postcar-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
204 ramstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
205 romstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
206 postcar-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
208 romstage-y += boot_device.c
209 ramstage-y += boot_device.c
211 smm-y += boot_device.c
212 smm-y += malloc.c
213 smm-y += delay.c
214 smm-y += fmap.c
215 smm-y += cbfs.c memcmp.c
216 smm-$(CONFIG_GENERIC_UDELAY) += timer.c
218 bootblock-y += version.c
219 romstage-y += version.c
220 ramstage-y += version.c
221 smm-y += version.c
222 verstage-y += version.c
223 postcar-y += version.c
225 $(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h
226 $(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h
227 $(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h
228 $(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h
229 $(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h
230 $(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h
232 $(call src-to-obj,bootblock,$(dir)/fmap.c) : $(obj)/fmap_config.h
233 $(call src-to-obj,romstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
234 $(call src-to-obj,ramstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
235 $(call src-to-obj,smm,$(dir)/fmap.c) : $(obj)/fmap_config.h
236 $(call src-to-obj,verstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
237 $(call src-to-obj,postcar,$(dir)/fmap.c) : $(obj)/fmap_config.h
239 bootblock-y += bootmode.c
240 romstage-y += bootmode.c
241 ramstage-y += bootmode.c
242 verstage-y += bootmode.c
244 decompressor-y += halt.c
245 bootblock-y += halt.c
246 romstage-y += halt.c
247 ramstage-y += halt.c
248 smm-y += halt.c
250 decompressor-y += reset.c
251 bootblock-y += reset.c
252 verstage-y += reset.c
253 romstage-y += reset.c
254 postcar-y += reset.c
255 ramstage-y += reset.c
256 smm-y += reset.c
258 decompressor-y += string.c
259 bootblock-y += string.c
260 verstage-y += string.c
261 romstage-y += string.c
262 postcar-y += string.c
263 ramstage-y += string.c
264 smm-y += string.c
266 decompressor-y += crc_byte.c
267 bootblock-y += crc_byte.c
268 verstage-y += crc_byte.c
269 romstage-y += crc_byte.c
270 postcar-y += crc_byte.c
271 ramstage-y += crc_byte.c
272 smm-y += crc_byte.c
274 postcar-y += bootmode.c
275 postcar-y += boot_device.c
276 postcar-y += cbfs.c
277 postcar-y += delay.c
278 postcar-y += fmap.c
279 postcar-y += gcc.c
280 postcar-y += halt.c
281 postcar-y += libgcc.c
282 postcar-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
283 postcar-y += memchr.c
284 postcar-y += memcmp.c
285 postcar-y += prog_loaders.c
286 postcar-y += prog_ops.c
287 postcar-y += rmodule.c
288 postcar-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
289 postcar-$(CONFIG_GENERIC_UDELAY) += timer.c
291 # Use program.ld for all the platforms which use C fo the bootblock.
292 bootblock-y += program.ld
294 decompressor-y += program.ld
295 postcar-y += program.ld
296 romstage-y += program.ld
297 ramstage-y += program.ld
298 verstage-y += program.ld
300 ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
301 ramstage-y += rmodule.c
302 romstage-y += rmodule.c
304 RMODULE_LDFLAGS  := -z defs -Bsymbolic
306 # rmodule_link_rules is a function that should be called with:
307 # (1) the object name to link
308 # (2) the dependencies
309 # (3) heap size of the relocatable module
310 # (4) arch for which the rmodules are to be linked
311 # It will create the necessary Make rules to create a rmodule. The resulting
312 # rmdoule is named $(1).rmod
313 define rmodule_link
314 $(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL)
315         $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
316         $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
317 endef
319 endif
321 $(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
322         $(RMODTOOL) -i $< -o $@
324 $(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
325         $(RMODTOOL) -i $< -o $@
327 ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads
329 ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y)
331 to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#)
333 $(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF)
335 $(call add-special-class,hw)
336 hw-handler = $(eval ramstage-srcs += $$(addprefix $(1),$(2)))
338 $(call add-special-class,hw-gen)
339 hw-gen-handler = \
340         $(eval additional-dirs += $(dir $(2))) \
341         $(eval ramstage-srcs += $(2)) \
342         $(eval ramstage-ads-deps += $(2)) \
343         $(eval ramstage-adb-deps += $(2)) \
344         $(eval $(2): $(obj)/config.h)
346 subdirs-y += ../../3rdparty/libhwbase
348 ramstage-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb
350 endif # CONFIG_RAMSTAGE_LIBHWBASE
352 romstage-y += spd_bin.c
354 ifeq ($(CONFIG_HAVE_SPD_IN_CBFS),y)
355 LIB_SPD_BIN = $(obj)/spd.bin
357 LIB_SPD_DEPS = $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)
359 # Include spd ROM data
360 $(LIB_SPD_BIN): $(LIB_SPD_DEPS)
361         test -n "$(SPD_SOURCES)" || \
362             (echo "HAVE_SPD_IN_CBFS is set but SPD_SOURCES is empty" && exit 1)
363         test -n "$(LIB_SPD_DEPS)" || \
364             (echo "SPD_SOURCES is set but no SPD file was found" && exit 1)
365         for f in $(LIB_SPD_DEPS); \
366          do for c in $$(cat $$f | grep --binary-files=text -v ^#); \
367           do printf $$(printf '\\%o' 0x$$c); \
368          done; \
369         done > $@
371 cbfs-files-y += spd.bin
372 spd.bin-file := $(LIB_SPD_BIN)
373 spd.bin-type := spd
374 endif
376 ramstage-y += uuid.c
378 romstage-$(CONFIG_ROMSTAGE_SPD_SMBUS) += spd_cache.c