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