| 1 |
|
| 2 |
|
| 3 |
ifeq ($(CONFIG_POSTCAR_STAGE),y) |
| 4 |
$(eval $(call init_standard_toolchain,postcar)) |
| 5 |
endif |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
NVRAMTOOL:=$(objutil)/nvramtool/nvramtool |
| 10 |
|
| 11 |
OPTION_TABLE_H:= |
| 12 |
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y) |
| 13 |
|
| 14 |
CMOS_LAYOUT_FILE := $(top)/$(call strip_quotes,$(CONFIG_CMOS_LAYOUT_FILE)) |
| 15 |
|
| 16 |
cbfs-files-y += cmos_layout.bin |
| 17 |
cmos_layout.bin-file = $(obj)/cmos_layout.bin |
| 18 |
cmos_layout.bin-type = cmos_layout |
| 19 |
|
| 20 |
$(obj)/cmos_layout.bin: $(NVRAMTOOL) $(CMOS_LAYOUT_FILE) |
| 21 |
@printf " OPTION $(subst $(obj)/,,$(@))\n" |
| 22 |
$(NVRAMTOOL) -y $(CMOS_LAYOUT_FILE) -L $@ |
| 23 |
|
| 24 |
OPTION_TABLE_H:=$(obj)/option_table.h |
| 25 |
|
| 26 |
$(OPTION_TABLE_H): $(NVRAMTOOL) $(CMOS_LAYOUT_FILE) |
| 27 |
@printf " OPTION $(subst $(obj)/,,$(@))\n" |
| 28 |
$(NVRAMTOOL) -y $(CMOS_LAYOUT_FILE) -H $@ |
| 29 |
endif |
| 30 |
|
| 31 |
stripped_vgabios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_ID)) |
| 32 |
cbfs-files-$(CONFIG_VGA_BIOS) += pci$(stripped_vgabios_id).rom |
| 33 |
pci$(stripped_vgabios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_FILE)) |
| 34 |
pci$(stripped_vgabios_id).rom-type := optionrom |
| 35 |
|
| 36 |
stripped_second_vbios_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_SECOND_ID)) |
| 37 |
cbfs-files-$(CONFIG_VGA_BIOS_SECOND) += pci$(stripped_second_vbios_id).rom |
| 38 |
pci$(stripped_second_vbios_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_SECOND_FILE)) |
| 39 |
pci$(stripped_second_vbios_id).rom-type := optionrom |
| 40 |
|
| 41 |
stripped_vgabios_dgpu_id = $(call strip_quotes,$(CONFIG_VGA_BIOS_DGPU_ID)) |
| 42 |
cbfs-files-$(CONFIG_VGA_BIOS_DGPU) += pci$(stripped_vgabios_dgpu_id).rom |
| 43 |
pci$(stripped_vgabios_dgpu_id).rom-file := $(call strip_quotes,$(CONFIG_VGA_BIOS_DGPU_FILE)) |
| 44 |
pci$(stripped_vgabios_dgpu_id).rom-type := optionrom |
| 45 |
|
| 46 |
|
| 47 |
ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y) |
| 48 |
pci$(stripped_vgabios_id).rom-align := 64 |
| 49 |
pci$(stripped_second_vbios_id).rom-align := 64 |
| 50 |
pci$(stripped_vgabios_dgpu_id).rom-align := 64 |
| 51 |
endif |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32)$(CONFIG_ARCH_BOOTBLOCK_X86_64),y) |
| 58 |
|
| 59 |
bootblock-y += boot.c |
| 60 |
bootblock-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c |
| 61 |
bootblock-y += post.c |
| 62 |
bootblock-y += cpu_common.c |
| 63 |
bootblock-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 64 |
bootblock-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
| 65 |
bootblock-y += memcpy.c |
| 66 |
bootblock-y += memset.c |
| 67 |
bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += memmove_32.c |
| 68 |
bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_64) += memmove_64.S |
| 69 |
bootblock-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
| 70 |
bootblock-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 71 |
bootblock-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS_IN_ALL_STAGES) += null_breakpoint.c |
| 72 |
bootblock-$(CONFIG_DEBUG_STACK_OVERFLOW_BREAKPOINTS_IN_ALL_STAGES) += stack_canary_breakpoint.c |
| 73 |
bootblock-$(CONFIG_BOOTBLOCK_NORMAL) += bootblock_normal.c |
| 74 |
bootblock-y += gdt_init.S |
| 75 |
bootblock-y += id.S |
| 76 |
bootblock-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
| 77 |
bootblock-y += bootblock.ld |
| 78 |
bootblock-y += car.ld |
| 79 |
|
| 80 |
$(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h |
| 81 |
|
| 82 |
$(eval $(call link_stage,bootblock)) |
| 83 |
|
| 84 |
ifeq ($(CONFIG_BOOTBLOCK_IN_CBFS),y) |
| 85 |
add_bootblock = \ |
| 86 |
$(CBFSTOOL) $(1) add -f $(2) -n bootblock -t bootblock $(TXTIBB) \ |
| 87 |
-b -$(call file-size,$(2)) \ |
| 88 |
$(cbfs-autogen-attributes) $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS) |
| 89 |
endif |
| 90 |
|
| 91 |
ifneq ($(CONFIG_CBFS_VERIFICATION),y) |
| 92 |
$(call src-to-obj,bootblock,$(dir)/walkcbfs.S): $(obj)/fmap_config.h |
| 93 |
bootblock-y += walkcbfs.S |
| 94 |
endif |
| 95 |
|
| 96 |
endif |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
ifeq ($(CONFIG_ARCH_VERSTAGE_X86_32)$(CONFIG_ARCH_VERSTAGE_X86_64),y) |
| 103 |
|
| 104 |
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += assembly_entry.S |
| 105 |
verstage-y += boot.c |
| 106 |
verstage-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c |
| 107 |
verstage-y += post.c |
| 108 |
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += gdt_init.S |
| 109 |
verstage-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 110 |
verstage-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
| 111 |
verstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
| 112 |
|
| 113 |
verstage-y += cpu_common.c |
| 114 |
verstage-y += memset.c |
| 115 |
verstage-y += memcpy.c |
| 116 |
verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += memmove_32.c |
| 117 |
verstage-$(CONFIG_ARCH_VERSTAGE_X86_64) += memmove_64.S |
| 118 |
verstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 119 |
verstage-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS_IN_ALL_STAGES) += null_breakpoint.c |
| 120 |
verstage-$(CONFIG_DEBUG_STACK_OVERFLOW_BREAKPOINTS_IN_ALL_STAGES) += stack_canary_breakpoint.c |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
verstage-$(CONFIG_VBOOT_SEPARATE_VERSTAGE) += verstage.c |
| 125 |
|
| 126 |
verstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
| 127 |
|
| 128 |
verstage-y += car.ld |
| 129 |
|
| 130 |
verstage-libs ?= |
| 131 |
|
| 132 |
$(eval $(call link_stage,verstage)) |
| 133 |
|
| 134 |
endif |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y) |
| 141 |
|
| 142 |
romstage-$(CONFIG_SEPARATE_ROMSTAGE) += assembly_entry.S |
| 143 |
romstage-$(CONFIG_SEPARATE_ROMSTAGE) += romstage.c |
| 144 |
romstage-y += boot.c |
| 145 |
romstage-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c |
| 146 |
romstage-y += post.c |
| 147 |
romstage-$(CONFIG_SEPARATE_ROMSTAGE) += gdt_init.S |
| 148 |
romstage-y += cpu_common.c |
| 149 |
romstage-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 150 |
romstage-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
| 151 |
romstage-y += memcpy.c |
| 152 |
romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += memmove_32.c |
| 153 |
romstage-$(CONFIG_ARCH_ROMSTAGE_X86_64) += memmove_64.S |
| 154 |
romstage-y += memset.c |
| 155 |
romstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 156 |
romstage-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS_IN_ALL_STAGES) += null_breakpoint.c |
| 157 |
romstage-$(CONFIG_DEBUG_STACK_OVERFLOW_BREAKPOINTS_IN_ALL_STAGES) += stack_canary_breakpoint.c |
| 158 |
romstage-y += postcar_loader.c |
| 159 |
romstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
| 160 |
romstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
| 161 |
romstage-$(CONFIG_COOP_MULTITASKING) += thread.c |
| 162 |
ifeq ($(CONFIG_COOP_MULTITASKING),y) |
| 163 |
romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += thread_switch_32.S |
| 164 |
romstage-$(CONFIG_ARCH_ROMSTAGE_X86_64) += thread_switch_64.S |
| 165 |
endif |
| 166 |
romstage-y += car.ld |
| 167 |
|
| 168 |
romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c) |
| 169 |
romstage-libs ?= |
| 170 |
|
| 171 |
$(eval $(call link_stage,romstage)) |
| 172 |
|
| 173 |
|
| 174 |
romstage-S-ccopts += -g0 |
| 175 |
|
| 176 |
endif |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
ifeq ($(CONFIG_ARCH_POSTCAR_X86_32),y) |
| 183 |
$(eval $(call create_class_compiler,postcar,x86_32)) |
| 184 |
else |
| 185 |
$(eval $(call create_class_compiler,postcar,x86_64)) |
| 186 |
endif |
| 187 |
postcar-generic-ccopts += -D__POSTCAR__ |
| 188 |
|
| 189 |
postcar-y += boot.c |
| 190 |
postcar-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c |
| 191 |
postcar-y += post.c |
| 192 |
postcar-y += gdt_init.S |
| 193 |
postcar-y += cpu_common.c |
| 194 |
postcar-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 195 |
postcar-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
| 196 |
postcar-y += exit_car.S |
| 197 |
postcar-y += memcpy.c |
| 198 |
postcar-$(CONFIG_ARCH_POSTCAR_X86_32) += memmove_32.c |
| 199 |
postcar-$(CONFIG_ARCH_POSTCAR_X86_64) += memmove_64.S |
| 200 |
postcar-y += memset.c |
| 201 |
postcar-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 202 |
postcar-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS_IN_ALL_STAGES) += null_breakpoint.c |
| 203 |
postcar-$(CONFIG_DEBUG_STACK_OVERFLOW_BREAKPOINTS_IN_ALL_STAGES) += stack_canary_breakpoint.c |
| 204 |
postcar-y += postcar.c |
| 205 |
postcar-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
| 206 |
postcar-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
| 207 |
|
| 208 |
LDFLAGS_postcar += -Map $(objcbfs)/postcar.map |
| 209 |
|
| 210 |
$(eval $(call link_stage,postcar)) |
| 211 |
|
| 212 |
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod |
| 213 |
cp $< $@ |
| 214 |
|
| 215 |
|
| 216 |
cbfs-files-$(CONFIG_POSTCAR_STAGE) += $(CONFIG_CBFS_PREFIX)/postcar |
| 217 |
$(CONFIG_CBFS_PREFIX)/postcar-file := $(objcbfs)/postcar.elf |
| 218 |
$(CONFIG_CBFS_PREFIX)/postcar-type := stage |
| 219 |
$(CONFIG_CBFS_PREFIX)/postcar-compression := none |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32)$(CONFIG_ARCH_RAMSTAGE_X86_64),y) |
| 226 |
|
| 227 |
ramstage-y += acpi.c |
| 228 |
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c |
| 229 |
ramstage-$(CONFIG_ACPI_BERT) += acpi_bert_storage.c |
| 230 |
ramstage-y += boot.c |
| 231 |
ramstage-y += post.c |
| 232 |
ramstage-y += c_start.S |
| 233 |
ramstage-y += cpu.c |
| 234 |
ramstage-y += cpu_common.c |
| 235 |
ramstage-$(CONFIG_DEBUG_HW_BREAKPOINTS) += breakpoint.c |
| 236 |
ramstage-y += ebda.c |
| 237 |
ramstage-y += exception.c |
| 238 |
ramstage-y += idt.S |
| 239 |
ramstage-$(CONFIG_IOAPIC) += ioapic.c |
| 240 |
ramstage-y += dma.c |
| 241 |
ramstage-y += memcpy.c |
| 242 |
ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += memmove_32.c |
| 243 |
ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_64) += memmove_64.S |
| 244 |
ramstage-y += memset.c |
| 245 |
ramstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 246 |
ramstage-$(CONFIG_GENERATE_MP_TABLE) += mpspec.c |
| 247 |
ramstage-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS) += null_breakpoint.c |
| 248 |
ramstage-$(CONFIG_DEBUG_STACK_OVERFLOW_BREAKPOINTS) += stack_canary_breakpoint.c |
| 249 |
ramstage-$(CONFIG_GENERATE_PIRQ_TABLE) += pirq_routing.c |
| 250 |
ramstage-y += rdrand.c |
| 251 |
ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c |
| 252 |
ramstage-y += tables.c |
| 253 |
ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c |
| 254 |
ifeq ($(CONFIG_COOP_MULTITASKING),y) |
| 255 |
ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += thread_switch_32.S |
| 256 |
ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_64) += thread_switch_64.S |
| 257 |
endif |
| 258 |
ramstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c |
| 259 |
ramstage-$(CONFIG_HAVE_ACPI_RESUME) += wakeup.S |
| 260 |
ramstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c |
| 261 |
|
| 262 |
rmodules_x86_32-y += memcpy.c |
| 263 |
rmodules_x86_32-y += memmove_32.c |
| 264 |
rmodules_x86_32-y += memset.c |
| 265 |
|
| 266 |
rmodules_x86_64-y += memcpy.c |
| 267 |
rmodules_x86_64-y += memmove_64.S |
| 268 |
rmodules_x86_64-y += memset.c |
| 269 |
|
| 270 |
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) |
| 271 |
target-objcopy=-O elf32-i386 -B i386 |
| 272 |
endif |
| 273 |
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_64),y) |
| 274 |
target-objcopy=-O elf64-x86-64 -B i386:x86-64 |
| 275 |
endif |
| 276 |
|
| 277 |
|
| 278 |
CFLAGS_x86_32 += -mno-mmx -mno-sse |
| 279 |
CFLAGS_x86_64 += -mno-mmx -mno-sse |
| 280 |
|
| 281 |
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) |
| 282 |
ifeq ($(CONFIG_GENERATE_MP_TABLE),y) |
| 283 |
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),) |
| 284 |
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c |
| 285 |
endif |
| 286 |
endif |
| 287 |
ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y) |
| 288 |
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c |
| 289 |
endif |
| 290 |
|
| 291 |
ramstage-libs ?= |
| 292 |
|
| 293 |
$(eval $(call link_stage,ramstage)) |
| 294 |
|
| 295 |
$(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod |
| 296 |
cp $< $@ |
| 297 |
|
| 298 |
endif |
| 299 |
|
| 300 |
smm-$(CONFIG_DEBUG_HW_BREAKPOINTS_IN_ALL_STAGES) += breakpoint.c |
| 301 |
smm-$(CONFIG_IDT_IN_EVERY_STAGE) += exception.c |
| 302 |
smm-$(CONFIG_IDT_IN_EVERY_STAGE) += idt.S |
| 303 |
smm-y += memcpy.c |
| 304 |
smm-$(CONFIG_ARCH_RAMSTAGE_X86_32) += memmove_32.c |
| 305 |
smm-$(CONFIG_ARCH_RAMSTAGE_X86_64) += memmove_64.S |
| 306 |
smm-y += memset.c |
| 307 |
smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c |
| 308 |
smm-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS_IN_ALL_STAGES) += null_breakpoint.c |
| 309 |
|
| 310 |
smm-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c) |
| 311 |
|
| 312 |
ifneq ($(CONFIG_HAVE_CONFIGURABLE_APMC_SMI_PORT),y) |
| 313 |
ramstage-y += apmc_smi_port.c |
| 314 |
smm-y += apmc_smi_port.c |
| 315 |
endif |