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