Shelley Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58191 )
Change subject: soc/qualcomm/sc7280: Enable compression of SHRM ......................................................................
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.
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 --- M src/soc/qualcomm/sc7280/Makefile.inc M src/soc/qualcomm/sc7280/shrm_load_reset.c 2 files changed, 15 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/58191/1
diff --git a/src/soc/qualcomm/sc7280/Makefile.inc b/src/soc/qualcomm/sc7280/Makefile.inc index 364c987..442b2a3 100644 --- a/src/soc/qualcomm/sc7280/Makefile.inc +++ b/src/soc/qualcomm/sc7280/Makefile.inc @@ -107,7 +107,7 @@ SHRM_CBFS := $(CONFIG_CBFS_PREFIX)/shrm $(SHRM_CBFS)-file := $(SHRM_FILE) $(SHRM_CBFS)-type := payload -$(SHRM_CBFS)-compression := none +$(SHRM_CBFS)-compression := $(CBFS_PRERAM_COMPRESS_FLAG) cbfs-files-y += $(SHRM_CBFS)
endif diff --git a/src/soc/qualcomm/sc7280/shrm_load_reset.c b/src/soc/qualcomm/sc7280/shrm_load_reset.c index 78830a2..a853c73 100644 --- a/src/soc/qualcomm/sc7280/shrm_load_reset.c +++ b/src/soc/qualcomm/sc7280/shrm_load_reset.c @@ -1,22 +1,32 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <arch/cache.h> +#include <arch/mmu.h> #include <cbfs.h> #include <console/console.h> #include <soc/mmu.h> +#include <soc/mmu_common.h> #include <soc/shrm.h> #include <soc/clock.h> +#include <soc/symbols_common.h>
void shrm_fw_load_reset(void) { - bool shrm_fw_entry; struct prog shrm_fw_prog = PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm");
- shrm_fw_entry = selfload(&shrm_fw_prog); - if (!shrm_fw_entry) + /* map to cached region to force address to be 4 byte aligned */ + mmu_config_range((void *)_shrm, REGION_SIZE(shrm), CACHED_RAM); + + if (!selfload(&shrm_fw_prog)) 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();
- printk(BIOS_DEBUG, "\nSOC:SHRM brought out of reset.\n"); + printk(BIOS_DEBUG, "SOC:SHRM brought out of reset.\n"); }