MdeModulePkg/CoreDxe: Allow DXE Drivers to use untested memory

REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3795
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Updated CoreInternalAllocatePages() to call PromoteMemoryResource() and
re-attempt the allocation if unable to convert the specified memory range

Signed-off-by: Stacy Howell <stacy.howell@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Stacy Howell 2022-01-08 03:36:12 +08:00 committed by mergify[bot]
parent 7ef91af84c
commit 494f333aba
1 changed files with 14 additions and 0 deletions

View File

@ -1417,6 +1417,20 @@ CoreInternalAllocatePages (
Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
}
if (EFI_ERROR (Status)) {
//
// If requested memory region is unavailable it may be untested memory
// Attempt to promote memory resources, then re-attempt the allocation
//
if (PromoteMemoryResource ()) {
if (NeedGuard) {
Status = CoreConvertPagesWithGuard (Start, NumberOfPages, MemoryType);
} else {
Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
}
}
}
Done:
CoreReleaseMemoryLock ();