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