stage_cache: Add resume_from_stage_cache()

Factor out the condition when an attempt to load
stage from cache can be tried.

Change-Id: I936f07bed6fc82f46118d217f1fd233e2e041405
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50000
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Kyösti Mälkki
2021-01-09 13:30:57 +02:00
parent cdaddde067
commit e0165fbc94
6 changed files with 19 additions and 35 deletions

View File

@@ -3,6 +3,7 @@
#ifndef _STAGE_CACHE_H_
#define _STAGE_CACHE_H_
#include <romstage_handoff.h>
#include <stddef.h>
#include <stdint.h>
#include <program_loading.h>
@@ -38,6 +39,15 @@ static inline void stage_cache_get_raw(int stage_id, void **base, size_t *size)
#endif
static inline int resume_from_stage_cache(void)
{
if (CONFIG(NO_STAGE_CACHE))
return 0;
/* TBD: Replace this with acpi_is_wakeup_s3(). */
return romstage_handoff_is_resume();
}
/* Fill in parameters for the external stage cache, if utilized. */
void stage_cache_external_region(void **base, size_t *size);