X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=OvmfPkg%2FPlatformPei%2FMemDetect.c;h=bd7bb0227d8c338173780a41bc8ce3db163cfa1d;hb=c404616199df383226df1b70940008c01cfaec81;hp=37030e6898390fcbd2e88ffe5d71363f546ba1b3;hpb=78a38b73c39569aacca5c7a4f44bb896305a301a;p=mirror_edk2.git diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 37030e6898..bd7bb0227d 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -24,6 +24,7 @@ Module Name: // // The Library classes this module consumes // +#include #include #include #include @@ -55,7 +56,7 @@ GetSystemMemorySizeBelow4gb ( Cmos0x34 = (UINT8) CmosRead8 (0x34); Cmos0x35 = (UINT8) CmosRead8 (0x35); - return (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB); + return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB); } @@ -204,6 +205,15 @@ InitializeRamRegions ( EfiACPIMemoryNVS ); + // + // SEC stores its table of GUIDed section handlers here. + // + BuildMemoryAllocationHob ( + PcdGet64 (PcdGuidedExtractHandlerTableAddress), + PcdGet32 (PcdGuidedExtractHandlerTableSize), + EfiACPIMemoryNVS + ); + #ifdef MDE_CPU_X64 // // Reserve the initial page tables built by the reset vector code. @@ -218,4 +228,26 @@ InitializeRamRegions ( ); #endif } + + if (mBootMode != BOOT_ON_S3_RESUME) { + // + // Reserve the lock box storage area + // + // Since this memory range will be used on S3 resume, it must be + // reserved as ACPI NVS. + // + // If S3 is unsupported, then various drivers might still write to the + // LockBox area. We ought to prevent DXE from serving allocation requests + // such that they would overlap the LockBox storage. + // + ZeroMem ( + (VOID*)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase), + (UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize) + ); + BuildMemoryAllocationHob ( + (EFI_PHYSICAL_ADDRESS)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageBase), + (UINT64)(UINTN) PcdGet32 (PcdOvmfLockBoxStorageSize), + mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData + ); + } }