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