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 <jwerner@chromium.org> Change-Id: Iec7571bec809f2f0712e7a97b4c853b8b40702d1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50350 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Wim Vervoorn <wvervoorn@eltan.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
committed by
Patrick Georgi
parent
806deb6661
commit
a9b44f4c79
@ -210,17 +210,16 @@ void print_spd_info(uint8_t spd[])
|
||||
}
|
||||
}
|
||||
|
||||
int get_spd_cbfs_rdev(struct region_device *spd_rdev, u8 spd_index)
|
||||
uintptr_t spd_cbfs_map(u8 spd_index)
|
||||
{
|
||||
struct cbfsf fh;
|
||||
enum cbfs_type cbfs_type = CBFS_TYPE_SPD;
|
||||
size_t size;
|
||||
|
||||
uint32_t cbfs_type = CBFS_TYPE_SPD;
|
||||
void *map = cbfs_type_map("spd.bin", &size, &cbfs_type);
|
||||
if (!map || size < (spd_index + 1) * CONFIG_DIMM_SPD_SIZE)
|
||||
return 0;
|
||||
|
||||
if (cbfs_boot_locate(&fh, "spd.bin", &cbfs_type) < 0)
|
||||
return -1;
|
||||
cbfs_file_data(spd_rdev, &fh);
|
||||
return rdev_chain(spd_rdev, spd_rdev, spd_index * CONFIG_DIMM_SPD_SIZE,
|
||||
CONFIG_DIMM_SPD_SIZE);
|
||||
return (uintptr_t)map + spd_index * CONFIG_DIMM_SPD_SIZE;
|
||||
}
|
||||
|
||||
#if CONFIG_DIMM_SPD_SIZE == 128
|
||||
|
Reference in New Issue
Block a user