mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: drivers/intel/{fsp1_1,fsp2_0}: Provide separate function for fsp load
Add a function to allow FSP component loading separately from silicon
initialization. This enables SoCs that might not have stage cache
available during silicon initialization to load/save components from/to
stage cache before it is relocated or destroyed.
BUG=chrome-os-partner:63114
BRANCH=None
TEST=Compiles successfully.
Change-Id: I593b27934b3f2093e3d1d0a36106471d2b5f10e4
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Original-Commit-Id: f4b20af9d7
Original-Change-Id: Iae77e20568418c29df9f69bd54aa571e153740c9
Original-Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/18413
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/445862
This commit is contained in:
parent
8dad06b5db
commit
cdf025ffc6
4 changed files with 38 additions and 7 deletions
|
@ -21,6 +21,12 @@
|
|||
#include <soc/intel/common/util.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Load FSP from stage cache or CBFS. This allows SoCs to load FSP separately
|
||||
* from calling silicon init. It might be required in cases where stage cache is
|
||||
* no longer available by the point SoC calls into silicon init.
|
||||
*/
|
||||
void fsp_load(void);
|
||||
/* Perform Intel silicon init. */
|
||||
void intel_silicon_init(void);
|
||||
void fsp_run_silicon_init(FSP_INFO_HEADER *fsp_info_header, int is_s3_wakeup);
|
||||
|
|
|
@ -185,11 +185,15 @@ static int fsp_find_and_relocate(struct prog *fsp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void intel_silicon_init(void)
|
||||
void fsp_load(void)
|
||||
{
|
||||
static int load_done;
|
||||
struct prog fsp = PROG_INIT(PROG_REFCODE, "fsp.bin");
|
||||
int is_s3_wakeup = acpi_is_wakeup_s3();
|
||||
|
||||
if (load_done)
|
||||
return;
|
||||
|
||||
if (is_s3_wakeup && !IS_ENABLED(CONFIG_NO_STAGE_CACHE)) {
|
||||
printk(BIOS_DEBUG, "FSP: Loading binary from cache\n");
|
||||
stage_cache_load_stage(STAGE_REFCODE, &fsp);
|
||||
|
@ -201,7 +205,13 @@ void intel_silicon_init(void)
|
|||
/* FSP_INFO_HEADER is set as the program entry. */
|
||||
fsp_update_fih(prog_entry(&fsp));
|
||||
|
||||
fsp_run_silicon_init(fsp_get_fih(), is_s3_wakeup);
|
||||
load_done = 1;
|
||||
}
|
||||
|
||||
void intel_silicon_init(void)
|
||||
{
|
||||
fsp_load();
|
||||
fsp_run_silicon_init(fsp_get_fih(), acpi_is_wakeup_s3());
|
||||
}
|
||||
|
||||
/* Initialize the UPD parameters for SiliconInit */
|
||||
|
|
|
@ -42,6 +42,13 @@ void fsp_memory_init(bool s3wake);
|
|||
void fsp_silicon_init(bool s3wake);
|
||||
void fsp_temp_ram_exit(void);
|
||||
|
||||
/*
|
||||
* Load FSP-S from stage cache or CBFS. This allows SoCs to load FSPS-S
|
||||
* separately from calling silicon init. It might be required in cases where
|
||||
* stage cache is no longer available by the point SoC calls into silicon init.
|
||||
*/
|
||||
void fsps_load(bool s3wake);
|
||||
|
||||
/* Callbacks for updating stage-specific parameters */
|
||||
void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version);
|
||||
void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd);
|
||||
|
|
|
@ -62,7 +62,7 @@ static void do_silicon_init(struct fsp_header *hdr)
|
|||
}
|
||||
}
|
||||
|
||||
void fsp_silicon_init(bool s3wake)
|
||||
void fsps_load(bool s3wake)
|
||||
{
|
||||
struct fsp_header *hdr = &fsps_hdr;
|
||||
struct cbfsf file_desc;
|
||||
|
@ -71,17 +71,20 @@ void fsp_silicon_init(bool s3wake)
|
|||
void *dest;
|
||||
size_t size;
|
||||
struct prog fsps = PROG_INIT(PROG_REFCODE, name);
|
||||
static int load_done;
|
||||
|
||||
if (load_done)
|
||||
return;
|
||||
|
||||
if (s3wake && !IS_ENABLED(CONFIG_NO_STAGE_CACHE)) {
|
||||
printk(BIOS_DEBUG, "Loading FSPS from stage_cache\n");
|
||||
stage_cache_load_stage(STAGE_REFCODE, &fsps);
|
||||
if (fsp_validate_component(hdr, prog_rdev(&fsps)) != CB_SUCCESS)
|
||||
die("On resume fsps header is invalid\n");
|
||||
do_silicon_init(hdr);
|
||||
load_done = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cbfs_boot_locate(&file_desc, name, NULL)) {
|
||||
printk(BIOS_ERR, "Could not locate %s in CBFS\n", name);
|
||||
die("FSPS not available!\n");
|
||||
|
@ -116,6 +119,11 @@ void fsp_silicon_init(bool s3wake)
|
|||
|
||||
/* Signal that FSP component has been loaded. */
|
||||
prog_segment_loaded(hdr->image_base, hdr->image_size, SEG_FINAL);
|
||||
|
||||
do_silicon_init(hdr);
|
||||
load_done = 1;
|
||||
}
|
||||
|
||||
void fsp_silicon_init(bool s3wake)
|
||||
{
|
||||
fsps_load(s3wake);
|
||||
do_silicon_init(&fsps_hdr);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue