summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/amd/torpedo/agesawrapper.c2
-rw-r--r--src/northbridge/amd/agesa/family12/fam12_callouts.c30
-rw-r--r--src/northbridge/amd/agesa/family12/fam12_callouts.h2
3 files changed, 26 insertions, 8 deletions
diff --git a/src/mainboard/amd/torpedo/agesawrapper.c b/src/mainboard/amd/torpedo/agesawrapper.c
index 45b591a523..eb4da38781 100644
--- a/src/mainboard/amd/torpedo/agesawrapper.c
+++ b/src/mainboard/amd/torpedo/agesawrapper.c
@@ -391,7 +391,7 @@ agesawrapper_amdinitpost (
AmdReleaseStruct (&AmdParamStruct);
/* Initialize heap space */
- BiosManagerPtr = (BIOS_HEAP_MANAGER *)BIOS_HEAP_START_ADDRESS;
+ BiosManagerPtr = (BIOS_HEAP_MANAGER *)GetHeapBase(&AmdParamStruct.StdHeader);
HeadPtr = (UINT32 *) ((UINT8 *) BiosManagerPtr + sizeof (BIOS_HEAP_MANAGER));
for (i = 0; i < ((BIOS_HEAP_SIZE/4) - (sizeof (BIOS_HEAP_MANAGER)/4)); i++)
diff --git a/src/northbridge/amd/agesa/family12/fam12_callouts.c b/src/northbridge/amd/agesa/family12/fam12_callouts.c
index 192c5ddaff..491f3ce47b 100644
--- a/src/northbridge/amd/agesa/family12/fam12_callouts.c
+++ b/src/northbridge/amd/agesa/family12/fam12_callouts.c
@@ -25,7 +25,23 @@
#include "OptionsIds.h"
#include "heapManager.h"
#include "Hudson-2.h"
+#include <cbmem.h>
+#include <arch/acpi.h>
+UINT32 GetHeapBase(AMD_CONFIG_PARAMS *StdHeader)
+{
+ UINT32 heap = BIOS_HEAP_START_ADDRESS;
+
+#if CONFIG_HAVE_ACPI_RESUME
+ /* 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 */
+#endif
+
+ return heap;
+}
AGESA_STATUS BiosAllocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
{
@@ -49,8 +65,8 @@ AGESA_STATUS BiosAllocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
AllocParams->BufferPointer = NULL;
AvailableHeapSize = BIOS_HEAP_SIZE - sizeof (BIOS_HEAP_MANAGER);
- BiosHeapBaseAddr = (UINT8 *) BIOS_HEAP_START_ADDRESS;
- BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BIOS_HEAP_START_ADDRESS;
+ BiosHeapBaseAddr = (UINT8 *) GetHeapBase(&(AllocParams->StdHeader));
+ BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BiosHeapBaseAddr;
if (BiosHeapBasePtr->StartOfAllocatedNodes == 0) {
/* First allocation */
@@ -172,11 +188,11 @@ AGESA_STATUS BiosDeallocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
BIOS_HEAP_MANAGER *BiosHeapBasePtr;
AGESA_BUFFER_PARAMS *AllocParams;
- BiosHeapBaseAddr = (UINT8 *) BIOS_HEAP_START_ADDRESS;
- BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BIOS_HEAP_START_ADDRESS;
-
AllocParams = (AGESA_BUFFER_PARAMS *) ConfigPtr;
+ BiosHeapBaseAddr = (UINT8 *) GetHeapBase(&(AllocParams->StdHeader));
+ BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BiosHeapBaseAddr;
+
/* Find target node to deallocate in list of allocated nodes.
Return AGESA_BOUNDS_CHK if the BufferHandle is not found
*/
@@ -285,8 +301,8 @@ AGESA_STATUS BiosLocateBuffer (UINT32 Func, UINT32 Data, VOID *ConfigPtr)
AllocParams = (AGESA_BUFFER_PARAMS *) ConfigPtr;
- BiosHeapBaseAddr = (UINT8 *) BIOS_HEAP_START_ADDRESS;
- BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BIOS_HEAP_START_ADDRESS;
+ BiosHeapBaseAddr = (UINT8 *) GetHeapBase(&(AllocParams->StdHeader));
+ BiosHeapBasePtr = (BIOS_HEAP_MANAGER *) BiosHeapBaseAddr;
AllocNodeOffset = BiosHeapBasePtr->StartOfAllocatedNodes;
AllocNodePtr = (BIOS_BUFFER_NODE *) (BiosHeapBaseAddr + AllocNodeOffset);
diff --git a/src/northbridge/amd/agesa/family12/fam12_callouts.h b/src/northbridge/amd/agesa/family12/fam12_callouts.h
index fd08cfe65a..387ff303ef 100644
--- a/src/northbridge/amd/agesa/family12/fam12_callouts.h
+++ b/src/northbridge/amd/agesa/family12/fam12_callouts.h
@@ -38,6 +38,8 @@ typedef struct _BIOS_BUFFER_NODE {
UINT32 NextNodeOffset;
} BIOS_BUFFER_NODE;
+UINT32 GetHeapBase(AMD_CONFIG_PARAMS *StdHeader);
+
/* REQUIRED CALLOUTS
* AGESA ADVANCED CALLOUTS - CPU
*/