summaryrefslogtreecommitdiff
path: root/OvmfPkg/PlatformPei
diff options
context:
space:
mode:
authorWei Liu <wei.liu2@citrix.com>2013-12-08 01:36:07 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-08 01:36:07 +0000
commit36658fff454167c716993cf649f6172361b0e7b2 (patch)
tree6c96cc618c89698e25b3043137146ee31137608a /OvmfPkg/PlatformPei
parentc7ea55b92b56a7434cb6f5c33fffc76eb1086e08 (diff)
downloadedk2-platforms-36658fff454167c716993cf649f6172361b0e7b2.tar.xz
OvmfPkg: introduce PublishPeiMemory
MemDetect actully does too many things, the underlying platform might want to have more control over memory layout. Extract the functionality of publishing PEI memory to a dedicated function. Also fixed wrong comment while I was there. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wei Liu <wei.liu2@citrix.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14944 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/PlatformPei')
-rw-r--r--OvmfPkg/PlatformPei/MemDetect.c36
-rw-r--r--OvmfPkg/PlatformPei/Platform.h5
2 files changed, 40 insertions, 1 deletions
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 9f6ca1942e..9145ebb89d 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -83,11 +83,45 @@ GetSystemMemorySizeAbove4gb (
return LShiftU64 (Size, 16);
}
+/**
+ Publish PEI core memory
+
+ @return EFI_SUCCESS The PEIM initialized successfully.
+
+**/
+EFI_STATUS
+PublishPeiMemory (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS MemoryBase;
+ UINT64 MemorySize;
+ UINT64 LowerMemorySize;
+
+ LowerMemorySize = GetSystemMemorySizeBelow4gb ();
+
+ MemoryBase = PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize);
+ MemorySize = LowerMemorySize - MemoryBase;
+ if (MemorySize > SIZE_64MB) {
+ MemoryBase = LowerMemorySize - SIZE_64MB;
+ MemorySize = SIZE_64MB;
+ }
+
+ //
+ // Publish this memory to the PEI Core
+ //
+ Status = PublishSystemMemory(MemoryBase, MemorySize);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
/**
Peform Memory Detection
- @return EFI_SUCCESS The PEIM initialized successfully.
+ @return Top of memory
**/
EFI_PHYSICAL_ADDRESS
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index d63d124064..7344c610bb 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -57,6 +57,11 @@ AddUntestedMemoryRangeHob (
EFI_PHYSICAL_ADDRESS MemoryLimit
);
+EFI_STATUS
+PublishPeiMemory (
+ VOID
+ );
+
EFI_PHYSICAL_ADDRESS
MemDetect (
VOID