1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
6 #include <commonlib/fsp.h>
9 int fsp_relocate(struct prog
*fsp_relocd
)
15 void *new_loc
= cbfs_cbmem_alloc(prog_name(fsp_relocd
),
16 CBMEM_ID_REFCODE
, &size
);
17 if (new_loc
== NULL
) {
18 printk(BIOS_ERR
, "Unable to load FSP into memory.\n");
22 fih_offset
= fsp1_1_relocate((uintptr_t)new_loc
, new_loc
, size
);
24 if (fih_offset
<= 0) {
25 printk(BIOS_ERR
, "FSP relocation failure.\n");
29 fih
= (void *)((uint8_t *)new_loc
+ fih_offset
);
31 prog_set_area(fsp_relocd
, new_loc
, size
);
32 prog_set_entry(fsp_relocd
, fih
, NULL
);