Revision: 14944
          http://sourceforge.net/p/edk2/code/14944
Author:   jljusten
Date:     2013-12-08 01:36:07 +0000 (Sun, 08 Dec 2013)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/PlatformPei/MemDetect.c
    trunk/edk2/OvmfPkg/PlatformPei/Platform.h

Modified: trunk/edk2/OvmfPkg/PlatformPei/MemDetect.c
===================================================================
--- trunk/edk2/OvmfPkg/PlatformPei/MemDetect.c  2013-12-08 01:36:00 UTC (rev 
14943)
+++ trunk/edk2/OvmfPkg/PlatformPei/MemDetect.c  2013-12-08 01:36:07 UTC (rev 
14944)
@@ -83,11 +83,45 @@
   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

Modified: trunk/edk2/OvmfPkg/PlatformPei/Platform.h
===================================================================
--- trunk/edk2/OvmfPkg/PlatformPei/Platform.h   2013-12-08 01:36:00 UTC (rev 
14943)
+++ trunk/edk2/OvmfPkg/PlatformPei/Platform.h   2013-12-08 01:36:07 UTC (rev 
14944)
@@ -57,6 +57,11 @@
   EFI_PHYSICAL_ADDRESS        MemoryLimit
   );
 
+EFI_STATUS
+PublishPeiMemory (
+  VOID
+  );
+
 EFI_PHYSICAL_ADDRESS
 MemDetect (
   VOID

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to