Shelley Chen has submitted this change. ( https://review.coreboot.org/c/coreboot/+/64245 )
Change subject: qclib common code clean up changes ......................................................................
qclib common code clean up changes
BUG=b:227946776 TEST=Validated on sc7180 and sc7280 hardware
Signed-off-by: Sudheer Kumar Amrabadi quic_samrabad@quicinc.com Change-Id: I211e132d1728cf14bdd201b71618af89b339cbc1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64245 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org --- M src/soc/qualcomm/common/include/soc/qclib_common.h M src/soc/qualcomm/common/qclib.c 2 files changed, 34 insertions(+), 4 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
diff --git a/src/soc/qualcomm/common/include/soc/qclib_common.h b/src/soc/qualcomm/common/include/soc/qclib_common.h index 648b29d..f38ed77 100644 --- a/src/soc/qualcomm/common/include/soc/qclib_common.h +++ b/src/soc/qualcomm/common/include/soc/qclib_common.h @@ -27,6 +27,14 @@ /* BA_BMASK_VALUES (blob_attributes bit mask values) */ #define QCLIB_BA_SAVE_TO_STORAGE 0x00000001
+enum qclib_cbfs_file { + QCLIB_CBFS_PMICCFG, + QCLIB_CBFS_QCSDI, + QCLIB_CBFS_QCLIB, + QCLIB_CBFS_DCB, + QCLIB_CBFS_MAX +}; + struct qclib_cb_if_table_entry { char name[QCLIB_TE_NAME_LENGTH]; /* 0x00 TE_NAME */ uint64_t blob_address; /* 0x18 blob addr in SRAM */ @@ -60,4 +68,7 @@ void qclib_load_and_run(void); int qclib_soc_blob_load(void);
+const char *qclib_file_default(enum qclib_cbfs_file file); +const char *qclib_file(enum qclib_cbfs_file file); + #endif // _SOC_QUALCOMM_QCLIB_COMMON_H_ diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c index 2829cb4..90bcc20 100644 --- a/src/soc/qualcomm/common/qclib.c +++ b/src/soc/qualcomm/common/qclib.c @@ -62,6 +62,25 @@ .reserved = 0, };
+const char *qclib_file_default(enum qclib_cbfs_file file) +{ + switch (file) { + case QCLIB_CBFS_PMICCFG: + return CONFIG_CBFS_PREFIX "/pmiccfg"; + case QCLIB_CBFS_QCSDI: + return CONFIG_CBFS_PREFIX "/qcsdi"; + case QCLIB_CBFS_QCLIB: + return CONFIG_CBFS_PREFIX "/qclib"; + case QCLIB_CBFS_DCB: + return CONFIG_CBFS_PREFIX "/dcb"; + default: + die("unknown QcLib file %d", file); + } +} + +const char *qclib_file(enum qclib_cbfs_file file) + __attribute__((weak, alias("qclib_file_default"))); + void qclib_add_if_table_entry(const char *name, void *base, uint32_t size, uint32_t attrs) { @@ -181,7 +200,7 @@ qclib_add_if_table_entry(QCLIB_TE_MEM_CHIP_INFO, NULL, 0, 0);
/* Attempt to load PMICCFG Blob */ - data_size = cbfs_load(CONFIG_CBFS_PREFIX "/pmiccfg", + data_size = cbfs_load(qclib_file(QCLIB_CBFS_PMICCFG), _pmic, REGION_SIZE(pmic)); if (!data_size) { printk(BIOS_ERR, "[%s] /pmiccfg failed\n", __func__); @@ -190,7 +209,7 @@ qclib_add_if_table_entry(QCLIB_TE_PMIC_SETTINGS, _pmic, data_size, 0);
/* Attempt to load DCB Blob */ - data_size = cbfs_load(CONFIG_CBFS_PREFIX "/dcb", + data_size = cbfs_load(qclib_file(QCLIB_CBFS_DCB), _dcb, REGION_SIZE(dcb)); if (!data_size) { printk(BIOS_ERR, "[%s] /dcb failed\n", __func__); @@ -213,7 +232,7 @@ !vboot_is_gbb_flag_set(VB2_GBB_FLAG_RUNNING_FAFT))) { struct prog qcsdi = PROG_INIT(PROG_REFCODE, - CONFIG_CBFS_PREFIX "/qcsdi"); + qclib_file(QCLIB_CBFS_QCSDI));
/* Attempt to load QCSDI elf */ if (cbfs_prog_stage_load(&qcsdi)) @@ -228,7 +247,7 @@
/* Attempt to load QCLib elf */ struct prog qclib = - PROG_INIT(PROG_REFCODE, CONFIG_CBFS_PREFIX "/qclib"); + PROG_INIT(PROG_REFCODE, qclib_file(QCLIB_CBFS_QCLIB));
if (cbfs_prog_stage_load(&qclib)) goto fail;