soc/qualcomm/sc7280: Enable compression of SHRM

The SHRM region needs to be 4 byte aligned, which make enabling
compression slightly more complicated.  We need to map it to cached
memory before loading it and flushing to memory (in aligned chunks)
then remapping the address space back to device memory before
beginning execution of the SHRM region.

Also, did some cleanup in this file based on comments in CB:49392.

BUG=b:182963902
BRANCH=None
TEST=Make sure we can still boot to kernel on herobrine

Change-Id: Iaad8a8a02abe40bd01766d94ef0b61aac7671936
Signed-off-by: Shelley Chen <shchen@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58191
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Shelley Chen 2021-10-07 23:09:36 -07:00
parent ad6f87d612
commit 9573c0ed3a
2 changed files with 15 additions and 5 deletions

View File

@ -107,7 +107,7 @@ SHRM_FILE := $(SC7280_BLOB)/shrm/shrm.elf
SHRM_CBFS := $(CONFIG_CBFS_PREFIX)/shrm SHRM_CBFS := $(CONFIG_CBFS_PREFIX)/shrm
$(SHRM_CBFS)-file := $(SHRM_FILE) $(SHRM_CBFS)-file := $(SHRM_FILE)
$(SHRM_CBFS)-type := payload $(SHRM_CBFS)-type := payload
$(SHRM_CBFS)-compression := none $(SHRM_CBFS)-compression := $(CBFS_PRERAM_COMPRESS_FLAG)
cbfs-files-y += $(SHRM_CBFS) cbfs-files-y += $(SHRM_CBFS)
endif endif

View File

@ -1,22 +1,32 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/cache.h>
#include <arch/mmu.h>
#include <cbfs.h> #include <cbfs.h>
#include <console/console.h> #include <console/console.h>
#include <soc/mmu.h> #include <soc/mmu.h>
#include <soc/mmu_common.h>
#include <soc/shrm.h> #include <soc/shrm.h>
#include <soc/clock.h> #include <soc/clock.h>
#include <soc/symbols_common.h>
void shrm_fw_load_reset(void) void shrm_fw_load_reset(void)
{ {
bool shrm_fw_entry;
struct prog shrm_fw_prog = struct prog shrm_fw_prog =
PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm"); PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm");
shrm_fw_entry = selfload(&shrm_fw_prog); /* map to cached region to force address to be 4 byte aligned */
if (!shrm_fw_entry) mmu_config_range((void *)_shrm, REGION_SIZE(shrm), CACHED_RAM);
if (!selfload(&shrm_fw_prog))
die("SOC image: SHRM load failed"); die("SOC image: SHRM load failed");
/* flush cached region */
dcache_clean_by_mva(_shrm, REGION_SIZE(shrm));
/* remap back to device memory */
mmu_config_range((void *)_shrm, REGION_SIZE(shrm), DEV_MEM);
clock_reset_shrm(); clock_reset_shrm();
printk(BIOS_DEBUG, "\nSOC:SHRM brought out of reset.\n"); printk(BIOS_DEBUG, "SOC:SHRM brought out of reset.\n");
} }