/** @file\r
UEFI Memory pool management functions.\r
\r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
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
#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')\r
typedef struct {\r
UINT32 Signature;\r
- UINT32 Size;\r
+ UINT32 Reserved;\r
EFI_MEMORY_TYPE Type;\r
- UINTN Reserved;\r
+ UINTN Size;\r
CHAR8 Data[1];\r
} POOL_HEAD;\r
\r
#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')\r
typedef struct {\r
UINT32 Signature;\r
- UINT32 Size;\r
+ UINT32 Reserved;\r
+ UINTN Size;\r
} POOL_TAIL;\r
\r
\r
mPoolHead[Type].Used = 0;\r
mPoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type;\r
for (Index=0; Index < MAX_POOL_LIST; Index++) {\r
- InitializeListHead (&mPoolHead[Type].FreeList[Index]);\r
+ InitializeListHead (&mPoolHead[Type].FreeList[Index]);\r
}\r
}\r
}\r
POOL *Pool;\r
UINTN Index;\r
\r
- if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) {\r
+ if ((UINT32)MemoryType < EfiMaxMemoryType) {\r
return &mPoolHead[MemoryType];\r
}\r
\r
//\r
if (Index >= MAX_POOL_LIST) {\r
NoPages = EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1;\r
- NoPages &= ~(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
+ NoPages &= ~(UINTN)(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
Head = CoreAllocatePoolPages (PoolType, NoPages, DEFAULT_PAGE_ALLOCATION);\r
goto Done;\r
}\r
// If we have a pool buffer, fill in the header & tail info\r
//\r
Head->Signature = POOL_HEAD_SIGNATURE;\r
- Head->Size = (UINT32) Size;\r
+ Head->Size = Size;\r
Head->Type = (EFI_MEMORY_TYPE) PoolType;\r
Tail = HEAD_TO_TAIL (Head);\r
Tail->Signature = POOL_TAIL_SIGNATURE;\r
- Tail->Size = (UINT32) Size;\r
+ Tail->Size = Size;\r
Buffer = Head->Data;\r
DEBUG_CLEAR_MEMORY (Buffer, Size - POOL_OVERHEAD);\r
\r
// Return the memory pages back to free memory\r
//\r
NoPages = EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1;\r
- NoPages &= ~(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
+ NoPages &= ~(UINTN)(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);\r
CoreFreePoolPages ((EFI_PHYSICAL_ADDRESS) (UINTN) Head, NoPages);\r
\r
} else {\r
// portion of that memory type has been freed. If it has, then free the\r
// list entry for that memory type\r
//\r
- if (Pool->MemoryType < 0 && Pool->Used == 0) {\r
+ if ((INT32)Pool->MemoryType < 0 && Pool->Used == 0) {\r
RemoveEntryList (&Pool->Link);\r
CoreFreePoolI (Pool);\r
}\r