UPSTREAM: romstage_handoff: remove code duplication
The same pattern was being used throughout the code base for initializing the romstage handoff structure. Provide a helper function to initialize the structure with the S3 resume state then utilize it at all the existing call sites. BUG=None BRANCH=None TEST=None Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17646 Tested-by: build bot (Jenkins) Reviewed-by: Kysti Mlkki <kyosti.malkki@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com> Change-Id: I1e9d588ab6b9ace67757387dbb5963ae31ceb252 Reviewed-on: https://chromium-review.googlesource.com/416155 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
b95c3a7f40
commit
c7b7a3fb44
9 changed files with 35 additions and 60 deletions
|
|
@ -99,7 +99,6 @@ void *cache_as_ram_stage_main(FSP_INFO_HEADER *fih)
|
|||
void romstage_common(struct romstage_params *params)
|
||||
{
|
||||
const struct mrc_saved_data *cache;
|
||||
struct romstage_handoff *handoff;
|
||||
struct pei_data *pei_data;
|
||||
|
||||
post_code(0x32);
|
||||
|
|
@ -165,14 +164,9 @@ void romstage_common(struct romstage_params *params)
|
|||
mainboard_save_dimm_info(params);
|
||||
|
||||
/* Create romstage handof information */
|
||||
handoff = romstage_handoff_find_or_add();
|
||||
if (handoff != NULL)
|
||||
handoff->s3_resume = (params->power_state->prev_sleep_state ==
|
||||
ACPI_S3);
|
||||
else {
|
||||
printk(BIOS_DEBUG, "Romstage handoff structure not added!\n");
|
||||
if (romstage_handoff_init(
|
||||
params->power_state->prev_sleep_state == ACPI_S3) < 0)
|
||||
hard_reset();
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the TPM, unless the TPM was already initialized
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ static void save_memory_training_data(bool s3wake, uint32_t fsp_version)
|
|||
static void do_fsp_post_memory_init(bool s3wake, uint32_t fsp_version)
|
||||
{
|
||||
struct range_entry fsp_mem;
|
||||
struct romstage_handoff *handoff;
|
||||
|
||||
if (fsp_find_reserved_memory(&fsp_mem))
|
||||
die("Failed to find FSP_RESERVED_MEMORY_RESOURCE_HOB!\n");
|
||||
|
|
@ -144,11 +143,7 @@ static void do_fsp_post_memory_init(bool s3wake, uint32_t fsp_version)
|
|||
save_memory_training_data(s3wake, fsp_version);
|
||||
|
||||
/* Create romstage handof information */
|
||||
handoff = romstage_handoff_find_or_add();
|
||||
if (handoff != NULL)
|
||||
handoff->s3_resume = s3wake;
|
||||
else
|
||||
printk(BIOS_SPEW, "Romstage handoff structure not added!\n");
|
||||
romstage_handoff_init(s3wake);
|
||||
}
|
||||
|
||||
static const char *mrc_cache_get_region_name(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue