summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2022-10-24 19:06:03 -0700
committerJulius Werner <jwerner@chromium.org>2022-12-09 00:48:57 +0000
commit3460aa3a421f57dc9a5cd9657cd9f0fd0ead8b72 (patch)
treee2f146e38463617b931654b8dc687ae0b9bacb97 /src/soc/qualcomm
parentee2f0b499ba50bf66b9dcdb1726c26860f08b2cb (diff)
mem_chip_info: Update to new format
The original version of the mem_chip_info structure does not record rank information and does not allow precise modeling of certain DDR configurations, so it falls short on its purpose to compile all available memory information. This patch updates the format to a new layout that remedies these issues. Since the structure was introduced so recently that no firmware using it has been finalized and shipped yet, we should be able to get away with this without accounting for backwards compatibility. BRANCH=corsola Cq-Depend: chromium:3980175 Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: If34e6857439b6f6ab225344e5b4dd0ff11d8d42a Reviewed-on: https://review.coreboot.org/c/coreboot/+/68871 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Xixi Chen <xixi.chen@mediatek.corp-partner.google.com>
Diffstat (limited to 'src/soc/qualcomm')
-rw-r--r--src/soc/qualcomm/common/qclib.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c
index 4d005e53af..2769dede2f 100644
--- a/src/soc/qualcomm/common/qclib.c
+++ b/src/soc/qualcomm/common/qclib.c
@@ -21,14 +21,15 @@
#define QCLIB_VERSION 0
/* store QcLib return data until CBMEM_CREATION_HOOK runs */
-static void *mem_chip_addr;
+static struct mem_chip_info *mem_chip_info;
static void write_mem_chip_information(struct qclib_cb_if_table_entry *te)
{
+ struct mem_chip_info *info = (void *)te->blob_address;
if (te->size > sizeof(struct mem_chip_info) &&
- te->size == mem_chip_info_size((void *)te->blob_address)) {
- /* Save mem_chip_addr in global variable ahead of hook running */
- mem_chip_addr = (void *)te->blob_address;
+ te->size == mem_chip_info_size(info->num_entries)) {
+ /* Save mem_chip_info in global variable ahead of hook running */
+ mem_chip_info = info;
}
}
@@ -37,19 +38,20 @@ static void add_mem_chip_info(int unused)
void *mem_region_base = NULL;
size_t size;
- if (!mem_chip_addr) {
+ if (!mem_chip_info || !mem_chip_info->num_entries ||
+ mem_chip_info->struct_version != MEM_CHIP_STRUCT_VERSION) {
printk(BIOS_ERR, "Did not receive valid mem_chip_info from QcLib!");
return;
}
- size = mem_chip_info_size(mem_chip_addr);
+ size = mem_chip_info_size(mem_chip_info->num_entries);
/* Add cbmem table */
mem_region_base = cbmem_add(CBMEM_ID_MEM_CHIP_INFO, size);
ASSERT(mem_region_base != NULL);
/* Migrate the data into CBMEM */
- memcpy(mem_region_base, mem_chip_addr, size);
+ memcpy(mem_region_base, mem_chip_info, size);
}
CBMEM_CREATION_HOOK(add_mem_chip_info);