]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UefiLib.h
f097949629b93d4e25a38bba816352694f1df80e
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
1 /** @file
2 MDE UEFI library functions and macros
3
4 Copyright (c) 2006 - 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __UEFI_LIB_H__
16 #define __UEFI_LIB_H__
17
18 #include <Protocol/DriverBinding.h>
19 #include <Protocol/DriverConfiguration.h>
20 #include <Protocol/ComponentName.h>
21 #include <Protocol/ComponentName2.h>
22 #include <Protocol/DriverDiagnostics.h>
23 #include <Protocol/DriverDiagnostics2.h>
24
25 //
26 // Unicode String Table
27 //
28 typedef struct {
29 CHAR8 *Language;
30 CHAR16 *UnicodeString;
31 } EFI_UNICODE_STRING_TABLE;
32
33 //
34 // EFI Lock Status
35 //
36 typedef enum {
37 EfiLockUninitialized = 0,
38 EfiLockReleased = 1,
39 EfiLockAcquired = 2
40 } EFI_LOCK_STATE;
41
42 //
43 // EFI Lock
44 //
45 typedef struct {
46 EFI_TPL Tpl;
47 EFI_TPL OwnerTpl;
48 EFI_LOCK_STATE Lock;
49 } EFI_LOCK;
50
51
52 /**
53 This function searches the list of configuration tables stored in the EFI System
54 Table for a table with a GUID that matches TableGuid. If a match is found,
55 then a pointer to the configuration table is returned in Table, and EFI_SUCCESS
56 is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.
57
58 @param TableGuid Pointer to table's GUID type..
59 @param Table Pointer to the table associated with TableGuid in the EFI System Table.
60
61 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
62 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
63
64 **/
65 EFI_STATUS
66 EFIAPI
67 EfiGetSystemConfigurationTable (
68 IN EFI_GUID *TableGuid,
69 OUT VOID **Table
70 );
71
72 /**
73 This function causes the notification function to be executed for every protocol
74 of type ProtocolGuid instance that exists in the system when this function is
75 invoked. In addition, every time a protocol of type ProtocolGuid instance is
76 installed or reinstalled, the notification function is also executed.
77
78 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
79 @param NotifyTpl Supplies the task priority level of the event notifications.
80 @param NotifyFunction Supplies the function to notify when the event is signaled.
81 @param NotifyContext The context parameter to pass to NotifyFunction.
82 @param Registration A pointer to a memory location to receive the registration value.
83
84 @return The notification event that was created.
85
86 **/
87 EFI_EVENT
88 EFIAPI
89 EfiCreateProtocolNotifyEvent(
90 IN EFI_GUID *ProtocolGuid,
91 IN EFI_TPL NotifyTpl,
92 IN EFI_EVENT_NOTIFY NotifyFunction,
93 IN VOID *NotifyContext, OPTIONAL
94 OUT VOID **Registration
95 );
96
97 /**
98 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
99 This event is signaled with EfiNamedEventSignal(). This provide the ability for
100 one or more listeners on the same event named by the GUID specified by Name.
101
102 @param Name Supplies GUID name of the event.
103 @param NotifyTpl Supplies the task priority level of the event notifications.
104 @param NotifyFunction Supplies the function to notify when the event is signaled.
105 @param NotifyContext The context parameter to pass to NotifyFunction.
106 @param Registration A pointer to a memory location to receive the registration value.
107
108 @retval EFI_SUCCESS A named event was created.
109 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
110
111 **/
112 EFI_STATUS
113 EFIAPI
114 EfiNamedEventListen (
115 IN CONST EFI_GUID *Name,
116 IN EFI_TPL NotifyTpl,
117 IN EFI_EVENT_NOTIFY NotifyFunction,
118 IN CONST VOID *NotifyContext, OPTIONAL
119 OUT VOID *Registration OPTIONAL
120 );
121
122 /**
123 This function signals the named event specified by Name. The named event must
124 have been created with EfiNamedEventListen().
125
126 @param Name Supplies GUID name of the event.
127
128 @retval EFI_SUCCESS A named event was signaled.
129 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
130
131 **/
132 EFI_STATUS
133 EFIAPI
134 EfiNamedEventSignal (
135 IN CONST EFI_GUID *Name
136 );
137
138 /**
139 Returns the current TPL.
140
141 This function returns the current TPL. There is no EFI service to directly
142 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
143 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
144 can then immediately be restored back to the current TPL level with a call
145 to RestoreTPL().
146
147 @param VOID
148
149 @retvale EFI_TPL The current TPL.
150
151 **/
152 EFI_TPL
153 EFIAPI
154 EfiGetCurrentTpl (
155 VOID
156 );
157
158 /**
159 This function initializes a basic mutual exclusion lock to the released state
160 and returns the lock. Each lock provides mutual exclusion access at its task
161 priority level. Since there is no preemption or multiprocessor support in EFI,
162 acquiring the lock only consists of raising to the locks TPL.
163
164 @param Lock A pointer to the lock data structure to initialize.
165 @param Priority EFI TPL associated with the lock.
166
167 @return The lock.
168
169 **/
170 EFI_LOCK *
171 EFIAPI
172 EfiInitializeLock (
173 IN OUT EFI_LOCK *Lock,
174 IN EFI_TPL Priority
175 );
176
177 /**
178 This macro initializes the contents of a basic mutual exclusion lock to the
179 released state. Each lock provides mutual exclusion access at its task
180 priority level. Since there is no preemption or multiprocessor support in EFI,
181 acquiring the lock only consists of raising to the locks TPL.
182
183 @param Lock A pointer to the lock data structure to initialize.
184 @param Priority The task priority level of the lock.
185
186 @return The lock.
187
188 **/
189 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
190 {Priority, TPL_APPLICATION, EfiLockReleased }
191
192
193 /**
194
195 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
196
197 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
198 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
199 is not in the locked state, then DebugAssert() is called passing in the source
200 filename, source line number, and Lock.
201
202 If Lock is NULL, then ASSERT().
203
204 @param LockParameter A pointer to the lock to acquire.
205
206 **/
207 #define ASSERT_LOCKED(LockParameter) \
208 do { \
209 if (DebugAssertEnabled ()) { \
210 ASSERT (LockParameter != NULL); \
211 if ((LockParameter)->Lock != EfiLockAcquired) { \
212 _ASSERT (LockParameter not locked); \
213 } \
214 } \
215 } while (FALSE)
216
217
218 /**
219 This function raises the system's current task priority level to the task
220 priority level of the mutual exclusion lock. Then, it places the lock in the
221 acquired state.
222
223 @param Priority The task priority level of the lock.
224
225 **/
226 VOID
227 EFIAPI
228 EfiAcquireLock (
229 IN EFI_LOCK *Lock
230 );
231
232 /**
233 This function raises the system's current task priority level to the task
234 priority level of the mutual exclusion lock. Then, it attempts to place the
235 lock in the acquired state.
236
237 @param Lock A pointer to the lock to acquire.
238
239 @retval EFI_SUCCESS The lock was acquired.
240 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
241
242 **/
243 EFI_STATUS
244 EFIAPI
245 EfiAcquireLockOrFail (
246 IN EFI_LOCK *Lock
247 );
248
249 /**
250 This function transitions a mutual exclusion lock from the acquired state to
251 the released state, and restores the system's task priority level to its
252 previous level.
253
254 @param Lock A pointer to the lock to release.
255
256 **/
257 VOID
258 EFIAPI
259 EfiReleaseLock (
260 IN EFI_LOCK *Lock
261 );
262
263 /**
264 Tests whether a controller handle is being managed by a specific driver.
265
266 This function tests whether the driver specified by DriverBindingHandle is
267 currently managing the controller specified by ControllerHandle. This test
268 is performed by evaluating if the the protocol specified by ProtocolGuid is
269 present on ControllerHandle and is was opened by DriverBindingHandle with an
270 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
271 If ProtocolGuid is NULL, then ASSERT().
272
273 @param ControllerHandle A handle for a controller to test.
274 @param DriverBindingHandle Specifies the driver binding handle for the
275 driver.
276 @param ProtocolGuid Specifies the protocol that the driver specified
277 by DriverBindingHandle opens in its Start()
278 function.
279
280 @retval EFI_SUCCESS ControllerHandle is managed by the driver
281 specifed by DriverBindingHandle.
282 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
283 specifed by DriverBindingHandle.
284
285 **/
286 EFI_STATUS
287 EFIAPI
288 EfiTestManagedDevice (
289 IN CONST EFI_HANDLE ControllerHandle,
290 IN CONST EFI_HANDLE DriverBindingHandle,
291 IN CONST EFI_GUID *ProtocolGuid
292 );
293
294 /**
295 Tests whether a child handle is a child device of the controller.
296
297 This function tests whether ChildHandle is one of the children of
298 ControllerHandle. This test is performed by checking to see if the protocol
299 specified by ProtocolGuid is present on ControllerHandle and opened by
300 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
301 If ProtocolGuid is NULL, then ASSERT().
302
303 @param ControllerHandle A handle for a (parent) controller to test.
304 @param ChildHandle A child handle to test.
305 @param ConsumsedGuid Supplies the protocol that the child controller
306 opens on its parent controller.
307
308 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
309 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
310 ControllerHandle.
311
312 **/
313 EFI_STATUS
314 EFIAPI
315 EfiTestChildHandle (
316 IN CONST EFI_HANDLE ControllerHandle,
317 IN CONST EFI_HANDLE ChildHandle,
318 IN CONST EFI_GUID *ProtocolGuid
319 );
320
321 /**
322 This function looks up a Unicode string in UnicodeStringTable. If Language is
323 a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable
324 that matches the language code specified by Language, then it is returned in
325 UnicodeString.
326
327 @param Language A pointer to the ISO 639-2 language code for the
328 Unicode string to look up and return.
329 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
330 that the Unicode string table supports. Language
331 must be a member of this set.
332 @param UnicodeStringTable A pointer to the table of Unicode strings.
333 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
334 that matches the language specified by Language.
335
336 @retval EFI_SUCCESS The Unicode string that matches the language
337 specified by Language was found
338 in the table of Unicoide strings UnicodeStringTable,
339 and it was returned in UnicodeString.
340 @retval EFI_INVALID_PARAMETER Language is NULL.
341 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
342 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
343 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
344 @retval EFI_UNSUPPORTED The language specified by Language is not a
345 member of SupportedLanguages.
346 @retval EFI_UNSUPPORTED The language specified by Language is not
347 supported by UnicodeStringTable.
348
349 **/
350 EFI_STATUS
351 EFIAPI
352 LookupUnicodeString (
353 IN CONST CHAR8 *Language,
354 IN CONST CHAR8 *SupportedLanguages,
355 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
356 OUT CHAR16 **UnicodeString
357 );
358
359 /**
360 This function looks up a Unicode string in UnicodeStringTable.
361 If Language is a member of SupportedLanguages and a Unicode
362 string is found in UnicodeStringTable that matches the
363 language code specified by Language, then it is returned in
364 UnicodeString.
365
366 @param Language A pointer to the ISO 639-2 or
367 RFC 3066 language code for the
368 Unicode string to look up and
369 return.
370
371 @param SupportedLanguages A pointer to the set of ISO
372 639-2 or RFC 3066 language
373 codes that the Unicode string
374 table supports. Language must
375 be a member of this set.
376
377 @param UnicodeStringTable A pointer to the table of
378 Unicode strings.
379
380 @param UnicodeString A pointer to the Unicode
381 string from UnicodeStringTable
382 that matches the language
383 specified by Language.
384
385 @param Iso639Language Specify the language code
386 format supported. If true,
387 then the format follow ISO
388 639-2. If false, then it
389 follows RFC3066.
390
391 @retval EFI_SUCCESS The Unicode string that
392 matches the language specified
393 by Language was found in the
394 table of Unicoide strings
395 UnicodeStringTable, and it was
396 returned in UnicodeString.
397
398 @retval EFI_INVALID_PARAMETER Language is NULL.
399
400 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
401
402 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
403
404 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
405
406 @retval EFI_UNSUPPORTED The language specified by
407 Language is not a member
408 ofSupportedLanguages.
409
410 @retval EFI_UNSUPPORTED The language specified by
411 Language is not supported by
412 UnicodeStringTable.
413
414 **/
415 EFI_STATUS
416 EFIAPI
417 LookupUnicodeString2 (
418 IN CONST CHAR8 *Language,
419 IN CONST CHAR8 *SupportedLanguages,
420 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
421 OUT CHAR16 **UnicodeString,
422 IN BOOLEAN Iso639Language
423 )
424 ;
425
426 /**
427 This function adds a Unicode string to UnicodeStringTable.
428 If Language is a member of SupportedLanguages then UnicodeString is added to
429 UnicodeStringTable. New buffers are allocated for both Language and
430 UnicodeString. The contents of Language and UnicodeString are copied into
431 these new buffers. These buffers are automatically freed when
432 FreeUnicodeStringTable() is called.
433
434 @param Language A pointer to the ISO 639-2 language code for the Unicode
435 string to add.
436 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
437 that the Unicode string table supports.
438 Language must be a member of this set.
439 @param UnicodeStringTable A pointer to the table of Unicode strings.
440 @param UnicodeString A pointer to the Unicode string to add.
441
442 @retval EFI_SUCCESS The Unicode string that matches the language
443 specified by Language was found in the table of
444 Unicode strings UnicodeStringTable, and it was
445 returned in UnicodeString.
446 @retval EFI_INVALID_PARAMETER Language is NULL.
447 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
448 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
449 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
450 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
451 already present in UnicodeStringTable.
452 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
453 Unicode string to UnicodeStringTable.
454 @retval EFI_UNSUPPORTED The language specified by Language is not a
455 member of SupportedLanguages.
456
457 **/
458 EFI_STATUS
459 EFIAPI
460 AddUnicodeString (
461 IN CONST CHAR8 *Language,
462 IN CONST CHAR8 *SupportedLanguages,
463 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
464 IN CONST CHAR16 *UnicodeString
465 );
466
467 /**
468
469 This function adds a Unicode string to UnicodeStringTable.
470 If Language is a member of SupportedLanguages then
471 UnicodeString is added to UnicodeStringTable. New buffers are
472 allocated for both Language and UnicodeString. The contents
473 of Language and UnicodeString are copied into these new
474 buffers. These buffers are automatically freed when
475 FreeUnicodeStringTable() is called.
476
477 @param Language A pointer to the ISO 639-2 or
478 RFC 3066 language code for the
479 Unicode string to add.
480
481 @param SupportedLanguages A pointer to the set of ISO
482 639-2 or RFC 3.66 language
483 codes that the Unicode string
484 table supports. Language must
485 be a member of this set.
486
487 @param UnicodeStringTable A pointer to the table of
488 Unicode strings.
489
490 @param UnicodeString A pointer to the Unicode
491 string to add.
492
493 @param Iso639Language Specify the language code
494 format supported. If true,
495 then the format follow ISO
496 639-2. If false, then it
497 follows RFC3066.
498
499 @retval EFI_SUCCESS The Unicode string that
500 matches the language specified
501 by Language was found in the
502 table of Unicode strings
503 UnicodeStringTable, and it was
504 returned in UnicodeString.
505
506 @retval EFI_INVALID_PARAMETER Language is NULL.
507
508 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
509
510 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
511
512 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
513
514 @retval EFI_ALREADY_STARTED A Unicode string with language
515 Language is already present in
516 UnicodeStringTable.
517
518 @retval EFI_OUT_OF_RESOURCES There is not enough memory to
519 add another Unicode string to
520 UnicodeStringTable.
521
522 @retval EFI_UNSUPPORTED The language specified by
523 Language is not a member of
524 SupportedLanguages.
525
526 **/
527 EFI_STATUS
528 EFIAPI
529 AddUnicodeString2 (
530 IN CONST CHAR8 *Language,
531 IN CONST CHAR8 *SupportedLanguages,
532 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
533 IN CONST CHAR16 *UnicodeString,
534 IN BOOLEAN Iso639Language
535 )
536 ;
537
538 /**
539 This function frees the table of Unicode strings in UnicodeStringTable.
540 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
541 Otherwise, each language code, and each Unicode string in the Unicode string
542 table are freed, and EFI_SUCCESS is returned.
543
544 @param UnicodeStringTable A pointer to the table of Unicode strings.
545
546 @retval EFI_SUCCESS The Unicode string table was freed.
547
548 **/
549 EFI_STATUS
550 EFIAPI
551 FreeUnicodeStringTable (
552 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
553 );
554
555 /**
556 This function computes and returns the width of the Unicode character
557 specified by UnicodeChar.
558
559 @param UnicodeChar A Unicode character.
560
561 @retval 0 The width if UnicodeChar could not be determined.
562 @retval 1 UnicodeChar is a narrow glyph.
563 @retval 2 UnicodeChar is a wide glyph.
564
565 **/
566 UINTN
567 EFIAPI
568 GetGlyphWidth (
569 IN CHAR16 UnicodeChar
570 );
571
572 /**
573 This function computes and returns the display length of
574 the Null-terminated Unicode string specified by String.
575 If String is NULL, then 0 is returned.
576 If any of the widths of the Unicode characters in String
577 can not be determined, then 0 is returned.
578
579 @param String A pointer to a Null-terminated Unicode string.
580
581 @return The display length of the Null-terminated Unicode string specified by String.
582
583 **/
584 UINTN
585 EFIAPI
586 UnicodeStringDisplayLength (
587 IN CONST CHAR16 *String
588 );
589
590 //
591 // Functions that abstract early Framework contamination of UEFI.
592 //
593 /**
594 Signal a Ready to Boot Event.
595
596 Create a Ready to Boot Event. Signal it and close it. This causes other
597 events of the same event group to be signaled in other modules.
598
599 **/
600 VOID
601 EFIAPI
602 EfiSignalEventReadyToBoot (
603 VOID
604 );
605
606 /**
607 Signal a Legacy Boot Event.
608
609 Create a legacy Boot Event. Signal it and close it. This causes other
610 events of the same event group to be signaled in other modules.
611
612 **/
613 VOID
614 EFIAPI
615 EfiSignalEventLegacyBoot (
616 VOID
617 );
618
619 /**
620 Create a Legacy Boot Event.
621
622 Tiano extended the CreateEvent Type enum to add a legacy boot event type.
623 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
624 added and now it's possible to not voilate the UEFI specification by
625 declaring a GUID for the legacy boot event class. This library supports
626 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
627 work both ways.
628
629 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
630
631 @retval EFI_SUCCESS Event was created.
632 @retval Other Event was not created.
633
634 **/
635 EFI_STATUS
636 EFIAPI
637 EfiCreateEventLegacyBoot (
638 OUT EFI_EVENT *LegacyBootEvent
639 );
640
641 /**
642 Create an EFI event in the Legacy Boot Event Group and allows
643 the caller to specify a notification function.
644
645 This function abstracts the creation of the Legacy Boot Event.
646 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
647 This library abstracts the caller from how this event is created to prevent
648 to code form having to change with the version of the specification supported.
649 If LegacyBootEvent is NULL, then ASSERT().
650
651 @param NotifyTpl The task priority level of the event.
652 @param NotifyFunction The notification function to call when the event is signaled.
653 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
654 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
655
656 @retval EFI_SUCCESS Event was created.
657 @retval Other Event was not created.
658
659 **/
660 EFI_STATUS
661 EFIAPI
662 EfiCreateEventLegacyBootEx (
663 IN EFI_TPL NotifyTpl,
664 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
665 IN VOID *NotifyContext, OPTIONAL
666 OUT EFI_EVENT *LegacyBootEvent
667 );
668
669 /**
670 Create a Read to Boot Event.
671
672 Tiano extended the CreateEvent Type enum to add a ready to boot event type.
673 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
674 added and now it's possible to not voilate the UEFI specification and use
675 the ready to boot event class defined in UEFI 2.0. This library supports
676 the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to
677 work both ways.
678
679 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
680
681 @retval EFI_SUCCESS Event was created.
682 @retval Other Event was not created.
683
684 **/
685 EFI_STATUS
686 EFIAPI
687 EfiCreateEventReadyToBoot (
688 OUT EFI_EVENT *ReadyToBootEvent
689 );
690
691 /**
692 Create an EFI event in the Ready To Boot Event Group and allows
693 the caller to specify a notification function.
694
695 This function abstracts the creation of the Ready to Boot Event.
696 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
697 This library abstracts the caller from how this event is created to prevent
698 to code form having to change with the version of the specification supported.
699 If ReadyToBootEvent is NULL, then ASSERT().
700
701 @param NotifyTpl The task priority level of the event.
702 @param NotifyFunction The notification function to call when the event is signaled.
703 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
704 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
705
706 @retval EFI_SUCCESS Event was created.
707 @retval Other Event was not created.
708
709 **/
710 EFI_STATUS
711 EFIAPI
712 EfiCreateEventReadyToBootEx (
713 IN EFI_TPL NotifyTpl,
714 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
715 IN VOID *NotifyContext, OPTIONAL
716 OUT EFI_EVENT *ReadyToBootEvent
717 );
718
719 /**
720 Initialize a Firmware Volume (FV) Media Device Path node.
721
722 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
723 so as we move to UEFI 2.0 support we must use a mechanism that conforms with
724 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
725 device path is defined for Tiano extensions of device path. If the code
726 is compiled to conform with the UEFI 2.0 specification use the new device path
727 else use the old form for backwards compatability.
728
729 @param FvDevicePathNode Pointer to a FV device path node to initialize
730 @param NameGuid FV file name to use in FvDevicePathNode
731
732 **/
733 VOID
734 EFIAPI
735 EfiInitializeFwVolDevicepathNode (
736 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
737 IN CONST EFI_GUID *NameGuid
738 );
739
740 /**
741 Check to see if the Firmware Volume (FV) Media Device Path is valid
742
743 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
744 so as we move to UEFI 2.0 support we must use a mechanism that conforms with
745 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
746 device path is defined for Tiano extensions of device path. If the code
747 is compiled to conform with the UEFI 2.0 specification use the new device path
748 else use the old form for backwards compatability. The return value to this
749 function points to a location in FvDevicePathNode and it does not allocate
750 new memory for the GUID pointer that is returned.
751
752 @param FvDevicePathNode Pointer to FV device path to check.
753
754 @retval NULL FvDevicePathNode is not valid.
755 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
756
757 **/
758 EFI_GUID *
759 EFIAPI
760 EfiGetNameGuidFromFwVolDevicePathNode (
761 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
762 );
763
764 /**
765 Prints a formatted Unicode string to the console output device specified by
766 ConOut defined in the EFI_SYSTEM_TABLE.
767
768 This function prints a formatted Unicode string to the console output device
769 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
770 characters that printed to ConOut. If the length of the formatted Unicode
771 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
772 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
773
774 @param Format Null-terminated Unicode format string.
775 @param ... VARARG list consumed to process Format.
776 If Format is NULL, then ASSERT().
777 If Format is not aligned on a 16-bit boundary, then ASSERT().
778
779 **/
780 UINTN
781 EFIAPI
782 Print (
783 IN CONST CHAR16 *Format,
784 ...
785 );
786
787 /**
788 Prints a formatted Unicode string to the console output device specified by
789 StdErr defined in the EFI_SYSTEM_TABLE.
790
791 This function prints a formatted Unicode string to the console output device
792 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
793 characters that printed to StdErr. If the length of the formatted Unicode
794 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
795 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
796
797 @param Format Null-terminated Unicode format string.
798 @param ... VARARG list consumed to process Format.
799 If Format is NULL, then ASSERT().
800 If Format is not aligned on a 16-bit boundary, then ASSERT().
801
802 **/
803 UINTN
804 EFIAPI
805 ErrorPrint (
806 IN CONST CHAR16 *Format,
807 ...
808 );
809
810 /**
811 Prints a formatted ASCII string to the console output device specified by
812 ConOut defined in the EFI_SYSTEM_TABLE.
813
814 This function prints a formatted ASCII string to the console output device
815 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
816 characters that printed to ConOut. If the length of the formatted ASCII
817 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
818 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
819
820 @param Format Null-terminated ASCII format string.
821 @param ... VARARG list consumed to process Format.
822 If Format is NULL, then ASSERT().
823 If Format is not aligned on a 16-bit boundary, then ASSERT().
824
825 **/
826 UINTN
827 EFIAPI
828 AsciiPrint (
829 IN CONST CHAR8 *Format,
830 ...
831 );
832
833 /**
834 Prints a formatted ASCII string to the console output device specified by
835 StdErr defined in the EFI_SYSTEM_TABLE.
836
837 This function prints a formatted ASCII string to the console output device
838 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
839 characters that printed to StdErr. If the length of the formatted ASCII
840 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
841 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
842
843 @param Format Null-terminated ASCII format string.
844 @param ... VARARG list consumed to process Format.
845 If Format is NULL, then ASSERT().
846 If Format is not aligned on a 16-bit boundary, then ASSERT().
847
848 **/
849 UINTN
850 EFIAPI
851 AsciiErrorPrint (
852 IN CONST CHAR8 *Format,
853 ...
854 );
855
856 /**
857 Intialize a driver by installing the Driver Binding Protocol onto the driver's
858 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but
859 it can be different if the driver produces multiple DriverBinding Protocols.
860 If the Drvier Binding Protocol interface is NULL, then ASSERT ().
861 If the installation fails, then ASSERT ().
862
863 @param ImageHandle The image handle of the driver.
864 @param SystemTable The EFI System Table that was passed to the driver's entry point.
865 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
866 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
867 parameter is NULL, then a new handle is created.
868
869 @retval EFI_SUCCESS The protocol installation is completed successfully.
870 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
871
872 **/
873 EFI_STATUS
874 EFIAPI
875 EfiLibInstallDriverBinding (
876 IN CONST EFI_HANDLE ImageHandle,
877 IN CONST EFI_SYSTEM_TABLE *SystemTable,
878 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
879 IN EFI_HANDLE DriverBindingHandle
880 );
881
882
883 /**
884 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,
885 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is
886 typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple
887 DriverBinding Protocols.
888 If the Drvier Binding Protocol interface is NULL, then ASSERT ().
889 If the installation fails, then ASSERT ().
890
891 @param ImageHandle The image handle of the driver.
892 @param SystemTable The EFI System Table that was passed to the driver's entry point.
893 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
894 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
895 parameter is NULL, then a new handle is created.
896 @param ComponentName A Component Name Protocol instance that this driver is producing.
897 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
898 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
899
900 @retval EFI_SUCCESS The protocol installation is completed successfully.
901 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
902
903 **/
904 EFI_STATUS
905 EFIAPI
906 EfiLibInstallAllDriverProtocols (
907 IN CONST EFI_HANDLE ImageHandle,
908 IN CONST EFI_SYSTEM_TABLE *SystemTable,
909 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
910 IN EFI_HANDLE DriverBindingHandle,
911 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
912 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
913 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
914 );
915
916
917
918 /**
919 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,
920 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's
921 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols.
922 If the Drvier Binding Protocol interface is NULL, then ASSERT ().
923 If the installation fails, then ASSERT ().
924
925 @param ImageHandle The image handle of the driver.
926 @param SystemTable The EFI System Table that was passed to the driver's entry point.
927 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
928 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
929 parameter is NULL, then a new handle is created.
930 @param ComponentName A Component Name Protocol instance that this driver is producing.
931 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
932
933 @retval EFI_SUCCESS The protocol installation is completed successfully.
934 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
935
936 **/
937 EFI_STATUS
938 EFIAPI
939 EfiLibInstallDriverBindingComponentName2 (
940 IN CONST EFI_HANDLE ImageHandle,
941 IN CONST EFI_SYSTEM_TABLE *SystemTable,
942 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
943 IN EFI_HANDLE DriverBindingHandle,
944 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
945 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
946 );
947
948
949 /**
950 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,
951 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's
952 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if
953 the driver produces multiple DriverBinding Protocols.
954 If the Drvier Binding Protocol interface is NULL, then ASSERT ().
955 If the installation fails, then ASSERT ().
956
957 @param ImageHandle The image handle of the driver.
958 @param SystemTable The EFI System Table that was passed to the driver's entry point.
959 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
960 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this
961 parameter is NULL, then a new handle is created.
962 @param ComponentName A Component Name Protocol instance that this driver is producing.
963 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
964 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
965 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
966 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
967
968 @retval EFI_SUCCESS The protocol installation is completed successfully.
969 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
970
971 **/
972 EFI_STATUS
973 EFIAPI
974 EfiLibInstallAllDriverProtocols2 (
975 IN CONST EFI_HANDLE ImageHandle,
976 IN CONST EFI_SYSTEM_TABLE *SystemTable,
977 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
978 IN EFI_HANDLE DriverBindingHandle,
979 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
980 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
981 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
982 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
983 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
984 );
985
986 #endif