3 Data structure and functions to allocate and free memory space.
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #if defined (MDE_CPU_IPF)
21 // For Itanium machines make the default allocations 8K aligned
23 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
24 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
28 // For genric EFI machines make the default allocations 4K aligned
30 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
31 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
40 #define MEMORY_MAP_SIGNATURE EFI_SIGNATURE_32('m','m','a','p')
55 // Internal prototypes
59 CoreAllocatePoolPages (
60 IN EFI_MEMORY_TYPE PoolType
,
61 IN UINTN NumberOfPages
,
68 Internal function. Used by the pool functions to allocate pages
69 to back pool allocation requests.
73 PoolType - The type of memory for the new pool pages
75 NumberOfPages - No of pages to allocate
77 Alignment - Bits to align.
81 The allocated memory, or NULL
89 IN EFI_PHYSICAL_ADDRESS Memory
,
90 IN UINTN NumberOfPages
96 Internal function. Frees pool pages allocated via AllocatePoolPages ()
100 Memory - The base address to free
102 NumberOfPages - The number of pages to free
114 IN EFI_MEMORY_TYPE PoolType
,
121 Internal function to allocate pool of a particular type.
123 Caller must have the memory lock held
128 PoolType - Type of pool to allocate
130 Size - The amount of pool to allocate
134 The allocate pool, or NULL
148 Internal function to free a pool entry.
150 Caller must have the memory lock held
155 Buffer - The allocated pool entry to free
159 EFI_INVALID_PARAMETER - Buffer not valid
161 EFI_SUCCESS - Buffer successfully freed.
168 CoreAcquireMemoryLock (
175 Enter critical section by gaining lock on gMemoryLock
189 CoreReleaseMemoryLock (
196 Exit critical section by releasing lock on gMemoryLock
211 // Internal Global data
214 extern EFI_LOCK gMemoryLock
;
215 extern LIST_ENTRY gMemoryMap
;
216 extern MEMORY_MAP
*gMemoryLastConvert
;
217 extern LIST_ENTRY mGcdMemorySpaceMap
;