Stacy: This fix covers the case with AllocateAddress allocation type. I agree this fix. Reviewed-by: Liming Gao <gaolim...@byosoft.com.cn>
Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Stacy Howell > 发送时间: 2022年1月8日 3:36 > 收件人: devel@edk2.groups.io > 抄送: Stacy Howell <stacy.how...@intel.com>; Dandan Bi > <dandan...@intel.com>; Liming Gao <gaolim...@byosoft.com.cn> > 主题: [edk2-devel] [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to > use untested memory > > REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3795 > CC: Dandan Bi <dandan...@intel.com> > CC: Liming Gao <gaolim...@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.how...@intel.com> > --- > MdeModulePkg/Core/Dxe/Mem/Page.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > 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 (); > > -- > 2.32.0.windows.2 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#85508): https://edk2.groups.io/g/devel/message/85508 Mute This Topic: https://groups.io/mt/88340321/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-