UPSTREAM: ACPI S3: Remove HIGH_MEMORY_SAVE where possible

Add implementation to use actual requirements of ramstage size
for S3 resume backup in CBMEM. The backup covers complete pages of 4 KiB.

Only the required amount of low memory is backed up when ACPI_TINY_LOWMEM_BACKUP
is selected for the platform. Enable this option for AGESA and binaryPI, other
platforms (without RELOCATABLE_RAMSTAGE) currently keep their romstage ramstack
in low memory for s3 resume path.

BUG=None
BRANCH=None
TEST=None

Signed-off-by: Kysti Mlkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/15255
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>

Change-Id: Ide7ce013f3727c2928cdb00fbcc7e7e84e859ff1
Reviewed-on: https://chromium-review.googlesource.com/410076
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:
Kyösti Mälkki 2016-06-28 07:38:46 +03:00 committed by chrome-bot
commit fa81f61d39
10 changed files with 175 additions and 26 deletions

View file

@ -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;

View file

@ -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);