]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/PlatformPei/MemDetect.c
OvmfPkg/PlatformPei: Initialise RCBA (B0:D31:F0 0xf0) register
[mirror_edk2.git] / OvmfPkg / PlatformPei / MemDetect.c
index 37030e6898390fcbd2e88ffe5d71363f546ba1b3..bd7bb0227d8c338173780a41bc8ce3db163cfa1d 100644 (file)
@@ -24,6 +24,7 @@ Module Name:
 //\r
 // The Library classes this module consumes\r
 //\r
+#include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/IoLib.h>\r
@@ -55,7 +56,7 @@ GetSystemMemorySizeBelow4gb (
   Cmos0x34 = (UINT8) CmosRead8 (0x34);\r
   Cmos0x35 = (UINT8) CmosRead8 (0x35);\r
 \r
-  return (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);\r
+  return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB);\r
 }\r
 \r
 \r
@@ -204,6 +205,15 @@ InitializeRamRegions (
       EfiACPIMemoryNVS\r
       );\r
 \r
+    //\r
+    // SEC stores its table of GUIDed section handlers here.\r
+    //\r
+    BuildMemoryAllocationHob (\r
+      PcdGet64 (PcdGuidedExtractHandlerTableAddress),\r
+      PcdGet32 (PcdGuidedExtractHandlerTableSize),\r
+      EfiACPIMemoryNVS\r
+      );\r
+\r
 #ifdef MDE_CPU_X64\r
     //\r
     // Reserve the initial page tables built by the reset vector code.\r
@@ -218,4 +228,26 @@ InitializeRamRegions (
       );\r
 #endif\r
   }\r
+\r
+  if (mBootMode != BOOT_ON_S3_RESUME) {\r
+    //\r
+    // Reserve the lock box storage area\r
+    //\r
+    // Since this memory range will be used on S3 resume, it must be\r
+    // reserved as ACPI NVS.\r
+    //\r
+    // If S3 is unsupported, then various drivers might still write to the\r
+    // LockBox area. We ought to prevent DXE from serving allocation requests\r
+    // such that they would overlap the LockBox storage.\r
+    //\r
+    ZeroMem (\r
+      (VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
+      (UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize)\r
+      );\r
+    BuildMemoryAllocationHob (\r
+      (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase),\r
+      (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize),\r
+      mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData\r
+      );\r
+  }\r
 }\r