From a9b44f4c79078210fe9966daf2412cc222c2d0a9 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 5 Feb 2021 17:27:45 -0800 Subject: spd_bin: Replace get_spd_cbfs_rdev() with spd_cbfs_map() In pursuit of the goal of eliminating the proliferation of raw region devices to represent CBFS files outside of the CBFS core code, this patch removes the get_spd_cbfs_rdev() API and instead replaces it with spd_cbfs_map() which will find and map the SPD file in one go and return a pointer to the relevant section. (This makes it impossible to unmap the mapping again, which all but one of the users didn't bother to do anyway since the API is only used on platforms with memory-mapped flash. Presumably this will stay that way in the future so this is not something worth worrying about.) Signed-off-by: Julius Werner Change-Id: Iec7571bec809f2f0712e7a97b4c853b8b40702d1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50350 Tested-by: build bot (Jenkins) Reviewed-by: Wim Vervoorn Reviewed-by: Aaron Durbin --- src/soc/intel/common/block/memory/meminit.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/soc/intel/common/block') diff --git a/src/soc/intel/common/block/memory/meminit.c b/src/soc/intel/common/block/memory/meminit.c index 17bf066ba2..50c8b40df2 100644 --- a/src/soc/intel/common/block/memory/meminit.c +++ b/src/soc/intel/common/block/memory/meminit.c @@ -39,7 +39,6 @@ static void read_spd_md(const struct soc_mem_cfg *soc_mem_cfg, const struct mem_ { size_t ch; size_t num_phys_ch = soc_mem_cfg->num_phys_channels; - struct region_device spd_rdev; uintptr_t spd_data; /* @@ -63,15 +62,14 @@ static void read_spd_md(const struct soc_mem_cfg *soc_mem_cfg, const struct mem_ printk(BIOS_DEBUG, "SPD index = %zu\n", info->cbfs_index); - if (get_spd_cbfs_rdev(&spd_rdev, info->cbfs_index) < 0) - die("SPD not found in CBFS or incorrect index!\n"); - /* 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_data = (uintptr_t)rdev_mmap_full(&spd_rdev); - *spd_len = region_device_sz(&spd_rdev); + *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"); print_spd_info((uint8_t *)spd_data); -- cgit v1.2.3