diff options
Diffstat (limited to 'OvmfPkg/PlatformPei/MemDetect.c')
-rw-r--r-- | OvmfPkg/PlatformPei/MemDetect.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 29df5370b0..11c79687c4 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -99,16 +99,21 @@ PublishPeiMemory ( UINT64 MemorySize;
UINT64 LowerMemorySize;
- LowerMemorySize = GetSystemMemorySizeBelow4gb ();
-
- //
- // Determine the range of memory to use during PEI
- //
- MemoryBase = PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemFvSize);
- MemorySize = LowerMemorySize - MemoryBase;
- if (MemorySize > SIZE_64MB) {
- MemoryBase = LowerMemorySize - SIZE_64MB;
- MemorySize = SIZE_64MB;
+ if (mBootMode == BOOT_ON_S3_RESUME) {
+ MemoryBase = PcdGet32 (PcdS3AcpiReservedMemoryBase);
+ MemorySize = PcdGet32 (PcdS3AcpiReservedMemorySize);
+ } else {
+ LowerMemorySize = GetSystemMemorySizeBelow4gb ();
+
+ //
+ // Determine the range of memory to use during PEI
+ //
+ MemoryBase = PcdGet32 (PcdOvmfDxeMemFvBase) + PcdGet32 (PcdOvmfDxeMemFvSize);
+ MemorySize = LowerMemorySize - MemoryBase;
+ if (MemorySize > SIZE_64MB) {
+ MemoryBase = LowerMemorySize - SIZE_64MB;
+ MemorySize = SIZE_64MB;
+ }
}
//
@@ -173,4 +178,15 @@ InitializeRamRegions ( } else {
XenPublishRamRegions ();
}
+
+ if (mS3Supported && mBootMode != BOOT_ON_S3_RESUME) {
+ //
+ // This is the memory range that will be used for PEI on S3 resume
+ //
+ BuildMemoryAllocationHob (
+ (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdS3AcpiReservedMemoryBase),
+ (UINT64)(UINTN) PcdGet32 (PcdS3AcpiReservedMemorySize),
+ EfiACPIMemoryNVS
+ );
+ }
}
|