Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64863 )
Change subject: soc/intel/apl: Update microcode in IFWI image ......................................................................
soc/intel/apl: Update microcode in IFWI image
First find the matching CPUID then replace it in the IFWI.
Tested on up/squared: latest microcode version is now reported in the bootblock.
Change-Id: If4ade0f6c6f985291ab75878a9c8f5512b6a271e Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/soc/intel/apollolake/Makefile.inc 1 file changed, 21 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/64863/1
diff --git a/src/soc/intel/apollolake/Makefile.inc b/src/soc/intel/apollolake/Makefile.inc index 11da0b38..0303e41 100644 --- a/src/soc/intel/apollolake/Makefile.inc +++ b/src/soc/intel/apollolake/Makefile.inc @@ -136,14 +136,34 @@ # 2. Delete OBBP sub-partition, if present. # 3. Replace IBBL directory entry in IBBP sub-partition with currently # generated bootblock.bin. +# 4. Update microcode entries with matching CPUIDs (allow this to fail if +# for instance the microcode is not in the repo) # b. Using cbfstool: # 1. Write ifwi.bin.tmp to coreboot.rom using CONFIG_IFWI_FMAP_NAME. ifeq ($(CONFIG_NEED_IFWI),y) -$(call add_intermediate, write_ifwi, $(objcbfs)/bootblock.bin $(IFWITOOL)) +$(obj)/upatch%: $(IFWITOOL) $(call strip_quotes,$(CONFIG_IFWI_FILE_NAME)) + $(IFWITOOL) $(CONFIG_IFWI_FILE_NAME) extract -f $@.tmp -n UCOD -d -e $(notdir $@) + dd if=$@.tmp of=$@.cpuid bs=1 count=4 skip=12 + for bin in $(cpu_microcode_bins); do \ + if [ ! -f "$$bin" ]; then \ + echo "Microcode error: $$bin does not exist"; \ + NO_MICROCODE_FILE=1; \ + fi; \ + dd if=$$bin of=$(obj)/bin.cpuid bs=1 count=4 skip=12; \ + if cmp -s "$(obj)/bin.cpuid" "$@.cpuid"; then \ + cp $$bin $@; \ + break; \ + fi; \ + done; \ + rm $(obj)/bin.cpuid $@.cpuid $@.tmp + +$(call add_intermediate, write_ifwi, $(objcbfs)/bootblock.bin $(obj)/upatch1 $(obj)/upatch2 $(IFWITOOL)) @printf " IFWI Embedding %s in %s\n" $(objcbfs)/bootblock.bin $(CONFIG_IFWI_FMAP_NAME) $(IFWITOOL) $(CONFIG_IFWI_FILE_NAME) create -f $(objcbfs)/ifwi.bin.tmp $(IFWITOOL) $(objcbfs)/ifwi.bin.tmp delete -n OBBP $(IFWITOOL) $(objcbfs)/ifwi.bin.tmp replace -n IBBP -f $(objcbfs)/bootblock.bin -d -e IBBL + -$(IFWITOOL) $(objcbfs)/ifwi.bin.tmp replace -n UCOD -f $(obj)/upatch1 -d -e upatch1 + -$(IFWITOOL) $(objcbfs)/ifwi.bin.tmp replace -n UCOD -f $(obj)/upatch2 -d -e upatch2 $(CBFSTOOL) $< write -r $(CONFIG_IFWI_FMAP_NAME) -f $(objcbfs)/ifwi.bin.tmp --fill-upward endif