summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm
diff options
context:
space:
mode:
authorSudheer Kumar Amrabadi <samrabad@codeaurora.org>2022-05-10 16:43:47 +0530
committerShelley Chen <shchen@google.com>2022-06-01 01:32:00 +0000
commit58f6031b610562301e52fcebda5d3d9da9c2bfb6 (patch)
tree31ddf836fec14703677d3a5753b93dbc5f8c469e /src/soc/qualcomm
parentdfe817e45165fdbb8f4f7f83de83710cc46e75d6 (diff)
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>
Diffstat (limited to 'src/soc/qualcomm')
-rw-r--r--src/soc/qualcomm/common/include/soc/qclib_common.h11
-rw-r--r--src/soc/qualcomm/common/qclib.c27
2 files changed, 34 insertions, 4 deletions
diff --git a/src/soc/qualcomm/common/include/soc/qclib_common.h b/src/soc/qualcomm/common/include/soc/qclib_common.h
index 648b29d343..f38ed77a0d 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_add_if_table_entry(const char *name, void *base,
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 2829cb4a98..90bcc20a7d 100644
--- a/src/soc/qualcomm/common/qclib.c
+++ b/src/soc/qualcomm/common/qclib.c
@@ -62,6 +62,25 @@ struct qclib_cb_if_table qclib_cb_if_table = {
.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 @@ void qclib_load_and_run(void)
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 @@ void qclib_load_and_run(void)
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 @@ void qclib_load_and_run(void)
!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 @@ void qclib_load_and_run(void)
/* 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;