From 22ea0078917415aa179f868b94b7f91fd533b369 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 5 Aug 2015 10:17:33 -0500 Subject: fsp1_1: fsp_relocate: use struct region_device and struct prog Using struct prog and struct region_device allows for the caller to be none-the-wiser about where FSP gets placed. It also allows for the source location to be abstracted away such that it doesn't require a large mapping up front to do the relocation. Lastly, it allows for simplifying the intel/commmon FSP support in that it can pass around a struct prog. BUG=chrome-os-partner:43636 BRANCH=None TEST=Built, booted, suspended, and resumed on glados. Original-Change-Id: I034b04ab2b7e9e01f5ee14fcc190f04b90517d30 Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/290830 Original-Tested-by: Aaron Durbin Original-Reviewed-by: Leroy P Leahy Original-Reviewed-by: Duncan Laurie Original-Commit-Queue: Aaron Durbin Change-Id: Ibe1f206a9541902103551afaf212418fcc90e73c Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/11193 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/soc/intel/common/fsp_ramstage.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/soc/intel/common') diff --git a/src/soc/intel/common/fsp_ramstage.c b/src/soc/intel/common/fsp_ramstage.c index 5ccc4eea92..1c3c38a35b 100644 --- a/src/soc/intel/common/fsp_ramstage.c +++ b/src/soc/intel/common/fsp_ramstage.c @@ -286,20 +286,22 @@ static void fsp_cache_save(void) static int fsp_find_and_relocate(void) { - void *fih; - void *data; - size_t length; + struct prog fsp_prog = PROG_INIT(ASSET_REFCODE, "fsp.bin"); + struct region_device fsp_rdev; + uint32_t type = CBFS_TYPE_FSP; - data = cbfs_boot_map_with_leak("fsp.bin", CBFS_TYPE_FSP, &length); - - if (data == NULL) { - printk(BIOS_ERR, "Couldn't find fsp.bin in CBFS.\n"); + if (cbfs_boot_locate(&fsp_rdev, prog_name(&fsp_prog), &type)) { + printk(BIOS_ERR, "ERROR: Couldn't find fsp.bin in CBFS.\n"); return -1; } - fih = fsp_relocate(data, length); + if (fsp_relocate(&fsp_prog, &fsp_rdev)) { + printk(BIOS_ERR, "ERROR: FSP relocation failed.\n"); + return -1; + } - fsp_update_fih(fih); + /* FSP_INFO_HEADER is set as the program entry. */ + fsp_update_fih(prog_entry(&fsp_prog)); return 0; } -- cgit v1.2.3