AGESA: Use common ACPI S3 recovery
Change-Id: I8ce91088c5fa1a2d2abc53b23e423939fe759117 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/15253 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
3969df875e
commit
a2a7e981d6
|
@ -25,29 +25,11 @@
|
||||||
#include <halt.h>
|
#include <halt.h>
|
||||||
#include "s3_resume.h"
|
#include "s3_resume.h"
|
||||||
|
|
||||||
static void *backup_resume(void)
|
|
||||||
{
|
|
||||||
void *resume_backup_memory;
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "Find resume memory location\n");
|
|
||||||
|
|
||||||
if (cbmem_recovery(1)) {
|
|
||||||
printk(BIOS_EMERG, "Unable to recover CBMEM\n");
|
|
||||||
halt();
|
|
||||||
}
|
|
||||||
|
|
||||||
resume_backup_memory = cbmem_find(CBMEM_ID_RESUME);
|
|
||||||
if (resume_backup_memory == NULL) {
|
|
||||||
printk(BIOS_EMERG, "No storage for low-memory backup\n");
|
|
||||||
halt();
|
|
||||||
}
|
|
||||||
|
|
||||||
return resume_backup_memory;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void move_stack_high_mem(void)
|
static void move_stack_high_mem(void)
|
||||||
{
|
{
|
||||||
void *high_stack = cbmem_find(CBMEM_ID_ROMSTAGE_RAM_STACK);
|
void *high_stack = cbmem_find(CBMEM_ID_ROMSTAGE_RAM_STACK);
|
||||||
|
if (high_stack == NULL)
|
||||||
|
halt();
|
||||||
|
|
||||||
/* TODO: Make the switch with empty stack instead. */
|
/* TODO: Make the switch with empty stack instead. */
|
||||||
memcpy(high_stack, (void *)BSP_STACK_BASE_ADDR, HIGH_ROMSTAGE_STACK_SIZE);
|
memcpy(high_stack, (void *)BSP_STACK_BASE_ADDR, HIGH_ROMSTAGE_STACK_SIZE);
|
||||||
|
@ -93,7 +75,10 @@ static void set_resume_cache(void)
|
||||||
|
|
||||||
void prepare_for_resume(void)
|
void prepare_for_resume(void)
|
||||||
{
|
{
|
||||||
void *resume_backup_memory = backup_resume();
|
if (cbmem_recovery(1)) {
|
||||||
|
printk(BIOS_EMERG, "Unable to recover CBMEM\n");
|
||||||
|
halt();
|
||||||
|
}
|
||||||
|
|
||||||
post_code(0x62);
|
post_code(0x62);
|
||||||
printk(BIOS_DEBUG, "Move CAR stack.\n");
|
printk(BIOS_DEBUG, "Move CAR stack.\n");
|
||||||
|
@ -108,8 +93,5 @@ void prepare_for_resume(void)
|
||||||
* Copy the system memory that is in the ramstage area to the
|
* Copy the system memory that is in the ramstage area to the
|
||||||
* reserved area.
|
* reserved area.
|
||||||
*/
|
*/
|
||||||
if (resume_backup_memory)
|
acpi_prepare_for_resume();
|
||||||
memcpy(resume_backup_memory, (void *)(CONFIG_RAMBASE), HIGH_MEMORY_SAVE);
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "System memory saved. OK to load ramstage.\n");
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue