28a00297 |
1 | /*++\r |
2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r |
4 | All rights reserved. This program and the accompanying materials \r |
5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r |
7 | http://opensource.org/licenses/bsd-license.php \r |
8 | \r |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r |
11 | \r |
12 | Module Name:\r |
13 | \r |
14 | Library.h\r |
15 | \r |
16 | Abstract:\r |
17 | \r |
18 | Revision History\r |
19 | \r |
20 | --*/\r |
21 | \r |
22 | #ifndef _DXE_LIBRARY_H_\r |
23 | #define _DXE_LIBRARY_H_\r |
24 | \r |
25 | \r |
26 | VOID\r |
27 | CoreReportProgressCode (\r |
28 | IN EFI_STATUS_CODE_VALUE Value\r |
29 | )\r |
30 | /*++\r |
31 | \r |
32 | Routine Description:\r |
33 | \r |
34 | Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid.\r |
35 | \r |
36 | Arguments:\r |
37 | \r |
38 | Value - Describes the class/subclass/operation of the hardware or software entity \r |
39 | that the Status Code relates to. \r |
40 | \r |
41 | Returns:\r |
42 | \r |
43 | None\r |
44 | \r |
45 | --*/\r |
46 | ;\r |
47 | \r |
48 | VOID\r |
49 | CoreReportProgressCodeSpecific (\r |
50 | IN EFI_STATUS_CODE_VALUE Value,\r |
51 | IN EFI_HANDLE Handle\r |
52 | )\r |
53 | /*++\r |
54 | \r |
55 | Routine Description:\r |
56 | \r |
57 | Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid, \r |
58 | with a handle as additional information.\r |
59 | \r |
60 | Arguments:\r |
61 | \r |
62 | Value - Describes the class/subclass/operation of the hardware or software entity \r |
63 | that the Status Code relates to. \r |
64 | \r |
65 | Handle - Additional information.\r |
66 | \r |
67 | Returns:\r |
68 | \r |
69 | None\r |
70 | \r |
71 | --*/\r |
72 | ;\r |
73 | \r |
74 | VOID\r |
75 | CoreAcquireLock (\r |
76 | IN EFI_LOCK *Lock\r |
77 | )\r |
78 | /*++\r |
79 | \r |
80 | Routine Description:\r |
81 | \r |
82 | Raising to the task priority level of the mutual exclusion\r |
83 | lock, and then acquires ownership of the lock.\r |
84 | \r |
85 | Arguments:\r |
86 | \r |
87 | Lock - The lock to acquire\r |
88 | \r |
89 | Returns:\r |
90 | \r |
91 | Lock owned\r |
92 | \r |
93 | --*/\r |
94 | ;\r |
95 | \r |
96 | EFI_STATUS\r |
97 | CoreAcquireLockOrFail (\r |
98 | IN EFI_LOCK *Lock\r |
99 | )\r |
100 | /*++\r |
101 | \r |
102 | Routine Description:\r |
103 | \r |
104 | Initialize a basic mutual exclusion lock. Each lock\r |
105 | provides mutual exclusion access at it's task priority\r |
106 | level. Since there is no-premption (at any TPL) or\r |
107 | multiprocessor support, acquiring the lock only consists\r |
108 | of raising to the locks TPL.\r |
109 | \r |
110 | Arguments:\r |
111 | \r |
112 | Lock - The EFI_LOCK structure to initialize\r |
113 | \r |
114 | Returns:\r |
115 | \r |
116 | EFI_SUCCESS - Lock Owned.\r |
117 | EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.\r |
118 | \r |
119 | --*/\r |
120 | ;\r |
121 | \r |
122 | VOID\r |
123 | CoreReleaseLock (\r |
124 | IN EFI_LOCK *Lock\r |
125 | )\r |
126 | /*++\r |
127 | \r |
128 | Routine Description:\r |
129 | \r |
130 | Releases ownership of the mutual exclusion lock, and\r |
131 | restores the previous task priority level.\r |
132 | \r |
133 | Arguments:\r |
134 | \r |
135 | Lock - The lock to release\r |
136 | \r |
137 | Returns:\r |
138 | \r |
139 | Lock unowned\r |
140 | \r |
141 | --*/\r |
142 | ;\r |
143 | \r |
144 | //\r |
145 | // Device Path functions\r |
146 | //\r |
147 | \r |
148 | UINTN\r |
149 | CoreDevicePathSize (\r |
150 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
151 | )\r |
152 | /*++\r |
153 | \r |
154 | Routine Description:\r |
155 | \r |
156 | Calculate the size of a whole device path. \r |
157 | \r |
158 | Arguments:\r |
159 | \r |
160 | DevicePath - The pointer to the device path data.\r |
161 | \r |
162 | Returns:\r |
163 | \r |
164 | Size of device path data structure..\r |
165 | \r |
166 | --*/\r |
167 | ;\r |
168 | \r |
169 | BOOLEAN\r |
170 | CoreIsDevicePathMultiInstance (\r |
171 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
172 | )\r |
173 | /*++\r |
174 | \r |
175 | Routine Description:\r |
176 | Return TRUE is this is a multi instance device path.\r |
177 | \r |
178 | Arguments:\r |
179 | DevicePath - A pointer to a device path data structure.\r |
180 | \r |
181 | \r |
182 | Returns:\r |
183 | TRUE - If DevicePath is multi instance. FALSE - If DevicePath is not multi\r |
184 | instance.\r |
185 | \r |
186 | --*/\r |
187 | ;\r |
188 | \r |
189 | \r |
190 | EFI_DEVICE_PATH_PROTOCOL *\r |
191 | CoreDuplicateDevicePath (\r |
192 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
193 | )\r |
194 | /*++\r |
195 | \r |
196 | Routine Description:\r |
197 | Duplicate a new device path data structure from the old one.\r |
198 | \r |
199 | Arguments:\r |
200 | DevicePath - A pointer to a device path data structure.\r |
201 | \r |
202 | Returns:\r |
203 | A pointer to the new allocated device path data.\r |
204 | Caller must free the memory used by DevicePath if it is no longer needed.\r |
205 | \r |
206 | --*/\r |
207 | ;\r |
208 | \r |
209 | EFI_DEVICE_PATH_PROTOCOL *\r |
210 | CoreAppendDevicePath (\r |
211 | IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r |
212 | IN EFI_DEVICE_PATH_PROTOCOL *Node\r |
213 | )\r |
214 | /*++\r |
215 | \r |
216 | Routine Description:\r |
217 | Function is used to append a Src1 and Src2 together.\r |
218 | \r |
219 | Arguments:\r |
220 | Src1 - A pointer to a device path data structure.\r |
221 | \r |
222 | Node - A pointer to a device path data structure.\r |
223 | \r |
224 | Returns:\r |
225 | \r |
226 | A pointer to the new device path is returned.\r |
227 | NULL is returned if space for the new device path could not be allocated from pool.\r |
228 | It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.\r |
229 | \r |
230 | --*/\r |
231 | ;\r |
232 | \r |
233 | VOID *\r |
234 | CoreAllocateBootServicesPool (\r |
235 | IN UINTN AllocationSize\r |
236 | )\r |
237 | /*++\r |
238 | \r |
239 | Routine Description:\r |
240 | \r |
241 | Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.\r |
242 | \r |
243 | Arguments:\r |
244 | \r |
245 | AllocationSize - Size to allocate.\r |
246 | \r |
247 | Returns:\r |
248 | \r |
249 | Pointer of the allocated pool.\r |
250 | \r |
251 | --*/\r |
252 | ;\r |
253 | \r |
254 | VOID *\r |
255 | CoreAllocateZeroBootServicesPool (\r |
256 | IN UINTN AllocationSize\r |
257 | )\r |
258 | /*++\r |
259 | \r |
260 | Routine Description:\r |
261 | \r |
262 | Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.\r |
263 | \r |
264 | Arguments:\r |
265 | \r |
266 | AllocationSize - Size to allocate.\r |
267 | \r |
268 | Returns:\r |
269 | \r |
270 | Pointer of the allocated pool.\r |
271 | \r |
272 | --*/\r |
273 | ;\r |
274 | \r |
275 | EFI_STATUS\r |
276 | CoreGetConfigTable (\r |
277 | IN EFI_GUID *Guid,\r |
278 | IN OUT VOID **Table\r |
279 | )\r |
280 | /*++\r |
281 | \r |
282 | Routine Description:\r |
283 | \r |
284 | Find a config table by name in system table's ConfigurationTable.\r |
285 | \r |
286 | Arguments:\r |
287 | \r |
288 | Guid - The table name to look for\r |
289 | \r |
290 | Table - Pointer of the config table\r |
291 | \r |
292 | Returns: \r |
293 | \r |
294 | EFI_NOT_FOUND - Could not find the table in system table's ConfigurationTable.\r |
295 | \r |
296 | EFI_SUCCESS - Table successfully found.\r |
297 | \r |
298 | --*/\r |
299 | ;\r |
300 | \r |
301 | VOID *\r |
302 | CoreAllocateRuntimeCopyPool (\r |
303 | IN UINTN AllocationSize,\r |
304 | IN VOID *Buffer\r |
305 | )\r |
306 | /*++\r |
307 | \r |
308 | Routine Description:\r |
309 | \r |
310 | Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.\r |
311 | \r |
312 | Arguments:\r |
313 | \r |
314 | AllocationSize - Size to allocate.\r |
315 | \r |
316 | Buffer - Specified buffer that will be copy to the allocated pool\r |
317 | \r |
318 | Returns:\r |
319 | \r |
320 | Pointer of the allocated pool.\r |
321 | \r |
322 | --*/\r |
323 | ;\r |
324 | \r |
325 | VOID *\r |
326 | CoreAllocateRuntimePool (\r |
327 | IN UINTN AllocationSize\r |
328 | )\r |
329 | /*++\r |
330 | \r |
331 | Routine Description:\r |
332 | \r |
333 | Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.\r |
334 | \r |
335 | Arguments:\r |
336 | \r |
337 | AllocationSize - Size to allocate.\r |
338 | \r |
339 | Returns:\r |
340 | \r |
341 | Pointer of the allocated pool.\r |
342 | \r |
343 | --*/\r |
344 | ;\r |
345 | \r |
346 | VOID *\r |
347 | CoreAllocateCopyPool (\r |
348 | IN UINTN AllocationSize,\r |
349 | IN VOID *Buffer\r |
350 | )\r |
351 | /*++\r |
352 | \r |
353 | Routine Description:\r |
354 | \r |
355 | Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.\r |
356 | \r |
357 | Arguments:\r |
358 | \r |
359 | AllocationSize - Size to allocate.\r |
360 | \r |
361 | Buffer - Specified buffer that will be copy to the allocated pool\r |
362 | \r |
363 | Returns:\r |
364 | \r |
365 | Pointer of the allocated pool.\r |
366 | \r |
367 | --*/\r |
368 | ;\r |
369 | \r |
370 | EFI_EVENT\r |
371 | CoreCreateProtocolNotifyEvent (\r |
372 | IN EFI_GUID *ProtocolGuid,\r |
373 | IN EFI_TPL NotifyTpl,\r |
374 | IN EFI_EVENT_NOTIFY NotifyFunction,\r |
375 | IN VOID *NotifyContext,\r |
376 | OUT VOID **Registration,\r |
377 | IN BOOLEAN SignalFlag\r |
378 | )\r |
379 | /*++\r |
380 | \r |
381 | Routine Description:\r |
382 | \r |
383 | Create a protocol notification event and return it.\r |
384 | \r |
385 | Arguments:\r |
386 | \r |
387 | ProtocolGuid - Protocol to register notification event on.\r |
388 | \r |
389 | NotifyTpl - Maximum TPL to signal the NotifyFunction.\r |
390 | \r |
391 | NotifyFuncition - EFI notification routine.\r |
392 | \r |
393 | NotifyContext - Context passed into Event when it is created.\r |
394 | \r |
395 | Registration - Registration key returned from RegisterProtocolNotify().\r |
396 | \r |
397 | SignalFlag - Boolean value to decide whether kick the event after register or not. \r |
398 | \r |
399 | Returns:\r |
400 | \r |
401 | The EFI_EVENT that has been registered to be signaled when a ProtocolGuid\r |
402 | is added to the system.\r |
403 | \r |
404 | --*/\r |
405 | ;\r |
406 | \r |
407 | #endif\r |