diff --git a/src/soc/qualcomm/common/include/soc/qclib_common.h b/src/soc/qualcomm/common/include/soc/qclib_common.h index c906ef2f73..648b29d343 100644 --- a/src/soc/qualcomm/common/include/soc/qclib_common.h +++ b/src/soc/qualcomm/common/include/soc/qclib_common.h @@ -22,6 +22,7 @@ #define QCLIB_TE_DDR_TRAINING_DATA "ddr_training_data" #define QCLIB_TE_LIMITS_CFG_DATA "limits_cfg_data" #define QCLIB_TE_QCSDI "qcsdi" +#define QCLIB_TE_MEM_CHIP_INFO "mem_chip_info" /* BA_BMASK_VALUES (blob_attributes bit mask values) */ #define QCLIB_BA_SAVE_TO_STORAGE 0x00000001 diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c index e016f25740..9a485db193 100644 --- a/src/soc/qualcomm/common/qclib.c +++ b/src/soc/qualcomm/common/qclib.c @@ -16,9 +16,35 @@ #include #include #include +#include #define QCLIB_VERSION 0 +/* store QcLib return data until ROMSTAGE_CBMEM_INIT_HOOK runs */ +static void *mem_chip_addr; + +static void write_mem_chip_information(struct qclib_cb_if_table_entry *te) +{ + /* Save mem_chip_info in local variables ahead of hook running */ + mem_chip_addr = (void *)te->blob_address; +} + +static void add_mem_chip_info(int unused) +{ + void *mem_region_base = NULL; + + /* Add cbmem table */ + if (sizeof(struct mem_chip_info) != 0) + mem_region_base = cbmem_add(CBMEM_ID_MEM_CHIP_INFO, + sizeof(struct mem_chip_info)); + ASSERT(mem_region_base != NULL); + + /* Migrate the data into CBMEM */ + memcpy(mem_region_base, mem_chip_addr, sizeof(struct mem_chip_info)); +} + +ROMSTAGE_CBMEM_INIT_HOOK(add_mem_chip_info); + struct qclib_cb_if_table qclib_cb_if_table = { .magic = QCLIB_MAGIC_NUMBER, .version = QCLIB_INTERFACE_VERSION, @@ -87,6 +113,10 @@ static void write_table_entry(struct qclib_cb_if_table_entry *te) write_qclib_log_to_cbmemc(te); + } else if (!strncmp(QCLIB_TE_MEM_CHIP_INFO, te->name, + sizeof(te->name))) { + write_mem_chip_information(te); + } else { printk(BIOS_WARNING, "%s write not implemented\n", te->name); @@ -139,6 +169,10 @@ void qclib_load_and_run(void) qclib_add_if_table_entry(QCLIB_TE_DDR_TRAINING_DATA, _ddr_training, REGION_SIZE(ddr_training), 0); + /* Attempt to read MEM CHIP information */ + qclib_add_if_table_entry(QCLIB_TE_MEM_CHIP_INFO, + mem_chip_addr, sizeof(mem_chip_addr), 0); + /* Attempt to load PMICCFG Blob */ data_size = cbfs_load(CONFIG_CBFS_PREFIX "/pmiccfg", _pmic, REGION_SIZE(pmic));