fsp2_0: Replace fspld->get_destination() callback with CBFS allocator
The Intel FSP 2.0 driver contains a custom construct that basically
serves the same purpose as the new CBFS allocator concept: a callback
function to customize placement of a loaded CBFS file whose size is
initially unknown. This patch removes the existing implementation and
replaces it with a CBFS allocator.
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I0b7b446a0d2af87ec337fb80ad54f2d404e69668
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52082
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c
index c9898f5..6326d53 100644
--- a/src/drivers/intel/fsp2_0/silicon_init.c
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -184,22 +184,16 @@
post_code(POST_FSP_MULTI_PHASE_SI_INIT_EXIT);
}
-static int fsps_get_dest(const struct fsp_load_descriptor *fspld, void **dest,
- size_t size, const struct region_device *source)
+static void *fsps_allocator(void *arg_unused, size_t size, const union cbfs_mdata *mdata_unused)
{
- *dest = cbmem_add(CBMEM_ID_REFCODE, size);
-
- if (*dest == NULL)
- return -1;
-
- return 0;
+ return cbmem_add(CBMEM_ID_REFCODE, size);
}
void fsps_load(void)
{
struct fsp_load_descriptor fspld = {
.fsp_prog = PROG_INIT(PROG_REFCODE, CONFIG_FSP_S_CBFS),
- .get_destination = fsps_get_dest,
+ .alloc = fsps_allocator,
};
struct prog *fsps = &fspld.fsp_prog;
static int load_done;