/** @file\r
-\r
UEFI Memory page management functions.\r
\r
-Copyright (c) 2007 - 2008, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
//\r
// This list maintain the free memory map list\r
//\r
-LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);\r
-BOOLEAN mMemoryTypeInformationInitialized = FALSE;\r
+LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);\r
+BOOLEAN mMemoryTypeInformationInitialized = FALSE;\r
\r
EFI_MEMORY_TYPE_STAISTICS mMemoryTypeStatistics[EfiMaxMemoryType + 1] = {\r
{ 0, EFI_MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiReservedMemoryType\r
Find untested but initialized memory regions in GCD map and convert them to be DXE allocatable.\r
\r
**/\r
-STATIC\r
-VOID \r
+VOID\r
PromoteMemoryResource (\r
VOID\r
);\r
byte of a page \r
@param Attribute The attributes of the memory range to add \r
\r
- @return None. The range is added to the memory map\r
-\r
**/\r
-STATIC\r
VOID\r
CoreAddRange (\r
IN EFI_MEMORY_TYPE Type,\r
temporary descriptor stack to heap.\r
\r
**/\r
-STATIC\r
VOID\r
CoreFreeMemoryMapStack (\r
VOID\r
specified type.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
CoreConvertPages (\r
IN UINT64 Start,\r
@param Entry The entry to remove\r
\r
**/\r
-STATIC\r
VOID\r
RemoveMemoryMapEntry (\r
MEMORY_MAP *Entry\r
@return The Memory map descriptor dequed from the mFreeMemoryMapEntryList\r
\r
**/\r
-STATIC\r
MEMORY_MAP *\r
AllocateMemoryMapEntry (\r
VOID\r
Find untested but initialized memory regions in GCD map and convert them to be DXE allocatable.\r
\r
**/\r
-STATIC\r
VOID\r
PromoteMemoryResource (\r
VOID\r
@return None. The range is added to the memory map\r
\r
**/\r
-STATIC\r
VOID\r
CoreAddRange (\r
IN EFI_MEMORY_TYPE Type,\r
temporary descriptor stack to heap.\r
\r
**/\r
-STATIC\r
VOID\r
CoreFreeMemoryMapStack (\r
VOID\r
//\r
// If already freeing the map stack, then return\r
//\r
- if (mFreeMapStack) {\r
+ if (mFreeMapStack != 0) {\r
return ;\r
}\r
\r
//\r
mFreeMapStack += 1;\r
\r
- while (mMapDepth) {\r
+ while (mMapDepth != 0) {\r
//\r
// Deque an memory map entry from mFreeMemoryMapEntryList \r
//\r
@param Entry The entry to remove\r
\r
**/\r
-STATIC\r
VOID\r
RemoveMemoryMapEntry (\r
- MEMORY_MAP *Entry\r
+ IN OUT MEMORY_MAP *Entry\r
)\r
{\r
RemoveEntryList (&Entry->Link);\r
@return The Memory map descriptor dequed from the mFreeMemoryMapEntryList\r
\r
**/\r
-STATIC\r
MEMORY_MAP *\r
AllocateMemoryMapEntry (\r
VOID\r
specified type.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
CoreConvertPages (\r
IN UINT64 Start,\r
ASSERT (End > Start) ;\r
ASSERT_LOCKED (&gMemoryLock);\r
\r
- if (NumberOfPages == 0 || (Start & EFI_PAGE_MASK ) || (Start > (Start + NumberOfBytes))) {\r
+ if (NumberOfPages == 0 || ((Start & EFI_PAGE_MASK) != 0) || (Start > (Start + NumberOfBytes))) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
@return The base address of the range, or 0 if the range was not found\r
\r
**/\r
-STATIC\r
UINT64\r
CoreFindFreePagesI (\r
IN UINT64 MaxAddress,\r
@return The base address of the range, or 0 if the range was not found.\r
\r
**/\r
-STATIC\r
UINT64\r
FindFreePages (\r
IN UINT64 MaxAddress,\r
}\r
\r
Start = CoreFindFreePagesI (NewMaxAddress, NoPages, NewType, Alignment);\r
- if (!Start) {\r
+ if (Start == 0) {\r
Start = CoreFindFreePagesI (MaxAddress, NoPages, NewType, Alignment);\r
- if (!Start) {\r
+ if (Start == 0) {\r
//\r
// Here means there may be no enough memory to use, so try to go through\r
// all the memory descript to promote the untested memory directly\r
}\r
\r
\r
-\r
-\r
-\r
/**\r
Frees previous allocated pages.\r
\r
}\r
\r
\r
-\r
-\r
/**\r
This function returns a copy of the current memory map. The map is an array of\r
memory descriptors, each of which describes a contiguous block of memory.\r
if (mMemoryTypeStatistics[Type].Special &&\r
mMemoryTypeStatistics[Type].NumberOfPages > 0 &&\r
Entry->Start >= mMemoryTypeStatistics[Type].BaseAddress &&\r
- Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress ) {\r
+ Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress) {\r
MemoryMap->Type = Type;\r
}\r
}\r
CoreConvertPages (Start, NumberOfPages, PoolType);\r
}\r
\r
- return (VOID *)(UINTN)Start;\r
+ return (VOID *)(UINTN) Start;\r
}\r
\r
\r