From 3f788e1f701ffb65f6f1bf62c91ac0d6fc013fb4 Mon Sep 17 00:00:00 2001 From: zbao Date: Wed, 18 Apr 2012 16:59:53 +0800 Subject: S3: Use old heap during normal boot During normal boot, the cbmem is uninitialized. So it is illegal to find the heap in cbmem. Change-Id: I8b5e1dbf1124819ed91693a86a6dbe41aea109e5 Signed-off-by: Zheng Bao Signed-off-by: zbao Reviewed-on: http://review.coreboot.org/904 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones --- src/mainboard/amd/persimmon/BiosCallOuts.h | 1 + src/mainboard/amd/persimmon/agesawrapper.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/amd/persimmon/BiosCallOuts.h b/src/mainboard/amd/persimmon/BiosCallOuts.h index 071c73c3c6..cd23110ef2 100644 --- a/src/mainboard/amd/persimmon/BiosCallOuts.h +++ b/src/mainboard/amd/persimmon/BiosCallOuts.h @@ -23,6 +23,7 @@ #include "Porting.h" #include "AGESA.h" +#define BIOS_HEAP_START_ADDRESS 0x10000 /* HEAP during cold boot */ #define BIOS_HEAP_SIZE 0x20000 #define BSP_STACK_BASE_ADDR 0x30000 diff --git a/src/mainboard/amd/persimmon/agesawrapper.c b/src/mainboard/amd/persimmon/agesawrapper.c index 6bba7ca15a..e60673ec9b 100644 --- a/src/mainboard/amd/persimmon/agesawrapper.c +++ b/src/mainboard/amd/persimmon/agesawrapper.c @@ -40,6 +40,7 @@ #include #include #include +#include #define FILECODE UNASSIGNED_FILE_FILECODE @@ -250,11 +251,15 @@ UINT32 GetHeapBase( AMD_CONFIG_PARAMS *StdHeader ) { - UINT32 high_heap; + UINT32 heap; - high_heap = (UINT32)cbmem_find(CBMEM_ID_RESUME_SCRATCH) + (CONFIG_HIGH_SCRATCH_MEMORY_SIZE - BIOS_HEAP_SIZE); /* base + high_stack_size */ + /* Both romstage and ramstage has this S3 detect. */ + if (acpi_get_sleep_type() == 3) + heap = (UINT32)cbmem_find(CBMEM_ID_RESUME_SCRATCH) + (CONFIG_HIGH_SCRATCH_MEMORY_SIZE - BIOS_HEAP_SIZE); /* himem_heap_base + high_stack_size */ + else + heap = BIOS_HEAP_START_ADDRESS; /* low mem */ - return high_heap; + return heap; } UINT32 -- cgit v1.2.3