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