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>
This commit is contained in:
Julius Werner
2020-01-22 18:00:18 -08:00
parent 8c99c27df1
commit 9d0cc2aea9
6 changed files with 61 additions and 93 deletions

View File

@ -107,9 +107,6 @@ void sdram_initialize(struct pei_data *pei_data)
{
int (*entry)(struct pei_data *pei_data) __attribute__((regparm(1)));
uint32_t type = CBFS_TYPE_MRC;
struct cbfsf f;
printk(BIOS_DEBUG, "Starting UEFI PEI System Agent\n");
/*
@ -130,13 +127,10 @@ void sdram_initialize(struct pei_data *pei_data)
/*
* Locate and call UEFI System Agent binary. The binary needs to be at a fixed offset
* in the flash and can therefore only reside in the COREBOOT fmap region.
* in the flash and can therefore only reside in the COREBOOT fmap region. We don't care
* about leaking the mapping.
*/
if (cbfs_locate_file_in_region(&f, "COREBOOT", "mrc.bin", &type) < 0)
die("mrc.bin not found!");
/* We don't care about leaking the mapping */
entry = rdev_mmap_full(&f.data);
entry = cbfs_ro_map("mrc.bin", NULL);
if (entry) {
int rv = entry(pei_data);