]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/imem.h
Add doxygen style comments for functions in DxeMain.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / imem.h
1 /** @file
2
3 Data structure and functions to allocate and free memory space.
4
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
10
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.
13
14
15 **/
16
17 #ifndef _IMEM_H_
18 #define _IMEM_H_
19
20 #if defined (MDE_CPU_IPF)
21 //
22 // For Itanium machines make the default allocations 8K aligned
23 //
24 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
25 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
26
27 #else
28 //
29 // For genric EFI machines make the default allocations 4K aligned
30 //
31 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
32 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
33
34 #endif
35
36
37 //
38 // MEMORY_MAP_ENTRY
39 //
40
41 #define MEMORY_MAP_SIGNATURE EFI_SIGNATURE_32('m','m','a','p')
42 typedef struct {
43 UINTN Signature;
44 LIST_ENTRY Link;
45 BOOLEAN FromPages;
46
47 EFI_MEMORY_TYPE Type;
48 UINT64 Start;
49 UINT64 End;
50
51 UINT64 VirtualStart;
52 UINT64 Attribute;
53 } MEMORY_MAP;
54
55 //
56 // Internal prototypes
57 //
58
59
60 /**
61 Internal function. Used by the pool functions to allocate pages
62 to back pool allocation requests.
63
64 @param PoolType The type of memory for the new pool pages
65 @param NumberOfPages No of pages to allocate
66 @param Alignment Bits to align.
67
68 @return The allocated memory, or NULL
69
70 **/
71 VOID *
72 CoreAllocatePoolPages (
73 IN EFI_MEMORY_TYPE PoolType,
74 IN UINTN NumberOfPages,
75 IN UINTN Alignment
76 )
77 ;
78
79
80
81 /**
82 Internal function. Frees pool pages allocated via AllocatePoolPages ()
83
84 @param Memory The base address to free
85 @param NumberOfPages The number of pages to free
86
87 **/
88 VOID
89 CoreFreePoolPages (
90 IN EFI_PHYSICAL_ADDRESS Memory,
91 IN UINTN NumberOfPages
92 )
93 ;
94
95
96
97 /**
98 Internal function to allocate pool of a particular type.
99 Caller must have the memory lock held
100
101 @param PoolType Type of pool to allocate
102 @param Size The amount of pool to allocate
103
104 @return The allocate pool, or NULL
105
106 **/
107 VOID *
108 CoreAllocatePoolI (
109 IN EFI_MEMORY_TYPE PoolType,
110 IN UINTN Size
111 )
112 ;
113
114
115
116 /**
117 Internal function to free a pool entry.
118 Caller must have the memory lock held
119
120 @param Buffer The allocated pool entry to free
121
122 @retval EFI_INVALID_PARAMETER Buffer not valid
123 @retval EFI_SUCCESS Buffer successfully freed.
124
125 **/
126 EFI_STATUS
127 CoreFreePoolI (
128 IN VOID *Buffer
129 )
130 ;
131
132
133
134 /**
135 Enter critical section by gaining lock on gMemoryLock.
136
137 **/
138 VOID
139 CoreAcquireMemoryLock (
140 VOID
141 )
142 ;
143
144
145 /**
146 Exit critical section by releasing lock on gMemoryLock.
147
148 **/
149 VOID
150 CoreReleaseMemoryLock (
151 VOID
152 )
153 ;
154
155
156 //
157 // Internal Global data
158 //
159
160 extern EFI_LOCK gMemoryLock;
161 extern LIST_ENTRY gMemoryMap;
162 extern MEMORY_MAP *gMemoryLastConvert;
163 extern LIST_ENTRY mGcdMemorySpaceMap;
164 #endif