arch/x86: cache postcar in stage cache
Stash and reload postcar stage in the stage cache for increased S3 resume speed. It's impact is small (2 ms or so), but there's no need to go to the boot media on resume to reload something that was already loaded. This aligns with the same paths we take on ramstage as well. Change-Id: I4313794826120853163c7366e81346858747ed0a Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17649 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
afe8aeed81
commit
d008413a3c
|
@ -20,6 +20,8 @@
|
||||||
#include <cpu/x86/mtrr.h>
|
#include <cpu/x86/mtrr.h>
|
||||||
#include <program_loading.h>
|
#include <program_loading.h>
|
||||||
#include <rmodule.h>
|
#include <rmodule.h>
|
||||||
|
#include <romstage_handoff.h>
|
||||||
|
#include <stage_cache.h>
|
||||||
|
|
||||||
static inline void stack_push(struct postcar_frame *pcf, uint32_t val)
|
static inline void stack_push(struct postcar_frame *pcf, uint32_t val)
|
||||||
{
|
{
|
||||||
|
@ -110,18 +112,14 @@ void *postcar_commit_mtrrs(struct postcar_frame *pcf)
|
||||||
return (void *) pcf->stack;
|
return (void *) pcf->stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_postcar_phase(struct postcar_frame *pcf)
|
static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf)
|
||||||
{
|
{
|
||||||
struct prog prog =
|
|
||||||
PROG_INIT(PROG_UNKNOWN, CONFIG_CBFS_PREFIX "/postcar");
|
|
||||||
struct rmod_stage_load rsl = {
|
struct rmod_stage_load rsl = {
|
||||||
.cbmem_id = CBMEM_ID_AFTER_CAR,
|
.cbmem_id = CBMEM_ID_AFTER_CAR,
|
||||||
.prog = &prog,
|
.prog = prog,
|
||||||
};
|
};
|
||||||
|
|
||||||
postcar_commit_mtrrs(pcf);
|
if (prog_locate(prog))
|
||||||
|
|
||||||
if (prog_locate(&prog))
|
|
||||||
die("Failed to locate after CAR program.\n");
|
die("Failed to locate after CAR program.\n");
|
||||||
if (rmodule_stage_load(&rsl))
|
if (rmodule_stage_load(&rsl))
|
||||||
die("Failed to load after CAR program.\n");
|
die("Failed to load after CAR program.\n");
|
||||||
|
@ -139,5 +137,21 @@ void run_postcar_phase(struct postcar_frame *pcf)
|
||||||
prog_segment_loaded((uintptr_t)rsl.params, sizeof(uintptr_t),
|
prog_segment_loaded((uintptr_t)rsl.params, sizeof(uintptr_t),
|
||||||
SEG_FINAL);
|
SEG_FINAL);
|
||||||
|
|
||||||
|
if (!IS_ENABLED(CONFIG_NO_STAGE_CACHE))
|
||||||
|
stage_cache_add(STAGE_POSTCAR, prog);
|
||||||
|
}
|
||||||
|
|
||||||
|
void run_postcar_phase(struct postcar_frame *pcf)
|
||||||
|
{
|
||||||
|
struct prog prog =
|
||||||
|
PROG_INIT(PROG_UNKNOWN, CONFIG_CBFS_PREFIX "/postcar");
|
||||||
|
|
||||||
|
postcar_commit_mtrrs(pcf);
|
||||||
|
|
||||||
|
if (!IS_ENABLED(CONFIG_NO_STAGE_CACHE) && romstage_handoff_is_resume())
|
||||||
|
stage_cache_load_stage(STAGE_POSTCAR, &prog);
|
||||||
|
else
|
||||||
|
load_postcar_cbfs(&prog, pcf);
|
||||||
|
|
||||||
prog_run(&prog);
|
prog_run(&prog);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
enum {
|
enum {
|
||||||
STAGE_RAMSTAGE,
|
STAGE_RAMSTAGE,
|
||||||
STAGE_REFCODE,
|
STAGE_REFCODE,
|
||||||
|
STAGE_POSTCAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Cache the loaded stage provided according to the parameters. */
|
/* Cache the loaded stage provided according to the parameters. */
|
||||||
|
|
Loading…
Reference in New Issue