summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cbfs.c12
-rw-r--r--src/lib/prog_loaders.c14
2 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 5a2f63f95d..19737a4192 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -187,6 +187,18 @@ size_t cbfs_boot_load_struct(const char *name, void *buf, size_t buf_size)
buf, buf_size, compression_algo);
}
+size_t cbfs_prog_stage_section(struct prog *pstage, uintptr_t *base)
+{
+ struct cbfs_stage stage;
+ const struct region_device *fh = prog_rdev(pstage);
+
+ if (rdev_readat(fh, &stage, 0, sizeof(stage)) != sizeof(stage))
+ return 0;
+
+ *base = (uintptr_t)stage.load;
+ return stage.memlen;
+}
+
int cbfs_prog_stage_load(struct prog *pstage)
{
struct cbfs_stage stage;
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index 09933ae70c..3a6f2e26a5 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -110,6 +110,18 @@ static int load_relocatable_ramstage(struct prog *ramstage)
return rmodule_stage_load(&rmod_ram);
}
+static int load_nonrelocatable_ramstage(struct prog *ramstage)
+{
+ if (IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)) {
+ uintptr_t base = 0;
+ size_t size = cbfs_prog_stage_section(ramstage, &base);
+ if (size)
+ backup_ramstage_section(base, size);
+ }
+
+ return cbfs_prog_stage_load(ramstage);
+}
+
void run_ramstage(void)
{
struct prog ramstage =
@@ -135,7 +147,7 @@ void run_ramstage(void)
if (IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE)) {
if (load_relocatable_ramstage(&ramstage))
goto fail;
- } else if (cbfs_prog_stage_load(&ramstage))
+ } else if (load_nonrelocatable_ramstage(&ramstage))
goto fail;
stage_cache_add(STAGE_RAMSTAGE, &ramstage);