blob: 12c682d43df2954e8997c02b38ec15cd831b81ae [file] [log] [blame]
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -05001################################################################################
2## Subdirectories
3################################################################################
Ronald G. Minnichfd4519b2009-08-12 15:56:17 +00004subdirs-y += amd
Hung-Te Lin7635a602013-02-12 00:07:38 +08005subdirs-y += armltd
Patrick Georgi0588d192009-08-12 15:00:51 +00006subdirs-y += intel
Gabe Black3c7e9392013-05-26 07:15:57 -07007subdirs-y += ti
Alexandru Gagniuccc328422015-10-04 19:34:08 -07008subdirs-$(CONFIG_ARCH_X86) += x86
Gerd Hoffmanncbf30732013-05-31 09:23:26 +02009subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86
Igor Bagnucki252fc292020-12-14 14:52:50 +010010subdirs-$(CONFIG_CPU_POWER9) += power9
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050011
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070012$(eval $(call create_class_compiler,cpu_microcode,x86_32))
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050013################################################################################
14## Rules for building the microcode blob in CBFS
15################################################################################
16
Nico Huberf5ca9222018-11-29 17:05:32 +010017cbfs-files-$(CONFIG_USE_CPU_MICROCODE_CBFS_BINS) += cpu_microcode_blob.bin
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050018
Martin Roth4c502692015-11-05 08:03:45 -070019ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y)
20cbfs-files-y += cpu_microcode_blob.bin
21cpu_microcode_blob.bin-file = $(objgenerated)/microcode.bin
22
Julien Viard de Galbertc4673342017-11-03 14:07:55 +010023$(objgenerated)/microcode.bin: $(call strip_quotes,$(CONFIG_CPU_MICROCODE_HEADER_FILES))
Martin Roth4c502692015-11-05 08:03:45 -070024 echo " util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin \"$(CONFIG_CPU_MICROCODE_HEADER_FILES)\""
25 util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin $(CONFIG_CPU_MICROCODE_HEADER_FILES)
26endif
27
Nico Huberf5ca9222018-11-29 17:05:32 +010028ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS),y)
Nico Huber63266c72020-02-20 20:20:00 +010029$(obj)/cpu_microcode_blob.bin: cpu_microcode_bins := $(call strip_quotes,$(CONFIG_CPU_UCODE_BINARIES))
Nico Huberf5ca9222018-11-29 17:05:32 +010030endif
31# otherwise `cpu_microcode_bins` should be filled by platform makefiles
32
Alexandru Gagniuc1d857002015-09-09 22:38:06 -070033# We just mash all microcode binaries together into one binary to rule them all.
34# This approach assumes that the microcode binaries are properly padded, and
35# their headers specify the correct size. This works fairly well on isolatied
36# updates, such as Intel and some AMD microcode, but won't work very well if the
37# updates are wrapped in a container, like AMD's microcode update container. If
38# there is only one microcode binary (i.e. one container), then we don't have
39# this issue, and this rule will continue to work.
Arthur Heymans12053452022-06-15 10:35:14 +020040$(obj)/cpu_microcode_blob.bin: $$(wildcard $$(cpu_microcode_bins)) $(DOTCONFIG)
Martin Roth85653742016-12-22 10:29:20 -070041 for bin in $(cpu_microcode_bins); do \
42 if [ ! -f "$$bin" ]; then \
43 echo "Microcode error: $$bin does not exist"; \
44 NO_MICROCODE_FILE=1; \
45 fi; \
46 done; \
47 if [ -n "$$NO_MICROCODE_FILE" ]; then \
Nico Huberf5ca9222018-11-29 17:05:32 +010048 if [ -z "$(CONFIG_USE_BLOBS)" ] && [ -n "$(CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS)" ]; then \
Martin Roth85653742016-12-22 10:29:20 -070049 echo "Try enabling binary-only repository in Kconfig 'General setup' menu."; \
50 fi; \
51 false; \
52 fi
Arthur Heymans12053452022-06-15 10:35:14 +020053 $(if $(cpu_microcode_bins),,false) # fail if no file is given at all
Daniele Forsi21fbc082014-08-10 15:18:42 +020054 @printf " MICROCODE $(subst $(obj)/,,$(@))\n"
Alexandru Gagniuc1d857002015-09-09 22:38:06 -070055 @echo $(cpu_microcode_bins)
Arthur Heymans12053452022-06-15 10:35:14 +020056 cat $(cpu_microcode_bins) > $@
Aaron Durbin32ab2832013-06-11 16:36:37 -050057
Martin Roth4c502692015-11-05 08:03:45 -070058cpu_microcode_blob.bin-file ?= $(obj)/cpu_microcode_blob.bin
Alexandru Gagniucf55e6682015-09-07 00:35:55 -070059cpu_microcode_blob.bin-type := microcode
Raul E Rangel4b5a4902021-11-19 11:38:35 -070060# The AMD LPC SPI DMA controller requires source files to be 64 byte aligned.
61ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y)
62cpu_microcode_blob.bin-align := 64
63else
Alexandru Gagniucf55e6682015-09-07 00:35:55 -070064cpu_microcode_blob.bin-align := 16
Raul E Rangel4b5a4902021-11-19 11:38:35 -070065endif
Andrey Petrovd1f7c6f2020-01-28 10:51:36 -080066
67ifneq ($(CONFIG_CPU_MICROCODE_CBFS_LOC),)
68cpu_microcode_blob.bin-COREBOOT-position := $(CONFIG_CPU_MICROCODE_CBFS_LOC)
69endif