]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UefiLib.h
MdeModulePkg: Change OPTIONAL keyword usage style
[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
ED
683\r
684/**\r
9095d37b
LG
685 Returns the status whether get the variable success. The function retrieves\r
686 variable through the UEFI Runtime Service GetVariable(). The\r
bf4a3dbd
ED
687 returned buffer is allocated using AllocatePool(). The caller is responsible\r
688 for freeing this buffer with FreePool().\r
689\r
690 If Name is NULL, then ASSERT().\r
691 If Guid is NULL, then ASSERT().\r
692 If Value is NULL, then ASSERT().\r
693\r
694 @param[in] Name The pointer to a Null-terminated Unicode string.\r
695 @param[in] Guid The pointer to an EFI_GUID structure\r
696 @param[out] Value The buffer point saved the variable info.\r
697 @param[out] Size The buffer size of the variable.\r
698\r
37bf6787
BB
699 @retval EFI_OUT_OF_RESOURCES Allocate buffer failed.\r
700 @retval EFI_SUCCESS Find the specified variable.\r
701 @retval Others Errors Return errors from call to gRT->GetVariable.\r
bf4a3dbd
ED
702\r
703**/\r
704EFI_STATUS\r
705EFIAPI\r
706GetVariable2 (\r
707 IN CONST CHAR16 *Name,\r
708 IN CONST EFI_GUID *Guid,\r
709 OUT VOID **Value,\r
710 OUT UINTN *Size OPTIONAL\r
711 );\r
712\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
bf4a3dbd 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
bf4a3dbd
ED
718 responsible for freeing this buffer with FreePool().\r
719\r
720 If Name is NULL, then ASSERT().\r
721 If Value is NULL, then ASSERT().\r
6d28c497 722\r
bf4a3dbd
ED
723 @param[in] Name The pointer to a Null-terminated Unicode string.\r
724 @param[out] Value The buffer point saved the variable info.\r
725 @param[out] Size The buffer size of the variable.\r
726\r
37bf6787
BB
727 @retval EFI_OUT_OF_RESOURCES Allocate buffer failed.\r
728 @retval EFI_SUCCESS Find the specified variable.\r
729 @retval Others Errors Return errors from call to gRT->GetVariable.\r
bf4a3dbd
ED
730\r
731**/\r
732EFI_STATUS\r
733EFIAPI\r
734GetEfiGlobalVariable2 (\r
735 IN CONST CHAR16 *Name,\r
736 OUT VOID **Value,\r
737 OUT UINTN *Size OPTIONAL\r
738 );\r
6d28c497 739\r
37bf6787
BB
740/** Return the attributes of the variable.\r
741\r
742 Returns the status whether get the variable success. The function retrieves\r
743 variable through the UEFI Runtime Service GetVariable(). The\r
744 returned buffer is allocated using AllocatePool(). The caller is responsible\r
745 for freeing this buffer with FreePool(). The attributes are returned if\r
746 the caller provides a valid Attribute parameter.\r
747\r
748 If Name is NULL, then ASSERT().\r
749 If Guid is NULL, then ASSERT().\r
750 If Value is NULL, then ASSERT().\r
751\r
752 @param[in] Name The pointer to a Null-terminated Unicode string.\r
753 @param[in] Guid The pointer to an EFI_GUID structure\r
754 @param[out] Value The buffer point saved the variable info.\r
755 @param[out] Size The buffer size of the variable.\r
756 @param[out] Attr The pointer to the variable attributes as found in var store\r
757\r
758 @retval EFI_OUT_OF_RESOURCES Allocate buffer failed.\r
759 @retval EFI_SUCCESS Find the specified variable.\r
760 @retval Others Errors Return errors from call to gRT->GetVariable.\r
761\r
762**/\r
763EFI_STATUS\r
764EFIAPI\r
765GetVariable3(\r
766 IN CONST CHAR16 *Name,\r
767 IN CONST EFI_GUID *Guid,\r
768 OUT VOID **Value,\r
769 OUT UINTN *Size OPTIONAL,\r
770 OUT UINT32 *Attr OPTIONAL\r
771 );\r
772\r
6d28c497 773/**\r
9095d37b
LG
774 Returns a pointer to an allocated buffer that contains the best matching language\r
775 from a set of supported languages.\r
776\r
777 This function supports both ISO 639-2 and RFC 4646 language codes, but language\r
778 code types may not be mixed in a single call to this function. The language\r
779 code returned is allocated using AllocatePool(). The caller is responsible for\r
6d28c497 780 freeing the allocated buffer using FreePool(). This function supports a variable\r
9095d37b
LG
781 argument list that allows the caller to pass in a prioritized list of language\r
782 codes to test against all the language codes in SupportedLanguages.\r
6d28c497 783\r
784 If SupportedLanguages is NULL, then ASSERT().\r
785\r
786 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that\r
9095d37b 787 contains a set of language codes in the format\r
6d28c497 788 specified by Iso639Language.\r
3d7c6cfb
LG
789 @param[in] Iso639Language If not zero, then all language codes are assumed to be\r
790 in ISO 639-2 format. If zero, then all language\r
6d28c497 791 codes are assumed to be in RFC 4646 language format\r
9095d37b 792 @param[in] ... A variable argument list that contains pointers to\r
6d28c497 793 Null-terminated ASCII strings that contain one or more\r
794 language codes in the format specified by Iso639Language.\r
795 The first language code from each of these language\r
796 code lists is used to determine if it is an exact or\r
9095d37b 797 close match to any of the language codes in\r
6d28c497 798 SupportedLanguages. Close matches only apply to RFC 4646\r
799 language codes, and the matching algorithm from RFC 4647\r
9095d37b 800 is used to determine if a close match is present. If\r
6d28c497 801 an exact or close match is found, then the matching\r
802 language code from SupportedLanguages is returned. If\r
803 no matches are found, then the next variable argument\r
9095d37b 804 parameter is evaluated. The variable argument list\r
6d28c497 805 is terminated by a NULL.\r
806\r
807 @retval NULL The best matching language could not be found in SupportedLanguages.\r
9095d37b 808 @retval NULL There are not enough resources available to return the best matching\r
6d28c497 809 language.\r
9095d37b 810 @retval Other A pointer to a Null-terminated ASCII string that is the best matching\r
6d28c497 811 language in SupportedLanguages.\r
812\r
813**/\r
814CHAR8 *\r
815EFIAPI\r
816GetBestLanguage (\r
9095d37b 817 IN CONST CHAR8 *SupportedLanguages,\r
d2aafe1e 818 IN UINTN Iso639Language,\r
6d28c497 819 ...\r
820 );\r
821\r
db2ef756 822/**\r
9095d37b 823 Draws a dialog box to the console output device specified by\r
db2ef756 824 ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke\r
9095d37b 825 from the console input device specified by ConIn defined in the\r
db2ef756
LG
826 EFI_SYSTEM_TABLE.\r
827\r
828 If there are no strings in the variable argument list, then ASSERT().\r
829 If all the strings in the variable argument list are empty, then ASSERT().\r
830\r
831 @param[in] Attribute Specifies the foreground and background color of the popup.\r
9095d37b 832 @param[out] Key A pointer to the EFI_KEY value of the key that was\r
db2ef756
LG
833 pressed. This is an optional parameter that may be NULL.\r
834 If it is NULL then no wait for a keypress will be performed.\r
835 @param[in] ... The variable argument list that contains pointers to Null-\r
9095d37b 836 terminated Unicode strings to display in the dialog box.\r
db2ef756
LG
837 The variable argument list is terminated by a NULL.\r
838\r
839**/\r
840VOID\r
841EFIAPI\r
842CreatePopUp (\r
9095d37b 843 IN UINTN Attribute,\r
db2ef756
LG
844 OUT EFI_INPUT_KEY *Key, OPTIONAL\r
845 ...\r
846 );\r
6d28c497 847\r
fb3df220 848/**\r
cf8ae2f6 849 Retrieves the width of a Unicode character.\r
850\r
851 This function computes and returns the width of the Unicode character specified\r
852 by UnicodeChar.\r
fb3df220 853\r
854 @param UnicodeChar A Unicode character.\r
855\r
856 @retval 0 The width if UnicodeChar could not be determined.\r
857 @retval 1 UnicodeChar is a narrow glyph.\r
858 @retval 2 UnicodeChar is a wide glyph.\r
859\r
860**/\r
861UINTN\r
862EFIAPI\r
863GetGlyphWidth (\r
864 IN CHAR16 UnicodeChar\r
865 );\r
866\r
867/**\r
1d37ab9f 868 Computes the display length of a Null-terminated Unicode String.\r
869\r
cf8ae2f6 870 This function computes and returns the display length of the Null-terminated Unicode\r
871 string specified by String. If String is NULL then 0 is returned. If any of the widths\r
872 of the Unicode characters in String can not be determined, then 0 is returned. The display\r
873 width of String can be computed by summing the display widths of each Unicode character\r
874 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode\r
9095d37b 875 characters that are width glyphs have a width of 2.\r
cf8ae2f6 876 If String is not aligned on a 16-bit boundary, then ASSERT().\r
fb3df220 877\r
878 @param String A pointer to a Null-terminated Unicode string.\r
879\r
880 @return The display length of the Null-terminated Unicode string specified by String.\r
9095d37b 881\r
fb3df220 882**/\r
883UINTN\r
884EFIAPI\r
885UnicodeStringDisplayLength (\r
886 IN CONST CHAR16 *String\r
887 );\r
888\r
889//\r
890// Functions that abstract early Framework contamination of UEFI.\r
891//\r
892/**\r
1d37ab9f 893 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r
9095d37b 894\r
1d37ab9f 895 This function abstracts the signaling of the Ready to Boot Event. The Framework moved\r
cf8ae2f6 896 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller\r
897 from how this event is created to prevent to code form having to change with the\r
898 version of the specification supported.\r
fb3df220 899\r
900**/\r
901VOID\r
902EFIAPI\r
903EfiSignalEventReadyToBoot (\r
904 VOID\r
905 );\r
906\r
907/**\r
1d37ab9f 908 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().\r
909\r
910 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from\r
911 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how\r
912 this event is created to prevent to code form having to change with the version of the\r
913 specification supported.\r
fb3df220 914\r
915**/\r
916VOID\r
917EFIAPI\r
918EfiSignalEventLegacyBoot (\r
919 VOID\r
920 );\r
921\r
922/**\r
cf8ae2f6 923 Creates an EFI event in the Legacy Boot Event Group.\r
924\r
925 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library\r
926 abstracts the implementation mechanism of this event from the caller. This function\r
927 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary\r
928 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event\r
929 is created to prevent to code form having to change with the version of the\r
930 specification supported.\r
7f1eba7b 931 If LegacyBootEvent is NULL, then ASSERT().\r
fb3df220 932\r
933 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
934\r
af2dc6a7 935 @retval EFI_SUCCESS The event was created.\r
936 @retval Other The event was not created.\r
fb3df220 937\r
938**/\r
939EFI_STATUS\r
940EFIAPI\r
941EfiCreateEventLegacyBoot (\r
942 OUT EFI_EVENT *LegacyBootEvent\r
943 );\r
944\r
945/**\r
946 Create an EFI event in the Legacy Boot Event Group and allows\r
9095d37b
LG
947 the caller to specify a notification function.\r
948\r
fb3df220 949 This function abstracts the creation of the Legacy Boot Event.\r
950 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
951 This library abstracts the caller from how this event is created to prevent\r
952 to code form having to change with the version of the specification supported.\r
953 If LegacyBootEvent is NULL, then ASSERT().\r
954\r
955 @param NotifyTpl The task priority level of the event.\r
956 @param NotifyFunction The notification function to call when the event is signaled.\r
957 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
958 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
959\r
af2dc6a7 960 @retval EFI_SUCCESS The event was created.\r
961 @retval Other The event was not created.\r
fb3df220 962\r
963**/\r
964EFI_STATUS\r
965EFIAPI\r
966EfiCreateEventLegacyBootEx (\r
967 IN EFI_TPL NotifyTpl,\r
968 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
969 IN VOID *NotifyContext, OPTIONAL\r
970 OUT EFI_EVENT *LegacyBootEvent\r
971 );\r
972\r
973/**\r
cf8ae2f6 974 Create an EFI event in the Ready To Boot Event Group.\r
975\r
976 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library\r
9095d37b
LG
977 abstracts the implementation mechanism of this event from the caller.\r
978 This function abstracts the creation of the Ready to Boot Event. The Framework\r
979 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts\r
980 the caller from how this event is created to prevent the code form having to\r
7f1eba7b 981 change with the version of the specification supported.\r
982 If ReadyToBootEvent is NULL, then ASSERT().\r
fb3df220 983\r
01aef47b 984 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
fb3df220 985\r
af2dc6a7 986 @retval EFI_SUCCESS The event was created.\r
987 @retval Other The event was not created.\r
fb3df220 988\r
989**/\r
990EFI_STATUS\r
991EFIAPI\r
992EfiCreateEventReadyToBoot (\r
993 OUT EFI_EVENT *ReadyToBootEvent\r
994 );\r
995\r
996/**\r
997 Create an EFI event in the Ready To Boot Event Group and allows\r
9095d37b
LG
998 the caller to specify a notification function.\r
999\r
fb3df220 1000 This function abstracts the creation of the Ready to Boot Event.\r
1001 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
1002 This library abstracts the caller from how this event is created to prevent\r
1003 to code form having to change with the version of the specification supported.\r
1004 If ReadyToBootEvent is NULL, then ASSERT().\r
1005\r
1006 @param NotifyTpl The task priority level of the event.\r
1007 @param NotifyFunction The notification function to call when the event is signaled.\r
1008 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
01aef47b 1009 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
fb3df220 1010\r
af2dc6a7 1011 @retval EFI_SUCCESS The event was created.\r
1012 @retval Other The event was not created.\r
fb3df220 1013\r
1014**/\r
1015EFI_STATUS\r
1016EFIAPI\r
1017EfiCreateEventReadyToBootEx (\r
1018 IN EFI_TPL NotifyTpl,\r
1019 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1020 IN VOID *NotifyContext, OPTIONAL\r
1021 OUT EFI_EVENT *ReadyToBootEvent\r
1022 );\r
1023\r
1024/**\r
1025 Initialize a Firmware Volume (FV) Media Device Path node.\r
9095d37b
LG
1026\r
1027 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.\r
1028 This library function abstracts initializing a device path node.\r
1029 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device\r
1030 path changed in the DXE CIS version 0.92 in a non back ward compatible way to\r
1031 not conflict with the UEFI 2.0 specification. This function abstracts the\r
7f1eba7b 1032 differences from the caller.\r
7f1eba7b 1033 If FvDevicePathNode is NULL, then ASSERT().\r
1034 If NameGuid is NULL, then ASSERT().\r
9095d37b 1035\r
af2dc6a7 1036 @param FvDevicePathNode The pointer to a FV device path node to initialize\r
fb3df220 1037 @param NameGuid FV file name to use in FvDevicePathNode\r
1038\r
1039**/\r
1040VOID\r
1041EFIAPI\r
1042EfiInitializeFwVolDevicepathNode (\r
1043 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
1044 IN CONST EFI_GUID *NameGuid\r
1045 );\r
1046\r
1047/**\r
9095d37b
LG
1048 Check to see if the Firmware Volume (FV) Media Device Path is valid\r
1049\r
1050 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification.\r
7f1eba7b 1051 This library function abstracts validating a device path node.\r
9095d37b
LG
1052 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid.\r
1053 If it is valid, then return the GUID file name from the device path node. Otherwise,\r
1054 return NULL. This device path changed in the DXE CIS version 0.92 in a non backward\r
1055 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts\r
7f1eba7b 1056 the differences from the caller.\r
1057 If FvDevicePathNode is NULL, then ASSERT().\r
fb3df220 1058\r
af2dc6a7 1059 @param FvDevicePathNode The pointer to FV device path to check.\r
fb3df220 1060\r
1061 @retval NULL FvDevicePathNode is not valid.\r
1062 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
1063\r
1064**/\r
1065EFI_GUID *\r
1066EFIAPI\r
1067EfiGetNameGuidFromFwVolDevicePathNode (\r
1068 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
1069 );\r
1070\r
9095d37b
LG
1071/**\r
1072 Prints a formatted Unicode string to the console output device specified by\r
fb3df220 1073 ConOut defined in the EFI_SYSTEM_TABLE.\r
1074\r
9095d37b
LG
1075 This function prints a formatted Unicode string to the console output device\r
1076 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode\r
1077 characters that printed to ConOut. If the length of the formatted Unicode\r
1078 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
fb3df220 1079 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1d37ab9f 1080 If Format is NULL, then ASSERT().\r
1081 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
cda8ba5e 1082 If gST->ConOut is NULL, then ASSERT().\r
fb3df220 1083\r
af2dc6a7 1084 @param Format A null-terminated Unicode format string.\r
9095d37b 1085 @param ... The variable argument list whose contents are accessed based\r
285010e7 1086 on the format string specified by Format.\r
9095d37b 1087\r
9199040c 1088 @return Number of Unicode characters printed to ConOut.\r
fb3df220 1089\r
1090**/\r
1091UINTN\r
1092EFIAPI\r
1093Print (\r
1094 IN CONST CHAR16 *Format,\r
1095 ...\r
1096 );\r
1097\r
9095d37b
LG
1098/**\r
1099 Prints a formatted Unicode string to the console output device specified by\r
fb3df220 1100 StdErr defined in the EFI_SYSTEM_TABLE.\r
1101\r
9095d37b
LG
1102 This function prints a formatted Unicode string to the console output device\r
1103 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode\r
1104 characters that printed to StdErr. If the length of the formatted Unicode\r
1105 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
fb3df220 1106 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1d37ab9f 1107 If Format is NULL, then ASSERT().\r
1108 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
cda8ba5e 1109 If gST->StdErr is NULL, then ASSERT().\r
fb3df220 1110\r
af2dc6a7 1111 @param Format A null-terminated Unicode format string.\r
9095d37b 1112 @param ... The variable argument list whose contents are accessed based\r
285010e7 1113 on the format string specified by Format.\r
9095d37b 1114\r
9199040c 1115 @return Number of Unicode characters printed to StdErr.\r
fb3df220 1116\r
1117**/\r
1118UINTN\r
1119EFIAPI\r
1120ErrorPrint (\r
1121 IN CONST CHAR16 *Format,\r
1122 ...\r
1123 );\r
1124\r
9095d37b
LG
1125/**\r
1126 Prints a formatted ASCII string to the console output device specified by\r
fb3df220 1127 ConOut defined in the EFI_SYSTEM_TABLE.\r
1128\r
9095d37b
LG
1129 This function prints a formatted ASCII string to the console output device\r
1130 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII\r
1131 characters that printed to ConOut. If the length of the formatted ASCII\r
1132 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first\r
fb3df220 1133 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1d37ab9f 1134 If Format is NULL, then ASSERT().\r
cda8ba5e 1135 If gST->ConOut is NULL, then ASSERT().\r
fb3df220 1136\r
af2dc6a7 1137 @param Format A null-terminated ASCII 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 ASCII characters printed to ConOut.\r
fb3df220 1142\r
1143**/\r
1144UINTN\r
1145EFIAPI\r
1146AsciiPrint (\r
1147 IN CONST CHAR8 *Format,\r
1148 ...\r
1149 );\r
1150\r
9095d37b
LG
1151/**\r
1152 Prints a formatted ASCII 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 ASCII string to the console output device\r
1156 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII\r
1157 characters that printed to StdErr. If the length of the formatted ASCII\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
cda8ba5e 1161 If gST->StdErr is NULL, then ASSERT().\r
fb3df220 1162\r
af2dc6a7 1163 @param Format A null-terminated ASCII format string.\r
9095d37b 1164 @param ... The variable argument list whose contents are accessed based\r
285010e7 1165 on the format string specified by Format.\r
9095d37b 1166\r
9199040c 1167 @return Number of ASCII characters printed to ConErr.\r
fb3df220 1168\r
1169**/\r
1170UINTN\r
1171EFIAPI\r
1172AsciiErrorPrint (\r
1173 IN CONST CHAR8 *Format,\r
1174 ...\r
1175 );\r
1176\r
51969ecb 1177\r
b3154720 1178/**\r
9095d37b 1179 Prints a formatted Unicode string to a graphics console device specified by\r
b3154720 1180 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
1181\r
9095d37b
LG
1182 This function prints a formatted Unicode string to the graphics console device\r
1183 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of\r
1184 Unicode characters displayed, not including partial characters that may be clipped\r
b9c8d8bd 1185 by the right edge of the display. If the length of the formatted Unicode string is\r
9095d37b 1186 greater than PcdUefiLibMaxPrintBufferSize, then at most the first\r
1a2f870c 1187 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
9095d37b 1188 is used to convert the string to a bitmap using the glyphs registered with the\r
1a2f870c 1189 HII database. No wrapping is performed, so any portions of the string the fall\r
1190 outside the active display region will not be displayed.\r
b3154720 1191\r
9095d37b 1192 If a graphics console device is not associated with the ConsoleOutputHandle\r
b3154720 1193 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
9095d37b 1194 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no\r
b3154720 1195 string is printed, and 0 is returned.\r
1196 If Format is NULL, then ASSERT().\r
1197 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
cda8ba5e 1198 If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
b3154720 1199\r
51969ecb 1200 @param PointX X coordinate to print the string.\r
1201 @param PointY Y coordinate to print the string.\r
28d3e14f 1202 @param ForeGround The foreground color of the string being printed. This is\r
b3154720 1203 an optional parameter that may be NULL. If it is NULL,\r
1204 then the foreground color of the current ConOut device\r
1205 in the EFI_SYSTEM_TABLE is used.\r
1206 @param BackGround The background color of the string being printed. This is\r
9095d37b 1207 an optional parameter that may be NULL. If it is NULL,\r
b3154720 1208 then the background color of the current ConOut device\r
1209 in the EFI_SYSTEM_TABLE is used.\r
9095d37b 1210 @param Format A null-terminated Unicode format string. See Print Library\r
b3154720 1211 for the supported format string syntax.\r
9095d37b
LG
1212 @param ... Variable argument list whose contents are accessed based on\r
1213 the format string specified by Format.\r
b3154720 1214\r
1215 @return The number of Unicode characters printed.\r
1216\r
1217**/\r
1218UINTN\r
1219EFIAPI\r
1220PrintXY (\r
51969ecb 1221 IN UINTN PointX,\r
1222 IN UINTN PointY,\r
b3154720 1223 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1224 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1225 IN CONST CHAR16 *Format,\r
1226 ...\r
1227 );\r
1228\r
1229/**\r
9095d37b 1230 Prints a formatted ASCII string to a graphics console device specified by\r
b3154720 1231 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
1232\r
9095d37b
LG
1233 This function prints a formatted ASCII string to the graphics console device\r
1234 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of\r
1235 ASCII characters displayed, not including partial characters that may be clipped\r
b9c8d8bd 1236 by the right edge of the display. If the length of the formatted ASCII string is\r
9095d37b 1237 greater than PcdUefiLibMaxPrintBufferSize, then at most the first\r
1a2f870c 1238 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
9095d37b 1239 is used to convert the string to a bitmap using the glyphs registered with the\r
1a2f870c 1240 HII database. No wrapping is performed, so any portions of the string the fall\r
1241 outside the active display region will not be displayed.\r
b3154720 1242\r
9095d37b 1243 If a graphics console device is not associated with the ConsoleOutputHandle\r
b3154720 1244 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
9095d37b 1245 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no\r
b3154720 1246 string is printed, and 0 is returned.\r
1247 If Format is NULL, then ASSERT().\r
cda8ba5e 1248 If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
b3154720 1249\r
51969ecb 1250 @param PointX X coordinate to print the string.\r
1251 @param PointY Y coordinate to print the string.\r
28d3e14f 1252 @param ForeGround The foreground color of the string being printed. This is\r
b3154720 1253 an optional parameter that may be NULL. If it is NULL,\r
1254 then the foreground color of the current ConOut device\r
1255 in the EFI_SYSTEM_TABLE is used.\r
1256 @param BackGround The background color of the string being printed. This is\r
9095d37b 1257 an optional parameter that may be NULL. If it is NULL,\r
b3154720 1258 then the background color of the current ConOut device\r
1259 in the EFI_SYSTEM_TABLE is used.\r
9095d37b 1260 @param Format A null-terminated ASCII format string. See Print Library\r
b3154720 1261 for the supported format string syntax.\r
9095d37b
LG
1262 @param ... The variable argument list whose contents are accessed based on\r
1263 the format string specified by Format.\r
b3154720 1264\r
1265 @return The number of ASCII characters printed.\r
1266\r
1267**/\r
1268UINTN\r
1269EFIAPI\r
1270AsciiPrintXY (\r
51969ecb 1271 IN UINTN PointX,\r
1272 IN UINTN PointY,\r
b3154720 1273 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1274 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1275 IN CONST CHAR8 *Format,\r
1276 ...\r
1277 );\r
1278\r
0290fca2 1279\r
c7d265a9 1280/**\r
cf8ae2f6 1281 Installs and completes the initialization of a Driver Binding Protocol instance.\r
9095d37b 1282\r
cf8ae2f6 1283 Installs the Driver Binding Protocol specified by DriverBinding onto the handle\r
1284 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding\r
1285 is installed onto a newly created handle. DriverBindingHandle is typically the same\r
1286 as the driver's ImageHandle, but it can be different if the driver produces multiple\r
9095d37b
LG
1287 Driver Binding Protocols.\r
1288 If DriverBinding is NULL, then ASSERT().\r
cf8ae2f6 1289 If DriverBinding can not be installed onto a handle, then ASSERT().\r
1290\r
1291 @param ImageHandle The image handle of the driver.\r
1292 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1293 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1294 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1295 parameter is NULL, then a new handle is created.\r
1296\r
af2dc6a7 1297 @retval EFI_SUCCESS The protocol installation completed successfully.\r
cf8ae2f6 1298 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.\r
1299 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 1300\r
1301**/\r
1302EFI_STATUS\r
1303EFIAPI\r
1304EfiLibInstallDriverBinding (\r
1305 IN CONST EFI_HANDLE ImageHandle,\r
1306 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1307 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1308 IN EFI_HANDLE DriverBindingHandle\r
1309 );\r
1310\r
c7d265a9 1311\r
0290fca2
AS
1312/**\r
1313 Uninstalls a Driver Binding Protocol instance.\r
1314\r
1315 If DriverBinding is NULL, then ASSERT().\r
1316 If DriverBinding can not be uninstalled, then ASSERT().\r
1317\r
1318 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1319\r
1320 @retval EFI_SUCCESS The protocol uninstallation successfully completed.\r
1321 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1322\r
1323**/\r
1324EFI_STATUS\r
1325EFIAPI\r
1326EfiLibUninstallDriverBinding (\r
1327 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding\r
1328 );\r
1329\r
1330\r
f662c194 1331/**\r
cf8ae2f6 1332 Installs and completes the initialization of a Driver Binding Protocol instance and\r
1333 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
1334\r
1335 Initializes a driver by installing the Driver Binding Protocol together with the\r
1336 optional Component Name, optional Driver Configure and optional Driver Diagnostic\r
1337 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,\r
1a2f870c 1338 then the protocols are installed onto a newly created handle. DriverBindingHandle\r
cf8ae2f6 1339 is typically the same as the driver's ImageHandle, but it can be different if the\r
9095d37b
LG
1340 driver produces multiple Driver Binding Protocols.\r
1341 If DriverBinding is NULL, then ASSERT().\r
cf8ae2f6 1342 If the installation fails, then ASSERT().\r
9095d37b 1343\r
cf8ae2f6 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 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1350 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1351 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1352\r
af2dc6a7 1353 @retval EFI_SUCCESS The protocol installation completed successfully.\r
1354 @retval EFI_OUT_OF_RESOURCES There was not enough memory in the pool to install all the protocols.\r
c7d265a9 1355\r
1356**/\r
1357EFI_STATUS\r
1358EFIAPI\r
1359EfiLibInstallAllDriverProtocols (\r
1360 IN CONST EFI_HANDLE ImageHandle,\r
1361 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1362 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1363 IN EFI_HANDLE DriverBindingHandle,\r
1364 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1365 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1366 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
1367 );\r
1368\r
1369\r
0290fca2
AS
1370/**\r
1371 Uninstalls a Driver Binding Protocol instance and optionally uninstalls the\r
1372 Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
1373\r
1374 If DriverBinding is NULL, then ASSERT().\r
1375 If the uninstallation fails, then ASSERT().\r
1376\r
1377 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1378 @param ComponentName A Component Name Protocol instance that this driver produced.\r
1379 @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced.\r
1380 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced.\r
1381\r
1382 @retval EFI_SUCCESS The protocol uninstallation successfully completed.\r
1383 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1384\r
1385**/\r
1386EFI_STATUS\r
1387EFIAPI\r
1388EfiLibUninstallAllDriverProtocols (\r
1389 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1390 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1391 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1392 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
1393 );\r
1394\r
f662c194 1395\r
c7d265a9 1396/**\r
cf8ae2f6 1397 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
1398\r
1399 Initializes a driver by installing the Driver Binding Protocol together with the\r
1400 optional Component Name and optional Component Name 2 protocols onto the driver's\r
1401 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed\r
1402 onto a newly created handle. DriverBindingHandle is typically the same as the driver's\r
9095d37b
LG
1403 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.\r
1404 If DriverBinding is NULL, then ASSERT().\r
cf8ae2f6 1405 If the installation fails, then ASSERT().\r
1406\r
1407 @param ImageHandle The image handle of the driver.\r
1408 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1409 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1410 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1411 parameter is NULL, then a new handle is created.\r
1412 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1413 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1414\r
af2dc6a7 1415 @retval EFI_SUCCESS The protocol installation completed successfully.\r
cf8ae2f6 1416 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
f662c194 1417\r
1418**/\r
1419EFI_STATUS\r
1420EFIAPI\r
1421EfiLibInstallDriverBindingComponentName2 (\r
1422 IN CONST EFI_HANDLE ImageHandle,\r
1423 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1424 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1425 IN EFI_HANDLE DriverBindingHandle,\r
1426 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1427 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
1428 );\r
1429\r
1430\r
0290fca2
AS
1431/**\r
1432 Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
1433\r
1434 If DriverBinding is NULL, then ASSERT().\r
1435 If the uninstallation fails, then ASSERT().\r
1436\r
1437 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1438 @param ComponentName A Component Name Protocol instance that this driver produced.\r
1439 @param ComponentName2 A Component Name 2 Protocol instance that this driver produced.\r
1440\r
1441 @retval EFI_SUCCESS The protocol installation successfully completed.\r
1442 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1443\r
1444**/\r
1445EFI_STATUS\r
1446EFIAPI\r
1447EfiLibUninstallDriverBindingComponentName2 (\r
1448 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1449 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1450 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
1451 );\r
1452\r
1453\r
f662c194 1454/**\r
cf8ae2f6 1455 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
1456 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
1457\r
1458 Initializes a driver by installing the Driver Binding Protocol together with the optional\r
63ba999c 1459 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,\r
1460 optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.\r
1461 DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver\r
9095d37b
LG
1462 produces multiple Driver Binding Protocols.\r
1463 If DriverBinding is NULL, then ASSERT().\r
63ba999c 1464 If the installation fails, then ASSERT().\r
1465\r
cf8ae2f6 1466\r
1467 @param ImageHandle The image handle of the driver.\r
1468 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1469 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
28d3e14f 1470 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
cf8ae2f6 1471 parameter is NULL, then a new handle is created.\r
1472 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1473 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1474 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1475 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.\r
1476 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1477 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
1478\r
af2dc6a7 1479 @retval EFI_SUCCESS The protocol installation completed successfully.\r
cf8ae2f6 1480 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
c7d265a9 1481\r
1482**/\r
1483EFI_STATUS\r
1484EFIAPI\r
1485EfiLibInstallAllDriverProtocols2 (\r
1486 IN CONST EFI_HANDLE ImageHandle,\r
1487 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1488 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1489 IN EFI_HANDLE DriverBindingHandle,\r
def220c4 1490 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1491 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
1492 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
8408411a 1493 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
def220c4 1494 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
1495 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
c7d265a9 1496 );\r
1497\r
0290fca2
AS
1498\r
1499/**\r
1500 Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
1501 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
1502\r
1503 If DriverBinding is NULL, then ASSERT().\r
1504 If the installation fails, then ASSERT().\r
1505\r
1506\r
1507 @param DriverBinding A Driver Binding Protocol instance that this driver produced.\r
1508 @param ComponentName A Component Name Protocol instance that this driver produced.\r
1509 @param ComponentName2 A Component Name 2 Protocol instance that this driver produced.\r
1510 @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced.\r
1511 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver produced.\r
1512 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced.\r
1513 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver produced.\r
1514\r
1515 @retval EFI_SUCCESS The protocol uninstallation successfully completed.\r
1516 @retval Others Status from gBS->UninstallMultipleProtocolInterfaces().\r
1517\r
1518**/\r
1519EFI_STATUS\r
1520EFIAPI\r
1521EfiLibUninstallAllDriverProtocols2 (\r
1522 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1523 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1524 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
1525 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1526 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
1527 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
1528 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
1529 );\r
1530\r
1531\r
9095d37b 1532/**\r
f405c067 1533 Appends a formatted Unicode string to a Null-terminated Unicode string\r
9095d37b
LG
1534\r
1535 This function appends a formatted Unicode string to the Null-terminated\r
f405c067 1536 Unicode string specified by String. String is optional and may be NULL.\r
9095d37b 1537 Storage for the formatted Unicode string returned is allocated using\r
f405c067 1538 AllocatePool(). The pointer to the appended string is returned. The caller\r
1539 is responsible for freeing the returned string.\r
9095d37b 1540\r
f405c067 1541 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
1542 If FormatString is NULL, then ASSERT().\r
1543 If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
9095d37b 1544\r
f405c067 1545 @param[in] String A Null-terminated Unicode string.\r
1546 @param[in] FormatString A Null-terminated Unicode format string.\r
1547 @param[in] Marker VA_LIST marker for the variable argument list.\r
1548\r
1549 @retval NULL There was not enough available memory.\r
9095d37b 1550 @return Null-terminated Unicode string is that is the formatted\r
f405c067 1551 string appended to String.\r
1552**/\r
1553CHAR16*\r
1554EFIAPI\r
1555CatVSPrint (\r
1556 IN CHAR16 *String, OPTIONAL\r
1557 IN CONST CHAR16 *FormatString,\r
1558 IN VA_LIST Marker\r
1559 );\r
1560\r
9095d37b 1561/**\r
f405c067 1562 Appends a formatted Unicode string to a Null-terminated Unicode string\r
9095d37b
LG
1563\r
1564 This function appends a formatted Unicode string to the Null-terminated\r
f405c067 1565 Unicode string specified by String. String is optional and may be NULL.\r
9095d37b 1566 Storage for the formatted Unicode string returned is allocated using\r
f405c067 1567 AllocatePool(). The pointer to the appended string is returned. The caller\r
1568 is responsible for freeing the returned string.\r
9095d37b 1569\r
f405c067 1570 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
1571 If FormatString is NULL, then ASSERT().\r
1572 If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
9095d37b 1573\r
f405c067 1574 @param[in] String A Null-terminated Unicode string.\r
1575 @param[in] FormatString A Null-terminated Unicode format string.\r
9095d37b
LG
1576 @param[in] ... The variable argument list whose contents are\r
1577 accessed based on the format string specified by\r
f405c067 1578 FormatString.\r
1579\r
1580 @retval NULL There was not enough available memory.\r
9095d37b 1581 @return Null-terminated Unicode string is that is the formatted\r
f405c067 1582 string appended to String.\r
1583**/\r
1584CHAR16 *\r
1585EFIAPI\r
1586CatSPrint (\r
1587 IN CHAR16 *String, OPTIONAL\r
1588 IN CONST CHAR16 *FormatString,\r
1589 ...\r
1590 );\r
1591\r
40070a18
MK
1592/**\r
1593 Returns an array of protocol instance that matches the given protocol.\r
1594\r
1595 @param[in] Protocol Provides the protocol to search for.\r
1596 @param[out] NoProtocols The number of protocols returned in Buffer.\r
1597 @param[out] Buffer A pointer to the buffer to return the requested\r
1598 array of protocol instances that match Protocol.\r
1599 The returned buffer is allocated using\r
1600 EFI_BOOT_SERVICES.AllocatePool(). The caller is\r
1601 responsible for freeing this buffer with\r
1602 EFI_BOOT_SERVICES.FreePool().\r
1603\r
1604 @retval EFI_SUCCESS The array of protocols was returned in Buffer,\r
1605 and the number of protocols in Buffer was\r
1606 returned in NoProtocols.\r
1607 @retval EFI_NOT_FOUND No protocols found.\r
1608 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
1609 matching results.\r
1610 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
1611 @retval EFI_INVALID_PARAMETER NoProtocols is NULL.\r
1612 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
1613\r
1614**/\r
1615EFI_STATUS\r
1616EFIAPI\r
1617EfiLocateProtocolBuffer (\r
1618 IN EFI_GUID *Protocol,\r
1619 OUT UINTN *NoProtocols,\r
1620 OUT VOID ***Buffer\r
1621 );\r
768b6111
LE
1622\r
1623/**\r
1624 Open or create a file or directory, possibly creating the chain of\r
1625 directories leading up to the directory.\r
1626\r
1627 EfiOpenFileByDevicePath() first locates EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on\r
1628 FilePath, and opens the root directory of that filesystem with\r
1629 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume().\r
1630\r
1631 On the remaining device path, the longest initial sequence of\r
1632 FILEPATH_DEVICE_PATH nodes is node-wise traversed with\r
5dbc768f 1633 EFI_FILE_PROTOCOL.Open().\r
768b6111
LE
1634\r
1635 (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes\r
1636 includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single\r
1637 pathname component, then EfiOpenFileByDevicePath() ensures that the specified\r
1638 series of subdirectories exist on return.)\r
1639\r
1640 The EFI_FILE_PROTOCOL identified by the last FILEPATH_DEVICE_PATH node is\r
1641 output to the caller; intermediate EFI_FILE_PROTOCOL instances are closed. If\r
1642 there are no FILEPATH_DEVICE_PATH nodes past the node that identifies the\r
1643 filesystem, then the EFI_FILE_PROTOCOL of the root directory of the\r
1644 filesystem is output to the caller. If a device path node that is different\r
1645 from FILEPATH_DEVICE_PATH is encountered relative to the filesystem, the\r
1646 traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output.\r
1647\r
1648 @param[in,out] FilePath On input, the device path to the file or directory\r
1649 to open or create. The caller is responsible for\r
1650 ensuring that the device path pointed-to by FilePath\r
1651 is well-formed. On output, FilePath points one past\r
1652 the last node in the original device path that has\r
1653 been successfully processed. FilePath is set on\r
1654 output even if EfiOpenFileByDevicePath() returns an\r
1655 error.\r
1656\r
1657 @param[out] File On error, File is set to NULL. On success, File is\r
1658 set to the EFI_FILE_PROTOCOL of the root directory\r
1659 of the filesystem, if there are no\r
1660 FILEPATH_DEVICE_PATH nodes in FilePath; otherwise,\r
1661 File is set to the EFI_FILE_PROTOCOL identified by\r
1662 the last node in FilePath.\r
1663\r
1664 @param[in] OpenMode The OpenMode parameter to pass to\r
5dbc768f 1665 EFI_FILE_PROTOCOL.Open().\r
768b6111
LE
1666\r
1667 @param[in] Attributes The Attributes parameter to pass to\r
5dbc768f 1668 EFI_FILE_PROTOCOL.Open().\r
768b6111
LE
1669\r
1670 @retval EFI_SUCCESS The file or directory has been opened or\r
1671 created.\r
1672\r
1673 @retval EFI_INVALID_PARAMETER FilePath is NULL; or File is NULL; or FilePath\r
1674 contains a device path node, past the node\r
1675 that identifies\r
1676 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, that is not a\r
1677 FILEPATH_DEVICE_PATH node.\r
1678\r
1679 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
1680\r
1681 @return Error codes propagated from the\r
1682 LocateDevicePath() and OpenProtocol() boot\r
1683 services, and from the\r
1684 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume()\r
1685 and EFI_FILE_PROTOCOL.Open() member functions.\r
1686**/\r
1687EFI_STATUS\r
1688EFIAPI\r
1689EfiOpenFileByDevicePath (\r
1690 IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,\r
1691 OUT EFI_FILE_PROTOCOL **File,\r
1692 IN UINT64 OpenMode,\r
1693 IN UINT64 Attributes\r
1694 );\r
af5e9521
SZ
1695\r
1696/**\r
1697 This function locates next ACPI table in XSDT/RSDT based on Signature and\r
1698 previous returned Table.\r
1699\r
1700 If PreviousTable is NULL:\r
1701 This function will locate the first ACPI table in XSDT/RSDT based on\r
1702 Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
1703 gEfiAcpi10TableGuid system configuration table.\r
1704 This function will locate in XSDT first, and then RSDT.\r
1705 For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
1706 FADT.\r
1707 For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
1708 FirmwareCtrl in FADT.\r
1709\r
1710 If PreviousTable is not NULL:\r
1711 1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration\r
1712 table, then this function will just locate next table in XSDT in\r
1713 gEfiAcpi20TableGuid system configuration table.\r
1714 2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration\r
1715 table, then this function will just locate next table in RSDT in\r
1716 gEfiAcpi20TableGuid system configuration table.\r
1717 3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration\r
1718 table, then this function will just locate next table in RSDT in\r
1719 gEfiAcpi10TableGuid system configuration table.\r
1720\r
1721 It's not supported that PreviousTable is not NULL but PreviousTable->Signature\r
1722 is not same with Signature, NULL will be returned.\r
1723\r
1724 @param Signature ACPI table signature.\r
1725 @param PreviousTable Pointer to previous returned table to locate next\r
1726 table, or NULL to locate first table.\r
1727\r
1728 @return Next ACPI table or NULL if not found.\r
1729\r
1730**/\r
1731EFI_ACPI_COMMON_HEADER *\r
1732EFIAPI\r
1733EfiLocateNextAcpiTable (\r
1734 IN UINT32 Signature,\r
1735 IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL\r
1736 );\r
1737\r
1738/**\r
1739 This function locates first ACPI table in XSDT/RSDT based on Signature.\r
1740\r
1741 This function will locate the first ACPI table in XSDT/RSDT based on\r
1742 Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
1743 gEfiAcpi10TableGuid system configuration table.\r
1744 This function will locate in XSDT first, and then RSDT.\r
1745 For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
1746 FADT.\r
1747 For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
1748 FirmwareCtrl in FADT.\r
1749\r
1750 @param Signature ACPI table signature.\r
1751\r
1752 @return First ACPI table or NULL if not found.\r
1753\r
1754**/\r
1755EFI_ACPI_COMMON_HEADER *\r
1756EFIAPI\r
1757EfiLocateFirstAcpiTable (\r
1758 IN UINT32 Signature\r
1759 );\r
1760\r
fb3df220 1761#endif\r