]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UefiLib.h
MdePkg/UefiLib: Abstract driver model protocol uninstallation
[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 Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention
12 of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
13 defined, then debug and assert related macros wrapped by it are the NULL implementations.
14
15 Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
16 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
17 This program and the accompanying materials are licensed and made available under
18 the terms and conditions of the BSD License that accompanies this distribution.
19 The full text of the license may be found at
20 http://opensource.org/licenses/bsd-license.php.
21
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24
25 **/
26
27 #ifndef __UEFI_LIB_H__
28 #define __UEFI_LIB_H__
29
30 #include <IndustryStandard/Acpi.h>
31
32 #include <Protocol/DriverBinding.h>
33 #include <Protocol/DriverConfiguration.h>
34 #include <Protocol/ComponentName.h>
35 #include <Protocol/ComponentName2.h>
36 #include <Protocol/DriverDiagnostics.h>
37 #include <Protocol/DriverDiagnostics2.h>
38 #include <Protocol/GraphicsOutput.h>
39 #include <Protocol/DevicePath.h>
40 #include <Protocol/SimpleFileSystem.h>
41
42 #include <Library/BaseLib.h>
43
44 ///
45 /// Unicode String Table
46 ///
47 typedef struct {
48 CHAR8 *Language;
49 CHAR16 *UnicodeString;
50 } EFI_UNICODE_STRING_TABLE;
51
52 ///
53 /// EFI Lock Status
54 ///
55 typedef enum {
56 EfiLockUninitialized = 0,
57 EfiLockReleased = 1,
58 EfiLockAcquired = 2
59 } EFI_LOCK_STATE;
60
61 ///
62 /// EFI Lock
63 ///
64 typedef struct {
65 EFI_TPL Tpl;
66 EFI_TPL OwnerTpl;
67 EFI_LOCK_STATE Lock;
68 } EFI_LOCK;
69
70 /**
71 Macro that returns the number of 100 ns units for a specified number of microseconds.
72 This is useful for managing EFI timer events.
73
74 @param Microseconds The number of microseconds.
75
76 @return The number of 100 ns units equivalent to the number of microseconds specified
77 by Microseconds.
78
79 **/
80 #define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)
81
82 /**
83 Macro that returns the number of 100 ns units for a specified number of milliseconds.
84 This is useful for managing EFI timer events.
85
86 @param Milliseconds The number of milliseconds.
87
88 @return The number of 100 ns units equivalent to the number of milliseconds specified
89 by Milliseconds.
90
91 **/
92 #define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)
93
94 /**
95 Macro that returns the number of 100 ns units for a specified number of seconds.
96 This is useful for managing EFI timer events.
97
98 @param Seconds The number of seconds.
99
100 @return The number of 100 ns units equivalent to the number of seconds specified
101 by Seconds.
102
103 **/
104 #define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)
105
106 /**
107 Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array
108 returned from GetMemoryMap().
109
110 @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR.
111
112 @param Size The size, in bytes, of the current EFI_MEMORY_DESCRIPTOR.
113
114 @return A pointer to the next EFI_MEMORY_DESCRIPTOR.
115
116 **/
117 #define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
118 ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))
119
120 /**
121 Retrieves a pointer to the system configuration table from the EFI System Table
122 based on a specified GUID.
123
124 This function searches the list of configuration tables stored in the EFI System Table
125 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to
126 the configuration table is returned in Table, and EFI_SUCCESS is returned. If a matching GUID
127 is not found, then EFI_NOT_FOUND is returned.
128 If TableGuid is NULL, then ASSERT().
129 If Table is NULL, then ASSERT().
130
131 @param TableGuid The pointer to table's GUID type..
132 @param Table The pointer to the table associated with TableGuid in the EFI System Table.
133
134 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
135 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
136
137 **/
138 EFI_STATUS
139 EFIAPI
140 EfiGetSystemConfigurationTable (
141 IN EFI_GUID *TableGuid,
142 OUT VOID **Table
143 );
144
145 /**
146 Creates and returns a notification event and registers that event with all the protocol
147 instances specified by ProtocolGuid.
148
149 This function causes the notification function to be executed for every protocol of type
150 ProtocolGuid instance that exists in the system when this function is invoked. If there are
151 no instances of ProtocolGuid in the handle database at the time this function is invoked,
152 then the notification function is still executed one time. In addition, every time a protocol
153 of type ProtocolGuid instance is installed or reinstalled, the notification function is also
154 executed. This function returns the notification event that was created.
155 If ProtocolGuid is NULL, then ASSERT().
156 If NotifyTpl is not a legal TPL value, then ASSERT().
157 If NotifyFunction is NULL, then ASSERT().
158 If Registration is NULL, then ASSERT().
159
160
161 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
162 @param NotifyTpl Supplies the task priority level of the event notifications.
163 @param NotifyFunction Supplies the function to notify when the event is signaled.
164 @param NotifyContext The context parameter to pass to NotifyFunction.
165 @param Registration A pointer to a memory location to receive the registration value.
166 This value is passed to LocateHandle() to obtain new handles that
167 have been added that support the ProtocolGuid-specified protocol.
168
169 @return The notification event that was created.
170
171 **/
172 EFI_EVENT
173 EFIAPI
174 EfiCreateProtocolNotifyEvent(
175 IN EFI_GUID *ProtocolGuid,
176 IN EFI_TPL NotifyTpl,
177 IN EFI_EVENT_NOTIFY NotifyFunction,
178 IN VOID *NotifyContext, OPTIONAL
179 OUT VOID **Registration
180 );
181
182 /**
183 Creates a named event that can be signaled with EfiNamedEventSignal().
184
185 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
186 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more
187 listeners on the same event named by the GUID specified by Name.
188 If Name is NULL, then ASSERT().
189 If NotifyTpl is not a legal TPL value, then ASSERT().
190 If NotifyFunction is NULL, then ASSERT().
191
192 @param Name Supplies GUID name of the event.
193 @param NotifyTpl Supplies the task priority level of the event notifications.
194 @param NotifyFunction Supplies the function to notify when the event is signaled.
195 @param NotifyContext The context parameter to pass to NotifyFunction.
196 @param Registration A pointer to a memory location to receive the registration value.
197
198 @retval EFI_SUCCESS A named event was created.
199 @retval EFI_OUT_OF_RESOURCES There are not enough resources to create the named event.
200
201 **/
202 EFI_STATUS
203 EFIAPI
204 EfiNamedEventListen (
205 IN CONST EFI_GUID *Name,
206 IN EFI_TPL NotifyTpl,
207 IN EFI_EVENT_NOTIFY NotifyFunction,
208 IN CONST VOID *NotifyContext, OPTIONAL
209 OUT VOID *Registration OPTIONAL
210 );
211
212 /**
213 Signals a named event created with EfiNamedEventListen().
214
215 This function signals the named event specified by Name. The named event must have been
216 created with EfiNamedEventListen().
217 If Name is NULL, then ASSERT().
218
219 @param Name Supplies the GUID name of the event.
220
221 @retval EFI_SUCCESS A named event was signaled.
222 @retval EFI_OUT_OF_RESOURCES There are not enough resources to signal the named event.
223
224 **/
225 EFI_STATUS
226 EFIAPI
227 EfiNamedEventSignal (
228 IN CONST EFI_GUID *Name
229 );
230
231 /**
232 Signals an event group by placing a new event in the group temporarily and
233 signaling it.
234
235 @param[in] EventGroup Supplies the unique identifier of the event
236 group to signal.
237
238 @retval EFI_SUCCESS The event group was signaled successfully.
239 @retval EFI_INVALID_PARAMETER EventGroup is NULL.
240 @return Error codes that report problems about event
241 creation or signaling.
242 **/
243 EFI_STATUS
244 EFIAPI
245 EfiEventGroupSignal (
246 IN CONST EFI_GUID *EventGroup
247 );
248
249 /**
250 An empty function that can be used as NotifyFunction parameter of
251 CreateEvent() or CreateEventEx().
252
253 @param Event Event whose notification function is being invoked.
254 @param Context The pointer to the notification function's context,
255 which is implementation-dependent.
256
257 **/
258 VOID
259 EFIAPI
260 EfiEventEmptyFunction (
261 IN EFI_EVENT Event,
262 IN VOID *Context
263 );
264
265 /**
266 Returns the current TPL.
267
268 This function returns the current TPL. There is no EFI service to directly
269 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
270 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
271 can then immediately be restored back to the current TPL level with a call
272 to RestoreTPL().
273
274 @return The current TPL.
275
276 **/
277 EFI_TPL
278 EFIAPI
279 EfiGetCurrentTpl (
280 VOID
281 );
282
283 /**
284 Initializes a basic mutual exclusion lock.
285
286 This function initializes a basic mutual exclusion lock to the released state
287 and returns the lock. Each lock provides mutual exclusion access at its task
288 priority level. Since there is no preemption or multiprocessor support in EFI,
289 acquiring the lock only consists of raising to the locks TPL.
290 If Lock is NULL, then ASSERT().
291 If Priority is not a valid TPL value, then ASSERT().
292
293 @param Lock A pointer to the lock data structure to initialize.
294 @param Priority The EFI TPL associated with the lock.
295
296 @return The lock.
297
298 **/
299 EFI_LOCK *
300 EFIAPI
301 EfiInitializeLock (
302 IN OUT EFI_LOCK *Lock,
303 IN EFI_TPL Priority
304 );
305
306 /**
307 Initializes a basic mutual exclusion lock.
308
309 This macro initializes the contents of a basic mutual exclusion lock to the
310 released state. Each lock provides mutual exclusion access at its task
311 priority level. Since there is no preemption or multiprocessor support in EFI,
312 acquiring the lock only consists of raising to the locks TPL.
313
314 @param Priority The task priority level of the lock.
315
316 @return The lock.
317
318 **/
319 #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
320 {Priority, TPL_APPLICATION, EfiLockReleased }
321
322
323 /**
324 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
325
326 If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED
327 bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_LOCK
328 structure specified by Lock. If Lock is not in the locked state, then
329 DebugAssert() is called passing in the source filename, source line number,
330 and Lock.
331
332 If Lock is NULL, then ASSERT().
333
334 @param LockParameter A pointer to the lock to acquire.
335
336 **/
337 #if !defined(MDEPKG_NDEBUG)
338 #define ASSERT_LOCKED(LockParameter) \
339 do { \
340 if (DebugAssertEnabled ()) { \
341 ASSERT (LockParameter != NULL); \
342 if ((LockParameter)->Lock != EfiLockAcquired) { \
343 _ASSERT (LockParameter not locked); \
344 } \
345 } \
346 } while (FALSE)
347 #else
348 #define ASSERT_LOCKED(LockParameter)
349 #endif
350
351
352 /**
353 Acquires ownership of a lock.
354
355 This function raises the system's current task priority level to the task
356 priority level of the mutual exclusion lock. Then, it places the lock in the
357 acquired state.
358 If Lock is NULL, then ASSERT().
359 If Lock is not initialized, then ASSERT().
360 If Lock is already in the acquired state, then ASSERT().
361
362 @param Lock A pointer to the lock to acquire.
363
364 **/
365 VOID
366 EFIAPI
367 EfiAcquireLock (
368 IN EFI_LOCK *Lock
369 );
370
371 /**
372 Acquires ownership of a lock.
373
374 This function raises the system's current task priority level to the task priority
375 level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.
376 If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
377 Otherwise, EFI_SUCCESS is returned.
378 If Lock is NULL, then ASSERT().
379 If Lock is not initialized, then ASSERT().
380
381 @param Lock A pointer to the lock to acquire.
382
383 @retval EFI_SUCCESS The lock was acquired.
384 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
385
386 **/
387 EFI_STATUS
388 EFIAPI
389 EfiAcquireLockOrFail (
390 IN EFI_LOCK *Lock
391 );
392
393 /**
394 Releases ownership of a lock.
395
396 This function transitions a mutual exclusion lock from the acquired state to
397 the released state, and restores the system's task priority level to its
398 previous level.
399 If Lock is NULL, then ASSERT().
400 If Lock is not initialized, then ASSERT().
401 If Lock is already in the released state, then ASSERT().
402
403 @param Lock A pointer to the lock to release.
404
405 **/
406 VOID
407 EFIAPI
408 EfiReleaseLock (
409 IN EFI_LOCK *Lock
410 );
411
412 /**
413 Tests whether a controller handle is being managed by a specific driver.
414
415 This function tests whether the driver specified by DriverBindingHandle is
416 currently managing the controller specified by ControllerHandle. This test
417 is performed by evaluating if the the protocol specified by ProtocolGuid is
418 present on ControllerHandle and is was opened by DriverBindingHandle with an
419 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
420 If ProtocolGuid is NULL, then ASSERT().
421
422 @param ControllerHandle A handle for a controller to test.
423 @param DriverBindingHandle Specifies the driver binding handle for the
424 driver.
425 @param ProtocolGuid Specifies the protocol that the driver specified
426 by DriverBindingHandle opens in its Start()
427 function.
428
429 @retval EFI_SUCCESS ControllerHandle is managed by the driver
430 specified by DriverBindingHandle.
431 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
432 specified by DriverBindingHandle.
433
434 **/
435 EFI_STATUS
436 EFIAPI
437 EfiTestManagedDevice (
438 IN CONST EFI_HANDLE ControllerHandle,
439 IN CONST EFI_HANDLE DriverBindingHandle,
440 IN CONST EFI_GUID *ProtocolGuid
441 );
442
443 /**
444 Tests whether a child handle is a child device of the controller.
445
446 This function tests whether ChildHandle is one of the children of
447 ControllerHandle. This test is performed by checking to see if the protocol
448 specified by ProtocolGuid is present on ControllerHandle and opened by
449 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
450 If ProtocolGuid is NULL, then ASSERT().
451
452 @param ControllerHandle A handle for a (parent) controller to test.
453 @param ChildHandle A child handle to test.
454 @param ProtocolGuid Supplies the protocol that the child controller
455 opens on its parent controller.
456
457 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
458 @retval EFI_UNSUPPORTED ChildHandle is not a child of the
459 ControllerHandle.
460
461 **/
462 EFI_STATUS
463 EFIAPI
464 EfiTestChildHandle (
465 IN CONST EFI_HANDLE ControllerHandle,
466 IN CONST EFI_HANDLE ChildHandle,
467 IN CONST EFI_GUID *ProtocolGuid
468 );
469
470 /**
471 This function looks up a Unicode string in UnicodeStringTable.
472
473 If Language is a member of SupportedLanguages and a Unicode string is found in
474 UnicodeStringTable that matches the language code specified by Language, then it
475 is returned in UnicodeString.
476
477 @param Language A pointer to the ISO 639-2 language code for the
478 Unicode string to look up and return.
479 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
480 that the Unicode string table supports. Language
481 must be a member of this set.
482 @param UnicodeStringTable A pointer to the table of Unicode strings.
483 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
484 that matches the language specified by Language.
485
486 @retval EFI_SUCCESS The Unicode string that matches the language
487 specified by Language was found
488 in the table of Unicode strings UnicodeStringTable,
489 and it was returned in UnicodeString.
490 @retval EFI_INVALID_PARAMETER Language is NULL.
491 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
492 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
493 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
494 @retval EFI_UNSUPPORTED The language specified by Language is not a
495 member of SupportedLanguages.
496 @retval EFI_UNSUPPORTED The language specified by Language is not
497 supported by UnicodeStringTable.
498
499 **/
500 EFI_STATUS
501 EFIAPI
502 LookupUnicodeString (
503 IN CONST CHAR8 *Language,
504 IN CONST CHAR8 *SupportedLanguages,
505 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
506 OUT CHAR16 **UnicodeString
507 );
508
509 /**
510 This function looks up a Unicode string in UnicodeStringTable.
511
512 If Language is a member of SupportedLanguages and a Unicode string is found in
513 UnicodeStringTable that matches the language code specified by Language, then
514 it is returned in UnicodeString.
515
516 @param Language A pointer to an ASCII string containing the ISO 639-2 or the
517 RFC 4646 language code for the Unicode string to look up and
518 return. If Iso639Language is TRUE, then this ASCII string is
519 not assumed to be Null-terminated, and only the first three
520 characters are used. If Iso639Language is FALSE, then this ASCII
521 string must be Null-terminated.
522 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a
523 set of ISO 639-2 or RFC 4646 language codes that the Unicode
524 string table supports. Language must be a member of this set.
525 If Iso639Language is TRUE, then this string contains one or more
526 ISO 639-2 language codes with no separator characters. If Iso639Language
527 is FALSE, then is string contains one or more RFC 4646 language
528 codes separated by ';'.
529 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
530 is defined in "Related Definitions".
531 @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable
532 that matches the language specified by Language.
533 @param Iso639Language Specifies the supported language code format. If it is TRUE, then
534 Language and SupportedLanguages follow ISO 639-2 language code format.
535 Otherwise, they follow the RFC 4646 language code format.
536
537
538 @retval EFI_SUCCESS The Unicode string that matches the language specified by Language
539 was found in the table of Unicode strings UnicodeStringTable, and
540 it was returned in UnicodeString.
541 @retval EFI_INVALID_PARAMETER Language is NULL.
542 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
543 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
544 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
545 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
546 @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.
547
548 **/
549 EFI_STATUS
550 EFIAPI
551 LookupUnicodeString2 (
552 IN CONST CHAR8 *Language,
553 IN CONST CHAR8 *SupportedLanguages,
554 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
555 OUT CHAR16 **UnicodeString,
556 IN BOOLEAN Iso639Language
557 );
558
559 /**
560 This function adds a Unicode string to UnicodeStringTable.
561
562 If Language is a member of SupportedLanguages then UnicodeString is added to
563 UnicodeStringTable. New buffers are allocated for both Language and
564 UnicodeString. The contents of Language and UnicodeString are copied into
565 these new buffers. These buffers are automatically freed when
566 FreeUnicodeStringTable() is called.
567
568 @param Language A pointer to the ISO 639-2 language code for the Unicode
569 string to add.
570 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
571 that the Unicode string table supports.
572 Language must be a member of this set.
573 @param UnicodeStringTable A pointer to the table of Unicode strings.
574 @param UnicodeString A pointer to the Unicode string to add.
575
576 @retval EFI_SUCCESS The Unicode string that matches the language
577 specified by Language was found in the table of
578 Unicode strings UnicodeStringTable, and it was
579 returned in UnicodeString.
580 @retval EFI_INVALID_PARAMETER Language is NULL.
581 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
582 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
583 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
584 @retval EFI_ALREADY_STARTED A Unicode string with language Language is
585 already present in UnicodeStringTable.
586 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
587 Unicode string to UnicodeStringTable.
588 @retval EFI_UNSUPPORTED The language specified by Language is not a
589 member of SupportedLanguages.
590
591 **/
592 EFI_STATUS
593 EFIAPI
594 AddUnicodeString (
595 IN CONST CHAR8 *Language,
596 IN CONST CHAR8 *SupportedLanguages,
597 IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
598 IN CONST CHAR16 *UnicodeString
599 );
600
601 /**
602 This function adds the Null-terminated Unicode string specified by UnicodeString
603 to UnicodeStringTable.
604
605 If Language is a member of SupportedLanguages then UnicodeString is added to
606 UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.
607 The contents of Language and UnicodeString are copied into these new buffers.
608 These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.
609
610 @param Language A pointer to an ASCII string containing the ISO 639-2 or
611 the RFC 4646 language code for the Unicode string to add.
612 If Iso639Language is TRUE, then this ASCII string is not
613 assumed to be Null-terminated, and only the first three
614 chacters are used. If Iso639Language is FALSE, then this
615 ASCII string must be Null-terminated.
616 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains
617 a set of ISO 639-2 or RFC 4646 language codes that the Unicode
618 string table supports. Language must be a member of this set.
619 If Iso639Language is TRUE, then this string contains one or more
620 ISO 639-2 language codes with no separator characters.
621 If Iso639Language is FALSE, then is string contains one or more
622 RFC 4646 language codes separated by ';'.
623 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
624 is defined in "Related Definitions".
625 @param UnicodeString A pointer to the Unicode string to add.
626 @param Iso639Language Specifies the supported language code format. If it is TRUE,
627 then Language and SupportedLanguages follow ISO 639-2 language code format.
628 Otherwise, they follow RFC 4646 language code format.
629
630 @retval EFI_SUCCESS The Unicode string that matches the language specified by
631 Language was found in the table of Unicode strings UnicodeStringTable,
632 and it was returned in UnicodeString.
633 @retval EFI_INVALID_PARAMETER Language is NULL.
634 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
635 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
636 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
637 @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in
638 UnicodeStringTable.
639 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.
640 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
641
642 **/
643 EFI_STATUS
644 EFIAPI
645 AddUnicodeString2 (
646 IN CONST CHAR8 *Language,
647 IN CONST CHAR8 *SupportedLanguages,
648 IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
649 IN CONST CHAR16 *UnicodeString,
650 IN BOOLEAN Iso639Language
651 );
652
653 /**
654 This function frees the table of Unicode strings in UnicodeStringTable.
655
656 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
657 Otherwise, each language code, and each Unicode string in the Unicode string
658 table are freed, and EFI_SUCCESS is returned.
659
660 @param UnicodeStringTable A pointer to the table of Unicode strings.
661
662 @retval EFI_SUCCESS The Unicode string table was freed.
663
664 **/
665 EFI_STATUS
666 EFIAPI
667 FreeUnicodeStringTable (
668 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
669 );
670
671 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
672
673 /**
674 [ATTENTION] This function will be deprecated for security reason.
675
676 Returns a pointer to an allocated buffer that contains the contents of a
677 variable retrieved through the UEFI Runtime Service GetVariable(). The
678 returned buffer is allocated using AllocatePool(). The caller is responsible
679 for freeing this buffer with FreePool().
680
681 If Name is NULL, then ASSERT().
682 If Guid is NULL, then ASSERT().
683
684 @param[in] Name The pointer to a Null-terminated Unicode string.
685 @param[in] Guid The pointer to an EFI_GUID structure.
686
687 @retval NULL The variable could not be retrieved.
688 @retval NULL There are not enough resources available for the variable contents.
689 @retval Other A pointer to allocated buffer containing the variable contents.
690
691 **/
692 VOID *
693 EFIAPI
694 GetVariable (
695 IN CONST CHAR16 *Name,
696 IN CONST EFI_GUID *Guid
697 );
698
699 /**
700 [ATTENTION] This function will be deprecated for security reason.
701
702 Returns a pointer to an allocated buffer that contains the contents of a
703 variable retrieved through the UEFI Runtime Service GetVariable(). This
704 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
705 The returned buffer is allocated using AllocatePool(). The caller is
706 responsible for freeing this buffer with FreePool().
707
708 If Name is NULL, then ASSERT().
709
710 @param[in] Name The pointer to a Null-terminated Unicode string.
711
712 @retval NULL The variable could not be retrieved.
713 @retval NULL There are not enough resources available for the variable contents.
714 @retval Other A pointer to allocated buffer containing the variable contents.
715
716 **/
717 VOID *
718 EFIAPI
719 GetEfiGlobalVariable (
720 IN CONST CHAR16 *Name
721 );
722 #endif
723
724
725 /**
726 Returns the status whether get the variable success. The function retrieves
727 variable through the UEFI Runtime Service GetVariable(). The
728 returned buffer is allocated using AllocatePool(). The caller is responsible
729 for freeing this buffer with FreePool().
730
731 If Name is NULL, then ASSERT().
732 If Guid is NULL, then ASSERT().
733 If Value is NULL, then ASSERT().
734
735 @param[in] Name The pointer to a Null-terminated Unicode string.
736 @param[in] Guid The pointer to an EFI_GUID structure
737 @param[out] Value The buffer point saved the variable info.
738 @param[out] Size The buffer size of the variable.
739
740 @return EFI_OUT_OF_RESOURCES Allocate buffer failed.
741 @return EFI_SUCCESS Find the specified variable.
742 @return Others Errors Return errors from call to gRT->GetVariable.
743
744 **/
745 EFI_STATUS
746 EFIAPI
747 GetVariable2 (
748 IN CONST CHAR16 *Name,
749 IN CONST EFI_GUID *Guid,
750 OUT VOID **Value,
751 OUT UINTN *Size OPTIONAL
752 );
753
754 /**
755 Returns a pointer to an allocated buffer that contains the contents of a
756 variable retrieved through the UEFI Runtime Service GetVariable(). This
757 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
758 The returned buffer is allocated using AllocatePool(). The caller is
759 responsible for freeing this buffer with FreePool().
760
761 If Name is NULL, then ASSERT().
762 If Value is NULL, then ASSERT().
763
764 @param[in] Name The pointer to a Null-terminated Unicode string.
765 @param[out] Value The buffer point saved the variable info.
766 @param[out] Size The buffer size of the variable.
767
768 @return EFI_OUT_OF_RESOURCES Allocate buffer failed.
769 @return EFI_SUCCESS Find the specified variable.
770 @return Others Errors Return errors from call to gRT->GetVariable.
771
772 **/
773 EFI_STATUS
774 EFIAPI
775 GetEfiGlobalVariable2 (
776 IN CONST CHAR16 *Name,
777 OUT VOID **Value,
778 OUT UINTN *Size OPTIONAL
779 );
780
781 /**
782 Returns a pointer to an allocated buffer that contains the best matching language
783 from a set of supported languages.
784
785 This function supports both ISO 639-2 and RFC 4646 language codes, but language
786 code types may not be mixed in a single call to this function. The language
787 code returned is allocated using AllocatePool(). The caller is responsible for
788 freeing the allocated buffer using FreePool(). This function supports a variable
789 argument list that allows the caller to pass in a prioritized list of language
790 codes to test against all the language codes in SupportedLanguages.
791
792 If SupportedLanguages is NULL, then ASSERT().
793
794 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
795 contains a set of language codes in the format
796 specified by Iso639Language.
797 @param[in] Iso639Language If not zero, then all language codes are assumed to be
798 in ISO 639-2 format. If zero, then all language
799 codes are assumed to be in RFC 4646 language format
800 @param[in] ... A variable argument list that contains pointers to
801 Null-terminated ASCII strings that contain one or more
802 language codes in the format specified by Iso639Language.
803 The first language code from each of these language
804 code lists is used to determine if it is an exact or
805 close match to any of the language codes in
806 SupportedLanguages. Close matches only apply to RFC 4646
807 language codes, and the matching algorithm from RFC 4647
808 is used to determine if a close match is present. If
809 an exact or close match is found, then the matching
810 language code from SupportedLanguages is returned. If
811 no matches are found, then the next variable argument
812 parameter is evaluated. The variable argument list
813 is terminated by a NULL.
814
815 @retval NULL The best matching language could not be found in SupportedLanguages.
816 @retval NULL There are not enough resources available to return the best matching
817 language.
818 @retval Other A pointer to a Null-terminated ASCII string that is the best matching
819 language in SupportedLanguages.
820
821 **/
822 CHAR8 *
823 EFIAPI
824 GetBestLanguage (
825 IN CONST CHAR8 *SupportedLanguages,
826 IN UINTN Iso639Language,
827 ...
828 );
829
830 /**
831 Draws a dialog box to the console output device specified by
832 ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke
833 from the console input device specified by ConIn defined in the
834 EFI_SYSTEM_TABLE.
835
836 If there are no strings in the variable argument list, then ASSERT().
837 If all the strings in the variable argument list are empty, then ASSERT().
838
839 @param[in] Attribute Specifies the foreground and background color of the popup.
840 @param[out] Key A pointer to the EFI_KEY value of the key that was
841 pressed. This is an optional parameter that may be NULL.
842 If it is NULL then no wait for a keypress will be performed.
843 @param[in] ... The variable argument list that contains pointers to Null-
844 terminated Unicode strings to display in the dialog box.
845 The variable argument list is terminated by a NULL.
846
847 **/
848 VOID
849 EFIAPI
850 CreatePopUp (
851 IN UINTN Attribute,
852 OUT EFI_INPUT_KEY *Key, OPTIONAL
853 ...
854 );
855
856 /**
857 Retrieves the width of a Unicode character.
858
859 This function computes and returns the width of the Unicode character specified
860 by UnicodeChar.
861
862 @param UnicodeChar A Unicode character.
863
864 @retval 0 The width if UnicodeChar could not be determined.
865 @retval 1 UnicodeChar is a narrow glyph.
866 @retval 2 UnicodeChar is a wide glyph.
867
868 **/
869 UINTN
870 EFIAPI
871 GetGlyphWidth (
872 IN CHAR16 UnicodeChar
873 );
874
875 /**
876 Computes the display length of a Null-terminated Unicode String.
877
878 This function computes and returns the display length of the Null-terminated Unicode
879 string specified by String. If String is NULL then 0 is returned. If any of the widths
880 of the Unicode characters in String can not be determined, then 0 is returned. The display
881 width of String can be computed by summing the display widths of each Unicode character
882 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode
883 characters that are width glyphs have a width of 2.
884 If String is not aligned on a 16-bit boundary, then ASSERT().
885
886 @param String A pointer to a Null-terminated Unicode string.
887
888 @return The display length of the Null-terminated Unicode string specified by String.
889
890 **/
891 UINTN
892 EFIAPI
893 UnicodeStringDisplayLength (
894 IN CONST CHAR16 *String
895 );
896
897 //
898 // Functions that abstract early Framework contamination of UEFI.
899 //
900 /**
901 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
902
903 This function abstracts the signaling of the Ready to Boot Event. The Framework moved
904 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller
905 from how this event is created to prevent to code form having to change with the
906 version of the specification supported.
907
908 **/
909 VOID
910 EFIAPI
911 EfiSignalEventReadyToBoot (
912 VOID
913 );
914
915 /**
916 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().
917
918 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from
919 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how
920 this event is created to prevent to code form having to change with the version of the
921 specification supported.
922
923 **/
924 VOID
925 EFIAPI
926 EfiSignalEventLegacyBoot (
927 VOID
928 );
929
930 /**
931 Creates an EFI event in the Legacy Boot Event Group.
932
933 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library
934 abstracts the implementation mechanism of this event from the caller. This function
935 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary
936 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event
937 is created to prevent to code form having to change with the version of the
938 specification supported.
939 If LegacyBootEvent is NULL, then ASSERT().
940
941 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
942
943 @retval EFI_SUCCESS The event was created.
944 @retval Other The event was not created.
945
946 **/
947 EFI_STATUS
948 EFIAPI
949 EfiCreateEventLegacyBoot (
950 OUT EFI_EVENT *LegacyBootEvent
951 );
952
953 /**
954 Create an EFI event in the Legacy Boot Event Group and allows
955 the caller to specify a notification function.
956
957 This function abstracts the creation of the Legacy Boot Event.
958 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
959 This library abstracts the caller from how this event is created to prevent
960 to code form having to change with the version of the specification supported.
961 If LegacyBootEvent is NULL, then ASSERT().
962
963 @param NotifyTpl The task priority level of the event.
964 @param NotifyFunction The notification function to call when the event is signaled.
965 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
966 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
967
968 @retval EFI_SUCCESS The event was created.
969 @retval Other The event was not created.
970
971 **/
972 EFI_STATUS
973 EFIAPI
974 EfiCreateEventLegacyBootEx (
975 IN EFI_TPL NotifyTpl,
976 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
977 IN VOID *NotifyContext, OPTIONAL
978 OUT EFI_EVENT *LegacyBootEvent
979 );
980
981 /**
982 Create an EFI event in the Ready To Boot Event Group.
983
984 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library
985 abstracts the implementation mechanism of this event from the caller.
986 This function abstracts the creation of the Ready to Boot Event. The Framework
987 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts
988 the caller from how this event is created to prevent the code form having to
989 change with the version of the specification supported.
990 If ReadyToBootEvent is NULL, then ASSERT().
991
992 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
993
994 @retval EFI_SUCCESS The event was created.
995 @retval Other The event was not created.
996
997 **/
998 EFI_STATUS
999 EFIAPI
1000 EfiCreateEventReadyToBoot (
1001 OUT EFI_EVENT *ReadyToBootEvent
1002 );
1003
1004 /**
1005 Create an EFI event in the Ready To Boot Event Group and allows
1006 the caller to specify a notification function.
1007
1008 This function abstracts the creation of the Ready to Boot Event.
1009 The Framework moved from a proprietary to UEFI 2.0 based mechanism.
1010 This library abstracts the caller from how this event is created to prevent
1011 to code form having to change with the version of the specification supported.
1012 If ReadyToBootEvent is NULL, then ASSERT().
1013
1014 @param NotifyTpl The task priority level of the event.
1015 @param NotifyFunction The notification function to call when the event is signaled.
1016 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
1017 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
1018
1019 @retval EFI_SUCCESS The event was created.
1020 @retval Other The event was not created.
1021
1022 **/
1023 EFI_STATUS
1024 EFIAPI
1025 EfiCreateEventReadyToBootEx (
1026 IN EFI_TPL NotifyTpl,
1027 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
1028 IN VOID *NotifyContext, OPTIONAL
1029 OUT EFI_EVENT *ReadyToBootEvent
1030 );
1031
1032 /**
1033 Initialize a Firmware Volume (FV) Media Device Path node.
1034
1035 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
1036 This library function abstracts initializing a device path node.
1037 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device
1038 path changed in the DXE CIS version 0.92 in a non back ward compatible way to
1039 not conflict with the UEFI 2.0 specification. This function abstracts the
1040 differences from the caller.
1041 If FvDevicePathNode is NULL, then ASSERT().
1042 If NameGuid is NULL, then ASSERT().
1043
1044 @param FvDevicePathNode The pointer to a FV device path node to initialize
1045 @param NameGuid FV file name to use in FvDevicePathNode
1046
1047 **/
1048 VOID
1049 EFIAPI
1050 EfiInitializeFwVolDevicepathNode (
1051 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
1052 IN CONST EFI_GUID *NameGuid
1053 );
1054
1055 /**
1056 Check to see if the Firmware Volume (FV) Media Device Path is valid
1057
1058 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.
1059 This library function abstracts validating a device path node.
1060 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.
1061 If it is valid, then return the GUID file name from the device path node. Otherwise,
1062 return NULL. This device path changed in the DXE CIS version 0.92 in a non backward
1063 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts
1064 the differences from the caller.
1065 If FvDevicePathNode is NULL, then ASSERT().
1066
1067 @param FvDevicePathNode The pointer to FV device path to check.
1068
1069 @retval NULL FvDevicePathNode is not valid.
1070 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
1071
1072 **/
1073 EFI_GUID *
1074 EFIAPI
1075 EfiGetNameGuidFromFwVolDevicePathNode (
1076 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
1077 );
1078
1079 /**
1080 Prints a formatted Unicode string to the console output device specified by
1081 ConOut defined in the EFI_SYSTEM_TABLE.
1082
1083 This function prints a formatted Unicode string to the console output device
1084 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
1085 characters that printed to ConOut. If the length of the formatted Unicode
1086 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1087 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
1088 If Format is NULL, then ASSERT().
1089 If Format is not aligned on a 16-bit boundary, then ASSERT().
1090 If gST->ConOut is NULL, then ASSERT().
1091
1092 @param Format A null-terminated Unicode format string.
1093 @param ... The variable argument list whose contents are accessed based
1094 on the format string specified by Format.
1095
1096 @return Number of Unicode characters printed to ConOut.
1097
1098 **/
1099 UINTN
1100 EFIAPI
1101 Print (
1102 IN CONST CHAR16 *Format,
1103 ...
1104 );
1105
1106 /**
1107 Prints a formatted Unicode string to the console output device specified by
1108 StdErr defined in the EFI_SYSTEM_TABLE.
1109
1110 This function prints a formatted Unicode string to the console output device
1111 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
1112 characters that printed to StdErr. If the length of the formatted Unicode
1113 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1114 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
1115 If Format is NULL, then ASSERT().
1116 If Format is not aligned on a 16-bit boundary, then ASSERT().
1117 If gST->StdErr is NULL, then ASSERT().
1118
1119 @param Format A null-terminated Unicode format string.
1120 @param ... The variable argument list whose contents are accessed based
1121 on the format string specified by Format.
1122
1123 @return Number of Unicode characters printed to StdErr.
1124
1125 **/
1126 UINTN
1127 EFIAPI
1128 ErrorPrint (
1129 IN CONST CHAR16 *Format,
1130 ...
1131 );
1132
1133 /**
1134 Prints a formatted ASCII string to the console output device specified by
1135 ConOut defined in the EFI_SYSTEM_TABLE.
1136
1137 This function prints a formatted ASCII string to the console output device
1138 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
1139 characters that printed to ConOut. If the length of the formatted ASCII
1140 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1141 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
1142 If Format is NULL, then ASSERT().
1143 If gST->ConOut is NULL, then ASSERT().
1144
1145 @param Format A null-terminated ASCII format string.
1146 @param ... The variable argument list whose contents are accessed based
1147 on the format string specified by Format.
1148
1149 @return Number of ASCII characters printed to ConOut.
1150
1151 **/
1152 UINTN
1153 EFIAPI
1154 AsciiPrint (
1155 IN CONST CHAR8 *Format,
1156 ...
1157 );
1158
1159 /**
1160 Prints a formatted ASCII string to the console output device specified by
1161 StdErr defined in the EFI_SYSTEM_TABLE.
1162
1163 This function prints a formatted ASCII string to the console output device
1164 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
1165 characters that printed to StdErr. If the length of the formatted ASCII
1166 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
1167 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
1168 If Format is NULL, then ASSERT().
1169 If gST->StdErr is NULL, then ASSERT().
1170
1171 @param Format A null-terminated ASCII format string.
1172 @param ... The variable argument list whose contents are accessed based
1173 on the format string specified by Format.
1174
1175 @return Number of ASCII characters printed to ConErr.
1176
1177 **/
1178 UINTN
1179 EFIAPI
1180 AsciiErrorPrint (
1181 IN CONST CHAR8 *Format,
1182 ...
1183 );
1184
1185
1186 /**
1187 Prints a formatted Unicode string to a graphics console device specified by
1188 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
1189
1190 This function prints a formatted Unicode string to the graphics console device
1191 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
1192 Unicode characters displayed, not including partial characters that may be clipped
1193 by the right edge of the display. If the length of the formatted Unicode string is
1194 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
1195 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
1196 is used to convert the string to a bitmap using the glyphs registered with the
1197 HII database. No wrapping is performed, so any portions of the string the fall
1198 outside the active display region will not be displayed.
1199
1200 If a graphics console device is not associated with the ConsoleOutputHandle
1201 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1202 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1203 string is printed, and 0 is returned.
1204 If Format is NULL, then ASSERT().
1205 If Format is not aligned on a 16-bit boundary, then ASSERT().
1206 If gST->ConsoleOutputHandle is NULL, then ASSERT().
1207
1208 @param PointX X coordinate to print the string.
1209 @param PointY Y coordinate to print the string.
1210 @param ForeGround The foreground color of the string being printed. This is
1211 an optional parameter that may be NULL. If it is NULL,
1212 then the foreground color of the current ConOut device
1213 in the EFI_SYSTEM_TABLE is used.
1214 @param BackGround The background color of the string being printed. This is
1215 an optional parameter that may be NULL. If it is NULL,
1216 then the background color of the current ConOut device
1217 in the EFI_SYSTEM_TABLE is used.
1218 @param Format A null-terminated Unicode format string. See Print Library
1219 for the supported format string syntax.
1220 @param ... Variable argument list whose contents are accessed based on
1221 the format string specified by Format.
1222
1223 @return The number of Unicode characters printed.
1224
1225 **/
1226 UINTN
1227 EFIAPI
1228 PrintXY (
1229 IN UINTN PointX,
1230 IN UINTN PointY,
1231 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
1232 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
1233 IN CONST CHAR16 *Format,
1234 ...
1235 );
1236
1237 /**
1238 Prints a formatted ASCII string to a graphics console device specified by
1239 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
1240
1241 This function prints a formatted ASCII string to the graphics console device
1242 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
1243 ASCII characters displayed, not including partial characters that may be clipped
1244 by the right edge of the display. If the length of the formatted ASCII string is
1245 greater than PcdUefiLibMaxPrintBufferSize, then at most the first
1246 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL
1247 is used to convert the string to a bitmap using the glyphs registered with the
1248 HII database. No wrapping is performed, so any portions of the string the fall
1249 outside the active display region will not be displayed.
1250
1251 If a graphics console device is not associated with the ConsoleOutputHandle
1252 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
1253 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
1254 string is printed, and 0 is returned.
1255 If Format is NULL, then ASSERT().
1256 If gST->ConsoleOutputHandle is NULL, then ASSERT().
1257
1258 @param PointX X coordinate to print the string.
1259 @param PointY Y coordinate to print the string.
1260 @param ForeGround The foreground color of the string being printed. This is
1261 an optional parameter that may be NULL. If it is NULL,
1262 then the foreground color of the current ConOut device
1263 in the EFI_SYSTEM_TABLE is used.
1264 @param BackGround The background color of the string being printed. This is
1265 an optional parameter that may be NULL. If it is NULL,
1266 then the background color of the current ConOut device
1267 in the EFI_SYSTEM_TABLE is used.
1268 @param Format A null-terminated ASCII format string. See Print Library
1269 for the supported format string syntax.
1270 @param ... The variable argument list whose contents are accessed based on
1271 the format string specified by Format.
1272
1273 @return The number of ASCII characters printed.
1274
1275 **/
1276 UINTN
1277 EFIAPI
1278 AsciiPrintXY (
1279 IN UINTN PointX,
1280 IN UINTN PointY,
1281 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
1282 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
1283 IN CONST CHAR8 *Format,
1284 ...
1285 );
1286
1287
1288 /**
1289 Installs and completes the initialization of a Driver Binding Protocol instance.
1290
1291 Installs the Driver Binding Protocol specified by DriverBinding onto the handle
1292 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding
1293 is installed onto a newly created handle. DriverBindingHandle is typically the same
1294 as the driver's ImageHandle, but it can be different if the driver produces multiple
1295 Driver Binding Protocols.
1296 If DriverBinding is NULL, then ASSERT().
1297 If DriverBinding can not be installed onto a handle, then ASSERT().
1298
1299 @param ImageHandle The image handle of the driver.
1300 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1301 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1302 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1303 parameter is NULL, then a new handle is created.
1304
1305 @retval EFI_SUCCESS The protocol installation completed successfully.
1306 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
1307 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
1308
1309 **/
1310 EFI_STATUS
1311 EFIAPI
1312 EfiLibInstallDriverBinding (
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 );
1318
1319
1320 /**
1321 Uninstalls a Driver Binding Protocol instance.
1322
1323 If DriverBinding is NULL, then ASSERT().
1324 If DriverBinding can not be uninstalled, then ASSERT().
1325
1326 @param DriverBinding A Driver Binding Protocol instance that this driver produced.
1327
1328 @retval EFI_SUCCESS The protocol uninstallation successfully completed.
1329 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().
1330
1331 **/
1332 EFI_STATUS
1333 EFIAPI
1334 EfiLibUninstallDriverBinding (
1335 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding
1336 );
1337
1338
1339 /**
1340 Installs and completes the initialization of a Driver Binding Protocol instance and
1341 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
1342
1343 Initializes a driver by installing the Driver Binding Protocol together with the
1344 optional Component Name, optional Driver Configure and optional Driver Diagnostic
1345 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,
1346 then the protocols are installed onto a newly created handle. DriverBindingHandle
1347 is typically the same as the driver's ImageHandle, but it can be different if the
1348 driver produces multiple Driver Binding Protocols.
1349 If DriverBinding is NULL, then ASSERT().
1350 If the installation fails, then ASSERT().
1351
1352 @param ImageHandle The image handle of the driver.
1353 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1354 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1355 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1356 parameter is NULL, then a new handle is created.
1357 @param ComponentName A Component Name Protocol instance that this driver is producing.
1358 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1359 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1360
1361 @retval EFI_SUCCESS The protocol installation completed successfully.
1362 @retval EFI_OUT_OF_RESOURCES There was not enough memory in the pool to install all the protocols.
1363
1364 **/
1365 EFI_STATUS
1366 EFIAPI
1367 EfiLibInstallAllDriverProtocols (
1368 IN CONST EFI_HANDLE ImageHandle,
1369 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1370 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1371 IN EFI_HANDLE DriverBindingHandle,
1372 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1373 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1374 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
1375 );
1376
1377
1378 /**
1379 Uninstalls a Driver Binding Protocol instance and optionally uninstalls the
1380 Component Name, Driver Configuration and Driver Diagnostics Protocols.
1381
1382 If DriverBinding is NULL, then ASSERT().
1383 If the uninstallation fails, then ASSERT().
1384
1385 @param DriverBinding A Driver Binding Protocol instance that this driver produced.
1386 @param ComponentName A Component Name Protocol instance that this driver produced.
1387 @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced.
1388 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced.
1389
1390 @retval EFI_SUCCESS The protocol uninstallation successfully completed.
1391 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().
1392
1393 **/
1394 EFI_STATUS
1395 EFIAPI
1396 EfiLibUninstallAllDriverProtocols (
1397 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1398 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1399 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1400 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
1401 );
1402
1403
1404 /**
1405 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
1406
1407 Initializes a driver by installing the Driver Binding Protocol together with the
1408 optional Component Name and optional Component Name 2 protocols onto the driver's
1409 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed
1410 onto a newly created handle. DriverBindingHandle is typically the same as the driver's
1411 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
1412 If DriverBinding is NULL, then ASSERT().
1413 If the installation fails, then ASSERT().
1414
1415 @param ImageHandle The image handle of the driver.
1416 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1417 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1418 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1419 parameter is NULL, then a new handle is created.
1420 @param ComponentName A Component Name Protocol instance that this driver is producing.
1421 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1422
1423 @retval EFI_SUCCESS The protocol installation completed successfully.
1424 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1425
1426 **/
1427 EFI_STATUS
1428 EFIAPI
1429 EfiLibInstallDriverBindingComponentName2 (
1430 IN CONST EFI_HANDLE ImageHandle,
1431 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1432 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1433 IN EFI_HANDLE DriverBindingHandle,
1434 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1435 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
1436 );
1437
1438
1439 /**
1440 Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
1441
1442 If DriverBinding is NULL, then ASSERT().
1443 If the uninstallation fails, then ASSERT().
1444
1445 @param DriverBinding A Driver Binding Protocol instance that this driver produced.
1446 @param ComponentName A Component Name Protocol instance that this driver produced.
1447 @param ComponentName2 A Component Name 2 Protocol instance that this driver produced.
1448
1449 @retval EFI_SUCCESS The protocol installation successfully completed.
1450 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().
1451
1452 **/
1453 EFI_STATUS
1454 EFIAPI
1455 EfiLibUninstallDriverBindingComponentName2 (
1456 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1457 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1458 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
1459 );
1460
1461
1462 /**
1463 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
1464 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
1465
1466 Initializes a driver by installing the Driver Binding Protocol together with the optional
1467 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,
1468 optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.
1469 DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver
1470 produces multiple Driver Binding Protocols.
1471 If DriverBinding is NULL, then ASSERT().
1472 If the installation fails, then ASSERT().
1473
1474
1475 @param ImageHandle The image handle of the driver.
1476 @param SystemTable The EFI System Table that was passed to the driver's entry point.
1477 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
1478 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
1479 parameter is NULL, then a new handle is created.
1480 @param ComponentName A Component Name Protocol instance that this driver is producing.
1481 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
1482 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
1483 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
1484 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
1485 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
1486
1487 @retval EFI_SUCCESS The protocol installation completed successfully.
1488 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1489
1490 **/
1491 EFI_STATUS
1492 EFIAPI
1493 EfiLibInstallAllDriverProtocols2 (
1494 IN CONST EFI_HANDLE ImageHandle,
1495 IN CONST EFI_SYSTEM_TABLE *SystemTable,
1496 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1497 IN EFI_HANDLE DriverBindingHandle,
1498 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1499 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
1500 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1501 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
1502 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
1503 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
1504 );
1505
1506
1507 /**
1508 Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver
1509 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
1510
1511 If DriverBinding is NULL, then ASSERT().
1512 If the installation fails, then ASSERT().
1513
1514
1515 @param DriverBinding A Driver Binding Protocol instance that this driver produced.
1516 @param ComponentName A Component Name Protocol instance that this driver produced.
1517 @param ComponentName2 A Component Name 2 Protocol instance that this driver produced.
1518 @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced.
1519 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver produced.
1520 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced.
1521 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver produced.
1522
1523 @retval EFI_SUCCESS The protocol uninstallation successfully completed.
1524 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().
1525
1526 **/
1527 EFI_STATUS
1528 EFIAPI
1529 EfiLibUninstallAllDriverProtocols2 (
1530 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
1531 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
1532 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
1533 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
1534 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
1535 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
1536 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
1537 );
1538
1539
1540 /**
1541 Appends a formatted Unicode string to a Null-terminated Unicode string
1542
1543 This function appends a formatted Unicode string to the Null-terminated
1544 Unicode string specified by String. String is optional and may be NULL.
1545 Storage for the formatted Unicode string returned is allocated using
1546 AllocatePool(). The pointer to the appended string is returned. The caller
1547 is responsible for freeing the returned string.
1548
1549 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
1550 If FormatString is NULL, then ASSERT().
1551 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
1552
1553 @param[in] String A Null-terminated Unicode string.
1554 @param[in] FormatString A Null-terminated Unicode format string.
1555 @param[in] Marker VA_LIST marker for the variable argument list.
1556
1557 @retval NULL There was not enough available memory.
1558 @return Null-terminated Unicode string is that is the formatted
1559 string appended to String.
1560 **/
1561 CHAR16*
1562 EFIAPI
1563 CatVSPrint (
1564 IN CHAR16 *String, OPTIONAL
1565 IN CONST CHAR16 *FormatString,
1566 IN VA_LIST Marker
1567 );
1568
1569 /**
1570 Appends a formatted Unicode string to a Null-terminated Unicode string
1571
1572 This function appends a formatted Unicode string to the Null-terminated
1573 Unicode string specified by String. String is optional and may be NULL.
1574 Storage for the formatted Unicode string returned is allocated using
1575 AllocatePool(). The pointer to the appended string is returned. The caller
1576 is responsible for freeing the returned string.
1577
1578 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
1579 If FormatString is NULL, then ASSERT().
1580 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
1581
1582 @param[in] String A Null-terminated Unicode string.
1583 @param[in] FormatString A Null-terminated Unicode format string.
1584 @param[in] ... The variable argument list whose contents are
1585 accessed based on the format string specified by
1586 FormatString.
1587
1588 @retval NULL There was not enough available memory.
1589 @return Null-terminated Unicode string is that is the formatted
1590 string appended to String.
1591 **/
1592 CHAR16 *
1593 EFIAPI
1594 CatSPrint (
1595 IN CHAR16 *String, OPTIONAL
1596 IN CONST CHAR16 *FormatString,
1597 ...
1598 );
1599
1600 /**
1601 Returns an array of protocol instance that matches the given protocol.
1602
1603 @param[in] Protocol Provides the protocol to search for.
1604 @param[out] NoProtocols The number of protocols returned in Buffer.
1605 @param[out] Buffer A pointer to the buffer to return the requested
1606 array of protocol instances that match Protocol.
1607 The returned buffer is allocated using
1608 EFI_BOOT_SERVICES.AllocatePool(). The caller is
1609 responsible for freeing this buffer with
1610 EFI_BOOT_SERVICES.FreePool().
1611
1612 @retval EFI_SUCCESS The array of protocols was returned in Buffer,
1613 and the number of protocols in Buffer was
1614 returned in NoProtocols.
1615 @retval EFI_NOT_FOUND No protocols found.
1616 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1617 matching results.
1618 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1619 @retval EFI_INVALID_PARAMETER NoProtocols is NULL.
1620 @retval EFI_INVALID_PARAMETER Buffer is NULL.
1621
1622 **/
1623 EFI_STATUS
1624 EFIAPI
1625 EfiLocateProtocolBuffer (
1626 IN EFI_GUID *Protocol,
1627 OUT UINTN *NoProtocols,
1628 OUT VOID ***Buffer
1629 );
1630
1631 /**
1632 Open or create a file or directory, possibly creating the chain of
1633 directories leading up to the directory.
1634
1635 EfiOpenFileByDevicePath() first locates EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on
1636 FilePath, and opens the root directory of that filesystem with
1637 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume().
1638
1639 On the remaining device path, the longest initial sequence of
1640 FILEPATH_DEVICE_PATH nodes is node-wise traversed with
1641 EFI_FILE_PROTOCOL.Open().
1642
1643 (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes
1644 includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single
1645 pathname component, then EfiOpenFileByDevicePath() ensures that the specified
1646 series of subdirectories exist on return.)
1647
1648 The EFI_FILE_PROTOCOL identified by the last FILEPATH_DEVICE_PATH node is
1649 output to the caller; intermediate EFI_FILE_PROTOCOL instances are closed. If
1650 there are no FILEPATH_DEVICE_PATH nodes past the node that identifies the
1651 filesystem, then the EFI_FILE_PROTOCOL of the root directory of the
1652 filesystem is output to the caller. If a device path node that is different
1653 from FILEPATH_DEVICE_PATH is encountered relative to the filesystem, the
1654 traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output.
1655
1656 @param[in,out] FilePath On input, the device path to the file or directory
1657 to open or create. The caller is responsible for
1658 ensuring that the device path pointed-to by FilePath
1659 is well-formed. On output, FilePath points one past
1660 the last node in the original device path that has
1661 been successfully processed. FilePath is set on
1662 output even if EfiOpenFileByDevicePath() returns an
1663 error.
1664
1665 @param[out] File On error, File is set to NULL. On success, File is
1666 set to the EFI_FILE_PROTOCOL of the root directory
1667 of the filesystem, if there are no
1668 FILEPATH_DEVICE_PATH nodes in FilePath; otherwise,
1669 File is set to the EFI_FILE_PROTOCOL identified by
1670 the last node in FilePath.
1671
1672 @param[in] OpenMode The OpenMode parameter to pass to
1673 EFI_FILE_PROTOCOL.Open().
1674
1675 @param[in] Attributes The Attributes parameter to pass to
1676 EFI_FILE_PROTOCOL.Open().
1677
1678 @retval EFI_SUCCESS The file or directory has been opened or
1679 created.
1680
1681 @retval EFI_INVALID_PARAMETER FilePath is NULL; or File is NULL; or FilePath
1682 contains a device path node, past the node
1683 that identifies
1684 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, that is not a
1685 FILEPATH_DEVICE_PATH node.
1686
1687 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
1688
1689 @return Error codes propagated from the
1690 LocateDevicePath() and OpenProtocol() boot
1691 services, and from the
1692 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume()
1693 and EFI_FILE_PROTOCOL.Open() member functions.
1694 **/
1695 EFI_STATUS
1696 EFIAPI
1697 EfiOpenFileByDevicePath (
1698 IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
1699 OUT EFI_FILE_PROTOCOL **File,
1700 IN UINT64 OpenMode,
1701 IN UINT64 Attributes
1702 );
1703
1704 /**
1705 This function locates next ACPI table in XSDT/RSDT based on Signature and
1706 previous returned Table.
1707
1708 If PreviousTable is NULL:
1709 This function will locate the first ACPI table in XSDT/RSDT based on
1710 Signature in gEfiAcpi20TableGuid system configuration table first, and then
1711 gEfiAcpi10TableGuid system configuration table.
1712 This function will locate in XSDT first, and then RSDT.
1713 For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in
1714 FADT.
1715 For FACS, this function will locate XFirmwareCtrl in FADT first, and then
1716 FirmwareCtrl in FADT.
1717
1718 If PreviousTable is not NULL:
1719 1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration
1720 table, then this function will just locate next table in XSDT in
1721 gEfiAcpi20TableGuid system configuration table.
1722 2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration
1723 table, then this function will just locate next table in RSDT in
1724 gEfiAcpi20TableGuid system configuration table.
1725 3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration
1726 table, then this function will just locate next table in RSDT in
1727 gEfiAcpi10TableGuid system configuration table.
1728
1729 It's not supported that PreviousTable is not NULL but PreviousTable->Signature
1730 is not same with Signature, NULL will be returned.
1731
1732 @param Signature ACPI table signature.
1733 @param PreviousTable Pointer to previous returned table to locate next
1734 table, or NULL to locate first table.
1735
1736 @return Next ACPI table or NULL if not found.
1737
1738 **/
1739 EFI_ACPI_COMMON_HEADER *
1740 EFIAPI
1741 EfiLocateNextAcpiTable (
1742 IN UINT32 Signature,
1743 IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL
1744 );
1745
1746 /**
1747 This function locates first ACPI table in XSDT/RSDT based on Signature.
1748
1749 This function will locate the first ACPI table in XSDT/RSDT based on
1750 Signature in gEfiAcpi20TableGuid system configuration table first, and then
1751 gEfiAcpi10TableGuid system configuration table.
1752 This function will locate in XSDT first, and then RSDT.
1753 For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in
1754 FADT.
1755 For FACS, this function will locate XFirmwareCtrl in FADT first, and then
1756 FirmwareCtrl in FADT.
1757
1758 @param Signature ACPI table signature.
1759
1760 @return First ACPI table or NULL if not found.
1761
1762 **/
1763 EFI_ACPI_COMMON_HEADER *
1764 EFIAPI
1765 EfiLocateFirstAcpiTable (
1766 IN UINT32 Signature
1767 );
1768
1769 #endif