summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/amd/agesa/heapmanager.c10
-rw-r--r--src/northbridge/amd/agesa/agesa_helper.h1
-rw-r--r--src/northbridge/amd/agesa/oem_s3.c31
3 files changed, 20 insertions, 22 deletions
diff --git a/src/cpu/amd/agesa/heapmanager.c b/src/cpu/amd/agesa/heapmanager.c
index cc6ee2216d..2a5141c62c 100644
--- a/src/cpu/amd/agesa/heapmanager.c
+++ b/src/cpu/amd/agesa/heapmanager.c
@@ -62,16 +62,6 @@ void EmptyHeap(void)
(unsigned int)(uintptr_t) base, (unsigned int)(uintptr_t) base + BIOS_HEAP_SIZE - 1);
}
-void ResumeHeap(void **heap, size_t *len)
-{
- void *base = GetHeapBase();
- *heap = base;
- *len = BIOS_HEAP_SIZE;
-
- printk(BIOS_DEBUG, "Using resume HEAP at [%08x - %08x]\n",
- (unsigned int)(uintptr_t) base, (unsigned int)(uintptr_t) base + BIOS_HEAP_SIZE - 1);
-}
-
#if (IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_TN) || \
IS_ENABLED(CONFIG_NORTHBRIDGE_AMD_AGESA_FAMILY15_RL)) && !defined(__PRE_RAM__)
diff --git a/src/northbridge/amd/agesa/agesa_helper.h b/src/northbridge/amd/agesa/agesa_helper.h
index 82963c1f04..ee7ab92ddd 100644
--- a/src/northbridge/amd/agesa/agesa_helper.h
+++ b/src/northbridge/amd/agesa/agesa_helper.h
@@ -37,7 +37,6 @@ void amd_initenv(void);
void *GetHeapBase(void);
void EmptyHeap(void);
-void ResumeHeap(void **heap, size_t *len);
#define BSP_STACK_BASE_ADDR 0x30000
diff --git a/src/northbridge/amd/agesa/oem_s3.c b/src/northbridge/amd/agesa/oem_s3.c
index 525bfabafb..e3d58c21d0 100644
--- a/src/northbridge/amd/agesa/oem_s3.c
+++ b/src/northbridge/amd/agesa/oem_s3.c
@@ -61,24 +61,33 @@ static void get_s3nv_data(S3_DATA_TYPE S3DataType, uintptr_t *pos, uintptr_t *le
AGESA_STATUS OemInitResume(AMD_S3_PARAMS *dataBlock)
{
uintptr_t pos, size;
-
get_s3nv_data(S3DataTypeNonVolatile, &pos, &size);
- /* TODO: Our NvStorage is really const. */
- dataBlock->NvStorageSize = *(UINT32 *) pos;
- dataBlock->NvStorage = (void *) (pos + sizeof(UINT32));
+ u32 len = *(u32*)pos;
+
+ /* Test for uninitialized s3nv data in SPI. */
+ if (len == 0 || len == (u32)-1ULL)
+ return AGESA_FATAL;
+
+ dataBlock->NvStorageSize = len;
+ dataBlock->NvStorage = (void *) (pos + sizeof(u32));
return AGESA_SUCCESS;
}
AGESA_STATUS OemS3LateRestore(AMD_S3_PARAMS *dataBlock)
{
- void *dst;
- size_t len;
-
- ResumeHeap(&dst, &len);
- dataBlock->VolatileStorageSize = len;
- dataBlock->VolatileStorage = dst;
-
+ char *heap = cbmem_find(CBMEM_ID_RESUME_SCRATCH);
+ if (heap == NULL)
+ return AGESA_FATAL;
+
+ printk(BIOS_DEBUG, "Using resume HEAP at %08x\n",
+ (unsigned int)(uintptr_t) heap);
+
+ /* Return allocated CBMEM size, we do not keep track of
+ * how much was actually used.
+ */
+ dataBlock->VolatileStorageSize = HIGH_MEMORY_SCRATCH;
+ dataBlock->VolatileStorage = heap;
return AGESA_SUCCESS;
}