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