Attention is currently required from: Jason Glenesk, Raul Rangel, Matt DeVillier, Fred Reitberger, Felix Held.
Grzegorz Bernacki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74716 )
Change subject: soc/amd/common/block: Add missing cbfs_unmap(). ......................................................................
soc/amd/common/block: Add missing cbfs_unmap().
cbfs_map() can allocate memory, so cbfs_unmap() should be called before leaving the function.
BUG=278264488 TEST=Built and run with additional debugs on Skyrim device to confirm that data are correctly unmapped
Change-Id: Ibbebe7401e9f5a5312da1216408bf42fa2449db1 --- M src/soc/amd/common/block/cpu/update_microcode.c M src/soc/amd/common/block/graphics/graphics.c 2 files changed, 36 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/74716/1
diff --git a/src/soc/amd/common/block/cpu/update_microcode.c b/src/soc/amd/common/block/cpu/update_microcode.c index 0edb9d2..558dd33 100644 --- a/src/soc/amd/common/block/cpu/update_microcode.c +++ b/src/soc/amd/common/block/cpu/update_microcode.c @@ -6,6 +6,7 @@ #include <cpu/amd/microcode.h> #include <cpu/amd/msr.h> #include <cpu/cpu.h> +#include <amdblocks/cpu.h> #include <cpu/x86/msr.h> #include <stdio.h> #include <timestamp.h> @@ -77,8 +78,9 @@ { static const struct microcode *ucode_cache; static bool cache_valid; + static int cpus_updated;
- struct microcode *ucode; + struct microcode *ucode = NULL; char name[] = CPU_MICROCODE_BLOB_NAME; uint16_t equivalent_processor_rev_id;
@@ -106,6 +108,10 @@ }
apply_microcode_patch(ucode_cache); + cpus_updated++; + + if (cpus_updated == get_cpu_count()) + cbfs_unmap(ucode); }
void preload_microcode(void) diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index cc52053..839f5c5 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -6,6 +6,7 @@ #include <boot/coreboot_tables.h> #include <bootmode.h> #include <bootstate.h> +#include <cbfs.h> #include <console/console.h> #include <device/pci.h> #include <fmap.h> @@ -157,11 +158,20 @@ return; } rom = pci_rom_probe(dev); - if (rom == NULL) + if (rom == NULL) { + printk(BIOS_ERR, "%s: Unable to find ROM for %s\n", + __func__, dev_path(dev)); return; + } + ram = pci_rom_load(dev, rom); - if (ram == NULL) - return; + if (ram == NULL) { + printk(BIOS_ERR, "%s: Unable to load ROM for %s\n", + __func__, dev_path(dev)); + } + + cbfs_unmap(rom); + timestamp_add_now(TS_OPROM_COPY_END); }