]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
4ea9375a HT |
3 | Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 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 | EfiDriverLib.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Light weight lib to support EFI drivers.\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | #ifndef _EFI_DRIVER_LIB_H_\r | |
23 | #define _EFI_DRIVER_LIB_H_\r | |
24 | \r | |
25 | #include "EfiStatusCode.h"\r | |
26 | #include "EfiCommonLib.h"\r | |
27 | #include "EfiPerf.h"\r | |
28 | #include "LinkedList.h"\r | |
29 | #include "GetImage.h"\r | |
30 | #include "EfiImageFormat.h"\r | |
d850121e | 31 | #include "EfiCompNameSupport.h"\r |
3eb9473e | 32 | \r |
33 | #include EFI_GUID_DEFINITION (DxeServices)\r | |
34 | #include EFI_GUID_DEFINITION (EventGroup)\r | |
35 | #include EFI_GUID_DEFINITION (EventLegacyBios)\r | |
36 | #include EFI_GUID_DEFINITION (FrameworkDevicePath)\r | |
37 | #include EFI_PROTOCOL_DEFINITION (FirmwareVolume)\r | |
38 | #include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)\r | |
39 | #include EFI_PROTOCOL_DEFINITION (DataHub)\r | |
40 | #include EFI_PROTOCOL_DEFINITION (DriverBinding)\r | |
41 | #include EFI_PROTOCOL_DEFINITION (ComponentName)\r | |
42 | #include EFI_PROTOCOL_DEFINITION (ComponentName2)\r | |
43 | #include EFI_PROTOCOL_DEFINITION (DriverConfiguration)\r | |
d850121e | 44 | #include EFI_PROTOCOL_DEFINITION (DriverConfiguration2)\r |
3eb9473e | 45 | #include EFI_PROTOCOL_DEFINITION (DriverDiagnostics)\r |
d850121e | 46 | #include EFI_PROTOCOL_DEFINITION (DriverDiagnostics2)\r |
3eb9473e | 47 | \r |
48 | #include EFI_PROTOCOL_DEFINITION (DebugMask)\r | |
49 | \r | |
f90eb36c | 50 | #if defined(__GNUC__) && defined(ECP_CPU_IPF)\r |
51 | \r | |
52 | VOID\r | |
53 | EFIAPI\r | |
54 | EcpEfiBreakPoint (\r | |
55 | VOID\r | |
56 | )\r | |
57 | /*++\r | |
58 | \r | |
59 | Routine Description:\r | |
60 | \r | |
61 | Generates a breakpoint on the CPU.\r | |
62 | \r | |
63 | Generates a breakpoint on the CPU. The breakpoint must be implemented such\r | |
64 | that code can resume normal execution after the breakpoint.\r | |
65 | \r | |
66 | Arguments:\r | |
67 | \r | |
68 | VOID\r | |
69 | \r | |
70 | Returns: \r | |
71 | \r | |
72 | VOID\r | |
73 | \r | |
74 | --*/\r | |
75 | ;\r | |
76 | \r | |
77 | VOID\r | |
78 | EFIAPI\r | |
79 | EcpMemoryFence (\r | |
80 | VOID\r | |
81 | )\r | |
82 | /*++\r | |
83 | \r | |
84 | Routine Description:\r | |
85 | \r | |
86 | Used to serialize load and store operations.\r | |
87 | \r | |
88 | All loads and stores that proceed calls to this function are guaranteed to be\r | |
89 | globally visible when this function returns.\r | |
90 | \r | |
91 | Arguments:\r | |
92 | \r | |
93 | VOID\r | |
94 | \r | |
95 | Returns: \r | |
96 | \r | |
97 | VOID\r | |
98 | \r | |
99 | --*/\r | |
100 | ;\r | |
101 | \r | |
102 | #endif\r | |
103 | \r | |
3eb9473e | 104 | typedef struct {\r |
105 | CHAR8 *Language;\r | |
106 | CHAR16 *UnicodeString;\r | |
107 | } EFI_UNICODE_STRING_TABLE;\r | |
108 | #if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r | |
109 | #define LANGUAGE_RFC_3066\r | |
110 | #define LANGUAGE_CODE_ENGLISH "en-US"\r | |
111 | #else\r | |
112 | #define LANGUAGE_ISO_639_2\r | |
113 | #define LANGUAGE_CODE_ENGLISH "eng"\r | |
114 | #endif\r | |
115 | \r | |
116 | //\r | |
117 | // Macros for EFI Driver Library Functions that are really EFI Boot Services\r | |
118 | //\r | |
119 | #define EfiCopyMem(_Destination, _Source, _Length) gBS->CopyMem ((_Destination), (_Source), (_Length))\r | |
120 | #define EfiSetMem(_Destination, _Length, _Value) gBS->SetMem ((_Destination), (_Length), (_Value))\r | |
121 | #define EfiZeroMem(_Destination, _Length) gBS->SetMem ((_Destination), (_Length), 0)\r | |
122 | \r | |
123 | //\r | |
124 | // Driver Lib Globals.\r | |
125 | //\r | |
126 | extern EFI_BOOT_SERVICES *gBS;\r | |
127 | extern EFI_DXE_SERVICES *gDS;\r | |
128 | extern EFI_RUNTIME_SERVICES *gRT;\r | |
129 | extern EFI_SYSTEM_TABLE *gST;\r | |
130 | extern UINTN gErrorLevel;\r | |
131 | extern EFI_GUID gEfiCallerIdGuid;\r | |
132 | extern EFI_DEBUG_MASK_PROTOCOL *gDebugMaskInterface;\r | |
133 | \r | |
134 | EFI_STATUS\r | |
135 | EfiInitializeDriverLib (\r | |
136 | IN EFI_HANDLE ImageHandle,\r | |
137 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
138 | )\r | |
139 | /*++\r | |
140 | \r | |
141 | Routine Description:\r | |
142 | \r | |
143 | Intialize Driver Lib if it has not yet been initialized. \r | |
144 | \r | |
145 | Arguments:\r | |
146 | \r | |
147 | ImageHandle - The firmware allocated handle for the EFI image.\r | |
148 | \r | |
149 | SystemTable - A pointer to the EFI System Table.\r | |
150 | \r | |
151 | \r | |
152 | Returns: \r | |
153 | \r | |
154 | EFI_STATUS always returns EFI_SUCCESS\r | |
155 | \r | |
156 | --*/\r | |
157 | ;\r | |
158 | \r | |
159 | EFI_STATUS\r | |
160 | DxeInitializeDriverLib (\r | |
161 | IN EFI_HANDLE ImageHandle,\r | |
162 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
163 | )\r | |
164 | /*++\r | |
165 | \r | |
166 | Routine Description:\r | |
167 | \r | |
168 | Intialize Driver Lib if it has not yet been initialized. \r | |
169 | \r | |
170 | Arguments:\r | |
171 | \r | |
172 | ImageHandle - The firmware allocated handle for the EFI image.\r | |
173 | \r | |
174 | SystemTable - A pointer to the EFI System Table.\r | |
175 | \r | |
176 | Returns: \r | |
177 | \r | |
178 | EFI_STATUS always returns EFI_SUCCESS\r | |
179 | \r | |
180 | --*/\r | |
181 | ;\r | |
182 | \r | |
183 | EFI_STATUS\r | |
184 | EfiLibInstallDriverBinding (\r | |
185 | IN EFI_HANDLE ImageHandle,\r | |
186 | IN EFI_SYSTEM_TABLE *SystemTable,\r | |
187 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
188 | IN EFI_HANDLE DriverBindingHandle\r | |
189 | )\r | |
190 | /*++\r | |
191 | \r | |
192 | Routine Description:\r | |
193 | \r | |
194 | Intialize a driver by installing the Driver Binding Protocol onto the \r | |
195 | driver's DriverBindingHandle. This is typically the same as the driver's\r | |
196 | ImageHandle, but it can be different if the driver produces multiple\r | |
197 | DriverBinding Protocols. This function also initializes the EFI Driver\r | |
198 | Library that initializes the global variables gST, gBS, gRT.\r | |
199 | \r | |
200 | Arguments:\r | |
201 | \r | |
202 | ImageHandle - The image handle of the driver\r | |
203 | \r | |
204 | SystemTable - The EFI System Table that was passed to the driver's entry point\r | |
205 | \r | |
206 | DriverBinding - A Driver Binding Protocol instance that this driver is producing\r | |
207 | \r | |
208 | DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r | |
209 | parameter is NULL, then a new handle is created.\r | |
210 | \r | |
211 | Returns: \r | |
212 | \r | |
213 | EFI_SUCCESS is DriverBinding is installed onto DriverBindingHandle\r | |
214 | \r | |
215 | Otherwise, then return status from gBS->InstallProtocolInterface()\r | |
216 | \r | |
217 | --*/\r | |
218 | ;\r | |
219 | \r | |
220 | EFI_STATUS\r | |
221 | EfiLibInstallAllDriverProtocols (\r | |
222 | IN EFI_HANDLE ImageHandle,\r | |
223 | IN EFI_SYSTEM_TABLE *SystemTable,\r | |
224 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
225 | IN EFI_HANDLE DriverBindingHandle,\r | |
d850121e | 226 | IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r |
227 | IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r | |
228 | IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r | |
3eb9473e | 229 | )\r |
230 | /*++\r | |
231 | \r | |
232 | Routine Description:\r | |
233 | \r | |
234 | Intialize a driver by installing the Driver Binding Protocol onto the \r | |
235 | driver's DriverBindingHandle. This is typically the same as the driver's\r | |
236 | ImageHandle, but it can be different if the driver produces multiple\r | |
237 | DriverBinding Protocols. This function also initializes the EFI Driver\r | |
238 | Library that initializes the global variables gST, gBS, gRT.\r | |
239 | \r | |
240 | Arguments:\r | |
241 | \r | |
242 | ImageHandle - The image handle of the driver\r | |
243 | \r | |
244 | SystemTable - The EFI System Table that was passed to the driver's entry point\r | |
245 | \r | |
246 | DriverBinding - A Driver Binding Protocol instance that this driver is producing\r | |
247 | \r | |
248 | DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r | |
249 | parameter is NULL, then a new handle is created.\r | |
250 | \r | |
251 | ComponentName - A Component Name Protocol instance that this driver is producing\r | |
252 | \r | |
253 | DriverConfiguration - A Driver Configuration Protocol instance that this driver is producing\r | |
254 | \r | |
255 | DriverDiagnostics - A Driver Diagnostics Protocol instance that this driver is producing\r | |
256 | \r | |
257 | Returns: \r | |
258 | \r | |
259 | EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle\r | |
260 | \r | |
261 | Otherwise, then return status from gBS->InstallProtocolInterface()\r | |
262 | \r | |
263 | --*/\r | |
264 | ;\r | |
265 | \r | |
d850121e | 266 | EFI_STATUS\r |
267 | EfiLibInstallAllDriverProtocols2 (\r | |
268 | IN EFI_HANDLE ImageHandle,\r | |
269 | IN EFI_SYSTEM_TABLE *SystemTable,\r | |
270 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
271 | IN EFI_HANDLE DriverBindingHandle,\r | |
272 | IN EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r | |
273 | IN EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r | |
274 | IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r | |
275 | )\r | |
276 | /*++\r | |
277 | \r | |
278 | Routine Description:\r | |
279 | \r | |
280 | Intialize a driver by installing the Driver Binding Protocol onto the \r | |
281 | driver's DriverBindingHandle. This is typically the same as the driver's\r | |
282 | ImageHandle, but it can be different if the driver produces multiple\r | |
283 | DriverBinding Protocols. This function also initializes the EFI Driver\r | |
284 | Library that initializes the global variables gST, gBS, gRT.\r | |
285 | \r | |
286 | Arguments:\r | |
287 | \r | |
288 | ImageHandle - The image handle of the driver\r | |
289 | \r | |
290 | SystemTable - The EFI System Table that was passed to the driver's entry point\r | |
291 | \r | |
292 | DriverBinding - A Driver Binding Protocol instance that this driver is producing\r | |
293 | \r | |
294 | DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this\r | |
295 | parameter is NULL, then a new handle is created.\r | |
296 | \r | |
297 | ComponentName2 - A Component Name2 Protocol instance that this driver is producing\r | |
298 | \r | |
299 | DriverConfiguration2- A Driver Configuration2 Protocol instance that this driver is producing\r | |
300 | \r | |
301 | DriverDiagnostics2 - A Driver Diagnostics2 Protocol instance that this driver is producing\r | |
302 | \r | |
303 | Returns: \r | |
304 | \r | |
305 | EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle\r | |
306 | \r | |
307 | Otherwise, then return status from gBS->InstallProtocolInterface()\r | |
308 | \r | |
309 | --*/\r | |
310 | ;\r | |
311 | \r | |
3eb9473e | 312 | EFI_STATUS\r |
313 | EfiLibGetSystemConfigurationTable (\r | |
314 | IN EFI_GUID *TableGuid,\r | |
315 | OUT VOID **Table\r | |
316 | )\r | |
317 | /*++\r | |
318 | \r | |
319 | Routine Description:\r | |
320 | \r | |
321 | Return the EFI 1.0 System Tabl entry with TableGuid\r | |
322 | \r | |
323 | Arguments:\r | |
324 | \r | |
325 | TableGuid - Name of entry to return in the system table\r | |
326 | Table - Pointer in EFI system table associated with TableGuid\r | |
327 | \r | |
328 | Returns: \r | |
329 | \r | |
330 | EFI_SUCCESS - Table returned;\r | |
331 | EFI_NOT_FOUND - TableGuid not in EFI system table\r | |
332 | \r | |
333 | --*/\r | |
334 | ;\r | |
335 | \r | |
336 | BOOLEAN\r | |
337 | EfiLibCompareLanguage (\r | |
338 | CHAR8 *Language1,\r | |
339 | CHAR8 *Language2\r | |
340 | )\r | |
341 | /*++\r | |
342 | \r | |
343 | Routine Description:\r | |
344 | \r | |
345 | Compare two languages to say whether they are identical.\r | |
346 | \r | |
347 | Arguments:\r | |
348 | \r | |
349 | Language1 - first language\r | |
350 | Language2 - second language\r | |
351 | \r | |
352 | Returns:\r | |
353 | \r | |
354 | TRUE - identical\r | |
355 | FALSE - not identical\r | |
356 | \r | |
357 | --*/\r | |
358 | ;\r | |
359 | \r | |
360 | //\r | |
361 | // DevicePath.c\r | |
362 | //\r | |
363 | BOOLEAN\r | |
364 | EfiIsDevicePathMultiInstance (\r | |
365 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
366 | )\r | |
367 | /*++\r | |
368 | \r | |
369 | Routine Description:\r | |
370 | Return TRUE is this is a multi instance device path.\r | |
371 | \r | |
372 | Arguments:\r | |
373 | DevicePath - A pointer to a device path data structure.\r | |
374 | \r | |
375 | \r | |
376 | Returns:\r | |
377 | TRUE - If DevicePath is multi instance. \r | |
378 | FALSE - If DevicePath is not multi instance.\r | |
379 | \r | |
380 | --*/\r | |
381 | ;\r | |
382 | \r | |
383 | EFI_DEVICE_PATH_PROTOCOL *\r | |
384 | EfiDevicePathInstance (\r | |
385 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r | |
386 | OUT UINTN *Size\r | |
387 | )\r | |
388 | /*++\r | |
389 | \r | |
390 | Routine Description:\r | |
391 | Function retrieves the next device path instance from a device path data structure.\r | |
392 | \r | |
393 | Arguments:\r | |
394 | DevicePath - A pointer to a device path data structure.\r | |
395 | \r | |
396 | Size - A pointer to the size of a device path instance in bytes.\r | |
397 | \r | |
398 | Returns:\r | |
399 | \r | |
400 | This function returns a pointer to the current device path instance.\r | |
401 | In addition, it returns the size in bytes of the current device path instance in Size,\r | |
402 | and a pointer to the next device path instance in DevicePath.\r | |
403 | If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.\r | |
404 | \r | |
405 | --*/\r | |
406 | ;\r | |
407 | \r | |
408 | UINTN\r | |
409 | EfiDevicePathSize (\r | |
410 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
411 | )\r | |
412 | /*++\r | |
413 | \r | |
414 | Routine Description:\r | |
415 | \r | |
416 | Calculate the size of a whole device path. \r | |
417 | \r | |
418 | Arguments:\r | |
419 | \r | |
420 | DevPath - The pointer to the device path data.\r | |
421 | \r | |
422 | Returns:\r | |
423 | \r | |
424 | Size of device path data structure..\r | |
425 | \r | |
426 | --*/\r | |
427 | ;\r | |
428 | \r | |
429 | EFI_DEVICE_PATH_PROTOCOL *\r | |
430 | EfiAppendDevicePath (\r | |
431 | IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r | |
432 | IN EFI_DEVICE_PATH_PROTOCOL *Src2\r | |
433 | )\r | |
434 | /*++\r | |
435 | \r | |
436 | Routine Description:\r | |
437 | Function is used to append a Src1 and Src2 together.\r | |
438 | \r | |
439 | Arguments:\r | |
440 | Src1 - A pointer to a device path data structure.\r | |
441 | \r | |
442 | Src2 - A pointer to a device path data structure.\r | |
443 | \r | |
444 | Returns:\r | |
445 | \r | |
446 | A pointer to the new device path is returned.\r | |
447 | NULL is returned if space for the new device path could not be allocated from pool.\r | |
448 | It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.\r | |
449 | \r | |
450 | --*/\r | |
451 | ;\r | |
452 | \r | |
453 | EFI_DEVICE_PATH_PROTOCOL *\r | |
454 | EfiDevicePathFromHandle (\r | |
455 | IN EFI_HANDLE Handle\r | |
456 | )\r | |
457 | /*++\r | |
458 | \r | |
459 | Routine Description:\r | |
460 | \r | |
461 | Locate device path protocol interface on a device handle.\r | |
462 | \r | |
463 | Arguments:\r | |
464 | \r | |
465 | Handle - The device handle\r | |
466 | \r | |
467 | Returns:\r | |
468 | \r | |
469 | Device path protocol interface located.\r | |
470 | \r | |
471 | --*/\r | |
472 | ;\r | |
473 | \r | |
474 | EFI_DEVICE_PATH_PROTOCOL *\r | |
475 | EfiDuplicateDevicePath (\r | |
476 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
477 | )\r | |
478 | /*++\r | |
479 | \r | |
480 | Routine Description:\r | |
481 | Duplicate a new device path data structure from the old one.\r | |
482 | \r | |
483 | Arguments:\r | |
484 | DevPath - A pointer to a device path data structure.\r | |
485 | \r | |
486 | Returns:\r | |
487 | A pointer to the new allocated device path data.\r | |
488 | Caller must free the memory used by DevicePath if it is no longer needed.\r | |
489 | \r | |
490 | --*/\r | |
491 | ;\r | |
492 | \r | |
493 | EFI_DEVICE_PATH_PROTOCOL *\r | |
494 | EfiAppendDevicePathNode (\r | |
495 | IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r | |
496 | IN EFI_DEVICE_PATH_PROTOCOL *Src2\r | |
497 | )\r | |
498 | /*++\r | |
499 | \r | |
500 | Routine Description:\r | |
501 | Function is used to append a device path node to the end of another device path.\r | |
502 | \r | |
503 | Arguments:\r | |
504 | Src1 - A pointer to a device path data structure.\r | |
505 | \r | |
506 | Src2 - A pointer to a device path data structure.\r | |
507 | \r | |
508 | Returns:\r | |
509 | This function returns a pointer to the new device path.\r | |
510 | If there is not enough temporary pool memory available to complete this function,\r | |
511 | then NULL is returned.\r | |
512 | \r | |
513 | \r | |
514 | --*/\r | |
515 | ;\r | |
516 | \r | |
517 | EFI_DEVICE_PATH_PROTOCOL *\r | |
518 | EfiFileDevicePath (\r | |
519 | IN EFI_HANDLE Device OPTIONAL,\r | |
520 | IN CHAR16 *FileName\r | |
521 | )\r | |
522 | /*++\r | |
523 | \r | |
524 | Routine Description:\r | |
525 | Create a device path that appends a MEDIA_DEVICE_PATH with\r | |
526 | FileNameGuid to the device path of DeviceHandle.\r | |
527 | \r | |
528 | Arguments:\r | |
529 | Device - Optional Device Handle to use as Root of the Device Path\r | |
530 | \r | |
531 | FileName - FileName\r | |
532 | \r | |
533 | Returns:\r | |
534 | EFI_DEVICE_PATH_PROTOCOL that was allocated from dynamic memory\r | |
535 | or NULL pointer.\r | |
536 | \r | |
537 | --*/\r | |
538 | ;\r | |
539 | \r | |
540 | EFI_DEVICE_PATH_PROTOCOL *\r | |
541 | EfiAppendDevicePathInstance (\r | |
542 | IN EFI_DEVICE_PATH_PROTOCOL *Src,\r | |
543 | IN EFI_DEVICE_PATH_PROTOCOL *Instance\r | |
544 | )\r | |
545 | /*++\r | |
546 | \r | |
547 | Routine Description:\r | |
548 | \r | |
549 | Append a device path instance to another.\r | |
550 | \r | |
551 | Arguments:\r | |
552 | \r | |
553 | Src - The device path instance to be appended with.\r | |
554 | Instance - The device path instance appending the other.\r | |
555 | \r | |
556 | Returns:\r | |
557 | \r | |
558 | The contaction of these two.\r | |
559 | \r | |
560 | --*/\r | |
561 | ;\r | |
562 | \r | |
563 | //\r | |
564 | // Lock.c\r | |
565 | //\r | |
566 | typedef struct {\r | |
567 | EFI_TPL Tpl;\r | |
568 | EFI_TPL OwnerTpl;\r | |
569 | UINTN Lock;\r | |
570 | } EFI_LOCK;\r | |
571 | \r | |
572 | VOID\r | |
573 | EfiInitializeLock (\r | |
574 | IN OUT EFI_LOCK *Lock,\r | |
575 | IN EFI_TPL Priority\r | |
576 | )\r | |
577 | /*++\r | |
578 | \r | |
579 | Routine Description:\r | |
580 | \r | |
581 | Initialize a basic mutual exclusion lock. Each lock\r | |
582 | provides mutual exclusion access at it's task priority\r | |
583 | level. Since there is no-premption (at any TPL) or\r | |
584 | multiprocessor support, acquiring the lock only consists\r | |
585 | of raising to the locks TPL.\r | |
586 | \r | |
587 | Note on a check build ASSERT()s are used to ensure proper\r | |
588 | lock usage.\r | |
589 | \r | |
590 | Arguments:\r | |
591 | \r | |
592 | Lock - The EFI_LOCK structure to initialize\r | |
593 | \r | |
594 | Priority - The task priority level of the lock\r | |
595 | \r | |
596 | \r | |
597 | Returns:\r | |
598 | \r | |
599 | An initialized Efi Lock structure.\r | |
600 | \r | |
601 | --*/\r | |
602 | ;\r | |
603 | \r | |
604 | //\r | |
605 | // Macro to initialize the state of a lock when a lock variable is declared\r | |
606 | //\r | |
607 | #define EFI_INITIALIZE_LOCK_VARIABLE(Tpl) {Tpl,0,0}\r | |
608 | \r | |
609 | VOID\r | |
610 | EfiAcquireLock (\r | |
611 | IN EFI_LOCK *Lock\r | |
612 | )\r | |
613 | /*++\r | |
614 | \r | |
615 | Routine Description:\r | |
616 | \r | |
617 | Raising to the task priority level of the mutual exclusion\r | |
618 | lock, and then acquires ownership of the lock.\r | |
619 | \r | |
620 | Arguments:\r | |
621 | \r | |
622 | Lock - The lock to acquire\r | |
623 | \r | |
624 | Returns:\r | |
625 | \r | |
626 | None\r | |
627 | \r | |
628 | --*/\r | |
629 | ;\r | |
630 | \r | |
631 | EFI_STATUS\r | |
632 | EfiAcquireLockOrFail (\r | |
633 | IN EFI_LOCK *Lock\r | |
634 | )\r | |
635 | /*++\r | |
636 | \r | |
637 | Routine Description:\r | |
638 | \r | |
639 | Initialize a basic mutual exclusion lock. Each lock\r | |
640 | provides mutual exclusion access at it's task priority\r | |
641 | level. Since there is no-premption (at any TPL) or\r | |
642 | multiprocessor support, acquiring the lock only consists\r | |
643 | of raising to the locks TPL.\r | |
644 | \r | |
645 | Arguments:\r | |
646 | \r | |
647 | Lock - The EFI_LOCK structure to initialize\r | |
648 | \r | |
649 | Returns:\r | |
650 | \r | |
651 | EFI_SUCCESS - Lock Owned.\r | |
652 | EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.\r | |
653 | \r | |
654 | --*/\r | |
655 | ;\r | |
656 | \r | |
657 | VOID\r | |
658 | EfiReleaseLock (\r | |
659 | IN EFI_LOCK *Lock\r | |
660 | )\r | |
661 | /*++\r | |
662 | \r | |
663 | Routine Description:\r | |
664 | \r | |
665 | Releases ownership of the mutual exclusion lock, and\r | |
666 | restores the previous task priority level.\r | |
667 | \r | |
668 | Arguments:\r | |
669 | \r | |
670 | Lock - The lock to release\r | |
671 | \r | |
672 | Returns:\r | |
673 | \r | |
674 | None\r | |
675 | \r | |
676 | --*/\r | |
677 | ;\r | |
678 | \r | |
679 | VOID *\r | |
680 | EfiLibAllocatePool (\r | |
681 | IN UINTN AllocationSize\r | |
682 | )\r | |
683 | /*++\r | |
684 | \r | |
685 | Routine Description:\r | |
686 | \r | |
687 | Allocate EfiBootServicesData pool of size AllocationSize\r | |
688 | \r | |
689 | Arguments:\r | |
690 | \r | |
691 | AllocationSize - Pool size\r | |
692 | \r | |
693 | Returns:\r | |
694 | \r | |
695 | Pointer to the pool allocated\r | |
696 | \r | |
697 | --*/\r | |
698 | ;\r | |
699 | \r | |
700 | VOID *\r | |
701 | EfiLibAllocateRuntimePool (\r | |
702 | IN UINTN AllocationSize\r | |
703 | )\r | |
704 | /*++\r | |
705 | \r | |
706 | Routine Description:\r | |
707 | \r | |
708 | Allocate EfiRuntimeServicesData pool of size AllocationSize\r | |
709 | \r | |
710 | Arguments:\r | |
711 | \r | |
712 | AllocationSize - Pool size\r | |
713 | \r | |
714 | Returns:\r | |
715 | \r | |
716 | Pointer to the pool allocated\r | |
717 | \r | |
718 | --*/\r | |
719 | ;\r | |
720 | \r | |
721 | VOID *\r | |
722 | EfiLibAllocateZeroPool (\r | |
723 | IN UINTN AllocationSize\r | |
724 | )\r | |
725 | /*++\r | |
726 | \r | |
727 | Routine Description:\r | |
728 | \r | |
729 | Allocate EfiBootServicesData pool of size AllocationSize and set memory to zero.\r | |
730 | \r | |
731 | Arguments:\r | |
732 | \r | |
733 | AllocationSize - Pool size\r | |
734 | \r | |
735 | Returns:\r | |
736 | \r | |
737 | Pointer to the pool allocated\r | |
738 | \r | |
739 | --*/\r | |
740 | ;\r | |
741 | \r | |
742 | VOID *\r | |
743 | EfiLibAllocateRuntimeZeroPool (\r | |
744 | IN UINTN AllocationSize\r | |
745 | )\r | |
746 | /*++\r | |
747 | \r | |
748 | Routine Description:\r | |
749 | \r | |
750 | Allocate EfiRuntimeServicesData pool of size AllocationSize and set memory to zero.\r | |
751 | \r | |
752 | Arguments:\r | |
753 | \r | |
754 | AllocationSize - Pool size\r | |
755 | \r | |
756 | Returns:\r | |
757 | \r | |
758 | Pointer to the pool allocated\r | |
759 | \r | |
760 | --*/\r | |
761 | ;\r | |
762 | \r | |
763 | VOID *\r | |
764 | EfiLibAllocateCopyPool (\r | |
765 | IN UINTN AllocationSize,\r | |
766 | IN VOID *Buffer\r | |
767 | )\r | |
768 | /*++\r | |
769 | \r | |
770 | Routine Description:\r | |
771 | \r | |
772 | Allocate BootServicesData pool and use a buffer provided by \r | |
773 | caller to fill it.\r | |
774 | \r | |
775 | Arguments:\r | |
776 | \r | |
777 | AllocationSize - The size to allocate\r | |
778 | \r | |
779 | Buffer - Buffer that will be filled into the buffer allocated\r | |
780 | \r | |
781 | Returns:\r | |
782 | \r | |
783 | Pointer of the buffer allocated.\r | |
784 | \r | |
785 | --*/\r | |
786 | ;\r | |
787 | \r | |
788 | VOID *\r | |
789 | EfiLibAllocateRuntimeCopyPool (\r | |
790 | IN UINTN AllocationSize,\r | |
791 | IN VOID *Buffer\r | |
792 | )\r | |
793 | /*++\r | |
794 | \r | |
795 | Routine Description:\r | |
796 | \r | |
797 | Allocate RuntimeServicesData pool and use a buffer provided by \r | |
798 | caller to fill it.\r | |
799 | \r | |
800 | Arguments:\r | |
801 | \r | |
802 | AllocationSize - The size to allocate\r | |
803 | \r | |
804 | Buffer - Buffer that will be filled into the buffer allocated\r | |
805 | \r | |
806 | Returns:\r | |
807 | \r | |
808 | Pointer of the buffer allocated.\r | |
809 | \r | |
810 | --*/\r | |
811 | ;\r | |
812 | \r | |
813 | //\r | |
814 | // Event.c\r | |
815 | //\r | |
816 | EFI_EVENT\r | |
817 | EfiLibCreateProtocolNotifyEvent (\r | |
818 | IN EFI_GUID *ProtocolGuid,\r | |
819 | IN EFI_TPL NotifyTpl,\r | |
820 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
821 | IN VOID *NotifyContext,\r | |
822 | OUT VOID **Registration\r | |
823 | )\r | |
824 | /*++\r | |
825 | \r | |
826 | Routine Description:\r | |
827 | \r | |
828 | Create a protocol notification event and return it.\r | |
829 | \r | |
830 | Arguments:\r | |
831 | \r | |
832 | ProtocolGuid - Protocol to register notification event on.\r | |
833 | \r | |
834 | NotifyTpl - Maximum TPL to single the NotifyFunction.\r | |
835 | \r | |
836 | NotifyFunction - EFI notification routine.\r | |
837 | \r | |
838 | NotifyContext - Context passed into Event when it is created.\r | |
839 | \r | |
840 | Registration - Registration key returned from RegisterProtocolNotify().\r | |
841 | \r | |
842 | Returns:\r | |
843 | \r | |
844 | The EFI_EVENT that has been registered to be signaled when a ProtocolGuid\r | |
845 | is added to the system.\r | |
846 | \r | |
847 | --*/\r | |
848 | ;\r | |
849 | \r | |
850 | EFI_STATUS\r | |
851 | EfiLibNamedEventSignal (\r | |
852 | IN EFI_GUID *Name\r | |
853 | )\r | |
854 | /*++\r | |
855 | \r | |
856 | Routine Description:\r | |
857 | Signals a named event. All registered listeners will run.\r | |
858 | The listeners should register using EfiLibNamedEventListen() function.\r | |
859 | \r | |
860 | NOTE: For now, the named listening/signalling is implemented\r | |
861 | on a protocol interface being installed and uninstalled.\r | |
862 | In the future, this maybe implemented based on a dedicated mechanism.\r | |
863 | \r | |
864 | Arguments:\r | |
865 | Name - Name to perform the signaling on. The name is a GUID.\r | |
866 | \r | |
867 | Returns:\r | |
868 | EFI_SUCCESS if successfull.\r | |
869 | \r | |
870 | --*/\r | |
871 | ;\r | |
872 | \r | |
873 | EFI_STATUS\r | |
874 | EfiLibNamedEventListen (\r | |
875 | IN EFI_GUID * Name,\r | |
876 | IN EFI_TPL NotifyTpl,\r | |
877 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
878 | IN VOID *NotifyContext\r | |
879 | )\r | |
880 | /*++\r | |
881 | \r | |
882 | Routine Description:\r | |
883 | Listenes to signals on the name.\r | |
884 | EfiLibNamedEventSignal() signals the event.\r | |
885 | \r | |
886 | NOTE: For now, the named listening/signalling is implemented\r | |
887 | on a protocol interface being installed and uninstalled.\r | |
888 | In the future, this maybe implemented based on a dedicated mechanism.\r | |
889 | \r | |
890 | Arguments:\r | |
891 | Name - Name to register the listener on.\r | |
892 | NotifyTpl - Maximum TPL to singnal the NotifyFunction.\r | |
893 | NotifyFunction - The listener routine.\r | |
894 | NotifyContext - Context passed into the listener routine.\r | |
895 | \r | |
896 | Returns:\r | |
897 | EFI_SUCCESS if successful.\r | |
898 | \r | |
899 | --*/\r | |
900 | ;\r | |
901 | \r | |
902 | //\r | |
903 | // Handle.c\r | |
904 | //\r | |
905 | EFI_STATUS\r | |
906 | EfiLibLocateHandleProtocolByProtocols (\r | |
907 | IN OUT EFI_HANDLE * Handle, OPTIONAL\r | |
908 | OUT VOID **Interface, OPTIONAL\r | |
909 | ...\r | |
910 | )\r | |
911 | /*++\r | |
912 | Routine Description:\r | |
913 | \r | |
914 | Function locates Protocol and/or Handle on which all Protocols specified\r | |
915 | as a variable list are installed.\r | |
916 | It supports continued search. The caller must assure that no handles are added\r | |
917 | or removed while performing continued search, by e.g., rising the TPL and not\r | |
918 | calling any handle routines. Otherwise the behavior is undefined.\r | |
919 | \r | |
920 | Arguments:\r | |
921 | \r | |
922 | Handle - The address of handle to receive the handle on which protocols\r | |
923 | indicated by the variable list are installed.\r | |
924 | If points to NULL, all handles are searched. If pointing to a\r | |
925 | handle returned from previous call, searches starting from next handle.\r | |
926 | If NULL, the parameter is ignored.\r | |
927 | \r | |
928 | Interface - The address of a pointer to a protocol interface that will receive\r | |
929 | the interface indicated by first variable argument.\r | |
930 | If NULL, the parameter is ignored.\r | |
931 | \r | |
932 | ... - A variable argument list containing protocol GUIDs. Must end with NULL.\r | |
933 | \r | |
934 | Returns:\r | |
935 | \r | |
936 | EFI_SUCCESS - All the protocols where found on same handle.\r | |
937 | EFI_NOT_FOUND - A Handle with all the protocols installed was not found.\r | |
938 | Other values as may be returned from LocateHandleBuffer() or HandleProtocol().\r | |
939 | \r | |
940 | --*/\r | |
941 | ;\r | |
942 | \r | |
943 | //\r | |
944 | // Debug.c init\r | |
945 | //\r | |
946 | EFI_STATUS\r | |
947 | EfiDebugAssertInit (\r | |
948 | VOID\r | |
949 | )\r | |
950 | /*++\r | |
951 | \r | |
952 | Routine Description:\r | |
953 | \r | |
954 | Locate Debug Assert Protocol and set as mDebugAssert\r | |
955 | \r | |
956 | Arguments:\r | |
957 | \r | |
958 | None\r | |
959 | \r | |
960 | Returns:\r | |
961 | \r | |
962 | Status code\r | |
963 | \r | |
964 | --*/\r | |
965 | ;\r | |
966 | \r | |
967 | //\r | |
968 | // Unicode String Support\r | |
969 | //\r | |
970 | EFI_STATUS\r | |
971 | EfiLibLookupUnicodeString (\r | |
972 | CHAR8 *Language,\r | |
973 | CHAR8 *SupportedLanguages,\r | |
974 | EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r | |
975 | CHAR16 **UnicodeString\r | |
976 | )\r | |
977 | /*++\r | |
978 | \r | |
979 | Routine Description:\r | |
980 | \r | |
981 | Translate a unicode string to a specified language if supported.\r | |
982 | \r | |
983 | Arguments:\r | |
984 | \r | |
985 | Language - The name of language to translate to\r | |
986 | SupportedLanguages - Supported languages set\r | |
987 | UnicodeStringTable - Pointer of one item in translation dictionary\r | |
988 | UnicodeString - The translated string\r | |
989 | \r | |
990 | Returns: \r | |
991 | \r | |
992 | EFI_INVALID_PARAMETER - Invalid parameter\r | |
993 | EFI_UNSUPPORTED - System not supported this language or this string translation\r | |
994 | EFI_SUCCESS - String successfully translated\r | |
995 | \r | |
996 | --*/\r | |
997 | ;\r | |
998 | \r | |
999 | EFI_STATUS\r | |
1000 | EfiLibAddUnicodeString (\r | |
1001 | CHAR8 *Language,\r | |
1002 | CHAR8 *SupportedLanguages,\r | |
1003 | EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r | |
1004 | CHAR16 *UnicodeString\r | |
1005 | )\r | |
1006 | /*++\r | |
1007 | \r | |
1008 | Routine Description:\r | |
1009 | \r | |
1010 | Add an translation to the dictionary if this language if supported.\r | |
1011 | \r | |
1012 | Arguments:\r | |
1013 | \r | |
1014 | Language - The name of language to translate to\r | |
1015 | SupportedLanguages - Supported languages set\r | |
1016 | UnicodeStringTable - Translation dictionary\r | |
1017 | UnicodeString - The corresponding string for the language to be translated to\r | |
1018 | \r | |
1019 | Returns: \r | |
1020 | \r | |
1021 | EFI_INVALID_PARAMETER - Invalid parameter\r | |
1022 | EFI_UNSUPPORTED - System not supported this language\r | |
1023 | EFI_ALREADY_STARTED - Already has a translation item of this language\r | |
1024 | EFI_OUT_OF_RESOURCES - No enough buffer to be allocated\r | |
1025 | EFI_SUCCESS - String successfully translated\r | |
1026 | \r | |
1027 | --*/\r | |
1028 | ;\r | |
1029 | \r | |
1030 | EFI_STATUS\r | |
1031 | EfiLibFreeUnicodeStringTable (\r | |
1032 | EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r | |
1033 | )\r | |
1034 | /*++\r | |
1035 | \r | |
1036 | Routine Description:\r | |
1037 | \r | |
1038 | Free a string table.\r | |
1039 | \r | |
1040 | Arguments:\r | |
1041 | \r | |
1042 | UnicodeStringTable - The string table to be freed.\r | |
1043 | \r | |
1044 | Returns: \r | |
1045 | \r | |
1046 | EFI_SUCCESS - The table successfully freed.\r | |
1047 | \r | |
1048 | --*/\r | |
1049 | ;\r | |
1050 | \r | |
1051 | EFI_STATUS\r | |
1052 | EfiLibReportStatusCode (\r | |
1053 | IN EFI_STATUS_CODE_TYPE Type,\r | |
1054 | IN EFI_STATUS_CODE_VALUE Value,\r | |
1055 | IN UINT32 Instance,\r | |
1056 | IN EFI_GUID *CallerId OPTIONAL,\r | |
1057 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL \r | |
1058 | )\r | |
1059 | /*++\r | |
1060 | \r | |
1061 | Routine Description:\r | |
1062 | \r | |
1063 | Report status code.\r | |
1064 | \r | |
1065 | Arguments:\r | |
1066 | \r | |
1067 | Type - Code type\r | |
1068 | Value - Code value\r | |
1069 | Instance - Instance number\r | |
1070 | CallerId - Caller name\r | |
1071 | DevicePath - Device path that to be reported\r | |
1072 | \r | |
1073 | Returns:\r | |
1074 | \r | |
1075 | Status code.\r | |
1076 | \r | |
1077 | EFI_OUT_OF_RESOURCES - No enough buffer could be allocated\r | |
1078 | \r | |
1079 | --*/\r | |
1080 | ;\r | |
1081 | \r | |
1082 | EFI_STATUS\r | |
1083 | ReportStatusCodeWithDevicePath (\r | |
1084 | IN EFI_STATUS_CODE_TYPE Type,\r | |
1085 | IN EFI_STATUS_CODE_VALUE Value,\r | |
1086 | IN UINT32 Instance,\r | |
1087 | IN EFI_GUID * CallerId OPTIONAL,\r | |
1088 | IN EFI_DEVICE_PATH_PROTOCOL * DevicePath\r | |
1089 | )\r | |
1090 | /*++\r | |
1091 | \r | |
1092 | Routine Description:\r | |
1093 | \r | |
1094 | Report device path through status code.\r | |
1095 | \r | |
1096 | Arguments:\r | |
1097 | \r | |
1098 | Type - Code type\r | |
1099 | Value - Code value\r | |
1100 | Instance - Instance number\r | |
1101 | CallerId - Caller name\r | |
1102 | DevicePath - Device path that to be reported\r | |
1103 | \r | |
1104 | Returns:\r | |
1105 | \r | |
1106 | Status code.\r | |
1107 | \r | |
1108 | EFI_OUT_OF_RESOURCES - No enough buffer could be allocated\r | |
1109 | \r | |
1110 | --*/\r | |
1111 | ;\r | |
1112 | \r | |
1113 | EFI_STATUS\r | |
1114 | EFIAPI\r | |
1115 | EfiCreateEventLegacyBoot (\r | |
1116 | IN EFI_TPL NotifyTpl,\r | |
1117 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
1118 | IN VOID *NotifyContext,\r | |
1119 | OUT EFI_EVENT *LegacyBootEvent\r | |
1120 | )\r | |
1121 | /*++\r | |
1122 | \r | |
1123 | Routine Description:\r | |
1124 | Create a Legacy Boot Event. \r | |
1125 | Tiano extended the CreateEvent Type enum to add a legacy boot event type. \r | |
1126 | This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r | |
1127 | added and now it's possible to not voilate the UEFI specification by \r | |
1128 | declaring a GUID for the legacy boot event class. This library supports\r | |
1129 | the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to \r | |
1130 | work both ways.\r | |
1131 | \r | |
1132 | Arguments:\r | |
1133 | LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)\r | |
1134 | \r | |
1135 | Returns:\r | |
1136 | EFI_SUCCESS Event was created.\r | |
1137 | Other Event was not created.\r | |
1138 | \r | |
1139 | --*/\r | |
1140 | ;\r | |
1141 | \r | |
1142 | EFI_STATUS\r | |
1143 | EFIAPI\r | |
1144 | EfiCreateEventReadyToBoot (\r | |
1145 | IN EFI_TPL NotifyTpl,\r | |
1146 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
1147 | IN VOID *NotifyContext,\r | |
1148 | OUT EFI_EVENT *ReadyToBootEvent\r | |
1149 | )\r | |
1150 | /*++\r | |
1151 | \r | |
1152 | Routine Description:\r | |
1153 | Create a Read to Boot Event. \r | |
1154 | \r | |
1155 | Tiano extended the CreateEvent Type enum to add a ready to boot event type. \r | |
1156 | This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r | |
1157 | added and now it's possible to not voilate the UEFI specification and use \r | |
1158 | the ready to boot event class defined in UEFI 2.0. This library supports\r | |
1159 | the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to \r | |
1160 | work both ways.\r | |
1161 | \r | |
1162 | Arguments:\r | |
1163 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)\r | |
1164 | \r | |
1165 | Return:\r | |
1166 | EFI_SUCCESS - Event was created.\r | |
1167 | Other - Event was not created.\r | |
1168 | \r | |
1169 | --*/\r | |
1170 | ;\r | |
1171 | \r | |
1172 | VOID\r | |
1173 | EFIAPI\r | |
1174 | EfiInitializeFwVolDevicepathNode (\r | |
1175 | IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r | |
1176 | IN EFI_GUID *NameGuid\r | |
1177 | )\r | |
1178 | /*++\r | |
1179 | Routine Description:\r | |
1180 | Initialize a Firmware Volume (FV) Media Device Path node.\r | |
1181 | \r | |
1182 | Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r | |
1183 | so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r | |
1184 | the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r | |
1185 | device path is defined for PIWG extensions of device path. If the code \r | |
1186 | is compiled to conform with the UEFI 2.0 specification use the new device path\r | |
1187 | else use the old form for backwards compatability.\r | |
1188 | \r | |
1189 | Arguments:\r | |
1190 | FvDevicePathNode - Pointer to a FV device path node to initialize\r | |
1191 | NameGuid - FV file name to use in FvDevicePathNode\r | |
1192 | \r | |
1193 | --*/\r | |
1194 | ;\r | |
1195 | \r | |
1196 | EFI_GUID *\r | |
1197 | EFIAPI\r | |
1198 | EfiGetNameGuidFromFwVolDevicePathNode (\r | |
1199 | IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r | |
1200 | )\r | |
1201 | /*++\r | |
1202 | Routine Description:\r | |
1203 | Check to see if the Firmware Volume (FV) Media Device Path is valid.\r | |
1204 | \r | |
1205 | Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r | |
1206 | so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r | |
1207 | the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r | |
1208 | device path is defined for PIWG extensions of device path. If the code \r | |
1209 | is compiled to conform with the UEFI 2.0 specification use the new device path\r | |
1210 | else use the old form for backwards compatability. The return value to this\r | |
1211 | function points to a location in FvDevicePathNode and it does not allocate\r | |
1212 | new memory for the GUID pointer that is returned.\r | |
1213 | \r | |
1214 | Arguments:\r | |
1215 | FvDevicePathNode - Pointer to FV device path to check\r | |
1216 | \r | |
1217 | Return:\r | |
1218 | NULL - FvDevicePathNode is not valid.\r | |
1219 | Other - FvDevicePathNode is valid and pointer to NameGuid was returned.\r | |
1220 | \r | |
1221 | --*/\r | |
1222 | ;\r | |
1223 | \r | |
1224 | VOID\r | |
1225 | EfiLibSafeFreePool (\r | |
1226 | IN VOID *Buffer\r | |
1227 | )\r | |
1228 | /*++\r | |
1229 | \r | |
1230 | Routine Description:\r | |
1231 | \r | |
1232 | Free pool safely.\r | |
1233 | \r | |
1234 | Arguments:\r | |
1235 | \r | |
1236 | Buffer - The allocated pool entry to free\r | |
1237 | \r | |
1238 | Returns:\r | |
1239 | \r | |
1240 | Pointer of the buffer allocated.\r | |
1241 | \r | |
1242 | --*/\r | |
1243 | ;\r | |
1244 | \r | |
1245 | EFI_STATUS\r | |
1246 | EfiLibTestManagedDevice (\r | |
1247 | IN EFI_HANDLE ControllerHandle,\r | |
1248 | IN EFI_HANDLE DriverBindingHandle,\r | |
1249 | IN EFI_GUID *ManagedProtocolGuid\r | |
1250 | )\r | |
1251 | /*++\r | |
1252 | \r | |
1253 | Routine Description:\r | |
1254 | \r | |
1255 | Test to see if the controller is managed by a specific driver.\r | |
1256 | \r | |
1257 | Arguments:\r | |
1258 | \r | |
1259 | ControllerHandle - Handle for controller to test\r | |
1260 | \r | |
1261 | DriverBindingHandle - Driver binding handle for controller\r | |
1262 | \r | |
1263 | ManagedProtocolGuid - The protocol guid the driver opens on controller\r | |
1264 | \r | |
1265 | Returns: \r | |
1266 | \r | |
1267 | EFI_SUCCESS - The controller is managed by the driver\r | |
1268 | \r | |
1269 | EFI_UNSUPPORTED - The controller is not managed by the driver\r | |
1270 | \r | |
1271 | --*/\r | |
1272 | ;\r | |
1273 | \r | |
1274 | EFI_STATUS\r | |
1275 | EfiLibTestChildHandle (\r | |
1276 | IN EFI_HANDLE ControllerHandle,\r | |
1277 | IN EFI_HANDLE ChildHandle,\r | |
1278 | IN EFI_GUID *ConsumedGuid\r | |
1279 | )\r | |
1280 | /*++\r | |
1281 | \r | |
1282 | Routine Description:\r | |
1283 | \r | |
1284 | Test to see if the child handle is the child of the controller\r | |
1285 | \r | |
1286 | Arguments:\r | |
1287 | \r | |
1288 | ControllerHandle - Handle for controller (parent)\r | |
1289 | \r | |
1290 | ChildHandle - Child handle to test\r | |
1291 | \r | |
1292 | ConsumsedGuid - Protocol guid consumed by child from controller\r | |
1293 | \r | |
1294 | Returns: \r | |
1295 | \r | |
1296 | EFI_SUCCESS - The child handle is the child of the controller\r | |
1297 | \r | |
1298 | EFI_UNSUPPORTED - The child handle is not the child of the controller\r | |
1299 | \r | |
1300 | --*/\r | |
1301 | ;\r | |
1302 | #endif\r |