e2d53be6e89d97922ace05f43b45aa39b52e47e4
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
1 /** @file
2 Provides library functions for common UEFI operations. Only available to DXE
3 and UEFI module types.
4
5 The UEFI Library provides functions and macros that simplify the development of
6 UEFI Drivers and UEFI Applications. These functions and macros help manage EFI
7 events, build simple locks utilizing EFI Task Priority Levels (TPLs), install
8 EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,
9 and print messages on the console output and standard error devices.
10
11 Copyright (c) 2006 - 2008, Intel Corporation<BR>
12 All rights reserved. This program and the accompanying materials
13 are licensed and made available under the terms and conditions of the BSD License
14 which accompanies this distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php
16
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19
20 **/
21
22 #ifndef __UEFI_LIB_H__
23 #define __UEFI_LIB_H__
24
25 #include <Protocol/DriverBinding.h>
26 #include <Protocol/DriverConfiguration.h>
27 #include <Protocol/ComponentName.h>
28 #include <Protocol/ComponentName2.h>
29 #include <Protocol/DriverDiagnostics.h>
30 #include <Protocol/DriverDiagnostics2.h>
31 #include <Protocol/GraphicsOutput.h>
32
33 #include <Library/BaseLib.h>
34
35 ///
36 /// Unicode String Table
37 ///
38 typedef struct {
39 CHAR8 *Language;
40 CHAR16 *UnicodeString;
41 } EFI_UNICODE_STRING_TABLE;
42
43 ///
44 /// EFI Lock Status
45 ///
46 typedef enum {
47 EfiLockUninitialized = 0,
48 EfiLockReleased = 1,
49 EfiLockAcquired = 2
50 } EFI_LOCK_STATE;
51
52 ///
53 /// EFI Lock
54 ///
55 typedef struct {
56 EFI_TPL Tpl;
57 EFI_TPL OwnerTpl;
58 EFI_LOCK_STATE Lock;
59 } EFI_LOCK;
60
61 /**
62 Macro that returns the number of 100 ns units for a specified number of microseconds.
63 Useful for managing EFI timer events.
64
65 @param Microseconds Number of microseconds.
66
67 @return The number of 100 ns units equivalent to the number of microseconds specified
68 by Microseconds.
69
70 **/
71 #define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)
72
73 /**
74 Macro that returns the number of 100 ns units for a specified number of milliseconds.
75 Useful for managing EFI timer events.
76
77 @param Milliseconds Number of milliseconds.
78
79 @return The number of 100 ns units equivalent to the number of milliseconds specified
80 by Milliseconds.
81
82 **/
83 #define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)
84
85 /**
86 Macro that returns the number of 100 ns units for a specified number of seconds.
87 Useful for managing EFI timer events.
88
89 @param Seconds Number of seconds.
90
91 @return The number of 100 ns units equivalent to the number of seconds specified
92 by Seconds.
93
94 **/
95 #define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)
96
97 /**
98 Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array
99 returned from GetMemoryMap().
100
101 @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR.
102
103 @param Size The size, in bytes, of the current EFI_MEMORY_DESCRIPTOR.
104
105 @return A pointer to the next EFI_MEMORY_DESCRIPTOR.
106
107 **/
108 #define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
109 ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))
110
111 /**
112 Retrieves a pointer to the system configuration table from the EFI System Table
113 based on a specified GUID.
114
115 This function searches the list of configuration tables stored in the EFI System Table
116 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to
117 the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID
118 is not found, then EFI_NOT_FOUND is returned.
119 If TableGuid is NULL, then ASSERT().
120 If Table is NULL, then ASSERT().
121
122 @param TableGuid Pointer to table's GUID type..
123 @param Table Pointer to the table associated with TableGuid in the EFI System Table.
124
125 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
126 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
127
128 **/
129 EFI_STATUS
130 EFIAPI
131 EfiGetSystemConfigurationTable (
132 IN EFI_GUID *TableGuid,
133 OUT VOID **Table
134 );
135
136 /**
137 Creates and returns a notification event and registers that event with all the protocol
138 instances specified by ProtocolGuid.
139
140 This function causes the notification function to be executed for every protocol of type
141 ProtocolGuid instance that exists in the system when this function is invoked. If there are
142 no instances of ProtocolGuid in the handle database at the time this function is invoked,
143 then the notification function is still executed one time. In addition, every time a protocol
144 of type ProtocolGuid instance is installed or reinstalled, the notification function is also
145 executed. This function returns the notification event that was created.
146 If ProtocolGuid is NULL, then ASSERT().
147 If NotifyTpl is not a legal TPL value, then ASSERT().
148 If NotifyFunction is NULL, then ASSERT().
149 If Registration is NULL, then ASSERT().
150
151
152 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
153 @param NotifyTpl Supplies the task priority level of the event notifications.
154 @param NotifyFunction Supplies the function to notify when the event is signaled.
155 @param NotifyContext The context parameter to pass to NotifyFunction.
156 @param Registration A pointer to a memory location to receive the registration value.
157 This value is passed to LocateHandle() to obtain new handles that
158 have been added that support the ProtocolGuid-specified protocol.
159
160 @return The notification event that was created.
161
162 **/
163 EFI_EVENT
164 EFIAPI
165 EfiCreateProtocolNotifyEvent(
166 IN EFI_GUID *ProtocolGuid,
167 IN EFI_TPL NotifyTpl,
168 IN EFI_EVENT_NOTIFY NotifyFunction,
169 IN VOID *NotifyContext, OPTIONAL
170 OUT VOID **Registration
171 );
172
173 /**
174 Creates a named event that can be signaled with EfiNamedEventSignal().
175
176 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
177 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more
178 listeners on the same event named by the GUID specified by Name.
179 If Name is NULL, then ASSERT().
180 If NotifyTpl is not a legal TPL value, then ASSERT().
181 If NotifyFunction is NULL, then ASSERT().
182
183 @param Name Supplies GUID name of the event.
184 @param NotifyTpl Supplies the task priority level of the event notifications.
185 @param NotifyFunction Supplies the function to notify when the event is signaled.
186 @param NotifyContext The context parameter to pass to NotifyFunction.
187 @param Registration A pointer to a memory location to receive the registration value.
188
189 @retval EFI_SUCCESS A named event was created.
190 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
191
192 **/
193 EFI_STATUS
194 EFIAPI
195 EfiNamedEventListen (
196 IN CONST EFI_GUID *Name,
197 IN EFI_TPL NotifyTpl,
198 IN EFI_EVENT_NOTIFY NotifyFunction,
199 IN CONST VOID *NotifyContext, OPTIONAL
200 OUT VOID *Registration OPTIONAL
201 );
202
203 /**
204 Signals a named event created with EfiNamedEventListen().
205
206 This function signals the named event specified by Name. The named event must have been
207 created with EfiNamedEventListen().
208 If Name is NULL, then ASSERT().
209
210 @param Name Supplies GUID name of the event.
211
212 @retval EFI_SUCCESS A named event was signaled.
213 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
214
215 **/
216 EFI_STATUS
217 EFIAPI
218 EfiNamedEventSignal (
219 IN CONST EFI_GUID *Name
220 );
221
222 /**
223 Returns the current TPL.
224
225 This function returns the current TPL. There is no EFI service to directly
226 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
227 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
228 can then immediately be restored back to the current TPL level with a call
229 to RestoreTPL().
230
231 @return The current TPL.
232
233 **/
234 EFI_TPL
235 EFIAPI
236 EfiGetCurrentTpl (
237 VOID
238 );
239
240 /**
241 Initializes a basic mutual exclusion lock.
242
243 This function initializes a basic mutual exclusion lock to the released state
244 and returns the lock. Each lock provides mutual exclusion access at its task
245 priority level. Since there is no preemption or multiprocessor support in EFI,
246 acquiring the lock only consists of raising to the locks TPL.
247 If Lock is NULL, then ASSERT().
248 If Priority is not a valid TPL value, then ASSERT().
249
250 @param Lock A pointer to the lock data structure to initialize.
251 @param Priority EFI TPL associated with the lock.
252
253 @return The lock.
254
255 **/
256 EFI_LOCK *
257 EFIAPI
258 EfiInitializeLock (
259 IN OUT EFI_LOCK *Lock,
260 IN EFI_TPL Priority
261 );
262
263 /**
264 Initializes a basic mutual exclusion lock.
265
266 This macro initializes the contents of a basic mutual exclusion lock to the
267 released state. Each lock provides mutual exclusion access at its task
268 priority level. Since there is no preemption or multiprocessor support in EFI,
269 acquiring the lock only consists of raising to the locks TPL.
270
271 @param Priority The task priority level of the lock.
272
273 @return The lock.
274
275 **/
276 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
277 {Priority, TPL_APPLICATION, EfiLockReleased }
278
279
280 /**
281 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
282
283 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
284 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
285 is not in the locked state, then DebugAssert() is called passing in the source
286 filename, source line number, and Lock.
287 If Lock is NULL, then ASSERT().
288
289 @param LockParameter A pointer to the lock to acquire.
290
291 **/
292 #define ASSERT_LOCKED(LockParameter) \
293 do { \
294 if (DebugAssertEnabled ()) { \
295 ASSERT (LockParameter != NULL); \
296 if ((LockParameter)->Lock != EfiLockAcquired) { \
297 _ASSERT (LockParameter not locked); \
298 } \
299 } \
300 } while (FALSE)
301
302
303 /**
304 Acquires ownership of a lock.
305
306 This function raises the system's current task priority level to the task
307 priority level of the mutual exclusion lock. Then, it places the lock in the
308 acquired state.
309 If Lock is NULL, then ASSERT().
310 If Lock is not initialized, then ASSERT().
311 If Lock is already in the acquired state, then ASSERT().
312
313 @param Lock A pointer to the lock to acquire.
314
315 **/
316 VOID
317 EFIAPI
318 EfiAcquireLock (
319 IN EFI_LOCK *Lock
320 );
321
322 /**
323 Acquires ownership of a lock.
324
325 This function raises the system's current task priority level to the task priority
326 level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.
327 If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
328 Otherwise, EFI_SUCCESS is returned.
329 If Lock is NULL, then ASSERT().
330 If Lock is not initialized, then ASSERT().
331
332 @param Lock A pointer to the lock to acquire.
333
334 @retval EFI_SUCCESS The lock was acquired.
335 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
336
337 **/
338 EFI_STATUS
339 EFIAPI
340 EfiAcquireLockOrFail (
341 IN EFI_LOCK *Lock
342 );
343
344 /**
345 Releases ownership of a lock.
346
347 This function transitions a mutual exclusion lock from the acquired state to
348 the released state, and restores the system's task priority level to its
349 previous level.
350 If Lock is NULL, then ASSERT().
351 If Lock is not initialized, then ASSERT().
352 If Lock is already in the released state, then ASSERT().
353
354 @param Lock A pointer to the lock to release.
355
356 **/
357 VOID
358 EFIAPI
359 EfiReleaseLock (
360 IN EFI_LOCK *Lock
361 );
362
363 /**
364 Tests whether a controller handle is being managed by a specific driver.
365
366 This function tests whether the driver specified by DriverBindingHandle is
367 currently managing the controller specified by ControllerHandle. This test
368 is performed by evaluating if the the protocol specified by ProtocolGuid is
369 present on ControllerHandle and is was opened by DriverBindingHandle with an
370 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
371 If ProtocolGuid is NULL, then ASSERT().
372
373 @param ControllerHandle A handle for a controller to test.
374 @param DriverBindingHandle Specifies the driver binding handle for the
375 driver.
376 @param ProtocolGuid Specifies the protocol that the driver specified
377 by DriverBindingHandle opens in its Start()
378 function.
379
380 @retval EFI_SUCCESS ControllerHandle is managed by the driver
381 specified by DriverBindingHandle.
382 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
383 specified by DriverBindingHandle.
384
385 **/
386 EFI_STATUS
387 EFIAPI
388 EfiTestManagedDevice (
389 IN CONST EFI_HANDLE ControllerHandle,
390 IN CONST EFI_HANDLE DriverBindingHandle,
391 IN CONST EFI_GUID *ProtocolGuid
392 );
393
394 /**
395 Tests whether a child handle is a child device of the controller.
396
397 This function tests whether ChildHandle is one of the children of
398 ControllerHandle. This test is performed by checking to see if the protocol
399 specified by ProtocolGuid is present on ControllerHandle and opened by
400 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
401 If ProtocolGuid is NULL, then ASSERT().
402
403 @param ControllerHandle A handle for a (parent) controller to test.
404 @param ChildHandle A child handle to test.
405 @param ProtocolGuid Supplies the protocol that the child controller
406 opens on its parent controller.
407
408 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
409 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
410 ControllerHandle.
411
412 **/
413 EFI_STATUS
414 EFIAPI
415 EfiTestChildHandle (
416 IN CONST EFI_HANDLE ControllerHandle,
417 IN CONST EFI_HANDLE ChildHandle,
418 IN CONST EFI_GUID *ProtocolGuid
419 );
420
421 /**
422 This function looks up a Unicode string in UnicodeStringTable.
423
424 If Language is a member of SupportedLanguages and a Unicode string is found in
425 UnicodeStringTable that matches the language code specified by Language, then it
426 is returned in UnicodeString.
427
428 @param Language A pointer to the ISO 639-2 language code for the
429 Unicode string to look up and return.
430 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
431 that the Unicode string table supports. Language
432 must be a member of this set.
433 @param UnicodeStringTable A pointer to the table of Unicode strings.
434 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
435 that matches the language specified by Language.
436
437 @retval EFI_SUCCESS The Unicode string that matches the language
438 specified by Language was found
439 in the table of Unicode strings UnicodeStringTable,
440 and it was returned in UnicodeString.
441 @retval EFI_INVALID_PARAMETER Language is NULL.
442 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
443 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
444 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
445 @retval EFI_UNSUPPORTED The language specified by Language is not a
446 member of SupportedLanguages.
447 @retval EFI_UNSUPPORTED The language specified by Language is not
448 supported by UnicodeStringTable.
449
450 **/
451 EFI_STATUS
452 EFIAPI
453 LookupUnicodeString (
454 IN CONST CHAR8 *Language,
455 IN CONST CHAR8 *SupportedLanguages,
456 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
457 OUT CHAR16 **UnicodeString
458 );
459
460 /**
461 This function looks up a Unicode string in UnicodeStringTable.
462
463 If Language is a member of SupportedLanguages and a Unicode string is found in
464 UnicodeStringTable that matches the language code specified by Language, then
465 it is returned in UnicodeString.
466
467 @param Language A pointer to an ASCII string containing the ISO 639-2 or the
468 RFC 4646 language code for the Unicode string to look up and
469 return. If Iso639Language is TRUE, then this ASCII string is
470 not assumed to be Null-terminated, and only the first three
471 characters are used. If Iso639Language is FALSE, then this ASCII
472 string must be Null-terminated.
473 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a
474 set of ISO 639-2 or RFC 4646 language codes that the Unicode
475 string table supports. Language must be a member of this set.
476 If Iso639Language is TRUE, then this string contains one or more
477 ISO 639-2 language codes with no separator characters. If Iso639Language
478 is FALSE, then is string contains one or more RFC 4646 language
479 codes separated by ';'.
480 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
481 is defined in "Related Definitions".
482 @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable
483 that matches the language specified by Language.
484 @param Iso639Language Specifies the supported language code format. If it is TRUE, then
485 Language and SupportedLanguages follow ISO 639-2 language code format.
486 Otherwise, they follow RFC 4646 language code format.
487
488
489 @retval EFI_SUCCESS The Unicode string that matches the language specified by Language
490 was found in the table of Unicode strings UnicodeStringTable, and
491 it was returned in UnicodeString.
492 @retval EFI_INVALID_PARAMETER Language is NULL.
493 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
494 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
495 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
496 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
497 @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.
498
499 **/
500 EFI_STATUS
501 EFIAPI
502 LookupUnicodeString2 (
503 IN CONST CHAR8 *Language,
504 IN CONST CHAR8 *SupportedLanguages,
505 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
506 OUT CHAR16 **UnicodeString,
507 IN BOOLEAN Iso639Language
508 );
509
510 /**
511 This function adds a Unicode string to UnicodeStringTable.
512
513 If Language is a member of SupportedLanguages then UnicodeString is added to
514 UnicodeStringTable. New buffers are allocated for both Language and
515 UnicodeString. The contents of Language and UnicodeString are copied into
516 these new buffers. These buffers are automatically freed when
517 FreeUnicodeStringTable() is called.
518
519 @param Language A pointer to the ISO 639-2 language code for the Unicode
520 string to add.
521 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
522 that the Unicode string table supports.
523 Language must be a member of this set.
524 @param UnicodeStringTable A pointer to the table of Unicode strings.
525 @param UnicodeString A pointer to the Unicode string to add.
526
527 @retval EFI_SUCCESS The Unicode string that matches the language
528 specified by Language was found in the table of
529 Unicode strings UnicodeStringTable, and it was
530 returned in UnicodeString.
531 @retval EFI_INVALID_PARAMETER Language is NULL.
532 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
533 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
534 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
535 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
536 already present in UnicodeStringTable.
537 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
538 Unicode string to UnicodeStringTable.
539 @retval EFI_UNSUPPORTED The language specified by Language is not a
540 member of SupportedLanguages.
541
542 **/
543 EFI_STATUS
544 EFIAPI
545 AddUnicodeString (
546 IN CONST CHAR8 *Language,
547 IN CONST CHAR8 *SupportedLanguages,
548 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
549 IN CONST CHAR16 *UnicodeString
550 );
551
552 /**
553 This function adds the Null-terminated Unicode string specified by UnicodeString
554 to UnicodeStringTable.
555
556 If Language is a member of SupportedLanguages then UnicodeString is added to
557 UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.
558 The contents of Language and UnicodeString are copied into these new buffers.
559 These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.
560
561 @param Language A pointer to an ASCII string containing the ISO 639-2 or
562 the RFC 4646 language code for the Unicode string to add.
563 If Iso639Language is TRUE, then this ASCII string is not
564 assumed to be Null-terminated, and only the first three
565 chacters are used. If Iso639Language is FALSE, then this
566 ASCII string must be Null-terminated.
567 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains
568 a set of ISO 639-2 or RFC 4646 language codes that the Unicode
569 string table supports. Language must be a member of this set.
570 If Iso639Language is TRUE, then this string contains one or more
571 ISO 639-2 language codes with no separator characters.
572 If Iso639Language is FALSE, then is string contains one or more
573 RFC 4646 language codes separated by ';'.
574 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
575 is defined in "Related Definitions".
576 @param UnicodeString A pointer to the Unicode string to add.
577 @param Iso639Language Specifies the supported language code format. If it is TRUE,
578 then Language and SupportedLanguages follow ISO 639-2 language code format.
579 Otherwise, they follow RFC 4646 language code format.
580
581 @retval EFI_SUCCESS The Unicode string that matches the language specified by
582 Language was found in the table of Unicode strings UnicodeStringTable,
583 and it was returned in UnicodeString.
584 @retval EFI_INVALID_PARAMETER Language is NULL.
585 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
586 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
587 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
588 @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in
589 UnicodeStringTable.
590 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.
591 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
592
593 **/
594 EFI_STATUS
595 EFIAPI
596 AddUnicodeString2 (
597 IN CONST CHAR8 *Language,
598 IN CONST CHAR8 *SupportedLanguages,
599 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
600 IN CONST CHAR16 *UnicodeString,
601 IN BOOLEAN Iso639Language
602 );
603
604 /**
605 This function frees the table of Unicode strings in UnicodeStringTable.
606
607 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
608 Otherwise, each language code, and each Unicode string in the Unicode string
609 table are freed, and EFI_SUCCESS is returned.
610
611 @param UnicodeStringTable A pointer to the table of Unicode strings.
612
613 @retval EFI_SUCCESS The Unicode string table was freed.
614
615 **/
616 EFI_STATUS
617 EFIAPI
618 FreeUnicodeStringTable (
619 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
620 );
621
622
623 /**
624 Returns a pointer to an allocated buffer that contains the contents of a
625 variable retrieved through the UEFI Runtime Service GetVariable(). The
626 returned buffer is allocated using AllocatePool(). The caller is responsible
627 for freeing this buffer with FreePool().
628
629 If Name is NULL, then ASSERT().
630 If Guid is NULL, then ASSERT().
631
632 @param[in] Name Pointer to a Null-terminated Unicode string.
633 @param[in] Guid Pointer to an EFI_GUID structure
634
635 @retval NULL The variable could not be retrieved.
636 @retval NULL There are not enough resources available for the variable contents.
637 @retval Other A pointer to allocated buffer containing the variable contents.
638
639 **/
640 VOID *
641 EFIAPI
642 GetVariable (
643 IN CONST CHAR16 *Name,
644 IN CONST EFI_GUID *Guid
645 );
646
647 /**
648 Returns a pointer to an allocated buffer that contains the contents of a
649 variable retrieved through the UEFI Runtime Service GetVariable(). This
650 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
651 The returned buffer is allocated using AllocatePool(). The caller is
652 responsible for freeing this buffer with FreePool().
653
654 If Name is NULL, then ASSERT().
655
656 @param[in] Name Pointer to a Null-terminated Unicode string.
657
658 @retval NULL The variable could not be retrieved.
659 @retval NULL There are not enough resources available for the variable contents.
660 @retval Other A pointer to allocated buffer containing the variable contents.
661
662 **/
663 VOID *
664 EFIAPI
665 GetEfiGlobalVariable (
666 IN CONST CHAR16 *Name
667 );
668
669
670 /**
671 Returns a pointer to an allocated buffer that contains the best matching language
672 from a set of supported languages.
673
674 This function supports both ISO 639-2 and RFC 4646 language codes, but language
675 code types may not be mixed in a single call to this function. The language
676 code returned is allocated using AllocatePool(). The caller is responsible for
677 freeing the allocated buffer using FreePool(). This function supports a variable
678 argument list that allows the caller to pass in a prioritized list of language
679 codes to test against all the language codes in SupportedLanguages.
680
681 If SupportedLanguages is NULL, then ASSERT().
682
683 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
684 contains a set of language codes in the format
685 specified by Iso639Language.
686 @param[in] Iso639Language If TRUE, then all language codes are assumed to be
687 in ISO 639-2 format. If FALSE, then all language
688 codes are assumed to be in RFC 4646 language format
689 @param[in] ... A variable argument list that contains pointers to
690 Null-terminated ASCII strings that contain one or more
691 language codes in the format specified by Iso639Language.
692 The first language code from each of these language
693 code lists is used to determine if it is an exact or
694 close match to any of the language codes in
695 SupportedLanguages. Close matches only apply to RFC 4646
696 language codes, and the matching algorithm from RFC 4647
697 is used to determine if a close match is present. If
698 an exact or close match is found, then the matching
699 language code from SupportedLanguages is returned. If
700 no matches are found, then the next variable argument
701 parameter is evaluated. The variable argument list
702 is terminated by a NULL.
703
704 @retval NULL The best matching language could not be found in SupportedLanguages.
705 @retval NULL There are not enough resources available to return the best matching
706 language.
707 @retval Other A pointer to a Null-terminated ASCII string that is the best matching
708 language in SupportedLanguages.
709
710 **/
711 CHAR8 *
712 EFIAPI
713 GetBestLanguage (
714 IN CONST CHAR8 *SupportedLanguages,
715 IN BOOLEAN Iso639Language,
716 ...
717 );
718
719 /**
720 Draws a dialog box to the console output device specified by
721 ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke
722 from the console input device specified by ConIn defined in the
723 EFI_SYSTEM_TABLE.
724
725 If there are no strings in the variable argument list, then ASSERT().
726 If all the strings in the variable argument list are empty, then ASSERT().
727
728 @param[in] Attribute Specifies the foreground and background color of the popup.
729 @param[out] Key A pointer to the EFI_KEY value of the key that was
730 pressed. This is an optional parameter that may be NULL.
731 If it is NULL then no wait for a keypress will be performed.
732 @param[in] ... The variable argument list that contains pointers to Null-
733 terminated Unicode strings to display in the dialog box.
734 The variable argument list is terminated by a NULL.
735
736 **/
737 VOID
738 EFIAPI
739 CreatePopUp (
740 IN UINTN Attribute,
741 OUT EFI_INPUT_KEY *Key, OPTIONAL
742 ...
743 );
744
745 /**
746 Retrieves the width of a Unicode character.
747
748 This function computes and returns the width of the Unicode character specified
749 by UnicodeChar.
750
751 @param UnicodeChar A Unicode character.
752
753 @retval 0 The width if UnicodeChar could not be determined.
754 @retval 1 UnicodeChar is a narrow glyph.
755 @retval 2 UnicodeChar is a wide glyph.
756
757 **/
758 UINTN
759 EFIAPI
760 GetGlyphWidth (
761 IN CHAR16 UnicodeChar
762 );
763
764 /**
765 Computes the display length of a Null-terminated Unicode String.
766
767 This function computes and returns the display length of the Null-terminated Unicode
768 string specified by String. If String is NULL then 0 is returned. If any of the widths
769 of the Unicode characters in String can not be determined, then 0 is returned. The display
770 width of String can be computed by summing the display widths of each Unicode character
771 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode
772 characters that are width glyphs have a width of 2.
773 If String is not aligned on a 16-bit boundary, then ASSERT().
774
775 @param String A pointer to a Null-terminated Unicode string.
776
777 @return The display length of the Null-terminated Unicode string specified by String.
778
779 **/
780 UINTN
781 EFIAPI
782 UnicodeStringDisplayLength (
783 IN CONST CHAR16 *String
784 );
785
786 //
787 // Functions that abstract early Framework contamination of UEFI.
788 //
789 /**
790 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
791
792 This function abstracts the signaling of the Ready to Boot Event. The Framework moved
793 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller
794 from how this event is created to prevent to code form having to change with the
795 version of the specification supported.
796
797 **/
798 VOID
799 EFIAPI
800 EfiSignalEventReadyToBoot (
801 VOID
802 );
803
804 /**
805 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().
806
807 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from
808 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how
809 this event is created to prevent to code form having to change with the version of the
810 specification supported.
811
812 **/
813 VOID
814 EFIAPI
815 EfiSignalEventLegacyBoot (
816 VOID
817 );
818
819 /**
820 Creates an EFI event in the Legacy Boot Event Group.
821
822 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library
823 abstracts the implementation mechanism of this event from the caller. This function
824 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary
825 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event
826 is created to prevent to code form having to change with the version of the
827 specification supported.
828 If LegacyBootEvent is NULL, then ASSERT().
829
830 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
831
832 @retval EFI_SUCCESS Event was created.
833 @retval Other Event was not created.
834
835 **/
836 EFI_STATUS
837 EFIAPI
838 EfiCreateEventLegacyBoot (
839 OUT EFI_EVENT *LegacyBootEvent
840 );
841
842 /**
843 Create an EFI event in the Legacy Boot Event Group and allows
844 the caller to specify a notification function.
845
846 This function abstracts the creation of the Legacy Boot Event.
847 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
848 This library abstracts the caller from how this event is created to prevent
849 to code form having to change with the version of the specification supported.
850 If LegacyBootEvent is NULL, then ASSERT().
851
852 @param NotifyTpl The task priority level of the event.
853 @param NotifyFunction The notification function to call when the event is signaled.
854 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
855 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
856
857 @retval EFI_SUCCESS Event was created.
858 @retval Other Event was not created.
859
860 **/
861 EFI_STATUS
862 EFIAPI
863 EfiCreateEventLegacyBootEx (
864 IN EFI_TPL NotifyTpl,
865 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
866 IN VOID *NotifyContext, OPTIONAL
867 OUT EFI_EVENT *LegacyBootEvent
868 );
869
870 /**
871 Create an EFI event in the Ready To Boot Event Group.
872
873 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library
874 abstracts the implementation mechanism of this event from the caller.
875 This function abstracts the creation of the Ready to Boot Event. The Framework
876 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
877 the caller from how this event is created to prevent the code form having to
878 change with the version of the specification supported.
879 If ReadyToBootEvent is NULL, then ASSERT().
880
881 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
882
883 @retval EFI_SUCCESS Event was created.
884 @retval Other Event was not created.
885
886 **/
887 EFI_STATUS
888 EFIAPI
889 EfiCreateEventReadyToBoot (
890 OUT EFI_EVENT *ReadyToBootEvent
891 );
892
893 /**
894 Create an EFI event in the Ready To Boot Event Group and allows
895 the caller to specify a notification function.
896
897 This function abstracts the creation of the Ready to Boot Event.
898 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
899 This library abstracts the caller from how this event is created to prevent
900 to code form having to change with the version of the specification supported.
901 If ReadyToBootEvent is NULL, then ASSERT().
902
903 @param NotifyTpl The task priority level of the event.
904 @param NotifyFunction The notification function to call when the event is signaled.
905 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
906 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
907
908 @retval EFI_SUCCESS Event was created.
909 @retval Other Event was not created.
910
911 **/
912 EFI_STATUS
913 EFIAPI
914 EfiCreateEventReadyToBootEx (
915 IN EFI_TPL NotifyTpl,
916 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
917 IN VOID *NotifyContext, OPTIONAL
918 OUT EFI_EVENT *ReadyToBootEvent
919 );
920
921 /**
922 Initialize a Firmware Volume (FV) Media Device Path node.
923
924 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
925 This library function abstracts initializing a device path node.
926 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
927 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
928 not conflict with the UEFI 2.0 specification. This function abstracts the
929 differences from the caller.
930 If FvDevicePathNode is NULL, then ASSERT().
931 If NameGuid is NULL, then ASSERT().
932
933 @param FvDevicePathNode Pointer to a FV device path node to initialize
934 @param NameGuid FV file name to use in FvDevicePathNode
935
936 **/
937 VOID
938 EFIAPI
939 EfiInitializeFwVolDevicepathNode (
940 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
941 IN CONST EFI_GUID *NameGuid
942 );
943
944 /**
945 Check to see if the Firmware Volume (FV) Media Device Path is valid
946
947 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
948 This library function abstracts validating a device path node.
949 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
950 If it is valid, then return the GUID file name from the device path node. Otherwise,
951 return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward
952 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
953 the differences from the caller.
954 If FvDevicePathNode is NULL, then ASSERT().
955
956 @param FvDevicePathNode Pointer to FV device path to check.
957
958 @retval NULL FvDevicePathNode is not valid.
959 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
960
961 **/
962 EFI_GUID *
963 EFIAPI
964 EfiGetNameGuidFromFwVolDevicePathNode (
965 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
966 );
967
968 /**
969 Prints a formatted Unicode string to the console output device specified by
970 ConOut defined in the EFI_SYSTEM_TABLE.
971
972 This function prints a formatted Unicode string to the console output device
973 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
974 characters that printed to ConOut. If the length of the formatted Unicode
975 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
976 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
977 If Format is NULL, then ASSERT().
978 If Format is not aligned on a 16-bit boundary, then ASSERT().
979
980 @param Format Null-terminated Unicode format string.
981 @param ... Variable argument list whose contents are accessed based
982 on the format string specified by Format.
983
984 @return Number of Unicode characters printed to ConOut.
985
986 **/
987 UINTN
988 EFIAPI
989 Print (
990 IN CONST CHAR16 *Format,
991 ...
992 );
993
994 /**
995 Prints a formatted Unicode string to the console output device specified by
996 StdErr defined in the EFI_SYSTEM_TABLE.
997
998 This function prints a formatted Unicode string to the console output device
999 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
1000 characters that printed to StdErr. If the length of the formatted Unicode
1001 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1002 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
1003 If Format is NULL, then ASSERT().
1004 If Format is not aligned on a 16-bit boundary, then ASSERT().
1005
1006 @param Format Null-terminated Unicode format string.
1007 @param ... Variable argument list whose contents are accessed based
1008 on the format string specified by Format.
1009
1010 @return Number of Unicode characters printed to StdErr.
1011
1012 **/
1013 UINTN
1014 EFIAPI
1015 ErrorPrint (
1016 IN CONST CHAR16 *Format,
1017 ...
1018 );
1019
1020 /**
1021 Prints a formatted ASCII string to the console output device specified by
1022 ConOut defined in the EFI_SYSTEM_TABLE.
1023
1024 This function prints a formatted ASCII string to the console output device
1025 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
1026 characters that printed to ConOut. If the length of the formatted ASCII
1027 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1028 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
1029 If Format is NULL, then ASSERT().
1030
1031 @param Format Null-terminated ASCII format string.
1032 @param ... Variable argument list whose contents are accessed based
1033 on the format string specified by Format.
1034
1035 @return Number of ASCII characters printed to ConOut.
1036
1037 **/
1038 UINTN
1039 EFIAPI
1040 AsciiPrint (
1041 IN CONST CHAR8 *Format,
1042 ...
1043 );
1044
1045 /**
1046 Prints a formatted ASCII string to the console output device specified by
1047 StdErr defined in the EFI_SYSTEM_TABLE.
1048
1049 This function prints a formatted ASCII string to the console output device
1050 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
1051 characters that printed to StdErr. If the length of the formatted ASCII
1052 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1053 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
1054 If Format is NULL, then ASSERT().
1055
1056 @param Format Null-terminated ASCII format string.
1057 @param ... Variable argument list whose contents are accessed based
1058 on the format string specified by Format.
1059
1060 @return Number of ASCII characters printed to ConErr.
1061
1062 **/
1063 UINTN
1064 EFIAPI
1065 AsciiErrorPrint (
1066 IN CONST CHAR8 *Format,
1067 ...
1068 );
1069
1070
1071 /**
1072 Prints a formatted Unicode string to a graphics console device specified by
1073 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
1074
1075 This function prints a formatted Unicode string to the graphics console device
1076 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
1077 Unicode characters displayed, not including partial characters that may be clipped
1078 by the right edge of the display. If the length of the formatted Unicode string is
1079 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
1080 PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL
1081 StringToImage() service is used to convert the string to a bitmap using the glyphs
1082 registered with the HII database. No wrapping is performed, so any portions of the
1083 string the fall outside the active display region will not be displayed. Please see
1084 Section 27.2.6 of the UEFI Specification for a description of the supported string
1085 format including the set of control codes supported by the StringToImage() service.
1086
1087 If a graphics console device is not associated with the ConsoleOutputHandle
1088 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1089 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1090 string is printed, and 0 is returned.
1091 If Format is NULL, then ASSERT().
1092 If Format is not aligned on a 16-bit boundary, then ASSERT().
1093
1094 @param PointX X coordinate to print the string.
1095 @param PointY Y coordinate to print the string.
1096 @param ForeGround The foreground color of the string being printed. This is
1097 an optional parameter that may be NULL. If it is NULL,
1098 then the foreground color of the current ConOut device
1099 in the EFI_SYSTEM_TABLE is used.
1100 @param BackGround The background color of the string being printed. This is
1101 an optional parameter that may be NULL. If it is NULL,
1102 then the background color of the current ConOut device
1103 in the EFI_SYSTEM_TABLE is used.
1104 @param Format Null-terminated Unicode format string. See Print Library
1105 for the supported format string syntax.
1106 @param ... Variable argument list whose contents are accessed based on
1107 the format string specified by Format.
1108
1109 @return The number of Unicode characters printed.
1110
1111 **/
1112 UINTN
1113 EFIAPI
1114 PrintXY (
1115 IN UINTN PointX,
1116 IN UINTN PointY,
1117 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
1118 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
1119 IN CONST CHAR16 *Format,
1120 ...
1121 );
1122
1123 /**
1124 Prints a formatted ASCII string to a graphics console device specified by
1125 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
1126
1127 This function prints a formatted ASCII string to the graphics console device
1128 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
1129 ASCII characters displayed, not including partial characters that may be clipped
1130 by the right edge of the display. If the length of the formatted ASCII string is
1131 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
1132 PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL
1133 StringToImage() service is used to convert the string to a bitmap using the glyphs
1134 registered with the HII database. No wrapping is performed, so any portions of the
1135 string the fall outside the active display region will not be displayed. Please see
1136 Section 27.2.6 of the UEFI Specification for a description of the supported string
1137 format including the set of control codes supported by the StringToImage() service.
1138
1139 If a graphics console device is not associated with the ConsoleOutputHandle
1140 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1141 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1142 string is printed, and 0 is returned.
1143 If Format is NULL, then ASSERT().
1144
1145 @param PointX X coordinate to print the string.
1146 @param PointY Y coordinate to print the string.
1147 @param ForeGround The foreground color of the string being printed. This is
1148 an optional parameter that may be NULL. If it is NULL,
1149 then the foreground color of the current ConOut device
1150 in the EFI_SYSTEM_TABLE is used.
1151 @param BackGround The background color of the string being printed. This is
1152 an optional parameter that may be NULL. If it is NULL,
1153 then the background color of the current ConOut device
1154 in the EFI_SYSTEM_TABLE is used.
1155 @param Format Null-terminated ASCII format string. See Print Library
1156 for the supported format string syntax.
1157 @param ... Variable argument list whose contents are accessed based on
1158 the format string specified by Format.
1159
1160 @return The number of ASCII characters printed.
1161
1162 **/
1163 UINTN
1164 EFIAPI
1165 AsciiPrintXY (
1166 IN UINTN PointX,
1167 IN UINTN PointY,
1168 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
1169 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
1170 IN CONST CHAR8 *Format,
1171 ...
1172 );
1173
1174 /**
1175 Installs and completes the initialization of a Driver Binding Protocol instance.
1176
1177 Installs the Driver Binding Protocol specified by DriverBinding onto the handle
1178 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding
1179 is installed onto a newly created handle. DriverBindingHandle is typically the same
1180 as the driver's ImageHandle, but it can be different if the driver produces multiple
1181 Driver Binding Protocols.
1182 If DriverBinding is NULL, then ASSERT().
1183 If DriverBinding can not be installed onto a handle, then ASSERT().
1184
1185 @param ImageHandle The image handle of the driver.
1186 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1187 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1188 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1189 parameter is NULL, then a new handle is created.
1190
1191 @retval EFI_SUCCESS The protocol installation is completed successfully.
1192 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
1193 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1194
1195 **/
1196 EFI_STATUS
1197 EFIAPI
1198 EfiLibInstallDriverBinding (
1199 IN CONST EFI_HANDLE ImageHandle,
1200 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1201 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1202 IN EFI_HANDLE DriverBindingHandle
1203 );
1204
1205
1206 /**
1207 Installs and completes the initialization of a Driver Binding Protocol instance and
1208 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
1209
1210 Initializes a driver by installing the Driver Binding Protocol together with the
1211 optional Component Name, optional Driver Configure and optional Driver Diagnostic
1212 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,
1213 then the protocols are installed onto a newly created handle. DriverBindingHandle
1214 is typically the same as the driver's ImageHandle, but it can be different if the
1215 driver produces multiple Driver Binding Protocols.
1216 If DriverBinding is NULL, then ASSERT().
1217 If the installation fails, then ASSERT().
1218
1219 @param ImageHandle The image handle of the driver.
1220 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1221 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1222 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1223 parameter is NULL, then a new handle is created.
1224 @param ComponentName A Component Name Protocol instance that this driver is producing.
1225 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1226 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1227
1228 @retval EFI_SUCCESS The protocol installation is completed successfully.
1229 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1230
1231 **/
1232 EFI_STATUS
1233 EFIAPI
1234 EfiLibInstallAllDriverProtocols (
1235 IN CONST EFI_HANDLE ImageHandle,
1236 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1237 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1238 IN EFI_HANDLE DriverBindingHandle,
1239 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1240 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1241 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
1242 );
1243
1244
1245
1246 /**
1247 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
1248
1249 Initializes a driver by installing the Driver Binding Protocol together with the
1250 optional Component Name and optional Component Name 2 protocols onto the driver's
1251 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed
1252 onto a newly created handle. DriverBindingHandle is typically the same as the driver's
1253 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
1254 If DriverBinding is NULL, then ASSERT().
1255 If the installation fails, then ASSERT().
1256
1257 @param ImageHandle The image handle of the driver.
1258 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1259 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1260 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1261 parameter is NULL, then a new handle is created.
1262 @param ComponentName A Component Name Protocol instance that this driver is producing.
1263 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1264
1265 @retval EFI_SUCCESS The protocol installation is completed successfully.
1266 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1267
1268 **/
1269 EFI_STATUS
1270 EFIAPI
1271 EfiLibInstallDriverBindingComponentName2 (
1272 IN CONST EFI_HANDLE ImageHandle,
1273 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1274 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1275 IN EFI_HANDLE DriverBindingHandle,
1276 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1277 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
1278 );
1279
1280
1281 /**
1282 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
1283 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
1284
1285 Initializes a driver by installing the Driver Binding Protocol together with the optional
1286 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,
1287 optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.
1288 DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver
1289 produces multiple Driver Binding Protocols.
1290 If DriverBinding is NULL, then ASSERT().
1291 If the installation fails, then ASSERT().
1292
1293
1294 @param ImageHandle The image handle of the driver.
1295 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1296 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1297 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1298 parameter is NULL, then a new handle is created.
1299 @param ComponentName A Component Name Protocol instance that this driver is producing.
1300 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1301 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1302 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
1303 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1304 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
1305
1306 @retval EFI_SUCCESS The protocol installation is completed successfully.
1307 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1308
1309 **/
1310 EFI_STATUS
1311 EFIAPI
1312 EfiLibInstallAllDriverProtocols2 (
1313 IN CONST EFI_HANDLE ImageHandle,
1314 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1315 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1316 IN EFI_HANDLE DriverBindingHandle,
1317 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1318 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
1319 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1320 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
1321 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
1322 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
1323 );
1324
1325 #endif