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:
qhuang8 2008-08-27 14:29:23 +00:00
parent fb53e6cc34
commit 9c4ac31cca
31 changed files with 92 additions and 559 deletions

View File

@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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);
}
//

View File

@ -37,7 +37,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;

View File

@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
//

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
//
// Enumerate the valid types

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
//

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
//
// Internal prototypes

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
/**

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
/**

View File

@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;
}

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
/**

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;
}

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"

View File

@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;

View File

@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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
);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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 {

View File

@ -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.

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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.

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
//

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
#define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
#define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0')
typedef struct {

View File

@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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

View File

@ -12,46 +12,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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.

View File

@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#include "DxeMain.h"
#define WATCHDOG_TIMER_CALIBRATE_PER_SECOND 10000000

View File

@ -16,7 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Include statements
//
#include <DxeMain.h>
#include "DxeMain.h"

View File

@ -38,7 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <DxeMain.h>
#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;
}