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 <DxeMain.h> 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
This commit is contained in:
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <DxeMain.h>
|
||||
#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;
|
||||
|
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <DxeMain.h>
|
||||
#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;
|
||||
|
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <DxeMain.h>
|
||||
#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;
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include <DxeMain.h>
|
||||
#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;
|
||||
|
Reference in New Issue
Block a user