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/mainboard/portwell/m107/romstage.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/mainboard/portwell/m107') diff --git a/src/mainboard/portwell/m107/romstage.c b/src/mainboard/portwell/m107/romstage.c index 3ba12f30ff..d6d495518a 100644 --- a/src/mainboard/portwell/m107/romstage.c +++ b/src/mainboard/portwell/m107/romstage.c @@ -12,7 +12,6 @@ void mainboard_memory_init_params(struct romstage_params *params, MEMORY_INIT_UPD *memory_params) { - struct region_device spd_rdev; u8 spd_index = 0; if (CONFIG(ONBOARD_MEM_MICRON)) @@ -20,11 +19,10 @@ void mainboard_memory_init_params(struct romstage_params *params, else if (CONFIG(ONBOARD_MEM_KINGSTON)) spd_index = 2; - if (get_spd_cbfs_rdev(&spd_rdev, spd_index) < 0) - die("spd.bin not found\n"); - memory_params->PcdMemoryTypeEnable = MEM_DDR3; - memory_params->PcdMemorySpdPtr = (uintptr_t)rdev_mmap_full(&spd_rdev); + memory_params->PcdMemorySpdPtr = spd_cbfs_map(spd_index); + if (!memory_params->PcdMemorySpdPtr) + die("spd.bin not found\n"); memory_params->PcdMemChannel0Config = 1; /* Memory down */ memory_params->PcdMemChannel1Config = 2; /* Disabled */ } -- cgit v1.2.3