via: Start template for VIA C7 w/ CX700 northbridge
[coreboot2.git] / src / cpu / Makefile.mk
blob0afe454c1e65e8f932df63e50ab86af111de0f46
1 ## SPDX-License-Identifier: GPL-2.0-only
3 ################################################################################
4 ## Subdirectories
5 ################################################################################
6 subdirs-y += amd
7 subdirs-y += armltd
8 subdirs-y += intel
9 subdirs-y += via
10 subdirs-$(CONFIG_ARCH_X86) += x86
11 subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86
12 subdirs-$(CONFIG_CPU_POWER9) += power9
14 $(eval $(call create_class_compiler,cpu_microcode,x86_32))
15 ################################################################################
16 ## Rules for building the microcode blob in CBFS
17 ################################################################################
19 cbfs-files-$(CONFIG_USE_CPU_MICROCODE_CBFS_BINS) += cpu_microcode_blob.bin
21 ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y)
22 cbfs-files-y += cpu_microcode_blob.bin
23 cpu_microcode_blob.bin-file = $(objgenerated)/microcode.bin
25 $(objgenerated)/microcode.bin: $(call strip_quotes,$(CONFIG_CPU_MICROCODE_HEADER_FILES))
26 echo " util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin \"$(CONFIG_CPU_MICROCODE_HEADER_FILES)\""
27 util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin $(CONFIG_CPU_MICROCODE_HEADER_FILES)
28 endif
30 ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS),y)
31 $(obj)/cpu_microcode_blob.bin: cpu_microcode_bins := $(call strip_quotes,$(CONFIG_CPU_UCODE_BINARIES))
32 endif
33 # otherwise `cpu_microcode_bins` should be filled by platform makefiles
35 # We just mash all microcode binaries together into one binary to rule them all.
36 # This approach assumes that the microcode binaries are properly padded, and
37 # their headers specify the correct size. This works fairly well on isolatied
38 # updates, such as Intel and some AMD microcode, but won't work very well if the
39 # updates are wrapped in a container, like AMD's microcode update container. If
40 # there is only one microcode binary (i.e. one container), then we don't have
41 # this issue, and this rule will continue to work.
42 $(obj)/cpu_microcode_blob.bin: $$(wildcard $$(cpu_microcode_bins)) $(DOTCONFIG)
43 for bin in $(cpu_microcode_bins); do \
44 if [ ! -f "$$bin" ]; then \
45 echo "Microcode error: $$bin does not exist"; \
46 NO_MICROCODE_FILE=1; \
47 fi; \
48 done; \
49 if [ -n "$$NO_MICROCODE_FILE" ]; then \
50 if [ -z "$(CONFIG_USE_BLOBS)" ] && [ -n "$(CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS)" ]; then \
51 echo "Try enabling binary-only repository in Kconfig 'General setup' menu."; \
52 fi; \
53 false; \
55 $(if $(cpu_microcode_bins),,false) # fail if no file is given at all
56 @printf " MICROCODE $(subst $(obj)/,,$(@))\n"
57 @echo $(cpu_microcode_bins)
58 cat $(cpu_microcode_bins) > $@
60 cpu_microcode_blob.bin-file ?= $(obj)/cpu_microcode_blob.bin
61 cpu_microcode_blob.bin-type := microcode
62 # The AMD LPC SPI DMA controller requires source files to be 64 byte aligned.
63 ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y)
64 cpu_microcode_blob.bin-align := 64
65 else
66 cpu_microcode_blob.bin-align := 16
67 endif
69 ifneq ($(CONFIG_CPU_MICROCODE_CBFS_LOC),)
70 cpu_microcode_blob.bin-COREBOOT-position := $(CONFIG_CPU_MICROCODE_CBFS_LOC)
71 endif