From 9c4ac31cca01b4a503c36616770ea3157bf3bb9e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Wed, 27 Aug 2008 14:29:23 +0000 Subject: 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/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 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Hand') 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; -- cgit v1.2.3