blob: cdd353f20cd11bef760b6cd89c5b1cee8c10f162 [file] [log] [blame]
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -05001################################################################################
2## Subdirectories
3################################################################################
Alexandru Gagniucf64111b2013-12-13 20:44:48 -06004subdirs-y += allwinner
Ronald G. Minnichfd4519b2009-08-12 15:56:17 +00005subdirs-y += amd
Andrew Wu52e665b2013-06-19 18:55:08 +08006subdirs-y += dmp
Hung-Te Lin7635a602013-02-12 00:07:38 +08007subdirs-y += armltd
Paul Burtonc1081a42014-06-14 00:08:02 +01008subdirs-y += imgtec
Patrick Georgi0588d192009-08-12 15:00:51 +00009subdirs-y += intel
Gabe Black3c7e9392013-05-26 07:15:57 -070010subdirs-y += ti
Patrick Georgi0588d192009-08-12 15:00:51 +000011subdirs-y += via
Aaron Durbin716738a2013-05-10 00:33:32 -050012subdirs-y += x86
Gerd Hoffmanncbf30732013-05-31 09:23:26 +020013subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050014
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070015$(eval $(call create_class_compiler,cpu_microcode,x86_32))
Stefan Reinauerb5bba092015-03-15 19:43:05 +010016$(eval $(call create_class_compiler,cpu_microcode,x86_64))
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050017################################################################################
18## Rules for building the microcode blob in CBFS
19################################################################################
20
Aaron Durbin32ab2832013-06-11 16:36:37 -050021cpu_ucode_cbfs_name = cpu_microcode_blob.bin
22
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050023# External microcode file, or are we generating one ?
24ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL), y)
Aaron Durbin32ab2832013-06-11 16:36:37 -050025cpu_ucode_cbfs_file = $(call strip_quotes,$(CONFIG_CPU_MICROCODE_FILE))
26cbfs_include_ucode = y
Stefan Reinauer9c29cfa2013-02-27 20:24:11 +010027endif
28
29ifeq ($(CONFIG_CPU_MICROCODE_CBFS_GENERATE), y)
Aaron Durbin32ab2832013-06-11 16:36:37 -050030cpu_ucode_cbfs_file = $(obj)/cpu_microcode_blob.bin
31cbfs_include_ucode = y
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050032endif
33
Marc Jones78687972015-04-22 23:16:31 -060034ifeq ($(CONFIG_PLATFORM_USES_FSP1_0), y)
Marc Jonesbdafcfa2013-10-29 17:46:54 -060035cpu_ucode_cbfs_offset = "-b $(CONFIG_CPU_MICROCODE_CBFS_LOC)"
36else
37cpu_ucode_cbfs_offset = "-b"
38endif
39
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050040# In case we have more than one "source" (cough) files containing microcode, we
Stefan Reinauer9c29cfa2013-02-27 20:24:11 +010041# link them together in one large blob, so that we get all the microcode updates
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050042# in one file. This makes it easier for objcopy in the final step.
43# The --entry=0 is just here to suppress the LD warning. It does not affect the
44# final microcode file.
45$(obj)/cpu_microcode_blob.o: $$(cpu_microcode-objs)
46 @printf " LD $(subst $(obj)/,,$(@))\n"
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070047 $(LD_cpu_microcode) -static --entry=0 $+ -o $@
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050048
49# We have a lot of useless data in the large blob, and we are only interested in
50# the data section, so we only copy that part to the final microcode file
51$(obj)/cpu_microcode_blob.bin: $(obj)/cpu_microcode_blob.o
Daniele Forsi21fbc082014-08-10 15:18:42 +020052 @printf " MICROCODE $(subst $(obj)/,,$(@))\n"
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070053 $(OBJCOPY_cpu_microcode) -j .data -O binary $< $@
Aaron Durbin32ab2832013-06-11 16:36:37 -050054
55ifeq ($(cbfs_include_ucode),y)
56# Add CPU microcode to specified rom image $(1)
57add-cpu-microcode-to-cbfs = \
Marc Jonesbdafcfa2013-10-29 17:46:54 -060058 $(CBFSTOOL) $(1) locate -f $(cpu_ucode_cbfs_file) -n $(cpu_ucode_cbfs_name) -a 16 | xargs $(CBFSTOOL) $(1) add -n $(cpu_ucode_cbfs_name) -f $(cpu_ucode_cbfs_file) -t 0x53 $(cpu_ucode_cbfs_offset)
Aaron Durbin32ab2832013-06-11 16:36:37 -050059else
60add-cpu-microcode-to-cbfs = true
61endif