1## SPDX-License-Identifier: GPL-2.0-only 2 3################################################################################ 4## Subdirectories 5################################################################################ 6subdirs-y += amd 7subdirs-y += armltd 8subdirs-y += intel 9subdirs-$(CONFIG_ARCH_X86) += x86 10subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86 11subdirs-$(CONFIG_CPU_POWER9) += power9 12 13$(eval $(call create_class_compiler,cpu_microcode,x86_32)) 14################################################################################ 15## Rules for building the microcode blob in CBFS 16################################################################################ 17 18cbfs-files-$(CONFIG_USE_CPU_MICROCODE_CBFS_BINS) += cpu_microcode_blob.bin 19 20ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y) 21cbfs-files-y += cpu_microcode_blob.bin 22cpu_microcode_blob.bin-file = $(objgenerated)/microcode.bin 23 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) 27endif 28 29ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS),y) 30$(obj)/cpu_microcode_blob.bin: cpu_microcode_bins := $(call strip_quotes,$(CONFIG_CPU_UCODE_BINARIES)) 31endif 32# otherwise `cpu_microcode_bins` should be filled by platform makefiles 33 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; \ 53 fi 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) > $@ 58 59cpu_microcode_blob.bin-file ?= $(obj)/cpu_microcode_blob.bin 60cpu_microcode_blob.bin-type := microcode 61# The AMD LPC SPI DMA controller requires source files to be 64 byte aligned. 62ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y) 63cpu_microcode_blob.bin-align := 64 64else 65cpu_microcode_blob.bin-align := 16 66endif 67 68ifneq ($(CONFIG_CPU_MICROCODE_CBFS_LOC),) 69cpu_microcode_blob.bin-COREBOOT-position := $(CONFIG_CPU_MICROCODE_CBFS_LOC) 70endif 71