From e94a9ff7271367e649ee4f9a86da1f1bea6d112e Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Fri, 18 Jul 2008 09:50:09 +0000 Subject: Code scrub for DxeCore git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5520 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Mem/Page.c | 17 +++++---------- MdeModulePkg/Core/Dxe/Mem/Pool.c | 47 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 36 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Mem') diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 5da740cb7c..2bf457267a 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -46,8 +46,8 @@ UINTN mFreeMapStack = 0; // // This list maintain the free memory map list // -LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList); -BOOLEAN mMemoryTypeInformationInitialized = FALSE; +LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList); +BOOLEAN mMemoryTypeInformationInitialized = FALSE; EFI_MEMORY_TYPE_STAISTICS mMemoryTypeStatistics[EfiMaxMemoryType + 1] = { { 0, EFI_MAX_ADDRESS, 0, 0, EfiMaxMemoryType, TRUE, FALSE }, // EfiReservedMemoryType @@ -110,8 +110,6 @@ PromoteMemoryResource ( byte of a page @param Attribute The attributes of the memory range to add - @return None. The range is added to the memory map - **/ VOID CoreAddRange ( @@ -613,7 +611,7 @@ CoreFreeMemoryMapStack ( **/ VOID RemoveMemoryMapEntry ( - MEMORY_MAP *Entry + IN OUT MEMORY_MAP *Entry ) { RemoveEntryList (&Entry->Link); @@ -1151,9 +1149,6 @@ Done: } - - - /** Frees previous allocated pages. @@ -1235,8 +1230,6 @@ CoreFreePages ( } - - /** This function returns a copy of the current memory map. The map is an array of memory descriptors, each of which describes a contiguous block of memory. @@ -1373,7 +1366,7 @@ CoreGetMemoryMap ( if (mMemoryTypeStatistics[Type].Special && mMemoryTypeStatistics[Type].NumberOfPages > 0 && Entry->Start >= mMemoryTypeStatistics[Type].BaseAddress && - Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress ) { + Entry->End <= mMemoryTypeStatistics[Type].MaximumAddress) { MemoryMap->Type = Type; } } @@ -1467,7 +1460,7 @@ CoreAllocatePoolPages ( CoreConvertPages (Start, NumberOfPages, PoolType); } - return (VOID *)(UINTN)Start; + return (VOID *)(UINTN) Start; } diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c index f0af2b8800..fe1b239dc6 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Pool.c +++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c @@ -68,13 +68,15 @@ typedef struct { LIST_ENTRY Link; } POOL; - -POOL PoolHead[EfiMaxMemoryType]; -LIST_ENTRY PoolHeadList; - // +// Pool header for each memory type. +// +POOL mPoolHead[EfiMaxMemoryType]; + // +// List of pool header to search for the appropriate memory type. // +LIST_ENTRY mPoolHeadList; /** @@ -90,14 +92,14 @@ CoreInitializePool ( UINTN Index; for (Type=0; Type < EfiMaxMemoryType; Type++) { - PoolHead[Type].Signature = 0; - PoolHead[Type].Used = 0; - PoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type; + mPoolHead[Type].Signature = 0; + mPoolHead[Type].Used = 0; + mPoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type; for (Index=0; Index < MAX_POOL_LIST; Index++) { - InitializeListHead (&PoolHead[Type].FreeList[Index]); + InitializeListHead (&mPoolHead[Type].FreeList[Index]); } } - InitializeListHead (&PoolHeadList); + InitializeListHead (&mPoolHeadList); } @@ -119,12 +121,12 @@ LookupPoolHead ( UINTN Index; if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) { - return &PoolHead[MemoryType]; + return &mPoolHead[MemoryType]; } if (MemoryType < 0) { - for (Link = PoolHeadList.ForwardLink; Link != &PoolHeadList; Link = Link->ForwardLink) { + for (Link = mPoolHeadList.ForwardLink; Link != &mPoolHeadList; Link = Link->ForwardLink) { Pool = CR(Link, POOL, Link, POOL_SIGNATURE); if (Pool->MemoryType == MemoryType) { return Pool; @@ -143,7 +145,7 @@ LookupPoolHead ( InitializeListHead (&Pool->FreeList[Index]); } - InsertHeadList (&PoolHeadList, &Pool->Link); + InsertHeadList (&mPoolHeadList, &Pool->Link); return Pool; } @@ -153,7 +155,6 @@ LookupPoolHead ( - /** Allocate pool of a particular type. @@ -331,14 +332,13 @@ Done: Buffer = Head->Data; DEBUG_CLEAR_MEMORY (Buffer, Size - POOL_OVERHEAD); - DEBUG ( - (DEBUG_POOL, - "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", - PoolType, - Buffer, - Size - POOL_OVERHEAD, - Pool->Used) - ); + DEBUG (( + DEBUG_POOL, + "AllocatePoolI: Type %x, Addr %x (len %x) %,d\n", PoolType, + Buffer, + Size - POOL_OVERHEAD, + Pool->Used + )); // // Account the allocation @@ -354,7 +354,6 @@ Done: - /** Frees pool. @@ -372,7 +371,7 @@ CoreFreePool ( { EFI_STATUS Status; - if (NULL == Buffer) { + if (Buffer == NULL) { return EFI_INVALID_PARAMETER; } @@ -486,7 +485,7 @@ CoreFreePoolI ( // NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1)); Free = (POOL_FREE *) &NewPage[0]; - ASSERT(NULL != Free); + ASSERT(Free != NULL); if (Free->Signature == POOL_FREE_SIGNATURE) { -- cgit v1.2.3