Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 1 | ################################################################################ |
| 2 | ## Subdirectories |
| 3 | ################################################################################ |
Ronald G. Minnich | fd4519b | 2009-08-12 15:56:17 +0000 | [diff] [blame] | 4 | subdirs-y += amd |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 5 | subdirs-y += armltd |
Patrick Georgi | 0588d19 | 2009-08-12 15:00:51 +0000 | [diff] [blame] | 6 | subdirs-y += intel |
Gabe Black | 3c7e939 | 2013-05-26 07:15:57 -0700 | [diff] [blame] | 7 | subdirs-y += ti |
Alexandru Gagniuc | cc32842 | 2015-10-04 19:34:08 -0700 | [diff] [blame] | 8 | subdirs-$(CONFIG_ARCH_X86) += x86 |
Gerd Hoffmann | cbf3073 | 2013-05-31 09:23:26 +0200 | [diff] [blame] | 9 | subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86 |
Igor Bagnucki | 252fc29 | 2020-12-14 14:52:50 +0100 | [diff] [blame] | 10 | subdirs-$(CONFIG_CPU_POWER9) += power9 |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 11 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 12 | $(eval $(call create_class_compiler,cpu_microcode,x86_32)) |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 13 | ################################################################################ |
| 14 | ## Rules for building the microcode blob in CBFS |
| 15 | ################################################################################ |
| 16 | |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 17 | cbfs-files-$(CONFIG_USE_CPU_MICROCODE_CBFS_BINS) += cpu_microcode_blob.bin |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 18 | |
Martin Roth | 4c50269 | 2015-11-05 08:03:45 -0700 | [diff] [blame] | 19 | ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y) |
| 20 | cbfs-files-y += cpu_microcode_blob.bin |
| 21 | cpu_microcode_blob.bin-file = $(objgenerated)/microcode.bin |
| 22 | |
Julien Viard de Galbert | c467334 | 2017-11-03 14:07:55 +0100 | [diff] [blame] | 23 | $(objgenerated)/microcode.bin: $(call strip_quotes,$(CONFIG_CPU_MICROCODE_HEADER_FILES)) |
Martin Roth | 4c50269 | 2015-11-05 08:03:45 -0700 | [diff] [blame] | 24 | 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) |
| 26 | endif |
| 27 | |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 28 | ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS),y) |
Nico Huber | 63266c7 | 2020-02-20 20:20:00 +0100 | [diff] [blame] | 29 | $(obj)/cpu_microcode_blob.bin: cpu_microcode_bins := $(call strip_quotes,$(CONFIG_CPU_UCODE_BINARIES)) |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 30 | endif |
| 31 | # otherwise `cpu_microcode_bins` should be filled by platform makefiles |
| 32 | |
Alexandru Gagniuc | 1d85700 | 2015-09-09 22:38:06 -0700 | [diff] [blame] | 33 | # 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 Heymans | 1205345 | 2022-06-15 10:35:14 +0200 | [diff] [blame] | 40 | $(obj)/cpu_microcode_blob.bin: $$(wildcard $$(cpu_microcode_bins)) $(DOTCONFIG) |
Martin Roth | 8565374 | 2016-12-22 10:29:20 -0700 | [diff] [blame] | 41 | 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 Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 48 | if [ -z "$(CONFIG_USE_BLOBS)" ] && [ -n "$(CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS)" ]; then \ |
Martin Roth | 8565374 | 2016-12-22 10:29:20 -0700 | [diff] [blame] | 49 | echo "Try enabling binary-only repository in Kconfig 'General setup' menu."; \ |
| 50 | fi; \ |
| 51 | false; \ |
| 52 | fi |
Arthur Heymans | 1205345 | 2022-06-15 10:35:14 +0200 | [diff] [blame] | 53 | $(if $(cpu_microcode_bins),,false) # fail if no file is given at all |
Daniele Forsi | 21fbc08 | 2014-08-10 15:18:42 +0200 | [diff] [blame] | 54 | @printf " MICROCODE $(subst $(obj)/,,$(@))\n" |
Alexandru Gagniuc | 1d85700 | 2015-09-09 22:38:06 -0700 | [diff] [blame] | 55 | @echo $(cpu_microcode_bins) |
Arthur Heymans | 1205345 | 2022-06-15 10:35:14 +0200 | [diff] [blame] | 56 | cat $(cpu_microcode_bins) > $@ |
Aaron Durbin | 32ab283 | 2013-06-11 16:36:37 -0500 | [diff] [blame] | 57 | |
Martin Roth | 4c50269 | 2015-11-05 08:03:45 -0700 | [diff] [blame] | 58 | cpu_microcode_blob.bin-file ?= $(obj)/cpu_microcode_blob.bin |
Alexandru Gagniuc | f55e668 | 2015-09-07 00:35:55 -0700 | [diff] [blame] | 59 | cpu_microcode_blob.bin-type := microcode |
Raul E Rangel | 4b5a490 | 2021-11-19 11:38:35 -0700 | [diff] [blame] | 60 | # The AMD LPC SPI DMA controller requires source files to be 64 byte aligned. |
| 61 | ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_LPC_SPI_DMA),y) |
| 62 | cpu_microcode_blob.bin-align := 64 |
| 63 | else |
Alexandru Gagniuc | f55e668 | 2015-09-07 00:35:55 -0700 | [diff] [blame] | 64 | cpu_microcode_blob.bin-align := 16 |
Raul E Rangel | 4b5a490 | 2021-11-19 11:38:35 -0700 | [diff] [blame] | 65 | endif |
Andrey Petrov | d1f7c6f | 2020-01-28 10:51:36 -0800 | [diff] [blame] | 66 | |
| 67 | ifneq ($(CONFIG_CPU_MICROCODE_CBFS_LOC),) |
| 68 | cpu_microcode_blob.bin-COREBOOT-position := $(CONFIG_CPU_MICROCODE_CBFS_LOC) |
| 69 | endif |