diff --git a/src/soc/intel/common/block/include/intelblocks/meminit.h b/src/soc/intel/common/block/include/intelblocks/meminit.h index a4fb9fa1f3..566efa03d9 100644 --- a/src/soc/intel/common/block/include/intelblocks/meminit.h +++ b/src/soc/intel/common/block/include/intelblocks/meminit.h @@ -57,6 +57,17 @@ struct mem_spd { struct { uint8_t addr_dimm[CONFIG_DIMMS_PER_CHANNEL]; } smbus[MRC_CHANNELS]; + + /* If the SPD data is provided in a memory buffer, spd_data.in_mem needs to be + * set to 'true'. In this case spd_data.ptr points to the memory buffer where the + * SPD data is stored in and spd_data.len stores the length of the SPD data + * in that buffer. In this case cbfs_index is ignored. + */ + struct { + bool in_mem; + size_t len; + uintptr_t ptr; + } spd_data; }; /* Information about memory technology supported by SoC */ diff --git a/src/soc/intel/common/block/memory/meminit.c b/src/soc/intel/common/block/memory/meminit.c index 3c310798d0..fa80017c50 100644 --- a/src/soc/intel/common/block/memory/meminit.c +++ b/src/soc/intel/common/block/memory/meminit.c @@ -60,17 +60,24 @@ static void read_spd_md(const struct soc_mem_cfg *soc_mem_cfg, const struct mem_ if (pop_mask == 0) die("Memory technology does not support the selected configuration!\n"); + if (!(info->spd_data.in_mem)) { - printk(BIOS_DEBUG, "SPD index = %zu\n", info->cbfs_index); + printk(BIOS_DEBUG, "SPD index = %zu\n", info->cbfs_index); - /* Memory leak is ok as long as we have memory mapped boot media */ - _Static_assert(CONFIG(BOOT_DEVICE_MEMORY_MAPPED), - "Function assumes memory-mapped boot media"); + /* Memory leak is ok as long as we have memory mapped boot media */ + _Static_assert(CONFIG(BOOT_DEVICE_MEMORY_MAPPED), + "Function assumes memory-mapped boot media"); - *spd_len = CONFIG_DIMM_SPD_SIZE; - spd_data = spd_cbfs_map(info->cbfs_index); - if (!spd_data) - die("SPD not found in CBFS or incorrect index!\n"); + *spd_len = CONFIG_DIMM_SPD_SIZE; + spd_data = spd_cbfs_map(info->cbfs_index); + if (!spd_data) + die("SPD not found in CBFS or incorrect index!\n"); + } else { + *spd_len = info->spd_data.len; + spd_data = info->spd_data.ptr; + if (!spd_data) + die("SPD data in memory expected but no buffer provided!\n"); + } print_spd_info((uint8_t *)spd_data);