Code Scrub for Dxe Core.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5560 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
The file contains the GCD related services in the EFI Boot Services Table.
|
||||
The GCD services are used to manage the memory and I/O regions that
|
||||
The GCD services are used to manage the memory and I/O regions that
|
||||
are accessible to the CPU that is executing the DXE core.
|
||||
|
||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
@@ -26,7 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED | \
|
||||
EFI_RESOURCE_ATTRIBUTE_16_BIT_IO | \
|
||||
EFI_RESOURCE_ATTRIBUTE_32_BIT_IO | \
|
||||
EFI_RESOURCE_ATTRIBUTE_64_BIT_IO )
|
||||
EFI_RESOURCE_ATTRIBUTE_64_BIT_IO )
|
||||
|
||||
#define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
|
||||
EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
|
||||
@@ -49,7 +49,7 @@ LIST_ENTRY mGcdIoSpaceMap = INITIALIZE_LIST_HEAD_VARIABLE (mGcdIoSp
|
||||
|
||||
EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {
|
||||
EFI_GCD_MAP_SIGNATURE,
|
||||
{
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
@@ -81,7 +81,7 @@ EFI_GCD_MAP_ENTRY mGcdIoSpaceMapEntryTemplate = {
|
||||
|
||||
GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = {
|
||||
{ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, EFI_MEMORY_UC, TRUE },
|
||||
{ EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED, EFI_MEMORY_UCE, TRUE },
|
||||
{ EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED, EFI_MEMORY_UCE, TRUE },
|
||||
{ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE, EFI_MEMORY_WC, TRUE },
|
||||
{ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE, EFI_MEMORY_WT, TRUE },
|
||||
{ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE, EFI_MEMORY_WB, TRUE },
|
||||
@@ -156,11 +156,11 @@ CoreReleaseGcdIoLock (
|
||||
/**
|
||||
Aligns a value to the specified boundary.
|
||||
|
||||
@param Value 64 bit value to align
|
||||
@param Alignment Log base 2 of the boundary to align Value to
|
||||
@param RoundUp TRUE if Value is to be rounded up to the nearest
|
||||
aligned boundary. FALSE is Value is to be
|
||||
rounded down to the nearest aligned boundary.
|
||||
@param Value 64 bit value to align
|
||||
@param Alignment Log base 2 of the boundary to align Value to
|
||||
@param RoundUp TRUE if Value is to be rounded up to the nearest
|
||||
aligned boundary. FALSE is Value is to be
|
||||
rounded down to the nearest aligned boundary.
|
||||
|
||||
@return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
|
||||
|
||||
@@ -185,7 +185,7 @@ AlignValue (
|
||||
/**
|
||||
Aligns address to the page boundary.
|
||||
|
||||
@param Value 64 bit address to align
|
||||
@param Value 64 bit address to align
|
||||
|
||||
@return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
|
||||
|
||||
@@ -202,7 +202,7 @@ PageAlignAddress (
|
||||
/**
|
||||
Aligns length to the page boundary.
|
||||
|
||||
@param Value 64 bit length to align
|
||||
@param Value 64 bit length to align
|
||||
|
||||
@return A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
|
||||
|
||||
@@ -222,10 +222,10 @@ PageAlignLength (
|
||||
/**
|
||||
Allocate pool for two entries.
|
||||
|
||||
@param TopEntry An entry of GCD map
|
||||
@param BottomEntry An entry of GCD map
|
||||
@param TopEntry An entry of GCD map
|
||||
@param BottomEntry An entry of GCD map
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
|
||||
@retval EFI_SUCCESS Both entries successfully allocated.
|
||||
|
||||
**/
|
||||
@@ -253,13 +253,13 @@ CoreAllocateGcdMapEntry (
|
||||
/**
|
||||
Internal function. Inserts a new descriptor into a sorted list
|
||||
|
||||
@param Link The linked list to insert the range BaseAddress
|
||||
and Length into
|
||||
@param Entry A pointer to the entry that is inserted
|
||||
@param BaseAddress The base address of the new range
|
||||
@param Length The length of the new range in bytes
|
||||
@param TopEntry Top pad entry to insert if needed.
|
||||
@param BottomEntry Bottom pad entry to insert if needed.
|
||||
@param Link The linked list to insert the range BaseAddress
|
||||
and Length into
|
||||
@param Entry A pointer to the entry that is inserted
|
||||
@param BaseAddress The base address of the new range
|
||||
@param Length The length of the new range in bytes
|
||||
@param TopEntry Top pad entry to insert if needed.
|
||||
@param BottomEntry Bottom pad entry to insert if needed.
|
||||
|
||||
@retval EFI_SUCCESS The new range was inserted into the linked list
|
||||
|
||||
@@ -283,7 +283,7 @@ CoreInsertGcdMapEntry (
|
||||
Entry->BaseAddress = BaseAddress;
|
||||
BottomEntry->EndAddress = BaseAddress - 1;
|
||||
InsertTailList (Link, &BottomEntry->Link);
|
||||
}
|
||||
}
|
||||
|
||||
if ((BaseAddress + Length - 1) < Entry->EndAddress) {
|
||||
CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
|
||||
@@ -299,12 +299,12 @@ CoreInsertGcdMapEntry (
|
||||
/**
|
||||
Merge the Gcd region specified by Link and its adjacent entry.
|
||||
|
||||
@param Link Specify the entry to be merged (with its
|
||||
adjacent entry).
|
||||
@param Forward Direction (forward or backward).
|
||||
@param Map Boundary.
|
||||
@param Link Specify the entry to be merged (with its
|
||||
adjacent entry).
|
||||
@param Forward Direction (forward or backward).
|
||||
@param Map Boundary.
|
||||
|
||||
@retval EFI_SUCCESS Successfully returned.
|
||||
@retval EFI_SUCCESS Successfully returned.
|
||||
@retval EFI_UNSUPPORTED These adjacent regions could not merge.
|
||||
|
||||
**/
|
||||
@@ -372,11 +372,11 @@ CoreMergeGcdMapEntry (
|
||||
/**
|
||||
Merge adjacent entries on total chain.
|
||||
|
||||
@param TopEntry Top entry of GCD map.
|
||||
@param BottomEntry Bottom entry of GCD map.
|
||||
@param StartLink Start link of the list for this loop.
|
||||
@param EndLink End link of the list for this loop.
|
||||
@param Map Boundary.
|
||||
@param TopEntry Top entry of GCD map.
|
||||
@param BottomEntry Bottom entry of GCD map.
|
||||
@param StartLink Start link of the list for this loop.
|
||||
@param EndLink End link of the list for this loop.
|
||||
@param Map Boundary.
|
||||
|
||||
@retval EFI_SUCCESS GCD map successfully cleaned up.
|
||||
|
||||
@@ -413,15 +413,15 @@ CoreCleanupGcdMapEntry (
|
||||
/**
|
||||
Search a segment of memory space in GCD map. The result is a range of GCD entry list.
|
||||
|
||||
@param BaseAddress The start address of the segment.
|
||||
@param Length The length of the segment.
|
||||
@param StartLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param EndLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param Map Points to the start entry to search.
|
||||
@param BaseAddress The start address of the segment.
|
||||
@param Length The length of the segment.
|
||||
@param StartLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param EndLink The first GCD entry involves this segment of
|
||||
memory space.
|
||||
@param Map Points to the start entry to search.
|
||||
|
||||
@retval EFI_SUCCESS Successfully found the entry.
|
||||
@retval EFI_SUCCESS Successfully found the entry.
|
||||
@retval EFI_NOT_FOUND Not found.
|
||||
|
||||
**/
|
||||
@@ -449,7 +449,7 @@ CoreSearchGcdMapEntry (
|
||||
*StartLink = Link;
|
||||
}
|
||||
if (*StartLink != NULL) {
|
||||
if ((BaseAddress + Length - 1) >= Entry->BaseAddress &&
|
||||
if ((BaseAddress + Length - 1) >= Entry->BaseAddress &&
|
||||
(BaseAddress + Length - 1) <= Entry->EndAddress ) {
|
||||
*EndLink = Link;
|
||||
return EFI_SUCCESS;
|
||||
@@ -465,7 +465,7 @@ CoreSearchGcdMapEntry (
|
||||
/**
|
||||
Count the amount of GCD map entries.
|
||||
|
||||
@param Map Points to the start entry to do the count loop.
|
||||
@param Map Points to the start entry to do the count loop.
|
||||
|
||||
@return The count.
|
||||
|
||||
@@ -484,7 +484,7 @@ CoreCountGcdMapEntry (
|
||||
Count++;
|
||||
Link = Link->ForwardLink;
|
||||
}
|
||||
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ CoreCountGcdMapEntry (
|
||||
/**
|
||||
Return the memory attribute specified by Attributes
|
||||
|
||||
@param Attributes A num with some attribute bits on.
|
||||
@param Attributes A num with some attribute bits on.
|
||||
|
||||
@return The enum value of memory attribute.
|
||||
|
||||
@@ -531,23 +531,23 @@ ConverToCpuArchAttributes (
|
||||
/**
|
||||
Do operation on a segment of memory space specified (add, free, remove, change attribute ...).
|
||||
|
||||
@param Operation The type of the operation
|
||||
@param GcdMemoryType Additional information for the operation
|
||||
@param GcdIoType Additional information for the operation
|
||||
@param BaseAddress Start address of the segment
|
||||
@param Length length of the segment
|
||||
@param Capabilities The alterable attributes of a newly added entry
|
||||
@param Attributes The attributes needs to be set
|
||||
@param Operation The type of the operation
|
||||
@param GcdMemoryType Additional information for the operation
|
||||
@param GcdIoType Additional information for the operation
|
||||
@param BaseAddress Start address of the segment
|
||||
@param Length length of the segment
|
||||
@param Capabilities The alterable attributes of a newly added entry
|
||||
@param Attributes The attributes needs to be set
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Length is 0 or address (length) not aligned when
|
||||
setting attribute.
|
||||
@retval EFI_SUCCESS Action successfully done.
|
||||
@retval EFI_UNSUPPORTED Could not find the proper descriptor on this
|
||||
segment or set an upsupported attribute.
|
||||
@retval EFI_ACCESS_DENIED Operate on an space non-exist or is used for an
|
||||
image.
|
||||
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
|
||||
space, and so on.
|
||||
@retval EFI_INVALID_PARAMETER Length is 0 or address (length) not aligned when
|
||||
setting attribute.
|
||||
@retval EFI_SUCCESS Action successfully done.
|
||||
@retval EFI_UNSUPPORTED Could not find the proper descriptor on this
|
||||
segment or set an upsupported attribute.
|
||||
@retval EFI_ACCESS_DENIED Operate on an space non-exist or is used for an
|
||||
image.
|
||||
@retval EFI_NOT_FOUND Free a non-using space or remove a non-exist
|
||||
space, and so on.
|
||||
@retval EFI_OUT_OF_RESOURCES No buffer could be allocated.
|
||||
|
||||
**/
|
||||
@@ -570,7 +570,7 @@ CoreConvertSpace (
|
||||
EFI_GCD_MAP_ENTRY *BottomEntry;
|
||||
LIST_ENTRY *StartLink;
|
||||
LIST_ENTRY *EndLink;
|
||||
|
||||
|
||||
EFI_CPU_ARCH_PROTOCOL *CpuArch;
|
||||
UINT64 CpuArchAttributes;
|
||||
|
||||
@@ -778,15 +778,15 @@ Done:
|
||||
/**
|
||||
Check whether an entry could be used to allocate space.
|
||||
|
||||
@param Operation Allocate memory or IO
|
||||
@param Entry The entry to be tested
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
@param Operation Allocate memory or IO
|
||||
@param Entry The entry to be tested
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
|
||||
@retval EFI_NOT_FOUND The memory type does not match or there's an
|
||||
image handle on the entry.
|
||||
@retval EFI_UNSUPPORTED The operation unsupported.
|
||||
@retval EFI_SUCCESS It's ok for this entry to be used to allocate
|
||||
@retval EFI_NOT_FOUND The memory type does not match or there's an
|
||||
image handle on the entry.
|
||||
@retval EFI_UNSUPPORTED The operation unsupported.
|
||||
@retval EFI_SUCCESS It's ok for this entry to be used to allocate
|
||||
space.
|
||||
|
||||
**/
|
||||
@@ -822,18 +822,18 @@ CoreAllocateSpaceCheckEntry (
|
||||
/**
|
||||
Allocate space on specified address and length.
|
||||
|
||||
@param Operation The type of operation (memory or IO)
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
@param Operation The type of operation (memory or IO)
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor for the desired space exists.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor for the desired space exists.
|
||||
@retval EFI_SUCCESS Space successfully allocated.
|
||||
|
||||
**/
|
||||
@@ -1074,12 +1074,12 @@ Done:
|
||||
/**
|
||||
Add a segment of memory to GCD map.
|
||||
|
||||
@param GcdMemoryType Memory type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param Capabilities alterable attributes of the segment.
|
||||
@param GcdMemoryType Memory type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param Capabilities alterable attributes of the segment.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameters.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameters.
|
||||
@retval EFI_SUCCESS Successfully add a segment of memory space.
|
||||
|
||||
**/
|
||||
@@ -1109,16 +1109,16 @@ CoreInternalAddMemorySpace (
|
||||
Allocates nonexistent memory, reserved memory, system memory, or memorymapped
|
||||
I/O resources from the global coherency domain of the processor.
|
||||
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdMemoryType The desired memory type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_SUCCESS Memory space successfully allocated.
|
||||
|
||||
**/
|
||||
@@ -1134,14 +1134,14 @@ CoreAllocateMemorySpace (
|
||||
)
|
||||
{
|
||||
return CoreAllocateSpace (
|
||||
GCD_ALLOCATE_MEMORY_OPERATION,
|
||||
GcdAllocateType,
|
||||
GcdMemoryType,
|
||||
(EFI_GCD_IO_TYPE) 0,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
GCD_ALLOCATE_MEMORY_OPERATION,
|
||||
GcdAllocateType,
|
||||
GcdMemoryType,
|
||||
(EFI_GCD_IO_TYPE) 0,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
DeviceHandle
|
||||
);
|
||||
}
|
||||
@@ -1151,10 +1151,10 @@ CoreAllocateMemorySpace (
|
||||
Adds reserved memory, system memory, or memory-mapped I/O resources to the
|
||||
global coherency domain of the processor.
|
||||
|
||||
@param GcdMemoryType Memory type of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param Capabilities alterable attributes of the memory space.
|
||||
@param GcdMemoryType Memory type of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param Capabilities alterable attributes of the memory space.
|
||||
|
||||
@retval EFI_SUCCESS Merged this memory space into GCD map.
|
||||
|
||||
@@ -1181,7 +1181,7 @@ CoreAddMemorySpace (
|
||||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
GcdMemoryType,
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SHIFT,
|
||||
PageLength,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
@@ -1200,7 +1200,7 @@ CoreAddMemorySpace (
|
||||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
GcdMemoryType,
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SHIFT,
|
||||
EFI_PAGE_SIZE,
|
||||
&PageBaseAddress,
|
||||
gDxeCoreImageHandle,
|
||||
@@ -1226,8 +1226,8 @@ CoreAddMemorySpace (
|
||||
Frees nonexistent memory, reserved memory, system memory, or memory-mapped
|
||||
I/O resources from the global coherency domain of the processor.
|
||||
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
|
||||
@retval EFI_SUCCESS Space successfully freed.
|
||||
|
||||
@@ -1246,8 +1246,8 @@ CoreFreeMemorySpace (
|
||||
Removes reserved memory, system memory, or memory-mapped I/O resources from
|
||||
the global coherency domain of the processor.
|
||||
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
@param BaseAddress Base address of the memory space.
|
||||
@param Length Length of the memory space.
|
||||
|
||||
@retval EFI_SUCCESS Successfully remove a segment of memory space.
|
||||
|
||||
@@ -1265,7 +1265,7 @@ CoreRemoveMemorySpace (
|
||||
/**
|
||||
Build a memory descriptor according to an entry.
|
||||
|
||||
@param Descriptor The descriptor to be built
|
||||
@param Descriptor The descriptor to be built
|
||||
@param Entry According to this entry
|
||||
|
||||
**/
|
||||
@@ -1288,10 +1288,10 @@ BuildMemoryDescriptor (
|
||||
/**
|
||||
Retrieves the descriptor for a memory region containing a specified address.
|
||||
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_SUCCESS Successfully get memory space descriptor.
|
||||
|
||||
**/
|
||||
@@ -1316,7 +1316,7 @@ CoreGetMemorySpaceDescriptor (
|
||||
CoreAcquireGcdMemoryLock ();
|
||||
|
||||
//
|
||||
// Search for the list of descriptors that contain BaseAddress
|
||||
// Search for the list of descriptors that contain BaseAddress
|
||||
//
|
||||
Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdMemorySpaceMap);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -1339,11 +1339,11 @@ CoreGetMemorySpaceDescriptor (
|
||||
Modifies the attributes for a memory region in the global coherency domain of the
|
||||
processor.
|
||||
|
||||
@param BaseAddress Specified start address
|
||||
@param Length Specified length
|
||||
@param Attributes Specified attributes
|
||||
@param BaseAddress Specified start address
|
||||
@param Length Specified length
|
||||
@param Attributes Specified attributes
|
||||
|
||||
@retval EFI_SUCCESS Successfully set attribute of a segment of
|
||||
@retval EFI_SUCCESS Successfully set attribute of a segment of
|
||||
memory space.
|
||||
|
||||
**/
|
||||
@@ -1362,11 +1362,11 @@ CoreSetMemorySpaceAttributes (
|
||||
Returns a map of the memory resources in the global coherency domain of the
|
||||
processor.
|
||||
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param MemorySpaceMap Descriptor array
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param MemorySpaceMap Descriptor array
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_SUCCESS Successfully get memory space map.
|
||||
|
||||
**/
|
||||
@@ -1429,11 +1429,11 @@ Done:
|
||||
/**
|
||||
Adds reserved I/O or I/O resources to the global coherency domain of the processor.
|
||||
|
||||
@param GcdIoType IO type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param GcdIoType IO type of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
|
||||
@retval EFI_SUCCESS Merged this segment into GCD map.
|
||||
@retval EFI_SUCCESS Merged this segment into GCD map.
|
||||
@retval EFI_INVALID_PARAMETER Parameter not valid
|
||||
|
||||
**/
|
||||
@@ -1458,16 +1458,16 @@ CoreAddIoSpace (
|
||||
Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
|
||||
domain of the processor.
|
||||
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
@param GcdAllocateType The type of allocate operation
|
||||
@param GcdIoType The desired IO type
|
||||
@param Alignment Align with 2^Alignment
|
||||
@param Length Length to allocate
|
||||
@param BaseAddress Base address to allocate
|
||||
@param ImageHandle The image handle consume the allocated space.
|
||||
@param DeviceHandle The device handle consume the allocated space.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
@retval EFI_NOT_FOUND No descriptor contains the desired space.
|
||||
@retval EFI_SUCCESS IO space successfully allocated.
|
||||
|
||||
**/
|
||||
@@ -1483,14 +1483,14 @@ CoreAllocateIoSpace (
|
||||
)
|
||||
{
|
||||
return CoreAllocateSpace (
|
||||
GCD_ALLOCATE_IO_OPERATION,
|
||||
GcdAllocateType,
|
||||
(EFI_GCD_MEMORY_TYPE) 0,
|
||||
GcdIoType,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
GCD_ALLOCATE_IO_OPERATION,
|
||||
GcdAllocateType,
|
||||
(EFI_GCD_MEMORY_TYPE) 0,
|
||||
GcdIoType,
|
||||
Alignment,
|
||||
Length,
|
||||
BaseAddress,
|
||||
ImageHandle,
|
||||
DeviceHandle
|
||||
);
|
||||
}
|
||||
@@ -1500,8 +1500,8 @@ CoreAllocateIoSpace (
|
||||
Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
|
||||
domain of the processor.
|
||||
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
|
||||
@retval EFI_SUCCESS Space successfully freed.
|
||||
|
||||
@@ -1520,8 +1520,8 @@ CoreFreeIoSpace (
|
||||
Removes reserved I/O or I/O resources from the global coherency domain of the
|
||||
processor.
|
||||
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
@param BaseAddress Base address of the segment.
|
||||
@param Length Length of the segment.
|
||||
|
||||
@retval EFI_SUCCESS Successfully removed a segment of IO space.
|
||||
|
||||
@@ -1539,7 +1539,7 @@ CoreRemoveIoSpace (
|
||||
/**
|
||||
Build a IO descriptor according to an entry.
|
||||
|
||||
@param Descriptor The descriptor to be built
|
||||
@param Descriptor The descriptor to be built
|
||||
@param Entry According to this entry
|
||||
|
||||
**/
|
||||
@@ -1560,10 +1560,10 @@ BuildIoDescriptor (
|
||||
/**
|
||||
Retrieves the descriptor for an I/O region containing a specified address.
|
||||
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
@param BaseAddress Specified start address
|
||||
@param Descriptor Specified length
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Descriptor is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Descriptor is NULL.
|
||||
@retval EFI_SUCCESS Successfully get the IO space descriptor.
|
||||
|
||||
**/
|
||||
@@ -1588,7 +1588,7 @@ CoreGetIoSpaceDescriptor (
|
||||
CoreAcquireGcdIoLock ();
|
||||
|
||||
//
|
||||
// Search for the list of descriptors that contain BaseAddress
|
||||
// Search for the list of descriptors that contain BaseAddress
|
||||
//
|
||||
Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdIoSpaceMap);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -1610,11 +1610,11 @@ CoreGetIoSpaceDescriptor (
|
||||
/**
|
||||
Returns a map of the I/O resources in the global coherency domain of the processor.
|
||||
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param IoSpaceMap Descriptor array
|
||||
@param NumberOfDescriptors Number of descriptors.
|
||||
@param IoSpaceMap Descriptor array
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter
|
||||
@retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
|
||||
@retval EFI_SUCCESS Successfully get IO space map.
|
||||
|
||||
**/
|
||||
@@ -1671,16 +1671,16 @@ CoreGetIoSpaceMap (
|
||||
Done:
|
||||
CoreReleaseGcdIoLock ();
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts a Resource Descriptor HOB attributes mask to an EFI Memory Descriptor
|
||||
capabilities mask
|
||||
|
||||
@param GcdMemoryType Type of resource in the GCD memory map.
|
||||
@param Attributes The attribute mask in the Resource Descriptor
|
||||
HOB.
|
||||
@param GcdMemoryType Type of resource in the GCD memory map.
|
||||
@param Attributes The attribute mask in the Resource Descriptor
|
||||
HOB.
|
||||
|
||||
@return The capabilities mask for an EFI Memory Descriptor.
|
||||
|
||||
@@ -1693,7 +1693,7 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
|
||||
{
|
||||
UINT64 Capabilities;
|
||||
GCD_ATTRIBUTE_CONVERSION_ENTRY *Conversion;
|
||||
|
||||
|
||||
//
|
||||
// Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
|
||||
//
|
||||
@@ -1704,7 +1704,7 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Capabilities;
|
||||
}
|
||||
|
||||
@@ -1717,10 +1717,10 @@ CoreConvertResourceDescriptorHobAttributesToCapabilities (
|
||||
memory descriptor is provided to the memory services. Then the memory services
|
||||
can be used to intialize the GCD map.
|
||||
|
||||
@param HobStart The start address of the HOB.
|
||||
@param MemoryBaseAddress Start address of memory region found to init DXE
|
||||
core.
|
||||
@param MemoryLength Length of memory region found to init DXE core.
|
||||
@param HobStart The start address of the HOB.
|
||||
@param MemoryBaseAddress Start address of memory region found to init DXE
|
||||
core.
|
||||
@param MemoryLength Length of memory region found to init DXE core.
|
||||
|
||||
@retval EFI_SUCCESS Memory services successfully initialized.
|
||||
|
||||
@@ -1807,7 +1807,7 @@ CoreInitializeMemoryServices (
|
||||
if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
|
||||
(ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES ) {
|
||||
|
||||
if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart &&
|
||||
if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart &&
|
||||
PhitHob->EfiFreeMemoryTop <= (ResourceHob->PhysicalStart + ResourceHob->ResourceLength) ) {
|
||||
|
||||
//
|
||||
@@ -1931,10 +1931,10 @@ CoreInitializeMemoryServices (
|
||||
can be used to intialize the GCD map. The HobStart will be relocated to a pool
|
||||
buffer.
|
||||
|
||||
@param HobStart The start address of the HOB
|
||||
@param MemoryBaseAddress Start address of memory region found to init DXE
|
||||
core.
|
||||
@param MemoryLength Length of memory region found to init DXE core.
|
||||
@param HobStart The start address of the HOB
|
||||
@param MemoryBaseAddress Start address of memory region found to init DXE
|
||||
core.
|
||||
@param MemoryLength Length of memory region found to init DXE core.
|
||||
|
||||
@retval EFI_SUCCESS GCD services successfully initialized.
|
||||
|
||||
@@ -1979,7 +1979,7 @@ CoreInitializeGcdServices (
|
||||
ASSERT (CpuHob != NULL);
|
||||
SizeOfMemorySpace = CpuHob->SizeOfMemorySpace;
|
||||
SizeOfIoSpace = CpuHob->SizeOfIoSpace;
|
||||
|
||||
|
||||
//
|
||||
// Initialize the GCD Memory Space Map
|
||||
//
|
||||
@@ -2001,7 +2001,7 @@ CoreInitializeGcdServices (
|
||||
InsertHeadList (&mGcdIoSpaceMap, &Entry->Link);
|
||||
|
||||
//
|
||||
// Walk the HOB list and add all resource descriptors to the GCD
|
||||
// Walk the HOB list and add all resource descriptors to the GCD
|
||||
//
|
||||
for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
|
||||
|
||||
@@ -2092,7 +2092,7 @@ CoreInitializeGcdServices (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
Descriptor.GcdMemoryType,
|
||||
Descriptor.GcdMemoryType,
|
||||
0,
|
||||
MemoryHob->AllocDescriptor.MemoryLength,
|
||||
&BaseAddress,
|
||||
@@ -2115,7 +2115,7 @@ CoreInitializeGcdServices (
|
||||
BaseAddress = FirmwareVolumeHob->BaseAddress;
|
||||
Status = CoreAllocateMemorySpace (
|
||||
EfiGcdAllocateAddress,
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
EfiGcdMemoryTypeMemoryMappedIo,
|
||||
0,
|
||||
FirmwareVolumeHob->Length,
|
||||
&BaseAddress,
|
||||
@@ -2129,7 +2129,7 @@ CoreInitializeGcdServices (
|
||||
// Relocate HOB List to an allocated pool buffer.
|
||||
//
|
||||
NewHobList = CoreAllocateCopyPool (
|
||||
(UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart),
|
||||
(UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart),
|
||||
*HobStart
|
||||
);
|
||||
ASSERT (NewHobList != NULL);
|
||||
|
Reference in New Issue
Block a user