Patrick Georgi | 11f0079 | 2020-03-04 15:10:45 +0100 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 2 | |
Patrick Georgi | 29eeece | 2018-10-31 14:24:47 +0100 | [diff] [blame] | 3 | ifeq ($(CONFIG_POSTCAR_STAGE),y) |
| 4 | $(eval $(call init_standard_toolchain,postcar)) |
| 5 | endif |
| 6 | |
Patrick Georgi | 70a6b4f | 2015-03-27 14:14:58 +0100 | [diff] [blame] | 7 | ################################################################################ |
| 8 | # i386 specific tools |
| 9 | NVRAMTOOL:=$(objutil)/nvramtool/nvramtool |
| 10 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 11 | OPTION_TABLE_H:= |
| 12 | ifeq ($(CONFIG_HAVE_OPTION_TABLE),y) |
Patrick Georgi | 70a6b4f | 2015-03-27 14:14:58 +0100 | [diff] [blame] | 13 | |
Patrick Georgi | 5c0bca2 | 2011-01-30 16:31:15 +0000 | [diff] [blame] | 14 | cbfs-files-y += cmos_layout.bin |
| 15 | cmos_layout.bin-file = $(obj)/cmos_layout.bin |
Martin Roth | 8ea0651 | 2016-09-19 13:58:01 -0600 | [diff] [blame] | 16 | cmos_layout.bin-type = cmos_layout |
Patrick Georgi | 2447937 | 2011-01-18 13:56:36 +0000 | [diff] [blame] | 17 | |
Patrick Georgi | 70a6b4f | 2015-03-27 14:14:58 +0100 | [diff] [blame] | 18 | $(obj)/cmos_layout.bin: $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout |
| 19 | @printf " OPTION $(subst $(obj)/,,$(@))\n" |
| 20 | $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -L $@ |
| 21 | |
Patrick Georgi | 8463dd9 | 2010-09-30 16:55:02 +0000 | [diff] [blame] | 22 | OPTION_TABLE_H:=$(obj)/option_table.h |
Patrick Georgi | 70a6b4f | 2015-03-27 14:14:58 +0100 | [diff] [blame] | 23 | |
| 24 | $(OPTION_TABLE_H): $(NVRAMTOOL) $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout |
| 25 | @printf " OPTION $(subst $(obj)/,,$(@))\n" |
| 26 | $(NVRAMTOOL) -y $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout -H $@ |
| 27 | endif # CONFIG_HAVE_OPTION_TABLE |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 28 | |
Patrick Georgi | ff9d78c | 2011-01-30 16:37:39 +0000 | [diff] [blame] | 29 | stripped_vgabios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_ID)) |
| 30 | cbfs-files-$(CONFIG_VGA_BIOS) += pci$(stripped_vgabios_id).rom |
| 31 | pci$(stripped_vgabios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_FILE)) |
| 32 | pci$(stripped_vgabios_id).rom-type := optionrom |
| 33 | |
Martin Roth | 4cc2cac | 2019-12-06 19:11:08 -0700 | [diff] [blame] | 34 | stripped_second_vbios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_SECOND_ID)) |
| 35 | cbfs-files-$(CONFIG_VGA_BIOS_SECOND) += pci$(stripped_second_vbios_id).rom |
| 36 | pci$(stripped_second_vbios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_SECOND_FILE)) |
| 37 | pci$(stripped_second_vbios_id).rom-type := optionrom |
| 38 | |
Mike Banon | 0f8547e | 2019-02-17 19:51:53 +0300 | [diff] [blame] | 39 | stripped_vgabios_dgpu_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_DGPU_ID)) |
| 40 | cbfs-files-$(CONFIG_VGA_BIOS_DGPU) += pci$(stripped_vgabios_dgpu_id).rom |
| 41 | pci$(stripped_vgabios_dgpu_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_DGPU_FILE)) |
| 42 | pci$(stripped_vgabios_dgpu_id).rom-type := optionrom |
| 43 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 44 | ############################################################################### |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 45 | # common support for early assembly includes |
| 46 | ############################################################################### |
| 47 | |
| 48 | # Chipset specific assembly stubs in the romstage program flow. Certain |
| 49 | # boards have more than one assembly stub so collect those and put them |
| 50 | # into a single generated file. |
| 51 | crt0s = $(cpu_incs-y) |
| 52 | |
Patrick Georgi | 6f5e5e5 | 2020-06-29 22:28:18 +0200 | [diff] [blame] | 53 | $(objgenerated)/assembly.inc: build-dirs $$(crt0s) |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 54 | @printf " GEN $(subst $(obj)/,,$(@))\n" |
| 55 | printf '$(foreach crt0,$(crt0s),#include "$(crt0)"\n)' > $@ |
| 56 | |
| 57 | |
| 58 | define early_x86_assembly_entry_rule |
| 59 | # $1 stage name |
| 60 | # Add the assembly file that pulls in the rest of the dependencies in |
| 61 | # the right order. Make sure the auto generated assembly.inc is a proper |
| 62 | # dependency. |
| 63 | $(1)-y += assembly_entry.S |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 64 | $(call src-to-obj,$(1),$(dir)/assembly_entry.S): $(objgenerated)/assembly.inc |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 65 | endef |
| 66 | |
| 67 | define early_x86_stage |
| 68 | # $1 stage name |
| 69 | # $2 oformat |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 70 | |
| 71 | # The '.' include path is needed for the generated assembly.inc file. |
| 72 | $(1)-S-ccopts += -I. |
| 73 | |
| 74 | $$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs) |
| 75 | @printf " LINK $$(subst $$(obj)/,,$$(@))\n" |
Furquan Shaikh | 46514c2 | 2020-06-11 11:59:07 -0700 | [diff] [blame] | 76 | $$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) --whole-archive --start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) --no-whole-archive $$(COMPILER_RT_$(1)) --end-group -T $(call src-to-obj,$(1),$(CONFIG_MEMLAYOUT_LD_FILE)) --oformat $(2) |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 77 | -LANG=C LC_ALL= $$(OBJCOPY_$(1)) --only-section .illegal_globals $$(@) $$(objcbfs)/$(1)_null.offenders >/dev/null 2>&1 |
| 78 | if [ -z "$$$$($$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders 2>&1 | grep 'no symbols')" ];then \ |
| 79 | echo "Forbidden global variables in $(1):"; \ |
| 80 | $$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders; false; \ |
| 81 | fi |
| 82 | endef |
| 83 | |
| 84 | ############################################################################### |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 85 | # bootblock |
| 86 | ############################################################################### |
Patrick Georgi | 641dd71 | 2011-11-01 18:55:59 +0100 | [diff] [blame] | 87 | |
Stefan Reinauer | 181b773 | 2015-03-15 19:23:50 +0100 | [diff] [blame] | 88 | ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32)$(CONFIG_ARCH_BOOTBLOCK_X86_64),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 89 | |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 90 | bootblock-y += boot.c |
| 91 | bootblock-y += post.c |
| 92 | bootblock-y += cpu_common.c |
Aaron Durbin | 4b032e4 | 2018-04-20 01:39:30 -0600 | [diff] [blame] | 93 | bootblock-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 94 | bootblock-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 95 | bootblock-y += memcpy.c |
| 96 | bootblock-y += memset.c |
Martin Roth | 00b37d3 | 2020-06-25 14:34:46 -0600 | [diff] [blame] | 97 | bootblock-y += memmove.c |
Aaron Durbin | f49ddb6 | 2018-01-24 17:35:58 -0700 | [diff] [blame] | 98 | bootblock-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
Alexandru Gagniuc | 6a62231 | 2015-10-27 10:27:30 -0700 | [diff] [blame] | 99 | bootblock-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
Kyösti Mälkki | b8d575c | 2019-12-16 16:00:49 +0200 | [diff] [blame] | 100 | bootblock-$(CONFIG_BOOTBLOCK_NORMAL) += bootblock_normal.c |
Alexandru Gagniuc | ee2740b | 2015-10-04 17:47:36 -0700 | [diff] [blame] | 101 | bootblock-y += id.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 102 | bootblock-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
| 103 | |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 104 | $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h |
Patrick Georgi | ab35575 | 2015-10-15 11:07:07 +0200 | [diff] [blame] | 105 | |
Alexandru Gagniuc | 6be6c8f | 2016-01-26 18:22:43 -0800 | [diff] [blame] | 106 | bootblock-y += bootblock_crt0.S |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 107 | |
| 108 | ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y) |
| 109 | $(eval $(call early_x86_stage,bootblock,elf32-i386)) |
| 110 | else |
| 111 | $(eval $(call early_x86_stage,bootblock,elf64-x86-64)) |
| 112 | endif |
| 113 | |
Kyösti Mälkki | d60e9ab | 2019-12-21 10:14:15 +0200 | [diff] [blame] | 114 | bootblock-$(CONFIG_MICROCODE_UPDATE_PRE_RAM) += walkcbfs.S |
Arthur Heymans | 0eb9c57 | 2019-01-05 18:21:47 +0100 | [diff] [blame] | 115 | |
Stefan Reinauer | 181b773 | 2015-03-15 19:23:50 +0100 | [diff] [blame] | 116 | endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64 |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 117 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 118 | ############################################################################### |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 119 | # verstage |
| 120 | ############################################################################### |
| 121 | |
| 122 | ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32)$(CONFIG_ARCH_VERSTAGE_X86_64),y) |
| 123 | |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 124 | verstage-y += boot.c |
| 125 | verstage-y += post.c |
Hannah Williams | d3c0c0c | 2018-04-27 09:09:04 -0700 | [diff] [blame] | 126 | verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += gdt_init.S |
Aaron Durbin | 4b032e4 | 2018-04-20 01:39:30 -0600 | [diff] [blame] | 127 | verstage-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 128 | verstage-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 129 | verstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 130 | |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 131 | verstage-y += cpu_common.c |
| 132 | verstage-y += memset.c |
| 133 | verstage-y += memcpy.c |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 134 | verstage-y += memmove.c |
Aaron Durbin | 57dbbbb | 2016-03-18 13:12:41 -0500 | [diff] [blame] | 135 | verstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
Arthur Heymans | 7bea084 | 2018-06-06 18:19:56 +0200 | [diff] [blame] | 136 | # If verstage is a separate stage it means there's no need |
Aaron Durbin | 10221a0 | 2016-05-26 10:55:48 -0500 | [diff] [blame] | 137 | # for a chipset-specific car_stage_entry() so use the generic one |
| 138 | # which just calls verstage(). |
Arthur Heymans | 7bea084 | 2018-06-06 18:19:56 +0200 | [diff] [blame] | 139 | verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += verstage.c |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 140 | |
Aaron Durbin | f49ddb6 | 2018-01-24 17:35:58 -0700 | [diff] [blame] | 141 | verstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 142 | |
Julius Werner | e91d170 | 2017-03-20 15:32:15 -0700 | [diff] [blame] | 143 | verstage-libs ?= |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 144 | |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 145 | $(eval $(call early_x86_assembly_entry_rule,verstage)) |
| 146 | |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 147 | ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32),y) |
| 148 | $(eval $(call early_x86_stage,verstage,elf32-i386)) |
| 149 | else |
| 150 | $(eval $(call early_x86_stage,verstage,elf64-x86-64)) |
| 151 | endif |
| 152 | |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 153 | endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64 |
| 154 | |
| 155 | ############################################################################### |
Aaron Durbin | 1bc6a79 | 2015-09-29 14:54:25 -0500 | [diff] [blame] | 156 | # romstage |
| 157 | ############################################################################### |
| 158 | |
| 159 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 160 | |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 161 | romstage-y += boot.c |
| 162 | romstage-y += post.c |
Hannah Williams | d3c0c0c | 2018-04-27 09:09:04 -0700 | [diff] [blame] | 163 | # gdt_init.S is included by entry32.inc when romstage is the first C |
| 164 | # environment. |
Arthur Heymans | c05b1a6 | 2019-11-22 21:01:30 +0100 | [diff] [blame] | 165 | romstage-y += gdt_init.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 166 | romstage-y += cpu_common.c |
Aaron Durbin | 4b032e4 | 2018-04-20 01:39:30 -0600 | [diff] [blame] | 167 | romstage-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 168 | romstage-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 169 | romstage-y += memcpy.c |
Lee Leahy | e82b505 | 2016-07-25 17:07:53 -0700 | [diff] [blame] | 170 | romstage-y += memmove.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 171 | romstage-y += memset.c |
Lee Leahy | e82b505 | 2016-07-25 17:07:53 -0700 | [diff] [blame] | 172 | romstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
Rizwan Qureshi | b1b44d3 | 2016-08-26 21:08:50 +0530 | [diff] [blame] | 173 | romstage-y += postcar_loader.c |
Aaron Durbin | f49ddb6 | 2018-01-24 17:35:58 -0700 | [diff] [blame] | 174 | romstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 175 | romstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
Lee Leahy | e82b505 | 2016-07-25 17:07:53 -0700 | [diff] [blame] | 176 | |
Rizwan Qureshi | 8e8ca5c | 2018-10-01 14:35:25 +0530 | [diff] [blame] | 177 | romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c) |
Alexandru Gagniuc | eb3c991 | 2014-03-29 13:01:11 -0500 | [diff] [blame] | 178 | romstage-libs ?= |
| 179 | |
Aaron Durbin | eb907b3 | 2016-01-21 00:08:17 -0600 | [diff] [blame] | 180 | $(eval $(call early_x86_assembly_entry_rule,romstage)) |
| 181 | |
Stefan Reinauer | 9874933 | 2015-06-23 12:57:06 -0700 | [diff] [blame] | 182 | ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y) |
Aaron Durbin | 1bc6a79 | 2015-09-29 14:54:25 -0500 | [diff] [blame] | 183 | $(eval $(call early_x86_stage,romstage,elf32-i386)) |
Stefan Reinauer | 9874933 | 2015-06-23 12:57:06 -0700 | [diff] [blame] | 184 | else |
Aaron Durbin | 1bc6a79 | 2015-09-29 14:54:25 -0500 | [diff] [blame] | 185 | $(eval $(call early_x86_stage,romstage,elf64-x86-64)) |
Stefan Reinauer | 9874933 | 2015-06-23 12:57:06 -0700 | [diff] [blame] | 186 | endif |
| 187 | |
Patrick Georgi | d69839b | 2015-04-03 10:32:17 +0200 | [diff] [blame] | 188 | # Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428 |
Aaron Durbin | 75c51d9 | 2015-09-29 16:31:20 -0500 | [diff] [blame] | 189 | romstage-S-ccopts += -g0 |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 190 | |
Stefan Reinauer | 181b773 | 2015-03-15 19:23:50 +0100 | [diff] [blame] | 191 | endif # CONFIG_ARCH_ROMSTAGE_X86_32 / CONFIG_ARCH_ROMSTAGE_X86_64 |
Stefan Reinauer | f1939bb | 2010-12-30 17:39:50 +0000 | [diff] [blame] | 192 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 193 | ############################################################################### |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 194 | # postcar |
| 195 | ############################################################################### |
| 196 | |
Patrick Rudolph | 8daa12f | 2018-12-26 15:12:32 +0100 | [diff] [blame] | 197 | ifeq ($(CONFIG_ARCH_POSTCAR_X86_32),y) |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 198 | $(eval $(call create_class_compiler,postcar,x86_32)) |
Patrick Rudolph | 8daa12f | 2018-12-26 15:12:32 +0100 | [diff] [blame] | 199 | else |
| 200 | $(eval $(call create_class_compiler,postcar,x86_64)) |
| 201 | endif |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 202 | postcar-generic-ccopts += -D__POSTCAR__ |
| 203 | |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 204 | postcar-y += boot.c |
| 205 | postcar-y += post.c |
Hannah Williams | d3c0c0c | 2018-04-27 09:09:04 -0700 | [diff] [blame] | 206 | postcar-y += gdt_init.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 207 | postcar-y += cpu_common.c |
Aaron Durbin | 4b032e4 | 2018-04-20 01:39:30 -0600 | [diff] [blame] | 208 | postcar-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 209 | postcar-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 210 | postcar-y += exit_car.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 211 | postcar-y += memcpy.c |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 212 | postcar-y += memmove.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 213 | postcar-y += memset.c |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 214 | postcar-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 215 | postcar-y += postcar.c |
Aaron Durbin | f49ddb6 | 2018-01-24 17:35:58 -0700 | [diff] [blame] | 216 | postcar-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 217 | postcar-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 218 | |
Lee Leahy | 4cfde2a | 2016-07-24 07:51:24 -0700 | [diff] [blame] | 219 | LDFLAGS_postcar += -Map $(objcbfs)/postcar.map |
| 220 | |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 221 | $(objcbfs)/postcar.debug: $$(postcar-objs) |
| 222 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Furquan Shaikh | 46514c2 | 2020-06-11 11:59:07 -0700 | [diff] [blame] | 223 | $(LD_postcar) $(LDFLAGS_postcar) -o $@ -L$(obj) $(COMPILER_RT_FLAGS_postcar) --whole-archive --start-group $(filter-out %.ld,$^) --no-whole-archive $(COMPILER_RT_postcar) --end-group -T $(call src-to-obj,postcar,$(CONFIG_MEMLAYOUT_LD_FILE)) |
Lee Leahy | a749150 | 2016-07-24 07:43:23 -0700 | [diff] [blame] | 224 | |
| 225 | $(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod |
| 226 | cp $< $@ |
| 227 | |
| 228 | # Add postcar to CBFS |
| 229 | cbfs-files-$(CONFIG_POSTCAR_STAGE) += $(CONFIG_CBFS_PREFIX)/postcar |
| 230 | $(CONFIG_CBFS_PREFIX)/postcar-file := $(objcbfs)/postcar.elf |
| 231 | $(CONFIG_CBFS_PREFIX)/postcar-type := stage |
| 232 | $(CONFIG_CBFS_PREFIX)/postcar-compression := none |
| 233 | |
| 234 | ############################################################################### |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 235 | # ramstage |
| 236 | ############################################################################### |
| 237 | |
Stefan Reinauer | 181b773 | 2015-03-15 19:23:50 +0100 | [diff] [blame] | 238 | ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y) |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 239 | |
Angel Pons | 79572e4 | 2020-07-13 00:17:43 +0200 | [diff] [blame] | 240 | ramstage-y += acpi.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 241 | ramstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c |
Marshall Dawson | 991467d | 2018-09-04 12:32:56 -0600 | [diff] [blame] | 242 | ramstage-$(CONFIG_ACPI_BERT) += acpi_bert_storage.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 243 | ramstage-y += boot.c |
| 244 | ramstage-y += post.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 245 | ramstage-y += c_start.S |
Patrick Rudolph | e563815 | 2018-12-09 10:48:59 +0100 | [diff] [blame] | 246 | ramstage-y += c_exit.S |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 247 | ramstage-y += cpu.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 248 | ramstage-y += cpu_common.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 249 | ramstage-y += ebda.c |
| 250 | ramstage-y += exception.c |
Aaron Durbin | 7a7c70b | 2018-04-20 00:56:57 -0600 | [diff] [blame] | 251 | ramstage-y += idt.S |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 252 | ramstage-$(CONFIG_IOAPIC) += ioapic.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 253 | ramstage-y += memcpy.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 254 | ramstage-y += memmove.c |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 255 | ramstage-y += memset.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 256 | ramstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 257 | ramstage-$(CONFIG_GENERATE_MP_TABLE) += mpspec.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 258 | ramstage-$(CONFIG_GENERATE_PIRQ_TABLE) += pirq_routing.c |
Robbie Zhang | 1879231 | 2017-02-13 13:44:14 -0800 | [diff] [blame] | 259 | ramstage-y += rdrand.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 260 | ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c |
Angel Pons | bea5ce7 | 2020-07-29 18:40:00 +0200 | [diff] [blame] | 261 | ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios_defaults.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 262 | ramstage-y += tables.c |
| 263 | ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c |
| 264 | ramstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S |
Aaron Durbin | f49ddb6 | 2018-01-24 17:35:58 -0700 | [diff] [blame] | 265 | ramstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 266 | ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S |
Martin Roth | cbf6e6b | 2020-06-06 09:45:20 -0600 | [diff] [blame] | 267 | ramstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 268 | |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 269 | rmodules_x86_32-y += memcpy.c |
| 270 | rmodules_x86_32-y += memmove.c |
| 271 | rmodules_x86_32-y += memset.c |
Kyösti Mälkki | 67a537c | 2020-06-04 09:21:40 +0300 | [diff] [blame] | 272 | |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 273 | rmodules_x86_64-y += memcpy.c |
| 274 | rmodules_x86_64-y += memmove.c |
| 275 | rmodules_x86_64-y += memset.c |
Lee Leahy | 99f1b2f | 2016-07-25 17:18:50 -0700 | [diff] [blame] | 276 | |
Patrick Georgi | c32a52c | 2015-06-22 21:10:34 +0200 | [diff] [blame] | 277 | ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) |
| 278 | target-objcopy=-O elf32-i386 -B i386 |
Kyösti Mälkki | 67a537c | 2020-06-04 09:21:40 +0300 | [diff] [blame] | 279 | LD_MACHINE =-m elf_i386 |
Patrick Georgi | c32a52c | 2015-06-22 21:10:34 +0200 | [diff] [blame] | 280 | endif |
| 281 | ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_64),y) |
Stefan Reinauer | 593f5c8 | 2015-07-30 18:03:18 -0700 | [diff] [blame] | 282 | target-objcopy=-O elf64-x86-64 -B i386:x86-64 |
Kyösti Mälkki | 67a537c | 2020-06-04 09:21:40 +0300 | [diff] [blame] | 283 | LD_MACHINE =-m elf_x86_64 |
Patrick Georgi | c32a52c | 2015-06-22 21:10:34 +0200 | [diff] [blame] | 284 | endif |
| 285 | |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 286 | ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) |
| 287 | ifeq ($(CONFIG_GENERATE_MP_TABLE),y) |
| 288 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),) |
| 289 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c |
| 290 | endif |
| 291 | endif |
| 292 | ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y) |
| 293 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c |
| 294 | endif |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 295 | |
| 296 | ramstage-libs ?= |
| 297 | |
Elyes HAOUAS | 2f79eb3 | 2018-08-07 12:24:42 +0200 | [diff] [blame] | 298 | # The rmodule_link definition creates an elf file with .rmod extension. |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 299 | $(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod |
| 300 | cp $< $@ |
| 301 | |
Furquan Shaikh | 46514c2 | 2020-06-11 11:59:07 -0700 | [diff] [blame] | 302 | $(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 303 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Furquan Shaikh | 46514c2 | 2020-06-11 11:59:07 -0700 | [diff] [blame] | 304 | $(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(call src-to-obj,ramstage,$(CONFIG_MEMLAYOUT_LD_FILE)) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 305 | |
Patrick Georgi | 3ce96bd | 2014-11-22 17:42:58 +0100 | [diff] [blame] | 306 | $(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs) |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 307 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Kyösti Mälkki | 67a537c | 2020-06-04 09:21:40 +0300 | [diff] [blame] | 308 | $(LD_ramstage) $(LD_MACHINE) -r -o $@ $(COMPILER_RT_FLAGS_ramstage) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) $(ramstage-libs) --no-whole-archive $(COMPILER_RT_ramstage) --end-group |
Furquan Shaikh | 88ca81a | 2014-04-22 16:33:22 -0700 | [diff] [blame] | 309 | |
Stefan Reinauer | 181b773 | 2015-03-15 19:23:50 +0100 | [diff] [blame] | 310 | endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64 |
Subrata Banik | eb5b0d0 | 2019-06-04 16:46:41 +0530 | [diff] [blame] | 311 | |
| 312 | smm-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 313 | smm-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
| 314 | smm-y += memcpy.c |
| 315 | smm-y += memmove.c |
| 316 | smm-y += memset.c |
| 317 | smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 318 | |
Subrata Banik | eb5b0d0 | 2019-06-04 16:46:41 +0530 | [diff] [blame] | 319 | ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c),) |
| 320 | smm-srcs += src/mainboard/$(MAINBOARDDIR)/smihandler.c |
| 321 | endif |