From 9c4ac31cca01b4a503c36616770ea3157bf3bb9e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 27 Aug 2008 14:29:23 +0000 Subject: [PATCH] Clean up DxeCore to remove duplicate memory allocation & device path utility services in Library.c.DxeCore should use MemoryAllocationLib & DevicePathLib for these API. Minor cleanup the coding style: #include should be changed to #include "DxeMain.h" since "DxeMain.h" is not pubic header fie. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5742 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c | 6 +- MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 12 +- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 6 +- .../Core/Dxe/DxeMain/DxeProtocolNotify.c | 2 +- MdeModulePkg/Core/Dxe/Event/Event.c | 2 +- MdeModulePkg/Core/Dxe/Event/ExecData.c | 2 +- MdeModulePkg/Core/Dxe/Event/Timer.c | 2 +- MdeModulePkg/Core/Dxe/Event/Tpl.c | 2 +- MdeModulePkg/Core/Dxe/FwVol/Ffs.c | 2 +- MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 10 +- MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c | 2 +- MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c | 4 +- MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c | 2 +- MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 6 +- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 16 +- MdeModulePkg/Core/Dxe/Hand/DriverSupport.c | 12 +- MdeModulePkg/Core/Dxe/Hand/Handle.c | 16 +- MdeModulePkg/Core/Dxe/Hand/Locate.c | 10 +- MdeModulePkg/Core/Dxe/Hand/Notify.c | 4 +- MdeModulePkg/Core/Dxe/Image/Image.c | 18 +- MdeModulePkg/Core/Dxe/Image/ImageFile.c | 8 +- MdeModulePkg/Core/Dxe/Library.h | 161 ---------- MdeModulePkg/Core/Dxe/Library/Library.c | 274 +----------------- MdeModulePkg/Core/Dxe/Mem/MemData.c | 2 +- MdeModulePkg/Core/Dxe/Mem/Page.c | 2 +- MdeModulePkg/Core/Dxe/Mem/Pool.c | 2 +- MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c | 6 +- .../Core/Dxe/Misc/InstallConfigurationTable.c | 38 +-- MdeModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c | 2 +- MdeModulePkg/Core/Dxe/Misc/Stall.c | 2 +- .../SectionExtraction/CoreSectionExtraction.c | 18 +- 31 files changed, 92 insertions(+), 559 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c index f4a448680f..e489547302 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c @@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // Global stack used to evaluate dependency expressions @@ -50,7 +50,7 @@ GrowDepexStack ( Size = Size + (mDepexEvaluationStackEnd - mDepexEvaluationStack); } - NewStack = CoreAllocateBootServicesPool (Size * sizeof (BOOLEAN)); + NewStack = AllocatePool (Size * sizeof (BOOLEAN)); if (NewStack == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -68,7 +68,7 @@ GrowDepexStack ( // // Free The Old Stack // - CoreFreePool (mDepexEvaluationStack); + FreePool (mDepexEvaluationStack); } // diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c index f00442684e..ba8734e1d6 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -37,7 +37,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // The Driver List contains one copy of every driver that has been discovered. @@ -638,7 +638,7 @@ FvIsBeingProcesssed ( { KNOWN_HANDLE *KnownHandle; - KnownHandle = CoreAllocateBootServicesPool (sizeof (KNOWN_HANDLE)); + KnownHandle = AllocatePool (sizeof (KNOWN_HANDLE)); ASSERT (KnownHandle != NULL); KnownHandle->Signature = KNOWN_HANDLE_SIGNATURE; @@ -688,7 +688,7 @@ CoreFvToDevicePath ( mFvDevicePath.End.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL)); - FileNameDevicePath = CoreAppendDevicePath ( + FileNameDevicePath = AppendDevicePath ( FvDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath ); @@ -733,7 +733,7 @@ CoreAddToDriverList ( // Create the Driver Entry for the list. ZeroPool initializes lots of variables to // NULL or FALSE. // - DriverEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_CORE_DRIVER_ENTRY)); + DriverEntry = AllocateZeroPool (sizeof (EFI_CORE_DRIVER_ENTRY)); ASSERT (DriverEntry != NULL); DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE; @@ -876,7 +876,7 @@ CoreProcessFvImageFile ( // ReadSection or Produce FVB failed, Free data buffer // if (Buffer != NULL) { - CoreFreePool (Buffer); + FreePool (Buffer); } if (AlignedBuffer != NULL) { @@ -1043,7 +1043,7 @@ CoreFwVolEventProtocolNotify ( mFvDevicePath.End.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL)); - gDxeCoreLoadedImage->FilePath = CoreDuplicateDevicePath ( + gDxeCoreLoadedImage->FilePath = DuplicateDevicePath ( (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath ); gDxeCoreLoadedImage->DeviceHandle = FvHandle; diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 5687ba1856..acc675844a 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // DXE Core Global Variables for Protocols from PEI @@ -250,10 +250,10 @@ DxeMain ( // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table // - gDxeCoreST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate); + gDxeCoreST = AllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate); ASSERT (gDxeCoreST != NULL); - gDxeCoreRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate); + gDxeCoreRT = AllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate); ASSERT (gDxeCoreRT != NULL); gDxeCoreST->RuntimeServices = gDxeCoreRT; diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c index 89a4c50b99..2043384f82 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c @@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Event/Event.c index 5cf54199ed..c05f99c2e7 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/MdeModulePkg/Core/Dxe/Event/Event.c @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // Enumerate the valid types diff --git a/MdeModulePkg/Core/Dxe/Event/ExecData.c b/MdeModulePkg/Core/Dxe/Event/ExecData.c index 13f8ff28e3..66b62bfe3e 100644 --- a/MdeModulePkg/Core/Dxe/Event/ExecData.c +++ b/MdeModulePkg/Core/Dxe/Event/ExecData.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // diff --git a/MdeModulePkg/Core/Dxe/Event/Timer.c b/MdeModulePkg/Core/Dxe/Event/Timer.c index 3eabbaabaa..de5b169472 100644 --- a/MdeModulePkg/Core/Dxe/Event/Timer.c +++ b/MdeModulePkg/Core/Dxe/Event/Timer.c @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // Internal prototypes diff --git a/MdeModulePkg/Core/Dxe/Event/Tpl.c b/MdeModulePkg/Core/Dxe/Event/Tpl.c index e99cb7355c..5eb4628cb1 100644 --- a/MdeModulePkg/Core/Dxe/Event/Tpl.c +++ b/MdeModulePkg/Core/Dxe/Event/Tpl.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /** diff --git a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c index 1375e6bf7d..1c11dde036 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c +++ b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /** diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c index 8c91641834..48b309fee9 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c @@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" #define KEYSIZE sizeof (UINTN) @@ -87,7 +87,7 @@ GetFwVolHeader ( // // Allocate a buffer for the caller // - *FwVolHeader = CoreAllocateBootServicesPool (TempFvh.HeaderLength); + *FwVolHeader = AllocatePool (TempFvh.HeaderLength); if (*FwVolHeader == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -210,7 +210,7 @@ FvCheck ( // the header to check to make sure the volume is valid // Size = (UINTN)(FwVolHeader->FvLength - FwVolHeader->HeaderLength); - FvDevice->CachedFv = CoreAllocateBootServicesPool (Size); + FvDevice->CachedFv = AllocatePool (Size); if (FvDevice->CachedFv == NULL) { return EFI_OUT_OF_RESOURCES; @@ -336,7 +336,7 @@ FvCheck ( // // Create a FFS list entry for each non-deleted file // - FfsFileEntry = CoreAllocateZeroBootServicesPool (sizeof (FFS_FILE_LIST_ENTRY)); + FfsFileEntry = AllocateZeroPool (sizeof (FFS_FILE_LIST_ENTRY)); if (FfsFileEntry == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -465,7 +465,7 @@ NotifyFwVolBlock ( // // No FwVol protocol on the handle so create a new one // - FvDevice = CoreAllocateCopyPool (sizeof (FV_DEVICE), &mFvDevice); + FvDevice = AllocateCopyPool (sizeof (FV_DEVICE), &mFvDevice); if (FvDevice == NULL) { return; } diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c index 1b629ddf1f..664c3af967 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /** diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c index 7346928934..fbf6d0a1ba 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /*++ @@ -342,7 +342,7 @@ FvReadFile ( // // Caller passed in a pointer so allocate buffer for them // - *Buffer = CoreAllocateBootServicesPool (FileSize); + *Buffer = AllocatePool (FileSize); if (*Buffer == NULL) { return EFI_OUT_OF_RESOURCES; } diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c index 6ff9bda021..1e0263e844 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c index 35926d3ee2..8d45105872 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c @@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = { @@ -438,7 +438,7 @@ ProduceFVBProtocolOnBuffer ( // // Allocate EFI_FW_VOL_BLOCK_DEVICE // - FvbDev = CoreAllocateCopyPool (sizeof (EFI_FW_VOL_BLOCK_DEVICE), &mFwVolBlock); + FvbDev = AllocateCopyPool (sizeof (EFI_FW_VOL_BLOCK_DEVICE), &mFwVolBlock); if (FvbDev == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -460,7 +460,7 @@ ProduceFVBProtocolOnBuffer ( // // Second, allocate the cache // - FvbDev->LbaCache = CoreAllocateBootServicesPool (FvbDev->NumBlocks * sizeof (LBA_CACHE)); + FvbDev->LbaCache = AllocatePool (FvbDev->NumBlocks * sizeof (LBA_CACHE)); if (FvbDev->LbaCache == NULL) { CoreFreePool (FvbDev); return EFI_OUT_OF_RESOURCES; diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 2e7afb33c3..4927c67c18 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" #define MINIMUM_INITIAL_MEMORY_SIZE 0x10000 @@ -235,12 +235,12 @@ CoreAllocateGcdMapEntry ( IN OUT EFI_GCD_MAP_ENTRY **BottomEntry ) { - *TopEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_GCD_MAP_ENTRY)); + *TopEntry = AllocateZeroPool (sizeof (EFI_GCD_MAP_ENTRY)); if (*TopEntry == NULL) { return EFI_OUT_OF_RESOURCES; } - *BottomEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_GCD_MAP_ENTRY)); + *BottomEntry = AllocateZeroPool (sizeof (EFI_GCD_MAP_ENTRY)); if (*BottomEntry == NULL) { CoreFreePool (*TopEntry); return EFI_OUT_OF_RESOURCES; @@ -1401,7 +1401,7 @@ CoreGetMemorySpaceMap ( // // Allocate the MemorySpaceMap // - *MemorySpaceMap = CoreAllocateBootServicesPool (*NumberOfDescriptors * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR)); + *MemorySpaceMap = AllocatePool (*NumberOfDescriptors * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR)); if (*MemorySpaceMap == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1649,7 +1649,7 @@ CoreGetIoSpaceMap ( // // Allocate the IoSpaceMap // - *IoSpaceMap = CoreAllocateBootServicesPool (*NumberOfDescriptors * sizeof (EFI_GCD_IO_SPACE_DESCRIPTOR)); + *IoSpaceMap = AllocatePool (*NumberOfDescriptors * sizeof (EFI_GCD_IO_SPACE_DESCRIPTOR)); if (*IoSpaceMap == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1983,7 +1983,7 @@ CoreInitializeGcdServices ( // // Initialize the GCD Memory Space Map // - Entry = CoreAllocateCopyPool (sizeof (EFI_GCD_MAP_ENTRY), &mGcdMemorySpaceMapEntryTemplate); + Entry = AllocateCopyPool (sizeof (EFI_GCD_MAP_ENTRY), &mGcdMemorySpaceMapEntryTemplate); ASSERT (Entry != NULL); Entry->EndAddress = LShiftU64 (1, SizeOfMemorySpace) - 1; @@ -1993,7 +1993,7 @@ CoreInitializeGcdServices ( // // Initialize the GCD I/O Space Map // - Entry = CoreAllocateCopyPool (sizeof (EFI_GCD_MAP_ENTRY), &mGcdIoSpaceMapEntryTemplate); + Entry = AllocateCopyPool (sizeof (EFI_GCD_MAP_ENTRY), &mGcdIoSpaceMapEntryTemplate); ASSERT (Entry != NULL); Entry->EndAddress = LShiftU64 (1, SizeOfIoSpace) - 1; @@ -2128,7 +2128,7 @@ CoreInitializeGcdServices ( // // Relocate HOB List to an allocated pool buffer. // - NewHobList = CoreAllocateCopyPool ( + NewHobList = AllocateCopyPool ( (UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart), *HobStart ); diff --git a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c index 773165232f..9db124c9f3 100644 --- a/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c +++ b/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // @@ -72,7 +72,7 @@ CoreConnectController ( // AlignedRemainingDevicePath = NULL; if (RemainingDevicePath != NULL) { - AlignedRemainingDevicePath = CoreDuplicateDevicePath (RemainingDevicePath); + AlignedRemainingDevicePath = DuplicateDevicePath (RemainingDevicePath); } // @@ -137,7 +137,7 @@ CoreConnectController ( // // Allocate a handle buffer for ControllerHandle's children // - ChildHandleBuffer = CoreAllocateBootServicesPool (ChildHandleCount * sizeof(EFI_HANDLE)); + ChildHandleBuffer = AllocatePool (ChildHandleCount * sizeof(EFI_HANDLE)); // // Fill in a handle buffer with ControllerHandle's children @@ -376,7 +376,7 @@ CoreConnectSingleController ( // // Allocate a duplicate array for the sorted Driver Binding Protocol Instances // - SortedDriverBindingProtocols = CoreAllocateBootServicesPool (sizeof (VOID *) * DriverBindingHandleCount); + SortedDriverBindingProtocols = AllocatePool (sizeof (VOID *) * DriverBindingHandleCount); if (SortedDriverBindingProtocols == NULL) { CoreFreePool (DriverBindingHandleBuffer); return EFI_OUT_OF_RESOURCES; @@ -707,7 +707,7 @@ CoreDisconnectController ( goto Done; } - DriverImageHandleBuffer = CoreAllocateBootServicesPool (sizeof (EFI_HANDLE) * DriverImageHandleCount); + DriverImageHandleBuffer = AllocatePool (sizeof (EFI_HANDLE) * DriverImageHandleCount); if (DriverImageHandleBuffer == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -789,7 +789,7 @@ CoreDisconnectController ( ChildHandleValid = FALSE; ChildBuffer = NULL; if (ChildBufferCount != 0) { - ChildBuffer = CoreAllocateBootServicesPool (sizeof (EFI_HANDLE) * ChildBufferCount); + ChildBuffer = AllocatePool (sizeof (EFI_HANDLE) * ChildBufferCount); if (ChildBuffer == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Hand/Handle.c index d94fdde720..cfa103c0e5 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // @@ -132,7 +132,7 @@ CoreFindProtocolEntry ( // allocate a new entry // if ((ProtEntry == NULL) && Create) { - ProtEntry = CoreAllocateBootServicesPool (sizeof(PROTOCOL_ENTRY)); + ProtEntry = AllocatePool (sizeof(PROTOCOL_ENTRY)); if (ProtEntry != NULL) { // @@ -393,7 +393,7 @@ CoreInstallProtocolInterfaceNotify ( // // Allocate a new protocol interface structure // - Prot = CoreAllocateZeroBootServicesPool (sizeof(PROTOCOL_INTERFACE)); + Prot = AllocateZeroPool (sizeof(PROTOCOL_INTERFACE)); if (Prot == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -404,7 +404,7 @@ CoreInstallProtocolInterfaceNotify ( // Handle = (IHANDLE *)*UserHandle; if (Handle == NULL) { - Handle = CoreAllocateZeroBootServicesPool (sizeof(IHANDLE)); + Handle = AllocateZeroPool (sizeof(IHANDLE)); if (Handle == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1145,7 +1145,7 @@ CoreOpenProtocol ( // // Create new entry // - OpenData = CoreAllocateBootServicesPool (sizeof(OPEN_PROTOCOL_DATA)); + OpenData = AllocatePool (sizeof(OPEN_PROTOCOL_DATA)); if (OpenData == NULL) { Status = EFI_OUT_OF_RESOURCES; } else { @@ -1331,7 +1331,7 @@ CoreOpenProtocolInformation ( Size = Count * sizeof(EFI_OPEN_PROTOCOL_INFORMATION_ENTRY); } - Buffer = CoreAllocateBootServicesPool (Size); + Buffer = AllocatePool (Size); if (Buffer == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1434,7 +1434,7 @@ CoreProtocolsPerHandle ( goto Done; } - Buffer = CoreAllocateBootServicesPool (sizeof (EFI_GUID *) * ProtocolCount); + Buffer = AllocatePool (sizeof (EFI_GUID *) * ProtocolCount); if (Buffer == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1505,7 +1505,7 @@ CoreConnectHandlesByKey ( } } - HandleBuffer = CoreAllocateBootServicesPool (Count * sizeof (EFI_HANDLE)); + HandleBuffer = AllocatePool (Count * sizeof (EFI_HANDLE)); if (HandleBuffer == NULL) { CoreReleaseProtocolLock (); return; diff --git a/MdeModulePkg/Core/Dxe/Hand/Locate.c b/MdeModulePkg/Core/Dxe/Hand/Locate.c index 3bed845cf5..24f6e785a5 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Locate.c +++ b/MdeModulePkg/Core/Dxe/Hand/Locate.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // ProtocolRequest - Last LocateHandle request ID @@ -450,12 +450,12 @@ CoreLocateDevicePath ( *Device = NULL_HANDLE; SourcePath = *DevicePath; - SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); + SourceSize = GetDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); // // The source path can only have 1 instance // - if (CoreIsDevicePathMultiInstance (SourcePath)) { + if (IsDevicePathMultiInstance (SourcePath)) { DEBUG((DEBUG_ERROR, "LocateDevicePath: Device path has too many instances\n")); return EFI_INVALID_PARAMETER; } @@ -482,7 +482,7 @@ CoreLocateDevicePath ( // // Check if DevicePath is first part of SourcePath // - Size = CoreDevicePathSize (TmpDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); + Size = GetDevicePathSize (TmpDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, Size) == 0) { // // If the size is equal to the best match, then we @@ -672,7 +672,7 @@ CoreLocateHandleBuffer ( return Status; } - *Buffer = CoreAllocateBootServicesPool (BufferSize); + *Buffer = AllocatePool (BufferSize); if (*Buffer == NULL) { return EFI_OUT_OF_RESOURCES; } diff --git a/MdeModulePkg/Core/Dxe/Hand/Notify.c b/MdeModulePkg/Core/Dxe/Hand/Notify.c index db3dfa1641..5f4ae191c2 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Notify.c +++ b/MdeModulePkg/Core/Dxe/Hand/Notify.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /** @@ -132,7 +132,7 @@ CoreRegisterProtocolNotify ( // // Allocate a new notification record // - ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY)); + ProtNotify = AllocatePool (sizeof(PROTOCOL_NOTIFY)); if (ProtNotify != NULL) { ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE; diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 54254879ca..4b65148344 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // Module Globals // @@ -340,7 +340,7 @@ CoreLoadPeImage ( // if ((Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) != 0) { if (Image->ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) { - Image->ImageContext.FixupData = CoreAllocateRuntimePool ((UINTN)(Image->ImageContext.FixupDataSize)); + Image->ImageContext.FixupData = AllocateRuntimePool ((UINTN)(Image->ImageContext.FixupDataSize)); if (Image->ImageContext.FixupData == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -444,7 +444,7 @@ CoreLoadPeImage ( // // Make a list off all the RT images so we can let the RT AP know about them. // - Image->RuntimeData = CoreAllocateRuntimePool (sizeof(EFI_RUNTIME_IMAGE_ENTRY)); + Image->RuntimeData = AllocateRuntimePool (sizeof(EFI_RUNTIME_IMAGE_ENTRY)); if (Image->RuntimeData == NULL) { goto Done; } @@ -685,7 +685,7 @@ CoreLoadImageCommon ( // // Allocate a new image structure // - Image = CoreAllocateZeroBootServicesPool (sizeof(LOADED_IMAGE_PRIVATE_DATA)); + Image = AllocateZeroPool (sizeof(LOADED_IMAGE_PRIVATE_DATA)); if (Image == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -696,7 +696,7 @@ CoreLoadImageCommon ( FilePath = OriginalFilePath; Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath); if (!EFI_ERROR (Status)) { - FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); + FilePathSize = GetDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL); FilePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *)FilePath) + FilePathSize ); } @@ -707,7 +707,7 @@ CoreLoadImageCommon ( Image->Info.SystemTable = gDxeCoreST; Image->Info.DeviceHandle = DeviceHandle; Image->Info.Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION; - Image->Info.FilePath = CoreDuplicateDevicePath (FilePath); + Image->Info.FilePath = DuplicateDevicePath (FilePath); Image->Info.ParentHandle = ParentImageHandle; @@ -774,7 +774,7 @@ CoreLoadImageCommon ( // otherwise Loaded Image Device Path Protocol is installed with a NULL interface pointer. // if (OriginalFilePath != NULL) { - Image->LoadedImageDevicePath = CoreDuplicateDevicePath (OriginalFilePath); + Image->LoadedImageDevicePath = DuplicateDevicePath (OriginalFilePath); } // @@ -1000,7 +1000,7 @@ CoreStartImage ( // JumpContext must be aligned on a CPU specific boundary. // Overallocate the buffer and force the required alignment // - Image->JumpBuffer = CoreAllocateBootServicesPool (sizeof (BASE_LIBRARY_JUMP_BUFFER) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); + Image->JumpBuffer = AllocatePool (sizeof (BASE_LIBRARY_JUMP_BUFFER) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); if (Image->JumpBuffer == NULL) { PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0); return EFI_OUT_OF_RESOURCES; @@ -1322,7 +1322,7 @@ CoreExit ( // if (ExitData != NULL) { Image->ExitDataSize = ExitDataSize; - Image->ExitData = CoreAllocateBootServicesPool (Image->ExitDataSize); + Image->ExitData = AllocatePool (Image->ExitDataSize); if (Image->ExitData == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c index 3776e57513..a95496f9c5 100644 --- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c +++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" /** @@ -177,7 +177,7 @@ CoreOpenImageFile ( // Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH // nodes, It assures the fields in device path nodes are 2 byte aligned. // - FilePathNode = (FILEPATH_DEVICE_PATH *)CoreDuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(UINTN)FilePathNode); + FilePathNode = (FILEPATH_DEVICE_PATH *)DuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(UINTN)FilePathNode); if (FilePathNode == NULL) { FileHandle->Close (FileHandle); Status = EFI_OUT_OF_RESOURCES; @@ -247,7 +247,7 @@ CoreOpenImageFile ( // // Allocate space for the file // - ImageFileHandle->Source = CoreAllocateBootServicesPool ((UINTN)FileInfo->FileSize); + ImageFileHandle->Source = AllocatePool ((UINTN)FileInfo->FileSize); if (ImageFileHandle->Source != NULL) { // // Read the file into the buffer we allocated @@ -453,7 +453,7 @@ CoreGrowBuffer ( CoreFreePool (*Buffer); } - *Buffer = CoreAllocateBootServicesPool (BufferSize); + *Buffer = AllocatePool (BufferSize); if (*Buffer != NULL) { TryAgain = TRUE; } else { diff --git a/MdeModulePkg/Core/Dxe/Library.h b/MdeModulePkg/Core/Dxe/Library.h index a3fce51a28..6e6ad3818b 100644 --- a/MdeModulePkg/Core/Dxe/Library.h +++ b/MdeModulePkg/Core/Dxe/Library.h @@ -96,167 +96,6 @@ CoreReleaseLock ( IN EFI_LOCK *Lock ); -// -// Device Path functions -// - - -/** - Calculate the size of a whole device path. - - @param DevicePath The pointer to the device path data. - - @return Size of device path data structure.. - -**/ -UINTN -CoreDevicePathSize ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - - -/** - Return TRUE is this is a multi instance device path. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE If DevicePath is multi instance. FALSE - If - DevicePath is not multi instance. - -**/ -BOOLEAN -CoreIsDevicePathMultiInstance ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - - - -/** - Duplicate a new device path data structure from the old one. - - @param DevicePath A pointer to a device path data structure. - - @return A pointer to the new allocated device path data. - @return Caller must free the memory used by DevicePath if it is no longer needed. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -CoreDuplicateDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ); - - -/** - Function is used to append a Src1 and Src2 together. - - @param Src1 A pointer to a device path data structure. - @param Src2 A pointer to a device path data structure. - - @return A pointer to the new device path is returned. - @return NULL is returned if space for the new device path could not be allocated from pool. - @return It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -CoreAppendDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL *Src1, - IN EFI_DEVICE_PATH_PROTOCOL *Src2 - ); - - -/** - Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize. - - @param AllocationSize Size to allocate. - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateBootServicesPool ( - IN UINTN AllocationSize - ); - - -/** - Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize. - - @param AllocationSize Size to allocate. - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateZeroBootServicesPool ( - IN UINTN AllocationSize - ); - - -/** - Find a config table by name in system table's ConfigurationTable. - - @param Guid The table name to look for - @param Table Pointer of the config table - - @retval EFI_NOT_FOUND Could not find the table in system table's - ConfigurationTable. - @retval EFI_SUCCESS Table successfully found. - -**/ -EFI_STATUS -CoreGetConfigTable ( - IN EFI_GUID *Guid, - OUT VOID **Table - ); - - -/** - Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool. - - @param AllocationSize Size to allocate. - @param Buffer Specified buffer that will be copy to the allocated - pool - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateRuntimeCopyPool ( - IN UINTN AllocationSize, - IN VOID *Buffer - ); - - -/** - Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize. - - @param AllocationSize Size to allocate. - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateRuntimePool ( - IN UINTN AllocationSize - ); - - -/** - Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool. - - @param AllocationSize Size to allocate. - @param Buffer Specified buffer that will be copy to the allocated - pool - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateCopyPool ( - IN UINTN AllocationSize, - IN VOID *Buffer - ); - /** Create a protocol notification event and return it. diff --git a/MdeModulePkg/Core/Dxe/Library/Library.c b/MdeModulePkg/Core/Dxe/Library/Library.c index 18f0a9f589..911fbb70b8 100644 --- a/MdeModulePkg/Core/Dxe/Library/Library.c +++ b/MdeModulePkg/Core/Dxe/Library/Library.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" UINTN mErrorLevel = DEBUG_ERROR | DEBUG_LOAD; @@ -82,128 +82,9 @@ CoreReportProgressCode ( } - -/** - Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize. - - @param AllocationSize Size to allocate. - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateBootServicesPool ( - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - CoreAllocatePool (EfiBootServicesData, AllocationSize, &Memory); - return Memory; -} - - - -/** - Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize. - - @param AllocationSize Size to allocate. - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateZeroBootServicesPool ( - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - Memory = CoreAllocateBootServicesPool (AllocationSize); - ZeroMem (Memory, (Memory == NULL) ? 0 : AllocationSize); - return Memory; -} - - - -/** - Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool. - - @param AllocationSize Size to allocate. - @param Buffer Specified buffer that will be copy to the allocated - pool - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateCopyPool ( - IN UINTN AllocationSize, - IN VOID *Buffer - ) -{ - VOID *Memory; - - Memory = CoreAllocateBootServicesPool (AllocationSize); - CopyMem (Memory, Buffer, (Memory == NULL) ? 0 : AllocationSize); - - return Memory; -} - - - - -/** - Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize. - - @param AllocationSize Size to allocate. - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateRuntimePool ( - IN UINTN AllocationSize - ) -{ - VOID *Memory; - - CoreAllocatePool (EfiRuntimeServicesData, AllocationSize, &Memory); - return Memory; -} - - -/** - Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool. - - @param AllocationSize Size to allocate. - @param Buffer Specified buffer that will be copy to the allocated - pool - - @return Pointer of the allocated pool. - -**/ -VOID * -CoreAllocateRuntimeCopyPool ( - IN UINTN AllocationSize, - IN VOID *Buffer - ) -{ - VOID *Memory; - - Memory = CoreAllocateRuntimePool (AllocationSize); - CopyMem (Memory, Buffer, (Memory == NULL) ? 0 : AllocationSize); - - return Memory; -} - - - // // Lock Stuff // - - /** Initialize a basic mutual exclusion lock. Each lock provides mutual exclusion access at it's task priority @@ -290,159 +171,6 @@ CoreReleaseLock ( } - -/** - Calculate the size of a whole device path. - - @param DevicePath The pointer to the device path data. - - @return Size of device path data structure.. - -**/ -UINTN -CoreDevicePathSize ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_DEVICE_PATH_PROTOCOL *Start; - - if (DevicePath == NULL) { - return 0; - } - - // - // Search for the end of the device path structure - // - Start = DevicePath; - while (!EfiIsDevicePathEnd (DevicePath)) { - DevicePath = EfiNextDevicePathNode (DevicePath); - } - - // - // Compute the size and add back in the size of the end device path structure - // - return ((UINTN) DevicePath - (UINTN) Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL); -} - - - -/** - Return TRUE is this is a multi instance device path. - - @param DevicePath A pointer to a device path data structure. - - @retval TRUE If DevicePath is multi instance. FALSE - If - DevicePath is not multi instance. - -**/ -BOOLEAN -CoreIsDevicePathMultiInstance ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_DEVICE_PATH_PROTOCOL *Node; - - if (DevicePath == NULL) { - return FALSE; - } - - Node = DevicePath; - while (!EfiIsDevicePathEnd (Node)) { - if (EfiIsDevicePathEndInstance (Node)) { - return TRUE; - } - Node = EfiNextDevicePathNode (Node); - } - return FALSE; -} - - - - -/** - Duplicate a new device path data structure from the old one. - - @param DevicePath A pointer to a device path data structure. - - @return A pointer to the new allocated device path data. - @return Caller must free the memory used by DevicePath if it is no longer needed. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -CoreDuplicateDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - UINTN Size; - - if (DevicePath == NULL) { - return NULL; - } - - // - // Compute the size - // - Size = CoreDevicePathSize (DevicePath); - - // - // Allocate space for duplicate device path - // - NewDevicePath = CoreAllocateCopyPool (Size, DevicePath); - - return NewDevicePath; -} - - -/** - Function is used to append a Src1 and Src2 together. - - @param Src1 A pointer to a device path data structure. - @param Src2 A pointer to a device path data structure. - - @return A pointer to the new device path is returned. - @return NULL is returned if space for the new device path could not be allocated from pool. - @return It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -CoreAppendDevicePath ( - IN EFI_DEVICE_PATH_PROTOCOL *Src1, - IN EFI_DEVICE_PATH_PROTOCOL *Src2 - ) -{ - UINTN Size; - UINTN Size1; - UINTN Size2; - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath; - - if (Src1 == NULL && Src2 == NULL) { - return NULL; - } - - // - // Allocate space for the combined device path. It only has one end node of - // length EFI_DEVICE_PATH_PROTOCOL - // - Size1 = CoreDevicePathSize (Src1); - Size2 = CoreDevicePathSize (Src2); - Size = Size1 + Size2 - sizeof(EFI_DEVICE_PATH_PROTOCOL); - - NewDevicePath = CoreAllocateCopyPool (Size, Src1); - if (NewDevicePath != NULL) { - - // - // Over write Src1 EndNode and do the copy - // - SecondDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((CHAR8 *)NewDevicePath + (Size1 - sizeof(EFI_DEVICE_PATH_PROTOCOL))); - CopyMem (SecondDevicePath, Src2, Size2); - } - - return NewDevicePath; -} - - /** Create a protocol notification event and return it. diff --git a/MdeModulePkg/Core/Dxe/Mem/MemData.c b/MdeModulePkg/Core/Dxe/Mem/MemData.c index a523fbc00a..f7c6fbd55b 100644 --- a/MdeModulePkg/Core/Dxe/Mem/MemData.c +++ b/MdeModulePkg/Core/Dxe/Mem/MemData.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 3159fbd3b3..b09f2f1304 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" #define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE) diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index 5ad5edccc2..0691c4aba5 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" #define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0') typedef struct { diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c index 78f5073e3b..50e4468399 100644 --- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c +++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = { @@ -152,7 +152,7 @@ CoreNewDebugImageInfoEntry ( // Table is full, so re-allocate another page for a larger table... // TableSize = MaxTableIndex * EFI_DEBUG_TABLE_ENTRY_SIZE; - NewTable = CoreAllocateZeroBootServicesPool (TableSize + EFI_PAGE_SIZE); + NewTable = AllocateZeroPool (TableSize + EFI_PAGE_SIZE); if (NewTable == NULL) { mDebugInfoTableHeader.UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS; return; @@ -175,7 +175,7 @@ CoreNewDebugImageInfoEntry ( // // Allocate data for new entry // - Table[Index].NormalImage = CoreAllocateZeroBootServicesPool (sizeof (EFI_DEBUG_IMAGE_INFO_NORMAL)); + Table[Index].NormalImage = AllocateZeroPool (sizeof (EFI_DEBUG_IMAGE_INFO_NORMAL)); if (Table[Index].NormalImage != NULL) { // // Update the entry diff --git a/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c b/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c index 4eed6523b3..34dc532752 100644 --- a/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c +++ b/MdeModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c @@ -12,46 +12,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" #define CONFIG_TABLE_SIZE_INCREASED 0x10 UINTN mSystemTableAllocateSize = 0; - - -/** - Find a config table by name in system table's ConfigurationTable. - - @param Guid The table name to look for - @param Table Pointer of the config table - - @retval EFI_NOT_FOUND Could not find the table in system table's - ConfigurationTable. - @retval EFI_SUCCESS Table successfully found. - -**/ -EFI_STATUS -CoreGetConfigTable ( - IN EFI_GUID *Guid, - OUT VOID **Table - ) -{ - UINTN Index; - - for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) { - if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) { - *Table = gDxeCoreST->ConfigurationTable[Index].VendorTable; - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - - - - /** Boot Service called to add, modify, or remove a system configuration table from the EFI System Table. @@ -149,7 +115,7 @@ CoreInstallConfigurationTable ( // Allocate a table with one additional entry. // mSystemTableAllocateSize += (CONFIG_TABLE_SIZE_INCREASED * sizeof (EFI_CONFIGURATION_TABLE)); - EfiConfigurationTable = CoreAllocateRuntimePool (mSystemTableAllocateSize); + EfiConfigurationTable = AllocateRuntimePool (mSystemTableAllocateSize); if (EfiConfigurationTable == NULL) { // // If a new table could not be allocated, then return an error. diff --git a/MdeModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c b/MdeModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c index c7798133b1..6465f2a514 100644 --- a/MdeModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c +++ b/MdeModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" #define WATCHDOG_TIMER_CALIBRATE_PER_SECOND 10000000 diff --git a/MdeModulePkg/Core/Dxe/Misc/Stall.c b/MdeModulePkg/Core/Dxe/Misc/Stall.c index 5608db0148..96d9b339cf 100644 --- a/MdeModulePkg/Core/Dxe/Misc/Stall.c +++ b/MdeModulePkg/Core/Dxe/Misc/Stall.c @@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // Include statements // -#include +#include "DxeMain.h" diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c index 1660b9da07..a7a4509bb1 100644 --- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c +++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c @@ -38,7 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include "DxeMain.h" // // Local defines and typedefs @@ -607,7 +607,7 @@ GetSection ( // // Callee allocated buffer. Allocate buffer and return size. // - *Buffer = CoreAllocateBootServicesPool (CopySize); + *Buffer = AllocatePool (CopySize); if (*Buffer == NULL) { Status = EFI_OUT_OF_RESOURCES; goto GetSection_Done; @@ -918,7 +918,7 @@ CreateChildNode ( // // Allocate a new node // - *ChildNode = CoreAllocateBootServicesPool (sizeof (CORE_SECTION_CHILD_NODE)); + *ChildNode = AllocatePool (sizeof (CORE_SECTION_CHILD_NODE)); Node = *ChildNode; if (Node == NULL) { return EFI_OUT_OF_RESOURCES; @@ -951,7 +951,7 @@ CreateChildNode ( // if (CompressionHeader->UncompressedLength > 0) { NewStreamBufferSize = CompressionHeader->UncompressedLength; - NewStreamBuffer = CoreAllocateBootServicesPool (NewStreamBufferSize); + NewStreamBuffer = AllocatePool (NewStreamBufferSize); if (NewStreamBuffer == NULL) { CoreFreePool (Node); return EFI_OUT_OF_RESOURCES; @@ -984,7 +984,7 @@ CreateChildNode ( ASSERT_EFI_ERROR (Status); ASSERT (NewStreamBufferSize == CompressionHeader->UncompressedLength); - ScratchBuffer = CoreAllocateBootServicesPool (ScratchSize); + ScratchBuffer = AllocatePool (ScratchSize); if (ScratchBuffer == NULL) { CoreFreePool (Node); CoreFreePool (NewStreamBuffer); @@ -1202,7 +1202,7 @@ OpenSectionStreamEx ( // // Allocate a new stream // - NewStream = CoreAllocateBootServicesPool (sizeof (CORE_SECTION_STREAM_NODE)); + NewStream = AllocatePool (sizeof (CORE_SECTION_STREAM_NODE)); if (NewStream == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -1213,7 +1213,7 @@ OpenSectionStreamEx ( // data in // if (SectionStreamLength > 0) { - NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength); + NewStream->StreamBuffer = AllocatePool (SectionStreamLength); if (NewStream->StreamBuffer == NULL) { CoreFreePool (NewStream); return EFI_OUT_OF_RESOURCES; @@ -1473,7 +1473,7 @@ CustomGuidedSectionExtract ( // // Allocate scratch buffer // - ScratchBuffer = CoreAllocateBootServicesPool (ScratchBufferSize); + ScratchBuffer = AllocatePool (ScratchBufferSize); if (ScratchBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } @@ -1483,7 +1483,7 @@ CustomGuidedSectionExtract ( // // Allocate output buffer // - AllocatedOutputBuffer = CoreAllocateBootServicesPool (OutputBufferSize); + AllocatedOutputBuffer = AllocatePool (OutputBufferSize); if (AllocatedOutputBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } -- 2.39.2