2 Data structure and functions to allocate and free memory space.
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #if defined (MDE_CPU_IPF)
20 /// For Itanium machines make the default allocations 8K aligned
22 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
23 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
27 /// For genric EFI machines make the default allocations 4K aligned
29 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
30 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
39 #define MEMORY_MAP_SIGNATURE SIGNATURE_32('m','m','a','p')
54 // Internal prototypes
59 Internal function. Used by the pool functions to allocate pages
60 to back pool allocation requests.
62 @param PoolType The type of memory for the new pool pages
63 @param NumberOfPages No of pages to allocate
64 @param Alignment Bits to align.
66 @return The allocated memory, or NULL
70 CoreAllocatePoolPages (
71 IN EFI_MEMORY_TYPE PoolType
,
72 IN UINTN NumberOfPages
,
79 Internal function. Frees pool pages allocated via AllocatePoolPages ()
81 @param Memory The base address to free
82 @param NumberOfPages The number of pages to free
87 IN EFI_PHYSICAL_ADDRESS Memory
,
88 IN UINTN NumberOfPages
94 Internal function to allocate pool of a particular type.
95 Caller must have the memory lock held
97 @param PoolType Type of pool to allocate
98 @param Size The amount of pool to allocate
100 @return The allocate pool, or NULL
105 IN EFI_MEMORY_TYPE PoolType
,
112 Internal function to free a pool entry.
113 Caller must have the memory lock held
115 @param Buffer The allocated pool entry to free
117 @retval EFI_INVALID_PARAMETER Buffer not valid
118 @retval EFI_SUCCESS Buffer successfully freed.
129 Enter critical section by gaining lock on gMemoryLock.
133 CoreAcquireMemoryLock (
139 Exit critical section by releasing lock on gMemoryLock.
143 CoreReleaseMemoryLock (
149 // Internal Global data
152 extern EFI_LOCK gMemoryLock
;
153 extern LIST_ENTRY gMemoryMap
;
154 extern LIST_ENTRY mGcdMemorySpaceMap
;