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