[coreboot-gerrit] Change in coreboot[master]: soc/amd/common: Define regions in AGESA cbmem

Marshall Dawson (Code Review) gerrit at coreboot.org
Tue Dec 5 18:08:51 CET 2017


Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/22720


Change subject: soc/amd/common: Define regions in AGESA cbmem
......................................................................

soc/amd/common: Define regions in AGESA cbmem

In 6c747068 "amd/stoneyridge: Put AGESA heap into cbmem" the AGESA
heap was moved completely into cbmem.  This was a departure from the
"late cbmem init" method of adding it late in post, then storing the
S3 volatile data to the region.

To prepare for S3 support, split the region into subregions for
heap, AGESA's S3 volatile storage, and an MTRR save area.

Change-Id: I06c137f56516f3a04091d1191cd657a0aa07320b
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/soc/amd/common/BiosCallOuts.h
M src/soc/amd/common/heapmanager.c
M src/soc/amd/common/s3_resume.h
3 files changed, 15 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/20/22720/1

diff --git a/src/soc/amd/common/BiosCallOuts.h b/src/soc/amd/common/BiosCallOuts.h
index 5237d52..53fc46f 100644
--- a/src/soc/amd/common/BiosCallOuts.h
+++ b/src/soc/amd/common/BiosCallOuts.h
@@ -17,12 +17,20 @@
 #ifndef __CALLOUTS_AMD_AGESA_H__
 #define __CALLOUTS_AMD_AGESA_H__
 
+#include "s3_resume.h"
 #include "agesawrapper.h"
 
-#define BIOS_HEAP_START_ADDRESS		0x010000000
 #define BIOS_HEAP_SIZE			0x30000
 #define BSP_STACK_BASE_ADDR		0x30000
 
+struct cbmem_usage {
+	uint8_t heap_base[BIOS_HEAP_SIZE];
+#if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)
+	uint8_t s3_vol_data[S3_VOLATILE_SIZE];
+	struct all_mtrrs s3_mtrrs;
+#endif
+};
+
 typedef struct _BIOS_HEAP_MANAGER {
 	UINT32 StartOfAllocatedNodes;
 	UINT32 StartOfFreedNodes;
diff --git a/src/soc/amd/common/heapmanager.c b/src/soc/amd/common/heapmanager.c
index b991514..22d95f0 100644
--- a/src/soc/amd/common/heapmanager.c
+++ b/src/soc/amd/common/heapmanager.c
@@ -21,7 +21,10 @@
 
 static void *GetHeapBase(void)
 {
-	return cbmem_add(CBMEM_ID_RESUME_SCRATCH, BIOS_HEAP_SIZE);
+	struct cbmem_usage *heap;
+	heap = (struct cbmem_usage *)cbmem_add(CBMEM_ID_RESUME_SCRATCH,
+						sizeof(struct cbmem_usage));
+	return (void *)heap->heap_base;
 }
 
 static void EmptyHeap(int unused)
diff --git a/src/soc/amd/common/s3_resume.h b/src/soc/amd/common/s3_resume.h
index 3e80d72..8dc60da 100644
--- a/src/soc/amd/common/s3_resume.h
+++ b/src/soc/amd/common/s3_resume.h
@@ -18,6 +18,8 @@
 
 #include <cpu/x86/msr.h>
 
+#define S3_VOLATILE_SIZE 0x1000
+
 struct vmtrr_pair {
 	msr_t base;
 	msr_t mask;

-- 
To view, visit https://review.coreboot.org/22720
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I06c137f56516f3a04091d1191cd657a0aa07320b
Gerrit-Change-Number: 22720
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171205/fe0aa841/attachment-0001.html>


More information about the coreboot-gerrit mailing list