aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/quark
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-01-22 18:00:18 -0800
committerJulius Werner <jwerner@chromium.org>2020-12-03 00:00:19 +0000
commit9d0cc2aea918eced42dc3825c1ac94d0d4fbc380 (patch)
tree9be158e3f76a533bb95e93fe2f4ef3aa4bb25189 /src/soc/intel/quark
parent8c99c27df10f6c5a120e41ffb0948e357f5a2d20 (diff)
cbfs: Introduce cbfs_ro_map() and cbfs_ro_load()
This patch introduces two new CBFS API functions which are equivalent to cbfs_map() and cbfs_load(), respectively, with the difference that they always operate on the read-only CBFS region ("COREBOOT" FMAP section). Use it to replace some of the simple cases that needed to use cbfs_locate_file_in_region(). Change-Id: I9c55b022b6502a333a9805ab0e4891dd7b97ef7f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39306 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/quark')
-rw-r--r--src/soc/intel/quark/romstage/romstage.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/soc/intel/quark/romstage/romstage.c b/src/soc/intel/quark/romstage/romstage.c
index 9800aa4be6..23a551ef57 100644
--- a/src/soc/intel/quark/romstage/romstage.c
+++ b/src/soc/intel/quark/romstage/romstage.c
@@ -49,29 +49,16 @@ void disable_rom_shadow(void)
void *locate_rmu_file(size_t *rmu_file_len)
{
- struct cbfsf fh;
size_t fsize;
void *rmu_data;
- uint32_t type;
/* Locate the rmu.bin file in the read-only region of the flash */
- type = CBFS_TYPE_RAW;
- if (cbfs_locate_file_in_region(&fh, "COREBOOT", "rmu.bin", &type))
+ rmu_data = cbfs_ro_map("rmu.bin", &fsize);
+ if (!rmu_data)
return NULL;
- /* Get the file size */
- fsize = region_device_sz(&fh.data);
if (rmu_file_len != NULL)
*rmu_file_len = fsize;
- /* Get the data address */
- rmu_data = rdev_mmap(&fh.data, 0, fsize);
-
- /* Since the SPI flash is directly mapped into memory, we do not need
- * the mapping provided by the rdev service. Unmap the file to prevent
- * a memory leak. Return/leak the SPI flash address for the rmu.bin
- * file data which will be directly accessed by FSP MemoryInit.
- */
- rdev_munmap(&fh.data, rmu_data);
return rmu_data;
}