diff options
author | Stacy Howell <stacy.howell@intel.com> | 2022-01-08 03:36:12 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-07-22 05:36:57 +0000 |
commit | 494f333aba024cf8e695fda78594e5cac210c7a3 (patch) | |
tree | e8d8fd0639d830464ed61e96fa483486a884ee5f /MdeModulePkg/Core/Dxe | |
parent | 7ef91af84c04b1e5a17631bd1811c9bc1945dfdc (diff) | |
download | edk2-494f333aba024cf8e695fda78594e5cac210c7a3.tar.gz edk2-494f333aba024cf8e695fda78594e5cac210c7a3.tar.bz2 edk2-494f333aba024cf8e695fda78594e5cac210c7a3.zip |
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>
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Mem/Page.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 47d4c5d92e..cc0b90ac0d 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -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 ();
|