This area is also overwritten by SEC when it decompresses the main
firmware -- tell the OS to stay away.

                                     +------+ 8M      (PcdOvmfMemFvBase)
               ^                     |      |
final decompr. |                     +------+ 9M      (OutputBuffer)
target,        |                   ^ |      |
reserved by    |                   | |      |
prev. patch    |     temporary     | |      |
               v     decompression | |      |
                     output        | +------+ 16M     (PcdOvmfMemFvBase +
               ^                   | |      |          PcdOvmfMemFvSize)
               |                   v |      |
               |                     +------+ 17M+80  (OutputBuffer +
      reserved |                   ^ |      |          OutputBufferSize)
      now      |            unused | |      |
               |                   v |      |
               |                     +------+ 18M     (ScratchBuffer)
               |                   ^ |      |
               |  decompr. scratch | |      |
               v                   v |      |
                                     +------+ 18M+64K (ScratchBuffer +
                                                       ScratchBufferSize)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/PlatformPei/Fv.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/OvmfPkg/PlatformPei/Fv.c b/OvmfPkg/PlatformPei/Fv.c
index 4f1ad16..4a31cc3 100644
--- a/OvmfPkg/PlatformPei/Fv.c
+++ b/OvmfPkg/PlatformPei/Fv.c
@@ -54,6 +54,18 @@ PeiFvInitialization (
     EfiACPIMemoryNVS
     );
 
+  //
+  // Firmware decompression in DecompressGuidedFv() [OvmfPkg/Sec/SecMain.c]
+  // uses additional temporary memory.
+  //
+  BuildMemoryAllocationHob (
+    PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize),
+    (SIZE_2MB  + // cover the end of OutputBuffer, rounded up to 1MB
+     SIZE_64KB   // cover the end of ScratchBuffer
+     ),
+    EfiACPIMemoryNVS
+    );
+
   return EFI_SUCCESS;
 }
 
-- 
1.8.3.1



------------------------------------------------------------------------------
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-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to