23c98c94 |
1 | /** @file\r |
504214c4 |
2 | Internal functions shared in DxeCore module.\r |
28a00297 |
3 | \r |
23c98c94 |
4 | Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r |
5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r |
8 | http://opensource.org/licenses/bsd-license.php\r |
28a00297 |
9 | \r |
23c98c94 |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
162ed594 |
12 | \r |
13 | **/\r |
28a00297 |
14 | \r |
15 | #ifndef _DXE_LIBRARY_H_\r |
16 | #define _DXE_LIBRARY_H_\r |
17 | \r |
18 | \r |
162ed594 |
19 | \r |
20 | /**\r |
21 | Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid.\r |
22 | \r |
022c6d45 |
23 | @param Value Describes the class/subclass/operation of the\r |
24 | hardware or software entity that the Status Code\r |
162ed594 |
25 | relates to.\r |
26 | \r |
27 | **/\r |
28a00297 |
28 | VOID\r |
29 | CoreReportProgressCode (\r |
30 | IN EFI_STATUS_CODE_VALUE Value\r |
23c98c94 |
31 | );\r |
28a00297 |
32 | \r |
28a00297 |
33 | \r |
162ed594 |
34 | /**\r |
35 | Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid,\r |
36 | with a handle as additional information.\r |
28a00297 |
37 | \r |
022c6d45 |
38 | @param Value Describes the class/subclass/operation of the\r |
39 | hardware or software entity that the Status Code\r |
40 | relates to.\r |
162ed594 |
41 | @param Handle Additional information.\r |
28a00297 |
42 | \r |
162ed594 |
43 | **/\r |
28a00297 |
44 | VOID\r |
45 | CoreReportProgressCodeSpecific (\r |
46 | IN EFI_STATUS_CODE_VALUE Value,\r |
47 | IN EFI_HANDLE Handle\r |
23c98c94 |
48 | );\r |
28a00297 |
49 | \r |
28a00297 |
50 | \r |
162ed594 |
51 | /**\r |
52 | Raising to the task priority level of the mutual exclusion\r |
53 | lock, and then acquires ownership of the lock.\r |
28a00297 |
54 | \r |
022c6d45 |
55 | @param Lock The lock to acquire\r |
28a00297 |
56 | \r |
162ed594 |
57 | @return Lock owned\r |
28a00297 |
58 | \r |
162ed594 |
59 | **/\r |
28a00297 |
60 | VOID\r |
61 | CoreAcquireLock (\r |
23c98c94 |
62 | IN EFI_LOCK *Lock\r |
63 | );\r |
28a00297 |
64 | \r |
28a00297 |
65 | \r |
162ed594 |
66 | /**\r |
67 | Initialize a basic mutual exclusion lock. Each lock\r |
68 | provides mutual exclusion access at it's task priority\r |
69 | level. Since there is no-premption (at any TPL) or\r |
70 | multiprocessor support, acquiring the lock only consists\r |
71 | of raising to the locks TPL.\r |
28a00297 |
72 | \r |
022c6d45 |
73 | @param Lock The EFI_LOCK structure to initialize\r |
28a00297 |
74 | \r |
022c6d45 |
75 | @retval EFI_SUCCESS Lock Owned.\r |
162ed594 |
76 | @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r |
28a00297 |
77 | \r |
162ed594 |
78 | **/\r |
28a00297 |
79 | EFI_STATUS\r |
80 | CoreAcquireLockOrFail (\r |
81 | IN EFI_LOCK *Lock\r |
23c98c94 |
82 | );\r |
28a00297 |
83 | \r |
28a00297 |
84 | \r |
162ed594 |
85 | /**\r |
86 | Releases ownership of the mutual exclusion lock, and\r |
87 | restores the previous task priority level.\r |
28a00297 |
88 | \r |
022c6d45 |
89 | @param Lock The lock to release\r |
28a00297 |
90 | \r |
162ed594 |
91 | @return Lock unowned\r |
28a00297 |
92 | \r |
162ed594 |
93 | **/\r |
28a00297 |
94 | VOID\r |
95 | CoreReleaseLock (\r |
23c98c94 |
96 | IN EFI_LOCK *Lock\r |
97 | );\r |
28a00297 |
98 | \r |
99 | //\r |
100 | // Device Path functions\r |
101 | //\r |
102 | \r |
162ed594 |
103 | \r |
104 | /**\r |
105 | Calculate the size of a whole device path.\r |
106 | \r |
022c6d45 |
107 | @param DevicePath The pointer to the device path data.\r |
162ed594 |
108 | \r |
109 | @return Size of device path data structure..\r |
110 | \r |
111 | **/\r |
28a00297 |
112 | UINTN\r |
113 | CoreDevicePathSize (\r |
114 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
23c98c94 |
115 | );\r |
28a00297 |
116 | \r |
28a00297 |
117 | \r |
162ed594 |
118 | /**\r |
119 | Return TRUE is this is a multi instance device path.\r |
28a00297 |
120 | \r |
022c6d45 |
121 | @param DevicePath A pointer to a device path data structure.\r |
28a00297 |
122 | \r |
022c6d45 |
123 | @retval TRUE If DevicePath is multi instance. FALSE - If\r |
162ed594 |
124 | DevicePath is not multi instance.\r |
28a00297 |
125 | \r |
162ed594 |
126 | **/\r |
28a00297 |
127 | BOOLEAN\r |
128 | CoreIsDevicePathMultiInstance (\r |
129 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
23c98c94 |
130 | );\r |
28a00297 |
131 | \r |
28a00297 |
132 | \r |
133 | \r |
162ed594 |
134 | /**\r |
135 | Duplicate a new device path data structure from the old one.\r |
28a00297 |
136 | \r |
022c6d45 |
137 | @param DevicePath A pointer to a device path data structure.\r |
28a00297 |
138 | \r |
162ed594 |
139 | @return A pointer to the new allocated device path data.\r |
140 | @return Caller must free the memory used by DevicePath if it is no longer needed.\r |
28a00297 |
141 | \r |
162ed594 |
142 | **/\r |
28a00297 |
143 | EFI_DEVICE_PATH_PROTOCOL *\r |
144 | CoreDuplicateDevicePath (\r |
145 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
23c98c94 |
146 | );\r |
28a00297 |
147 | \r |
28a00297 |
148 | \r |
162ed594 |
149 | /**\r |
150 | Function is used to append a Src1 and Src2 together.\r |
28a00297 |
151 | \r |
022c6d45 |
152 | @param Src1 A pointer to a device path data structure.\r |
153 | @param Src2 A pointer to a device path data structure.\r |
28a00297 |
154 | \r |
162ed594 |
155 | @return A pointer to the new device path is returned.\r |
156 | @return NULL is returned if space for the new device path could not be allocated from pool.\r |
157 | @return It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.\r |
28a00297 |
158 | \r |
162ed594 |
159 | **/\r |
28a00297 |
160 | EFI_DEVICE_PATH_PROTOCOL *\r |
161 | CoreAppendDevicePath (\r |
162 | IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r |
162ed594 |
163 | IN EFI_DEVICE_PATH_PROTOCOL *Src2\r |
23c98c94 |
164 | );\r |
28a00297 |
165 | \r |
28a00297 |
166 | \r |
162ed594 |
167 | /**\r |
168 | Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.\r |
28a00297 |
169 | \r |
022c6d45 |
170 | @param AllocationSize Size to allocate.\r |
28a00297 |
171 | \r |
162ed594 |
172 | @return Pointer of the allocated pool.\r |
28a00297 |
173 | \r |
162ed594 |
174 | **/\r |
28a00297 |
175 | VOID *\r |
176 | CoreAllocateBootServicesPool (\r |
177 | IN UINTN AllocationSize\r |
23c98c94 |
178 | );\r |
28a00297 |
179 | \r |
28a00297 |
180 | \r |
162ed594 |
181 | /**\r |
182 | Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.\r |
28a00297 |
183 | \r |
022c6d45 |
184 | @param AllocationSize Size to allocate.\r |
28a00297 |
185 | \r |
162ed594 |
186 | @return Pointer of the allocated pool.\r |
28a00297 |
187 | \r |
162ed594 |
188 | **/\r |
28a00297 |
189 | VOID *\r |
190 | CoreAllocateZeroBootServicesPool (\r |
191 | IN UINTN AllocationSize\r |
23c98c94 |
192 | );\r |
28a00297 |
193 | \r |
28a00297 |
194 | \r |
162ed594 |
195 | /**\r |
196 | Find a config table by name in system table's ConfigurationTable.\r |
28a00297 |
197 | \r |
022c6d45 |
198 | @param Guid The table name to look for\r |
199 | @param Table Pointer of the config table\r |
28a00297 |
200 | \r |
022c6d45 |
201 | @retval EFI_NOT_FOUND Could not find the table in system table's\r |
202 | ConfigurationTable.\r |
162ed594 |
203 | @retval EFI_SUCCESS Table successfully found.\r |
28a00297 |
204 | \r |
162ed594 |
205 | **/\r |
28a00297 |
206 | EFI_STATUS\r |
207 | CoreGetConfigTable (\r |
208 | IN EFI_GUID *Guid,\r |
23c98c94 |
209 | OUT VOID **Table\r |
210 | );\r |
28a00297 |
211 | \r |
28a00297 |
212 | \r |
162ed594 |
213 | /**\r |
214 | Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.\r |
28a00297 |
215 | \r |
022c6d45 |
216 | @param AllocationSize Size to allocate.\r |
217 | @param Buffer Specified buffer that will be copy to the allocated\r |
218 | pool\r |
28a00297 |
219 | \r |
162ed594 |
220 | @return Pointer of the allocated pool.\r |
28a00297 |
221 | \r |
162ed594 |
222 | **/\r |
28a00297 |
223 | VOID *\r |
224 | CoreAllocateRuntimeCopyPool (\r |
225 | IN UINTN AllocationSize,\r |
226 | IN VOID *Buffer\r |
23c98c94 |
227 | );\r |
28a00297 |
228 | \r |
28a00297 |
229 | \r |
162ed594 |
230 | /**\r |
231 | Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.\r |
28a00297 |
232 | \r |
022c6d45 |
233 | @param AllocationSize Size to allocate.\r |
28a00297 |
234 | \r |
162ed594 |
235 | @return Pointer of the allocated pool.\r |
28a00297 |
236 | \r |
162ed594 |
237 | **/\r |
28a00297 |
238 | VOID *\r |
239 | CoreAllocateRuntimePool (\r |
240 | IN UINTN AllocationSize\r |
23c98c94 |
241 | );\r |
28a00297 |
242 | \r |
28a00297 |
243 | \r |
162ed594 |
244 | /**\r |
245 | Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.\r |
28a00297 |
246 | \r |
022c6d45 |
247 | @param AllocationSize Size to allocate.\r |
248 | @param Buffer Specified buffer that will be copy to the allocated\r |
249 | pool\r |
28a00297 |
250 | \r |
162ed594 |
251 | @return Pointer of the allocated pool.\r |
28a00297 |
252 | \r |
162ed594 |
253 | **/\r |
28a00297 |
254 | VOID *\r |
255 | CoreAllocateCopyPool (\r |
256 | IN UINTN AllocationSize,\r |
257 | IN VOID *Buffer\r |
23c98c94 |
258 | );\r |
28a00297 |
259 | \r |
28a00297 |
260 | \r |
162ed594 |
261 | /**\r |
262 | Create a protocol notification event and return it.\r |
28a00297 |
263 | \r |
022c6d45 |
264 | @param ProtocolGuid Protocol to register notification event on.\r |
265 | @param NotifyTpl Maximum TPL to signal the NotifyFunction.\r |
266 | @param NotifyFunction EFI notification routine.\r |
267 | @param NotifyContext Context passed into Event when it is created.\r |
268 | @param Registration Registration key returned from\r |
269 | RegisterProtocolNotify().\r |
270 | @param SignalFlag Boolean value to decide whether kick the event after\r |
271 | register or not.\r |
28a00297 |
272 | \r |
162ed594 |
273 | @return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid\r |
274 | is added to the system.\r |
28a00297 |
275 | \r |
162ed594 |
276 | **/\r |
28a00297 |
277 | EFI_EVENT\r |
278 | CoreCreateProtocolNotifyEvent (\r |
279 | IN EFI_GUID *ProtocolGuid,\r |
280 | IN EFI_TPL NotifyTpl,\r |
281 | IN EFI_EVENT_NOTIFY NotifyFunction,\r |
282 | IN VOID *NotifyContext,\r |
283 | OUT VOID **Registration,\r |
284 | IN BOOLEAN SignalFlag\r |
23c98c94 |
285 | );\r |
28a00297 |
286 | \r |
287 | #endif\r |