blob: 7cd9d5fddd57011f31b94672c7281aefb6f4086d [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
Andrew Wu52e665b2013-06-19 18:55:08 +08005subdirs-y += dmp
Hung-Te Lin7635a602013-02-12 00:07:38 +08006subdirs-y += armltd
Patrick Georgi0588d192009-08-12 15:00:51 +00007subdirs-y += intel
Stefan Reinauer9fe20cb2012-12-07 17:18:43 -08008subdirs-y += samsung
Gabe Black3c7e9392013-05-26 07:15:57 -07009subdirs-y += ti
Patrick Georgi0588d192009-08-12 15:00:51 +000010subdirs-y += via
Aaron Durbin716738a2013-05-10 00:33:32 -050011subdirs-y += x86
Gerd Hoffmanncbf30732013-05-31 09:23:26 +020012subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050013
14################################################################################
15## Rules for building the microcode blob in CBFS
16################################################################################
17
Aaron Durbin32ab2832013-06-11 16:36:37 -050018cpu_ucode_cbfs_name = cpu_microcode_blob.bin
19
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050020# External microcode file, or are we generating one ?
21ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL), y)
Aaron Durbin32ab2832013-06-11 16:36:37 -050022cpu_ucode_cbfs_file = $(call strip_quotes,$(CONFIG_CPU_MICROCODE_FILE))
23cbfs_include_ucode = y
Stefan Reinauer9c29cfa2013-02-27 20:24:11 +010024endif
25
26ifeq ($(CONFIG_CPU_MICROCODE_CBFS_GENERATE), y)
Aaron Durbin32ab2832013-06-11 16:36:37 -050027cpu_ucode_cbfs_file = $(obj)/cpu_microcode_blob.bin
28cbfs_include_ucode = y
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050029endif
30
Marc Jonesbdafcfa2013-10-29 17:46:54 -060031ifneq ($(CONFIG_CPU_MICROCODE_CBFS_LOC), 0)
32cpu_ucode_cbfs_offset = "-b $(CONFIG_CPU_MICROCODE_CBFS_LOC)"
33else
34cpu_ucode_cbfs_offset = "-b"
35endif
36
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050037# In case we have more than one "source" (cough) files containing microcode, we
Stefan Reinauer9c29cfa2013-02-27 20:24:11 +010038# link them together in one large blob, so that we get all the microcode updates
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050039# in one file. This makes it easier for objcopy in the final step.
40# The --entry=0 is just here to suppress the LD warning. It does not affect the
41# final microcode file.
42$(obj)/cpu_microcode_blob.o: $$(cpu_microcode-objs)
43 @printf " LD $(subst $(obj)/,,$(@))\n"
Alexandru Gagniucc6c8cb72013-12-07 18:57:02 -060044 $(LD) -static --entry=0 $+ -o $@
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050045
46# We have a lot of useless data in the large blob, and we are only interested in
47# the data section, so we only copy that part to the final microcode file
48$(obj)/cpu_microcode_blob.bin: $(obj)/cpu_microcode_blob.o
49 @printf " MICROCODE $(subst $(obj)/,,$(@))\n"
50 $(OBJCOPY) -j .data -O binary $< $@
Aaron Durbin32ab2832013-06-11 16:36:37 -050051
52ifeq ($(cbfs_include_ucode),y)
53# Add CPU microcode to specified rom image $(1)
54add-cpu-microcode-to-cbfs = \
Marc Jonesbdafcfa2013-10-29 17:46:54 -060055 $(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 -050056else
57add-cpu-microcode-to-cbfs = true
58endif