blob: 1af7346aa213d8011d62a3c4fcbd383df1303150 [file] [log] [blame]
Patrick Georgic49d7a32020-05-08 22:50:46 +02001# SPDX-License-Identifier: GPL-2.0-only
2
Nico Huberbe5492a2015-09-29 16:41:19 +02003subdirs-y += gnat
Stefan Reinauer24ef1342011-04-14 22:28:00 +00004
Ryan Salsamendiab37e9a2017-06-11 21:07:31 -07005ifeq ($(CONFIG_UBSAN),y)
6ramstage-y += ubsan.c
7CFLAGS_ramstage += -fsanitize=undefined
8endif
Julius Werner86fc11d2015-10-09 13:37:58 -07009
Harshit Sharma3b9cc852020-07-06 23:38:31 -070010# Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used.
11CFLAGS_asan += -fsanitize=kernel-address --param asan-use-shadow-offset-callback=1 \
Harshit Sharmaa6ebe082020-07-20 00:21:05 -070012 --param asan-stack=1 -fsanitize-address-use-after-scope \
Harshit Sharma2bcaba02020-06-09 20:25:16 -070013 --param asan-instrumentation-with-call-threshold=0 \
Harshit Sharma2bcaba02020-06-09 20:25:16 -070014 --param use-after-scope-direct-emission-threshold=0
Harshit Sharmaa6ebe082020-07-20 00:21:05 -070015
16ifeq ($(CONFIG_ASAN_IN_ROMSTAGE),y)
17romstage-y += asan.c
18CFLAGS_asan += --param asan-globals=0
19CFLAGS_romstage += $(CFLAGS_asan)
Harshit Sharma2bcaba02020-06-09 20:25:16 -070020# Allow memory access without __asan_load and __asan_store checks.
Harshit Sharmaa6ebe082020-07-20 00:21:05 -070021$(obj)/romstage/lib/asan.o: CFLAGS_asan =
22endif
23
24ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y)
25ramstage-y += asan.c
26CFLAGS_asan += --param asan-globals=1
27CFLAGS_ramstage += $(CFLAGS_asan)
Harshit Sharma2bcaba02020-06-09 20:25:16 -070028$(obj)/ramstage/lib/asan.o: CFLAGS_asan =
29endif
30
Raul E Rangelba6eca32021-11-01 13:40:14 -060031all-y += list.c
32
Julius Werner99f46832018-05-16 14:14:04 -070033decompressor-y += decompressor.c
34$(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4
35$(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4
36# Must reset CCACHE_EXTRAFILES or make applies it transitively to dependencies.
37$(objcbfs)/bootblock.lz4: CCACHE_EXTRAFILES=
38
39decompressor-y += delay.c
40decompressor-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
41decompressor-y += memchr.c
42decompressor-y += memcmp.c
Julius Werner6296ca82021-04-02 16:31:21 -070043decompressor-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c
Julius Werner99f46832018-05-16 14:14:04 -070044decompressor-y += prog_ops.c
45decompressor-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
46
Julius Werner86fc11d2015-10-09 13:37:58 -070047bootblock-y += bootblock.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050048bootblock-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050049bootblock-y += prog_ops.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050050bootblock-y += cbfs.c
David Hendricks6fab3652014-11-06 15:22:10 -080051bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070052bootblock-y += libgcc.c
Julius Wernerfdabf3f2020-05-06 17:06:35 -070053bootblock-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c
Aaron Durbine5e36302014-09-25 10:05:15 -050054bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c
55
Patrick Georgi8b174042015-04-27 18:03:50 +020056bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Paul Menzel2ea25552015-10-13 17:30:57 +020057
Kyösti Mälkki8659e402014-12-21 08:55:47 +020058bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Patrick Georgib0a2d3c22016-01-19 18:10:55 +010059bootblock-y += delay.c
Hung-Te Linfe187922013-02-01 01:09:24 +080060bootblock-y += memchr.c
Hung-Te Linfe187922013-02-01 01:09:24 +080061bootblock-y += memcmp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050062bootblock-y += boot_device.c
Aaron Durbin0424c952015-03-28 23:56:22 -050063bootblock-y += fmap.c
Werner Zeh68601892021-05-25 14:26:06 +020064bootblcok-y += rtc.c
Hung-Te Linfe187922013-02-01 01:09:24 +080065
Aaron Durbin899d13d2015-05-15 23:39:23 -050066verstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050067verstage-y += prog_ops.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070068verstage-y += delay.c
69verstage-y += cbfs.c
Aaron Durbin17200ad2015-05-01 16:48:54 -050070verstage-y += halt.c
Aaron Durbin0424c952015-03-28 23:56:22 -050071verstage-y += fmap.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070072verstage-y += libgcc.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070073verstage-y += memcmp.c
Patrick Georgi19d04382019-06-18 23:28:57 +020074verstage-y += string.c
Martin Rothd09b9742020-06-10 14:57:35 -060075
Patrick Georgi8b174042015-04-27 18:03:50 +020076verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbinc6588c52015-05-15 13:15:34 -050077verstage-y += boot_device.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070078verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Yen Lin5bdbd002015-04-08 16:55:17 -070079
Vadim Bendebury3486d1f2014-10-16 11:24:12 -070080verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
David Hendricks6fab3652014-11-06 15:22:10 -080081verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070082
Patrick Rudolphbd4bcab2019-06-30 22:12:15 +020083romstage-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050084romstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050085romstage-y += prog_ops.c
Gabe Black1025f3a2011-09-16 02:18:56 -070086romstage-y += memchr.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +000087romstage-y += memcmp.c
Furquan Shaikh133096b2014-07-31 09:28:55 -070088$(foreach arch,$(ARCH_SUPPORTED),\
Julius Wernerec5e5e02014-08-20 15:29:56 -070089 $(eval rmodules_$(arch)-y += memcmp.c) \
90 $(eval rmodules_$(arch)-y += rmodule.ld))
Furquan Shaikh133096b2014-07-31 09:28:55 -070091
Aaron Durbin0424c952015-03-28 23:56:22 -050092romstage-y += fmap.c
Patrick Georgi82d9a312016-01-21 12:46:10 +010093romstage-y += delay.c
Aaron Durbin899d13d2015-05-15 23:39:23 -050094romstage-y += cbfs.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +110095romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
Julius Werner7a8a4ab2015-05-22 16:26:40 -070096romstage-y += libgcc.c
Aaron Durbin5fbe12d2016-07-17 22:59:47 -050097romstage-y += memrange.c
David Hendricks560c6432014-02-13 13:07:50 -080098romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
99ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c
Kyösti Mälkki321bce42019-03-20 19:53:44 +0200100romstage-y += ramtest.c
David Hendricks6fab3652014-11-06 15:22:10 -0800101romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbincd0bc982016-11-19 12:36:09 -0600102ramstage-y += region_file.c
103romstage-y += region_file.c
Aaron Durbinafe8aee2016-11-29 21:37:42 -0600104ramstage-y += romstage_handoff.c
105romstage-y += romstage_handoff.c
Ronald G. Minnich3d8e53f2018-10-29 09:58:06 -0700106romstage-y += selfboot.c
Julius Werner7dcf9d52015-10-16 13:10:02 -0700107romstage-y += stack.c
Shelley Chenafaa3d02020-10-06 15:50:21 -0700108romstage-y += rtc.c
Simon Glass2cf99e12016-06-10 20:58:24 -0600109ramstage-y += rtc.c
Vladimir Serbinenko45988da2013-03-30 02:02:13 +0100110
Aaron Durbinc15551a2013-03-23 00:00:54 -0500111romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +0300112romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Denis 'GNUtoo' Carikli8a0a8482013-06-20 16:24:14 +0200113
Stefan Reinauerfb89dd02012-03-30 16:28:20 -0700114romstage-y += compute_ip_checksum.c
Subrata Banik3afa4672021-10-27 20:53:49 +0530115romstage-y += dimm_info_util.c
Patrick Georgi6d0cba72014-11-29 11:32:12 +0100116ifeq ($(CONFIG_COMPILER_GCC),y)
Alexandru Gagniuc66bbb312015-10-06 16:35:07 -0700117bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c
Aaron Durbin75c51d92015-09-29 16:31:20 -0500118verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c
Furquan Shaikh99ac98f2014-04-23 10:18:48 -0700119romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +1000120ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c
Subrata Banik27618472019-05-30 18:28:59 +0530121smm-y += gcc.c
Edward O'Callaghan4ba8ba42014-05-23 01:29:00 +1000122endif
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000123
Aaron Durbine5e36302014-09-25 10:05:15 -0500124romstage-$(CONFIG_GENERIC_UDELAY) += timer.c
125
Patrick Rudolphbd4bcab2019-06-30 22:12:15 +0200126ramstage-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500127ramstage-y += prog_loaders.c
Aaron Durbinb3847e62015-03-20 15:55:08 -0500128ramstage-y += prog_ops.c
Stefan Reinauer1e753292012-11-30 12:23:45 -0800129ramstage-y += hardwaremain.c
130ramstage-y += selfboot.c
Stefan Reinauer3e4e3032013-03-20 14:08:04 -0700131ramstage-y += coreboot_table.c
Aaron Durbin49048022014-02-18 21:55:02 -0600132ramstage-y += bootmem.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500133ramstage-y += fmap.c
Gabe Black1025f3a2011-09-16 02:18:56 -0700134ramstage-y += memchr.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000135ramstage-y += memcmp.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000136ramstage-y += malloc.c
Raul E Rangel21db6cc2018-03-29 10:18:14 -0600137ramstage-y += dimm_info_util.c
Patrick Georgi8463dd92010-09-30 16:55:02 +0000138ramstage-y += delay.c
139ramstage-y += fallback_boot.c
140ramstage-y += compute_ip_checksum.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500141ramstage-y += cbfs.c
Edward O'Callaghancd31afd2014-11-11 12:27:06 +1100142ramstage-y += lzma.c lzmadecode.c
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -0700143ramstage-y += stack.c
Duncan Laurieb9552842016-05-09 10:58:03 -0700144ramstage-y += hexstrtobin.c
Felix Durairaj7f761652015-11-20 15:51:35 -0800145ramstage-y += wrdd.c
Vadim Bendebury3e316002011-09-30 12:02:18 -0700146ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Kyösti Mälkki4949a3d2021-01-09 20:38:43 +0200147ramstage-$(CONFIG_BMP_LOGO) += bmp_logo.c
Johanna Schanderdb7a3ae2019-07-24 10:14:26 +0200148ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c
Stefan Reinauer24ef1342011-04-14 22:28:00 +0000149ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c
Vadim Bendebury6f72d692011-09-21 16:12:39 -0700150ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Stefan Reinauerd37ab452012-12-18 16:23:28 -0800151ramstage-$(CONFIG_COVERAGE) += libgcov.c
xuxinxiongcb3745c2021-10-26 20:16:21 +0800152ramstage-y += dp_aux.c
Arthur Heymansa459a8a2017-04-30 08:26:27 +0200153ramstage-y += edid.c
Nico Huber3db76532017-05-18 18:07:34 +0200154ramstage-y += edid_fill_fb.c
Aaron Durbina05a8522013-03-22 20:44:46 -0500155ramstage-y += memrange.c
David Hendricks3b11de82014-11-05 14:05:56 -0800156ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
Aaron Durbine5e36302014-09-25 10:05:15 -0500157ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
Vadim Bendebury243c6142015-03-27 16:08:04 -0700158ramstage-y += b64_decode.c
Aaron Durbin9420a522015-11-17 16:31:00 -0600159ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c
Patrick Rudolph666c1722018-04-03 09:57:33 +0200160ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
Patrick Rudolpha892cde2018-04-19 14:39:07 +0200161ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c
162ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
Stefan Reinauer16ce01b2011-01-28 08:05:54 +0000163
Raul E Rangelca0606e2021-07-21 14:34:00 -0600164romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
165ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
166
167romstage-$(CONFIG_COOP_MULTITASKING) += thread.c
168ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
169
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600170romstage-y += cbmem_common.c
171romstage-y += imd_cbmem.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500172romstage-y += imd.c
Aaron Durbin0dff57d2015-03-05 21:18:33 -0600173
174ramstage-y += cbmem_common.c
175ramstage-y += imd_cbmem.c
Aaron Durbin20686d82015-03-05 14:11:27 -0600176ramstage-y += imd.c
177
Patrick Rudolphbd4bcab2019-06-30 22:12:15 +0200178postcar-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500179postcar-y += cbmem_common.c
Aaron Durbin1e9a9142016-09-16 16:23:21 -0500180postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500181postcar-y += imd_cbmem.c
182postcar-y += imd.c
Aaron Durbinafe8aee2016-11-29 21:37:42 -0600183postcar-y += romstage_handoff.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500184
Alexandru Gagniuce223e892015-10-14 09:58:36 -0700185bootblock-y += hexdump.c
Frans Hendriksd6225072019-05-21 11:04:50 +0200186postcar-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700187ramstage-y += hexdump.c
188romstage-y += hexdump.c
Duncan Laurie7fbdad82016-09-07 10:56:25 -0700189verstage-y += hexdump.c
John E. Kabat Jrd45011c2017-09-29 11:23:35 -0600190smm-y += hexdump.c
Stefan Reinauer2f38b072013-07-18 16:24:08 -0700191
Duncan Laurie36e6c6f2020-05-09 19:20:10 -0700192bootblock-$(CONFIG_FW_CONFIG) += fw_config.c
193verstage-$(CONFIG_FW_CONFIG) += fw_config.c
194romstage-$(CONFIG_FW_CONFIG) += fw_config.c
195ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
196
Furquan Shaikh5cc41f22020-05-11 12:11:27 -0700197bootblock-$(CONFIG_ESPI_DEBUG) += espi_debug.c
198verstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
199romstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
200ramstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c
201
Lee Leahy7a29cdc2016-06-05 18:49:55 -0700202bootblock-$(CONFIG_REG_SCRIPT) += reg_script.c
Aaron Durbin75c51d92015-09-29 16:31:20 -0500203verstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Isaac Christensen0b4e8df2014-10-01 11:50:20 -0600204romstage-$(CONFIG_REG_SCRIPT) += reg_script.c
Duncan Laurie72748002013-10-31 08:26:23 -0700205ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c
206
Kyösti Mälkki0a4457f2019-08-01 20:29:14 +0300207ramstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
208romstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
209postcar-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c
Aaron Durbinbd74a4b2015-03-06 23:17:33 -0600210
Kyösti Mälkki0a4457f2019-08-01 20:29:14 +0300211ramstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
212romstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
213postcar-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c
Aaron Durbin127525c2015-03-26 12:29:12 -0500214
Aaron Durbinc6588c52015-05-15 13:15:34 -0500215romstage-y += boot_device.c
216ramstage-y += boot_device.c
Aaron Durbin75e29742013-10-10 20:37:04 -0500217
Aaron Durbinc6588c52015-05-15 13:15:34 -0500218smm-y += boot_device.c
Kyösti Mälkki60012ac2019-07-08 00:01:42 +0300219smm-y += malloc.c
Furquan Shaikh591be2d2018-03-01 15:20:20 -0800220smm-y += delay.c
Aaron Durbin0424c952015-03-28 23:56:22 -0500221smm-y += fmap.c
Aaron Durbin899d13d2015-05-15 23:39:23 -0500222smm-y += cbfs.c memcmp.c
Aaron Durbin0660d1f2018-01-24 17:16:30 -0700223smm-$(CONFIG_GENERIC_UDELAY) += timer.c
Stefan Reinauere9f32582010-03-29 13:04:13 +0000224
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200225bootblock-y += version.c
226romstage-y += version.c
227ramstage-y += version.c
228smm-y += version.c
Aaron Durbinfd6fb262015-05-13 13:37:43 -0500229verstage-y += version.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500230postcar-y += version.c
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +0200231
Nico Huber81b09f42016-01-23 00:50:00 +0100232$(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h
233$(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h
234$(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h
235$(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h
236$(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500237$(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h
Stefan Reinauerba9dae22011-07-29 15:34:14 -0700238
Aaron Durbinbf1e4812016-05-10 15:12:08 -0500239$(call src-to-obj,bootblock,$(dir)/fmap.c) : $(obj)/fmap_config.h
240$(call src-to-obj,romstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
241$(call src-to-obj,ramstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
242$(call src-to-obj,smm,$(dir)/fmap.c) : $(obj)/fmap_config.h
243$(call src-to-obj,verstage,$(dir)/fmap.c) : $(obj)/fmap_config.h
244$(call src-to-obj,postcar,$(dir)/fmap.c) : $(obj)/fmap_config.h
245
Subrata Banik50b92582016-07-21 23:47:38 +0530246bootblock-y += bootmode.c
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200247romstage-y += bootmode.c
248ramstage-y += bootmode.c
Aaron Durbin7bc39a02016-01-25 16:58:43 -0600249verstage-y += bootmode.c
Kyösti Mälkki5687fc92013-11-28 18:11:49 +0200250
Julius Werner99f46832018-05-16 14:14:04 -0700251decompressor-y += halt.c
Patrick Georgi1b2f2a02014-11-28 22:00:22 +0100252bootblock-y += halt.c
253romstage-y += halt.c
254ramstage-y += halt.c
255smm-y += halt.c
256
Julius Werner99f46832018-05-16 14:14:04 -0700257decompressor-y += reset.c
Julius Werner01f9aa52017-05-18 16:03:26 -0700258bootblock-y += reset.c
259verstage-y += reset.c
260romstage-y += reset.c
261postcar-y += reset.c
262ramstage-y += reset.c
263smm-y += reset.c
264
Julius Wernera66c9b82019-05-20 14:53:47 -0700265decompressor-y += string.c
266bootblock-y += string.c
267verstage-y += string.c
268romstage-y += string.c
269postcar-y += string.c
270ramstage-y += string.c
271smm-y += string.c
272
Xiang Wang4e39c822019-11-05 12:00:39 +0800273decompressor-y += crc_byte.c
274bootblock-y += crc_byte.c
275verstage-y += crc_byte.c
276romstage-y += crc_byte.c
277postcar-y += crc_byte.c
278ramstage-y += crc_byte.c
279smm-y += crc_byte.c
280
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500281postcar-y += bootmode.c
282postcar-y += boot_device.c
283postcar-y += cbfs.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500284postcar-y += delay.c
285postcar-y += fmap.c
286postcar-y += gcc.c
287postcar-y += halt.c
288postcar-y += libgcc.c
289postcar-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c lzmadecode.c
290postcar-y += memchr.c
291postcar-y += memcmp.c
292postcar-y += prog_loaders.c
293postcar-y += prog_ops.c
294postcar-y += rmodule.c
295postcar-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Aaron Durbin0660d1f2018-01-24 17:16:30 -0700296postcar-$(CONFIG_GENERIC_UDELAY) += timer.c
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500297
Aaron Durbineb907b32016-01-21 00:08:17 -0600298# Use program.ld for all the platforms which use C fo the bootblock.
Arthur Heymansc05b1a62019-11-22 21:01:30 +0100299bootblock-y += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500300
Julius Werner99f46832018-05-16 14:14:04 -0700301decompressor-y += program.ld
Aaron Durbin7f8afe02016-03-18 12:21:23 -0500302postcar-y += program.ld
Aaron Durbin14714e12015-09-04 12:06:05 -0500303romstage-y += program.ld
Aaron Durbin4de29d42015-09-03 22:49:36 -0500304ramstage-y += program.ld
Aaron Durbine5bad5c2015-09-05 10:27:12 -0500305verstage-y += program.ld
Julius Wernerec5e5e02014-08-20 15:29:56 -0700306
Aaron Durbinad935522012-12-24 14:28:37 -0600307ifeq ($(CONFIG_RELOCATABLE_MODULES),y)
308ramstage-y += rmodule.c
Subrata Banik27618472019-05-30 18:28:59 +0530309romstage-y += rmodule.c
Aaron Durbinad935522012-12-24 14:28:37 -0600310
Aaron Durbind4dd44c2015-09-06 10:15:17 -0500311RMODULE_LDFLAGS := -z defs -Bsymbolic
Aaron Durbinad935522012-12-24 14:28:37 -0600312
313# rmodule_link_rules is a function that should be called with:
314# (1) the object name to link
315# (2) the dependencies
316# (3) heap size of the relocatable module
Furquan Shaikh133096b2014-07-31 09:28:55 -0700317# (4) arch for which the rmodules are to be linked
Aaron Durbin3eb8eb72014-03-10 16:13:58 -0500318# It will create the necessary Make rules to create a rmodule. The resulting
319# rmdoule is named $(1).rmod
Aaron Durbinad935522012-12-24 14:28:37 -0600320define rmodule_link
Nico Huber81b09f42016-01-23 00:50:00 +0100321$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL)
322 $$(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
Furquan Shaikh133096b2014-07-31 09:28:55 -0700323 $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
Aaron Durbinad935522012-12-24 14:28:37 -0600324endef
325
326endif
Aaron Durbin83bc0db2015-09-06 10:45:18 -0500327
328$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
329 $(RMODTOOL) -i $< -o $@
330
331$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
332 $(RMODTOOL) -i $< -o $@
Nico Huberc83239e2016-10-05 17:46:49 +0200333
Nico Huberb5679772019-01-01 22:06:01 +0100334ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads
335
Nico Huberc83239e2016-10-05 17:46:49 +0200336ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y)
337
Nico Huber625160f2017-07-17 23:42:33 +0200338to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#)
339
340$(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF)
341
Nico Huberc83239e2016-10-05 17:46:49 +0200342$(call add-special-class,hw)
343hw-handler = $(eval ramstage-srcs += $$(addprefix $(1),$(2)))
Nico Huber625160f2017-07-17 23:42:33 +0200344
345$(call add-special-class,hw-gen)
346hw-gen-handler = \
347 $(eval additional-dirs += $(dir $(2))) \
348 $(eval ramstage-srcs += $(2)) \
349 $(eval ramstage-ads-deps += $(2)) \
350 $(eval ramstage-adb-deps += $(2)) \
351 $(eval $(2): $(obj)/config.h)
352
Nico Huberc83239e2016-10-05 17:46:49 +0200353subdirs-y += ../../3rdparty/libhwbase
354
355ramstage-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb
356
357endif # CONFIG_RAMSTAGE_LIBHWBASE
Naresh G Solanki335781a2016-10-26 19:43:14 +0530358
Patrick Georgi0e3c59e2017-01-28 15:59:25 +0100359romstage-y += spd_bin.c
Naresh G Solanki335781a2016-10-26 19:43:14 +0530360
Michael Niewöhner87cc8892020-09-07 14:26:09 +0200361ifeq ($(CONFIG_HAVE_SPD_IN_CBFS),y)
Naresh G Solanki335781a2016-10-26 19:43:14 +0530362LIB_SPD_BIN = $(obj)/spd.bin
363
364LIB_SPD_DEPS = $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)
365
366# Include spd ROM data
367$(LIB_SPD_BIN): $(LIB_SPD_DEPS)
Michael Niewöhnereb662332020-09-06 17:06:40 +0200368 test -n "$(SPD_SOURCES)" || \
Paul Fagerburg96fd5292020-09-25 08:39:15 -0600369 (echo "HAVE_SPD_IN_CBFS is set but SPD_SOURCES is empty" && exit 1)
Michael Niewöhnereb662332020-09-06 17:06:40 +0200370 test -n "$(LIB_SPD_DEPS)" || \
371 (echo "SPD_SOURCES is set but no SPD file was found" && exit 1)
Reka Normanbdc49b22021-09-21 14:29:24 +1000372 if [ "$(SPD_SOURCES)" = "placeholder" ]; then \
373 printf '\0'; \
374 else \
375 for f in $(LIB_SPD_DEPS); do \
376 if [ ! -f $$f ]; then \
377 echo "File not found: $$f" >&2; \
378 exit 1; \
379 fi; \
380 for c in $$(cat $$f | grep --binary-files=text -v ^#); \
381 do printf $$(printf '\\%o' 0x$$c); \
382 done; \
Reka Norman16612c42021-09-16 14:11:34 +1000383 done; \
Reka Normanbdc49b22021-09-21 14:29:24 +1000384 fi > $@
Naresh G Solanki335781a2016-10-26 19:43:14 +0530385
Michael Niewöhnerc521d152020-09-07 21:39:43 +0200386cbfs-files-y += spd.bin
Naresh G Solanki335781a2016-10-26 19:43:14 +0530387spd.bin-file := $(LIB_SPD_BIN)
388spd.bin-type := spd
Martin Roth8e4bb312017-01-29 18:11:36 -0700389endif
Nico Huber2e6a0f82019-10-24 15:01:33 +0200390
391ramstage-y += uuid.c
Jamie Chen92ba06f2020-04-27 15:49:09 +0800392
Matt DeVillier8ead1dc2020-11-30 14:30:15 -0600393romstage-$(CONFIG_SPD_CACHE_IN_FMAP) += spd_cache.c