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 |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 10 | |
Furquan Shaikh | 99ac98f | 2014-04-23 10:18:48 -0700 | [diff] [blame] | 11 | $(eval $(call create_class_compiler,cpu_microcode,x86_32)) |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 12 | ################################################################################ |
| 13 | ## Rules for building the microcode blob in CBFS |
| 14 | ################################################################################ |
| 15 | |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 16 | cbfs-files-$(CONFIG_USE_CPU_MICROCODE_CBFS_BINS) += cpu_microcode_blob.bin |
Alexandru Gagniuc | 00b579a | 2012-07-20 00:11:21 -0500 | [diff] [blame] | 17 | |
Martin Roth | 4c50269 | 2015-11-05 08:03:45 -0700 | [diff] [blame] | 18 | ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y) |
| 19 | cbfs-files-y += cpu_microcode_blob.bin |
| 20 | cpu_microcode_blob.bin-file = $(objgenerated)/microcode.bin |
| 21 | |
Julien Viard de Galbert | c467334 | 2017-11-03 14:07:55 +0100 | [diff] [blame] | 22 | $(objgenerated)/microcode.bin: $(call strip_quotes,$(CONFIG_CPU_MICROCODE_HEADER_FILES)) |
Martin Roth | 4c50269 | 2015-11-05 08:03:45 -0700 | [diff] [blame] | 23 | echo " util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin \"$(CONFIG_CPU_MICROCODE_HEADER_FILES)\"" |
| 24 | util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin $(CONFIG_CPU_MICROCODE_HEADER_FILES) |
| 25 | endif |
| 26 | |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 27 | ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS),y) |
Nico Huber | 63266c7 | 2020-02-20 20:20:00 +0100 | [diff] [blame] | 28 | $(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] | 29 | endif |
| 30 | # otherwise `cpu_microcode_bins` should be filled by platform makefiles |
| 31 | |
Alexandru Gagniuc | 1d85700 | 2015-09-09 22:38:06 -0700 | [diff] [blame] | 32 | # We just mash all microcode binaries together into one binary to rule them all. |
| 33 | # This approach assumes that the microcode binaries are properly padded, and |
| 34 | # their headers specify the correct size. This works fairly well on isolatied |
| 35 | # updates, such as Intel and some AMD microcode, but won't work very well if the |
| 36 | # updates are wrapped in a container, like AMD's microcode update container. If |
| 37 | # there is only one microcode binary (i.e. one container), then we don't have |
| 38 | # this issue, and this rule will continue to work. |
Martin Roth | 8565374 | 2016-12-22 10:29:20 -0700 | [diff] [blame] | 39 | $(obj)/cpu_microcode_blob.bin: $$(wildcard $$(cpu_microcode_bins)) |
| 40 | for bin in $(cpu_microcode_bins); do \ |
| 41 | if [ ! -f "$$bin" ]; then \ |
| 42 | echo "Microcode error: $$bin does not exist"; \ |
| 43 | NO_MICROCODE_FILE=1; \ |
| 44 | fi; \ |
| 45 | done; \ |
| 46 | if [ -n "$$NO_MICROCODE_FILE" ]; then \ |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 47 | 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] | 48 | echo "Try enabling binary-only repository in Kconfig 'General setup' menu."; \ |
| 49 | fi; \ |
| 50 | false; \ |
| 51 | fi |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 52 | $(if $^,,false) # fail if no file is given at all |
Daniele Forsi | 21fbc08 | 2014-08-10 15:18:42 +0200 | [diff] [blame] | 53 | @printf " MICROCODE $(subst $(obj)/,,$(@))\n" |
Alexandru Gagniuc | 1d85700 | 2015-09-09 22:38:06 -0700 | [diff] [blame] | 54 | @echo $(cpu_microcode_bins) |
Nico Huber | f5ca922 | 2018-11-29 17:05:32 +0100 | [diff] [blame] | 55 | cat $^ > $@ |
Aaron Durbin | 32ab283 | 2013-06-11 16:36:37 -0500 | [diff] [blame] | 56 | |
Martin Roth | 4c50269 | 2015-11-05 08:03:45 -0700 | [diff] [blame] | 57 | cpu_microcode_blob.bin-file ?= $(obj)/cpu_microcode_blob.bin |
Alexandru Gagniuc | f55e668 | 2015-09-07 00:35:55 -0700 | [diff] [blame] | 58 | cpu_microcode_blob.bin-type := microcode |
Alexandru Gagniuc | f55e668 | 2015-09-07 00:35:55 -0700 | [diff] [blame] | 59 | cpu_microcode_blob.bin-align := 16 |
Andrey Petrov | d1f7c6f | 2020-01-28 10:51:36 -0800 | [diff] [blame] | 60 | |
| 61 | ifneq ($(CONFIG_CPU_MICROCODE_CBFS_LOC),) |
| 62 | cpu_microcode_blob.bin-COREBOOT-position := $(CONFIG_CPU_MICROCODE_CBFS_LOC) |
| 63 | endif |