soc/qualcomm/common/qup: Avoid double decompress of gsi_fw blob

During boot, gpi_firmware_load gets called twice because there are
2 serial engines. Thus gsi_fw blob is also decompressed twice and is
written to base addresses of SEs. This is redundant.

Perform the decompression once on first call and save the header
in static variable which can be reused in next call.

BUG=b:262426214
TEST=Validated on qualcomm sc7280 development board
     Saving of 80ms observed while testing with 130 boot cycles.

Change-Id: If98a3974f0791dffdf675c02cc28375d0485c485
Signed-off-by: Vijaya Nivarthi <vnivarth@codeaurora.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71927
Reviewed-by: Shelley Chen <shchen@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Sudheer Kumar Amrabadi 2023-01-16 08:48:15 +05:30 committed by Shelley Chen
parent 67efe443b1
commit 0d30a86aaa
1 changed files with 6 additions and 4 deletions

View File

@ -9,6 +9,7 @@
#include <soc/addressmap.h> #include <soc/addressmap.h>
static struct elf_se_hdr *fw_list[SE_PROTOCOL_MAX]; static struct elf_se_hdr *fw_list[SE_PROTOCOL_MAX];
static struct gsi_fw_hdr *gsi_hdr;
void qupv3_se_fw_load_and_init(unsigned int bus, unsigned int protocol, void qupv3_se_fw_load_and_init(unsigned int bus, unsigned int protocol,
unsigned int mode) unsigned int mode)
@ -185,16 +186,17 @@ void gpi_firmware_load(int addr)
{ {
uint32_t i; uint32_t i;
uint32_t regVal = 0; uint32_t regVal = 0;
struct gsi_fw_hdr *gsi_hdr;
struct gsi_fw_iep *fwIep; struct gsi_fw_iep *fwIep;
struct gsi_fw_iram *fwIRam; struct gsi_fw_iram *fwIRam;
struct gsi_regs *regs = (struct gsi_regs *)(uintptr_t)addr; struct gsi_regs *regs = (struct gsi_regs *)(uintptr_t)addr;
static const char * const filename = "fallback/gsi_fw"; static const char * const filename = "fallback/gsi_fw";
/* Assign firmware header base */ /* Assign firmware header base */
gsi_hdr = cbfs_map(filename, NULL); if (!gsi_hdr) {
if (!gsi_hdr) gsi_hdr = cbfs_map(filename, NULL);
die("*ERROR* * cbfs_map() failed ***\n"); if (!gsi_hdr)
die("*ERROR* * cbfs_map() failed ***\n");
}
assert(gsi_hdr->magic == GSI_FW_MAGIC_HEADER) assert(gsi_hdr->magic == GSI_FW_MAGIC_HEADER)