]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UefiLib.h
Synchronize function comment in MdePkg\Library\BaseMemoryLib.h,CacheMaintenanceLib...
[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
50a64e5b 11Copyright (c) 2006 - 2008, Intel Corporation\r
12All rights reserved. This program and the accompanying materials\r
13are licensed and made available under the terms and conditions of the BSD License\r
14which accompanies this distribution. The full text of the license may be found at\r
15http://opensource.org/licenses/bsd-license.php\r
fb3df220 16\r
50a64e5b 17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
18WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
fb3df220 19\r
20**/\r
21\r
22#ifndef __UEFI_LIB_H__\r
23#define __UEFI_LIB_H__\r
24\r
c7d265a9 25#include <Protocol/DriverBinding.h>\r
26#include <Protocol/DriverConfiguration.h>\r
27#include <Protocol/ComponentName.h>\r
28#include <Protocol/ComponentName2.h>\r
29#include <Protocol/DriverDiagnostics.h>\r
30#include <Protocol/DriverDiagnostics2.h>\r
b3154720 31#include <Protocol/GraphicsOutput.h>\r
c7d265a9 32\r
52ca0d98 33#include <Library/BaseLib.h>\r
34\r
fc30687f 35///\r
36/// Unicode String Table\r
37///\r
fb3df220 38typedef struct {\r
39 CHAR8 *Language;\r
40 CHAR16 *UnicodeString;\r
41} EFI_UNICODE_STRING_TABLE;\r
42\r
fc30687f 43///\r
44/// EFI Lock Status\r
45///\r
fb3df220 46typedef enum {\r
47 EfiLockUninitialized = 0,\r
48 EfiLockReleased = 1,\r
49 EfiLockAcquired = 2\r
50} EFI_LOCK_STATE;\r
51\r
fc30687f 52///\r
53/// EFI Lock \r
54///\r
fb3df220 55typedef struct {\r
56 EFI_TPL Tpl;\r
57 EFI_TPL OwnerTpl;\r
58 EFI_LOCK_STATE Lock;\r
59} EFI_LOCK;\r
60\r
61\r
52ca0d98 62/**\r
63 Macro that returns the number of 100 ns units for a specified number of microseconds.\r
64 Useful for managing EFI timer events.\r
65\r
66 @param Microseconds Number of microseonds.\r
67\r
68 @return The number of 100 ns units equivalent to the number of microseconds specified\r
69 by Microseconds.\r
70\r
71**/\r
72#define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)\r
73\r
74\r
75/**\r
76 Macro that returns the number of 100 ns units for a specified number of milliseoconds.\r
77 Useful for managing EFI timer events.\r
78\r
79 @param Milliseconds Number of milliseconds.\r
80\r
81 @return The number of 100 ns units equivalent to the number of milliseconds specified\r
82 by Milliseconds.\r
83\r
84**/\r
85#define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)\r
86\r
87\r
88/**\r
89 Macro that returns the number of 100 ns units for a specified number of seoconds.\r
90 Useful for managing EFI timer events.\r
91\r
92 @param Seconds Number of seconds.\r
93\r
94 @return The number of 100 ns units equivalent to the number of seconds specified\r
95 by Seconds.\r
96\r
97**/\r
98#define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)\r
99\r
100\r
fb3df220 101/**\r
1d37ab9f 102 Retrieves a pointer to the system configuration table from the EFI System Table\r
103 based on a specified GUID.\r
104 \r
105 This function searches the list of configuration tables stored in the EFI System Table\r
106 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to\r
107 the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID\r
108 is not found, then EFI_NOT_FOUND is returned.\r
109 If TableGuid is NULL, then ASSERT().\r
110 If Table is NULL, then ASSERT().\r
fb3df220 111\r
112 @param TableGuid Pointer to table's GUID type..\r
113 @param Table Pointer to the table associated with TableGuid in the EFI System Table.\r
114\r
115 @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
116 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.\r
117\r
118**/\r
119EFI_STATUS\r
120EFIAPI\r
121EfiGetSystemConfigurationTable ( \r
122 IN EFI_GUID *TableGuid,\r
123 OUT VOID **Table\r
124 );\r
125\r
126/**\r
1d37ab9f 127 Creates and returns a notification event and registers that event with all the protocol\r
128 instances specified by ProtocolGuid.\r
129\r
130 This function causes the notification function to be executed for every protocol of type\r
131 ProtocolGuid instance that exists in the system when this function is invoked.\r
132 In addition, every time a protocol of type ProtocolGuid instance is installed or reinstalled,\r
133 the notification function is also executed. This function returns the notification event\r
134 that was created. \r
135 If ProtocolGuid is NULL, then ASSERT().\r
136 If NotifyTpl is not a legal TPL value, then ASSERT().\r
137 If NotifyFunction is NULL, then ASSERT().\r
138 If Registration is NULL, then ASSERT().\r
fb3df220 139\r
140 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.\r
141 @param NotifyTpl Supplies the task priority level of the event notifications.\r
142 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
143 @param NotifyContext The context parameter to pass to NotifyFunction.\r
144 @param Registration A pointer to a memory location to receive the registration value.\r
1d37ab9f 145 This value is passed to LocateHandle() to obtain new handles that\r
146 have been added that support the ProtocolGuid-specified protocol. \r
fb3df220 147\r
1d37ab9f 148 @return The notification event that was created.\r
fb3df220 149\r
150**/\r
151EFI_EVENT\r
152EFIAPI\r
153EfiCreateProtocolNotifyEvent(\r
154 IN EFI_GUID *ProtocolGuid,\r
155 IN EFI_TPL NotifyTpl,\r
156 IN EFI_EVENT_NOTIFY NotifyFunction,\r
157 IN VOID *NotifyContext, OPTIONAL\r
158 OUT VOID **Registration\r
159 );\r
160\r
161/**\r
1d37ab9f 162 Creates a named event that can be signaled with EfiNamedEventSignal().\r
163\r
fb3df220 164 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r
1d37ab9f 165 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more\r
166 listeners on the same event named by the GUID specified by Name. \r
167 If Name is NULL, then ASSERT().\r
168 If NotifyTpl is not a legal TPL value, then ASSERT().\r
169 If NotifyFunction is NULL, then ASSERT().\r
fb3df220 170\r
171 @param Name Supplies GUID name of the event.\r
172 @param NotifyTpl Supplies the task priority level of the event notifications.\r
173 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
174 @param NotifyContext The context parameter to pass to NotifyFunction. \r
175 @param Registration A pointer to a memory location to receive the registration value.\r
176\r
177 @retval EFI_SUCCESS A named event was created.\r
178 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.\r
179\r
180**/\r
181EFI_STATUS\r
182EFIAPI\r
183EfiNamedEventListen (\r
184 IN CONST EFI_GUID *Name,\r
185 IN EFI_TPL NotifyTpl,\r
186 IN EFI_EVENT_NOTIFY NotifyFunction,\r
187 IN CONST VOID *NotifyContext, OPTIONAL\r
188 OUT VOID *Registration OPTIONAL\r
189 );\r
190\r
191/**\r
1d37ab9f 192 Signals a named event created with EfiNamedEventListen().\r
193\r
194 This function signals the named event specified by Name. The named event must have been\r
195 created with EfiNamedEventListen().\r
196 If Name is NULL, then ASSERT().\r
fb3df220 197\r
198 @param Name Supplies GUID name of the event.\r
199\r
200 @retval EFI_SUCCESS A named event was signaled.\r
201 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.\r
202\r
203**/\r
204EFI_STATUS\r
205EFIAPI\r
206EfiNamedEventSignal (\r
207 IN CONST EFI_GUID *Name\r
208 );\r
209\r
210/** \r
211 Returns the current TPL.\r
212\r
213 This function returns the current TPL. There is no EFI service to directly \r
214 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise \r
215 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level \r
216 can then immediately be restored back to the current TPL level with a call \r
217 to RestoreTPL().\r
218\r
01aef47b 219 @return The current TPL.\r
fb3df220 220\r
221**/\r
222EFI_TPL\r
223EFIAPI\r
224EfiGetCurrentTpl (\r
225 VOID\r
226 );\r
227\r
228/**\r
1d37ab9f 229 Initializes a basic mutual exclusion lock.\r
230\r
fb3df220 231 This function initializes a basic mutual exclusion lock to the released state \r
232 and returns the lock. Each lock provides mutual exclusion access at its task \r
233 priority level. Since there is no preemption or multiprocessor support in EFI,\r
234 acquiring the lock only consists of raising to the locks TPL.\r
1d37ab9f 235 If Lock is NULL, then ASSERT().\r
236 If Priority is not a valid TPL value, then ASSERT().\r
fb3df220 237\r
238 @param Lock A pointer to the lock data structure to initialize.\r
239 @param Priority EFI TPL associated with the lock.\r
240\r
241 @return The lock.\r
242\r
243**/\r
244EFI_LOCK *\r
245EFIAPI\r
246EfiInitializeLock (\r
247 IN OUT EFI_LOCK *Lock,\r
248 IN EFI_TPL Priority\r
249 );\r
250\r
251/**\r
252 This macro initializes the contents of a basic mutual exclusion lock to the \r
253 released state. Each lock provides mutual exclusion access at its task \r
254 priority level. Since there is no preemption or multiprocessor support in EFI,\r
255 acquiring the lock only consists of raising to the locks TPL.\r
256\r
fb3df220 257 @param Priority The task priority level of the lock.\r
258\r
259 @return The lock.\r
260\r
261**/\r
262#define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \\r
50615d1f 263 {Priority, TPL_APPLICATION, EfiLockReleased }\r
fb3df220 264\r
265\r
266/**\r
267 \r
268 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.\r
269\r
270 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set, \r
271 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock \r
272 is not in the locked state, then DebugAssert() is called passing in the source \r
273 filename, source line number, and Lock.\r
fb3df220 274 If Lock is NULL, then ASSERT().\r
275\r
276 @param LockParameter A pointer to the lock to acquire.\r
277\r
278**/\r
279#define ASSERT_LOCKED(LockParameter) \\r
280 do { \\r
281 if (DebugAssertEnabled ()) { \\r
282 ASSERT (LockParameter != NULL); \\r
283 if ((LockParameter)->Lock != EfiLockAcquired) { \\r
284 _ASSERT (LockParameter not locked); \\r
285 } \\r
286 } \\r
287 } while (FALSE)\r
288\r
289\r
290/**\r
1d37ab9f 291 Acquires ownership of a lock.\r
292\r
fb3df220 293 This function raises the system's current task priority level to the task \r
294 priority level of the mutual exclusion lock. Then, it places the lock in the \r
295 acquired state.\r
1d37ab9f 296 If Lock is NULL, then ASSERT().\r
297 If Lock is not initialized, then ASSERT().\r
298 If Lock is already in the acquired state, then ASSERT().\r
fb3df220 299\r
01aef47b 300 @param Lock A pointer to the lock to acquire.\r
fb3df220 301\r
302**/\r
303VOID\r
304EFIAPI\r
305EfiAcquireLock (\r
306 IN EFI_LOCK *Lock\r
307 );\r
308\r
309/**\r
1d37ab9f 310 Acquires ownership of a lock. If the lock is already owned , then an error is returned.\r
311\r
fb3df220 312 This function raises the system's current task priority level to the task \r
313 priority level of the mutual exclusion lock. Then, it attempts to place the \r
314 lock in the acquired state.\r
1d37ab9f 315 If Lock is NULL, then ASSERT().\r
316 If Lock is not initialized, then ASSERT().\r
fb3df220 317\r
318 @param Lock A pointer to the lock to acquire.\r
319\r
320 @retval EFI_SUCCESS The lock was acquired.\r
321 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.\r
322\r
323**/\r
324EFI_STATUS\r
325EFIAPI\r
326EfiAcquireLockOrFail (\r
327 IN EFI_LOCK *Lock\r
328 );\r
329\r
330/**\r
1d37ab9f 331 Releases ownership of a lock.\r
332\r
fb3df220 333 This function transitions a mutual exclusion lock from the acquired state to \r
334 the released state, and restores the system's task priority level to its \r
335 previous level.\r
1d37ab9f 336 If Lock is NULL, then ASSERT().\r
337 If Lock is not initialized, then ASSERT().\r
338 If Lock is already in the released state, then ASSERT().\r
fb3df220 339\r
340 @param Lock A pointer to the lock to release.\r
341\r
342**/\r
343VOID\r
344EFIAPI\r
345EfiReleaseLock (\r
346 IN EFI_LOCK *Lock\r
347 );\r
348\r
0c9d7395 349/**\r
350 Tests whether a controller handle is being managed by a specific driver.\r
351\r
fb3df220 352 This function tests whether the driver specified by DriverBindingHandle is\r
353 currently managing the controller specified by ControllerHandle. This test\r
354 is performed by evaluating if the the protocol specified by ProtocolGuid is\r
355 present on ControllerHandle and is was opened by DriverBindingHandle with an\r
356 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
357 If ProtocolGuid is NULL, then ASSERT().\r
0c9d7395 358\r
359 @param ControllerHandle A handle for a controller to test.\r
360 @param DriverBindingHandle Specifies the driver binding handle for the\r
361 driver.\r
362 @param ProtocolGuid Specifies the protocol that the driver specified\r
363 by DriverBindingHandle opens in its Start()\r
364 function.\r
365\r
366 @retval EFI_SUCCESS ControllerHandle is managed by the driver\r
367 specifed by DriverBindingHandle.\r
368 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver\r
369 specifed by DriverBindingHandle.\r
370\r
fb3df220 371**/\r
372EFI_STATUS\r
373EFIAPI\r
374EfiTestManagedDevice (\r
375 IN CONST EFI_HANDLE ControllerHandle,\r
376 IN CONST EFI_HANDLE DriverBindingHandle,\r
377 IN CONST EFI_GUID *ProtocolGuid\r
378 );\r
379\r
0c9d7395 380/**\r
381 Tests whether a child handle is a child device of the controller.\r
382\r
fb3df220 383 This function tests whether ChildHandle is one of the children of\r
384 ControllerHandle. This test is performed by checking to see if the protocol\r
385 specified by ProtocolGuid is present on ControllerHandle and opened by\r
386 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
387 If ProtocolGuid is NULL, then ASSERT().\r
0c9d7395 388\r
389 @param ControllerHandle A handle for a (parent) controller to test. \r
390 @param ChildHandle A child handle to test.\r
01aef47b 391 @param ProtocolGuid Supplies the protocol that the child controller\r
0c9d7395 392 opens on its parent controller. \r
393\r
394 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.\r
395 @retval EFI_UNSUPPORTED ChildHandle is not a child of the\r
396 ControllerHandle.\r
397\r
fb3df220 398**/\r
399EFI_STATUS\r
400EFIAPI\r
401EfiTestChildHandle (\r
402 IN CONST EFI_HANDLE ControllerHandle,\r
403 IN CONST EFI_HANDLE ChildHandle,\r
404 IN CONST EFI_GUID *ProtocolGuid\r
405 );\r
406\r
407/**\r
1d37ab9f 408 This function looks up a Unicode string in UnicodeStringTable.\r
409\r
410 If Language is a member of SupportedLanguages and a Unicode string is found in\r
411 UnicodeStringTable that matches the language code specified by Language, then it\r
412 is returned in UnicodeString.\r
fb3df220 413\r
414 @param Language A pointer to the ISO 639-2 language code for the \r
415 Unicode string to look up and return.\r
416 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes \r
417 that the Unicode string table supports. Language \r
418 must be a member of this set.\r
419 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
420 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable\r
421 that matches the language specified by Language.\r
422\r
423 @retval EFI_SUCCESS The Unicode string that matches the language \r
424 specified by Language was found\r
425 in the table of Unicoide strings UnicodeStringTable, \r
426 and it was returned in UnicodeString.\r
427 @retval EFI_INVALID_PARAMETER Language is NULL.\r
428 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
429 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
430 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r
431 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
432 member of SupportedLanguages.\r
433 @retval EFI_UNSUPPORTED The language specified by Language is not \r
434 supported by UnicodeStringTable.\r
435\r
436**/\r
437EFI_STATUS\r
438EFIAPI\r
439LookupUnicodeString (\r
440 IN CONST CHAR8 *Language,\r
441 IN CONST CHAR8 *SupportedLanguages,\r
442 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
443 OUT CHAR16 **UnicodeString\r
444 );\r
445\r
a73480f6 446/**\r
447 This function looks up a Unicode string in UnicodeStringTable.\r
448 If Language is a member of SupportedLanguages and a Unicode\r
449 string is found in UnicodeStringTable that matches the\r
450 language code specified by Language, then it is returned in\r
451 UnicodeString.\r
452\r
453 @param Language A pointer to the ISO 639-2 or\r
454 RFC 3066 language code for the\r
455 Unicode string to look up and\r
1d37ab9f 456 return. \r
a73480f6 457 @param SupportedLanguages A pointer to the set of ISO\r
458 639-2 or RFC 3066 language\r
459 codes that the Unicode string\r
460 table supports. Language must\r
1d37ab9f 461 be a member of this set. \r
a73480f6 462 @param UnicodeStringTable A pointer to the table of\r
1d37ab9f 463 Unicode strings. \r
a73480f6 464 @param UnicodeString A pointer to the Unicode\r
465 string from UnicodeStringTable\r
466 that matches the language\r
467 specified by Language.\r
a73480f6 468 @param Iso639Language Specify the language code\r
469 format supported. If true,\r
470 then the format follow ISO\r
471 639-2. If false, then it\r
472 follows RFC3066.\r
a73480f6 473 @retval EFI_SUCCESS The Unicode string that\r
474 matches the language specified\r
475 by Language was found in the\r
476 table of Unicoide strings\r
477 UnicodeStringTable, and it was\r
1d37ab9f 478 returned in UnicodeString. \r
479\r
480 @retval EFI_INVALID_PARAMETER Language is NULL. \r
481 @retval EFI_INVALID_PARAMETER UnicodeString is NULL. \r
482 @retval EFI_UNSUPPORTED SupportedLanguages is NULL. \r
483 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL. \r
a73480f6 484 @retval EFI_UNSUPPORTED The language specified by\r
485 Language is not a member\r
1d37ab9f 486 ofSupportedLanguages. \r
487 @retval EFI_UNSUPPORTED The language specified by\r
a73480f6 488 Language is not supported by\r
489 UnicodeStringTable.\r
490\r
491**/\r
492EFI_STATUS\r
493EFIAPI\r
494LookupUnicodeString2 (\r
495 IN CONST CHAR8 *Language,\r
496 IN CONST CHAR8 *SupportedLanguages,\r
497 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
498 OUT CHAR16 **UnicodeString,\r
499 IN BOOLEAN Iso639Language\r
ed66e1bc 500 );\r
a73480f6 501\r
fb3df220 502/**\r
503 This function adds a Unicode string to UnicodeStringTable.\r
1d37ab9f 504\r
fb3df220 505 If Language is a member of SupportedLanguages then UnicodeString is added to \r
506 UnicodeStringTable. New buffers are allocated for both Language and \r
507 UnicodeString. The contents of Language and UnicodeString are copied into \r
508 these new buffers. These buffers are automatically freed when \r
509 FreeUnicodeStringTable() is called.\r
510\r
511 @param Language A pointer to the ISO 639-2 language code for the Unicode \r
512 string to add.\r
513 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
514 that the Unicode string table supports.\r
515 Language must be a member of this set.\r
516 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
517 @param UnicodeString A pointer to the Unicode string to add.\r
518\r
519 @retval EFI_SUCCESS The Unicode string that matches the language \r
520 specified by Language was found in the table of \r
521 Unicode strings UnicodeStringTable, and it was \r
522 returned in UnicodeString.\r
523 @retval EFI_INVALID_PARAMETER Language is NULL.\r
524 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
525 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
526 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
527 @retval EFI_ALREADY_STARTED A Unicode string with language Language is \r
528 already present in UnicodeStringTable.\r
529 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another \r
530 Unicode string to UnicodeStringTable.\r
531 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
532 member of SupportedLanguages.\r
533\r
534**/\r
535EFI_STATUS\r
536EFIAPI\r
537AddUnicodeString (\r
538 IN CONST CHAR8 *Language,\r
539 IN CONST CHAR8 *SupportedLanguages,\r
540 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
541 IN CONST CHAR16 *UnicodeString\r
542 );\r
543\r
a73480f6 544/**\r
a73480f6 545 This function adds a Unicode string to UnicodeStringTable.\r
1d37ab9f 546\r
a73480f6 547 If Language is a member of SupportedLanguages then\r
548 UnicodeString is added to UnicodeStringTable. New buffers are\r
549 allocated for both Language and UnicodeString. The contents\r
550 of Language and UnicodeString are copied into these new\r
551 buffers. These buffers are automatically freed when\r
552 FreeUnicodeStringTable() is called.\r
553\r
554 @param Language A pointer to the ISO 639-2 or\r
555 RFC 3066 language code for the\r
1d37ab9f 556 Unicode string to add. \r
a73480f6 557 @param SupportedLanguages A pointer to the set of ISO\r
0c9d7395 558 639-2 or RFC 3066 language\r
a73480f6 559 codes that the Unicode string\r
560 table supports. Language must\r
1d37ab9f 561 be a member of this set. \r
a73480f6 562 @param UnicodeStringTable A pointer to the table of\r
1d37ab9f 563 Unicode strings. \r
a73480f6 564 @param UnicodeString A pointer to the Unicode\r
1d37ab9f 565 string to add. \r
a73480f6 566 @param Iso639Language Specify the language code\r
567 format supported. If true,\r
568 then the format follow ISO\r
569 639-2. If false, then it\r
570 follows RFC3066.\r
a73480f6 571 @retval EFI_SUCCESS The Unicode string that\r
572 matches the language specified\r
573 by Language was found in the\r
574 table of Unicode strings\r
575 UnicodeStringTable, and it was\r
576 returned in UnicodeString.\r
577 \r
1d37ab9f 578 @retval EFI_INVALID_PARAMETER Language is NULL. \r
579 @retval EFI_INVALID_PARAMETER UnicodeString is NULL. \r
580 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string. \r
581 @retval EFI_UNSUPPORTED SupportedLanguages is NULL. \r
a73480f6 582 @retval EFI_ALREADY_STARTED A Unicode string with language\r
583 Language is already present in\r
1d37ab9f 584 UnicodeStringTable. \r
a73480f6 585 @retval EFI_OUT_OF_RESOURCES There is not enough memory to\r
586 add another Unicode string to\r
1d37ab9f 587 UnicodeStringTable. \r
a73480f6 588 @retval EFI_UNSUPPORTED The language specified by\r
589 Language is not a member of\r
590 SupportedLanguages.\r
591\r
592**/\r
593EFI_STATUS\r
594EFIAPI\r
595AddUnicodeString2 (\r
596 IN CONST CHAR8 *Language,\r
597 IN CONST CHAR8 *SupportedLanguages,\r
598 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
599 IN CONST CHAR16 *UnicodeString,\r
600 IN BOOLEAN Iso639Language\r
ed66e1bc 601 );\r
a73480f6 602\r
fb3df220 603/**\r
604 This function frees the table of Unicode strings in UnicodeStringTable.\r
1d37ab9f 605\r
fb3df220 606 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
607 Otherwise, each language code, and each Unicode string in the Unicode string \r
608 table are freed, and EFI_SUCCESS is returned.\r
609\r
610 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
611\r
612 @retval EFI_SUCCESS The Unicode string table was freed.\r
613\r
614**/\r
615EFI_STATUS\r
616EFIAPI\r
617FreeUnicodeStringTable (\r
618 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
619 );\r
620\r
621/**\r
622 This function computes and returns the width of the Unicode character \r
623 specified by UnicodeChar.\r
624\r
625 @param UnicodeChar A Unicode character.\r
626\r
627 @retval 0 The width if UnicodeChar could not be determined.\r
628 @retval 1 UnicodeChar is a narrow glyph.\r
629 @retval 2 UnicodeChar is a wide glyph.\r
630\r
631**/\r
632UINTN\r
633EFIAPI\r
634GetGlyphWidth (\r
635 IN CHAR16 UnicodeChar\r
636 );\r
637\r
638/**\r
1d37ab9f 639 Computes the display length of a Null-terminated Unicode String.\r
640\r
fb3df220 641 This function computes and returns the display length of\r
642 the Null-terminated Unicode string specified by String.\r
643 If String is NULL, then 0 is returned.\r
644 If any of the widths of the Unicode characters in String\r
645 can not be determined, then 0 is returned.\r
646\r
647 @param String A pointer to a Null-terminated Unicode string.\r
648\r
649 @return The display length of the Null-terminated Unicode string specified by String.\r
650 \r
651**/\r
652UINTN\r
653EFIAPI\r
654UnicodeStringDisplayLength (\r
655 IN CONST CHAR16 *String\r
656 );\r
657\r
658//\r
659// Functions that abstract early Framework contamination of UEFI.\r
660//\r
661/**\r
1d37ab9f 662 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r
fb3df220 663 \r
1d37ab9f 664 This function abstracts the signaling of the Ready to Boot Event. The Framework moved\r
665 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from\r
666 how this event is created to prevent to code form having to change with the version of\r
667 the specification supported.\r
fb3df220 668\r
669**/\r
670VOID\r
671EFIAPI\r
672EfiSignalEventReadyToBoot (\r
673 VOID\r
674 );\r
675\r
676/**\r
1d37ab9f 677 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().\r
678\r
679 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from\r
680 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how\r
681 this event is created to prevent to code form having to change with the version of the\r
682 specification supported.\r
fb3df220 683\r
684**/\r
685VOID\r
686EFIAPI\r
687EfiSignalEventLegacyBoot (\r
688 VOID\r
689 );\r
690\r
691/**\r
7f1eba7b 692 Creates an EFI event in the Legacy Boot Event Group. Prior to UEFI 2.0 this \r
693 was done via a non blessed UEFI extensions and this library abstracts the \r
694 implementation mechanism of this event from the caller.\r
fb3df220 695 \r
7f1eba7b 696 This function abstracts the creation of the Legacy Boot Event. The Framework \r
697 moved from a proprietary to UEFI 2.0 based mechanism. This library abstracts \r
698 the caller from how this event is created to prevent to code form having to \r
699 change with the version of the specification supported.\r
700 If LegacyBootEvent is NULL, then ASSERT().\r
fb3df220 701\r
702 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
703\r
704 @retval EFI_SUCCESS Event was created.\r
705 @retval Other Event was not created.\r
706\r
707**/\r
708EFI_STATUS\r
709EFIAPI\r
710EfiCreateEventLegacyBoot (\r
711 OUT EFI_EVENT *LegacyBootEvent\r
712 );\r
713\r
714/**\r
715 Create an EFI event in the Legacy Boot Event Group and allows\r
716 the caller to specify a notification function. \r
717 \r
718 This function abstracts the creation of the Legacy Boot Event.\r
719 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
720 This library abstracts the caller from how this event is created to prevent\r
721 to code form having to change with the version of the specification supported.\r
722 If LegacyBootEvent is NULL, then ASSERT().\r
723\r
724 @param NotifyTpl The task priority level of the event.\r
725 @param NotifyFunction The notification function to call when the event is signaled.\r
726 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
727 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
728\r
729 @retval EFI_SUCCESS Event was created.\r
730 @retval Other Event was not created.\r
731\r
732**/\r
733EFI_STATUS\r
734EFIAPI\r
735EfiCreateEventLegacyBootEx (\r
736 IN EFI_TPL NotifyTpl,\r
737 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
738 IN VOID *NotifyContext, OPTIONAL\r
739 OUT EFI_EVENT *LegacyBootEvent\r
740 );\r
741\r
742/**\r
7f1eba7b 743 Create an EFI event in the Ready To Boot Event Group. Prior to UEFI 2.0 this \r
744 was done via a non-standard UEFI extension, and this library abstracts the \r
745 implementation mechanism of this event from the caller. \r
fb3df220 746 \r
7f1eba7b 747 This function abstracts the creation of the Ready to Boot Event. The Framework \r
748 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts \r
749 the caller from how this event is created to prevent the code form having to \r
750 change with the version of the specification supported.\r
751 If ReadyToBootEvent is NULL, then ASSERT().\r
fb3df220 752\r
01aef47b 753 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
fb3df220 754\r
755 @retval EFI_SUCCESS Event was created.\r
756 @retval Other Event was not created.\r
757\r
758**/\r
759EFI_STATUS\r
760EFIAPI\r
761EfiCreateEventReadyToBoot (\r
762 OUT EFI_EVENT *ReadyToBootEvent\r
763 );\r
764\r
765/**\r
766 Create an EFI event in the Ready To Boot Event Group and allows\r
767 the caller to specify a notification function. \r
768 \r
769 This function abstracts the creation of the Ready to Boot Event.\r
770 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
771 This library abstracts the caller from how this event is created to prevent\r
772 to code form having to change with the version of the specification supported.\r
773 If ReadyToBootEvent is NULL, then ASSERT().\r
774\r
775 @param NotifyTpl The task priority level of the event.\r
776 @param NotifyFunction The notification function to call when the event is signaled.\r
777 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
01aef47b 778 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
fb3df220 779\r
780 @retval EFI_SUCCESS Event was created.\r
781 @retval Other Event was not created.\r
782\r
783**/\r
784EFI_STATUS\r
785EFIAPI\r
786EfiCreateEventReadyToBootEx (\r
787 IN EFI_TPL NotifyTpl,\r
788 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
789 IN VOID *NotifyContext, OPTIONAL\r
790 OUT EFI_EVENT *ReadyToBootEvent\r
791 );\r
792\r
793/**\r
794 Initialize a Firmware Volume (FV) Media Device Path node.\r
795 \r
7f1eba7b 796 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. \r
1d37ab9f 797 This library function abstracts initializing a device path node. \r
7f1eba7b 798 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device \r
799 path changed in the DXE CIS version 0.92 in a non back ward compatible way to \r
800 not conflict with the UEFI 2.0 specification. This function abstracts the \r
801 differences from the caller.\r
7f1eba7b 802 If FvDevicePathNode is NULL, then ASSERT().\r
803 If NameGuid is NULL, then ASSERT().\r
804 \r
fb3df220 805 @param FvDevicePathNode Pointer to a FV device path node to initialize\r
806 @param NameGuid FV file name to use in FvDevicePathNode\r
807\r
808**/\r
809VOID\r
810EFIAPI\r
811EfiInitializeFwVolDevicepathNode (\r
812 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
813 IN CONST EFI_GUID *NameGuid\r
814 );\r
815\r
816/**\r
817 Check to see if the Firmware Volume (FV) Media Device Path is valid \r
818 \r
7f1eba7b 819 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. \r
820 This library function abstracts validating a device path node.\r
7f1eba7b 821 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid. \r
822 If it is valid, then return the GUID file name from the device path node. Otherwise, \r
823 return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward \r
824 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts \r
825 the differences from the caller.\r
826 If FvDevicePathNode is NULL, then ASSERT().\r
fb3df220 827\r
828 @param FvDevicePathNode Pointer to FV device path to check.\r
829\r
830 @retval NULL FvDevicePathNode is not valid.\r
831 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
832\r
833**/\r
834EFI_GUID *\r
835EFIAPI\r
836EfiGetNameGuidFromFwVolDevicePathNode (\r
837 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
838 );\r
839\r
840/** \r
841 Prints a formatted Unicode string to the console output device specified by \r
842 ConOut defined in the EFI_SYSTEM_TABLE.\r
843\r
844 This function prints a formatted Unicode string to the console output device \r
845 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r
846 characters that printed to ConOut. If the length of the formatted Unicode \r
847 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
848 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1d37ab9f 849 If Format is NULL, then ASSERT().\r
850 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
fb3df220 851\r
852 @param Format Null-terminated Unicode format string.\r
285010e7 853 @param ... Variable argument list whose contents are accessed based \r
854 on the format string specified by Format.\r
9199040c 855 \r
856 @return Number of Unicode characters printed to ConOut.\r
fb3df220 857\r
858**/\r
859UINTN\r
860EFIAPI\r
861Print (\r
862 IN CONST CHAR16 *Format,\r
863 ...\r
864 );\r
865\r
866/** \r
867 Prints a formatted Unicode string to the console output device specified by \r
868 StdErr defined in the EFI_SYSTEM_TABLE.\r
869\r
870 This function prints a formatted Unicode string to the console output device \r
871 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r
872 characters that printed to StdErr. If the length of the formatted Unicode \r
873 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
874 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1d37ab9f 875 If Format is NULL, then ASSERT().\r
876 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
fb3df220 877\r
878 @param Format Null-terminated Unicode format string.\r
285010e7 879 @param ... Variable argument list whose contents are accessed based \r
880 on the format string specified by Format.\r
9199040c 881 \r
882 @return Number of Unicode characters printed to StdErr.\r
fb3df220 883\r
884**/\r
885UINTN\r
886EFIAPI\r
887ErrorPrint (\r
888 IN CONST CHAR16 *Format,\r
889 ...\r
890 );\r
891\r
892/** \r
893 Prints a formatted ASCII string to the console output device specified by \r
894 ConOut defined in the EFI_SYSTEM_TABLE.\r
895\r
896 This function prints a formatted ASCII string to the console output device \r
897 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r
898 characters that printed to ConOut. If the length of the formatted ASCII \r
899 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
900 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1d37ab9f 901 If Format is NULL, then ASSERT().\r
902 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
fb3df220 903\r
904 @param Format Null-terminated ASCII format string.\r
285010e7 905 @param ... Variable argument list whose contents are accessed based \r
906 on the format string specified by Format.\r
9199040c 907 \r
908 @return Number of ASCII characters printed to ConOut.\r
fb3df220 909\r
910**/\r
911UINTN\r
912EFIAPI\r
913AsciiPrint (\r
914 IN CONST CHAR8 *Format,\r
915 ...\r
916 );\r
917\r
918/** \r
919 Prints a formatted ASCII string to the console output device specified by \r
920 StdErr defined in the EFI_SYSTEM_TABLE.\r
921\r
922 This function prints a formatted ASCII string to the console output device \r
923 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r
924 characters that printed to StdErr. If the length of the formatted ASCII \r
925 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
926 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1d37ab9f 927 If Format is NULL, then ASSERT().\r
928 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
fb3df220 929\r
930 @param Format Null-terminated ASCII format string.\r
285010e7 931 @param ... Variable argument list whose contents are accessed based \r
932 on the format string specified by Format.\r
9199040c 933 \r
934 @return Number of ASCII characters printed to ConErr.\r
fb3df220 935\r
936**/\r
937UINTN\r
938EFIAPI\r
939AsciiErrorPrint (\r
940 IN CONST CHAR8 *Format,\r
941 ...\r
942 );\r
943\r
b3154720 944/**\r
945 Prints a formatted Unicode string to a graphics console device specified by \r
946 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
947\r
948 This function prints a formatted Unicode string to the graphics console device \r
949 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r
950 Unicode characters printed. If the length of the formatted Unicode string is\r
951 greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
952 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
953 is used to convert the string to a bitmap using the glyphs registered with the \r
954 HII database. No wrapping is performed, so any portions of the string the fall\r
955 outside the active display region will not be displayed.\r
956\r
957 If a graphics console device is not associated with the ConsoleOutputHandle \r
958 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
959 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r
960 string is printed, and 0 is returned.\r
961 If Format is NULL, then ASSERT().\r
962 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
963\r
964 @param X X coordinate to print the string.\r
965 @param Y Y coordinate to print the string.\r
966 @param ForeGround The forground color of the string being printed. This is\r
967 an optional parameter that may be NULL. If it is NULL,\r
968 then the foreground color of the current ConOut device\r
969 in the EFI_SYSTEM_TABLE is used.\r
970 @param BackGround The background color of the string being printed. This is\r
971 an optional parameter that may be NULL. If it is NULL, \r
972 then the background color of the current ConOut device\r
973 in the EFI_SYSTEM_TABLE is used.\r
974 @param Format Null-terminated Unicode format string. See Print Library \r
975 for the supported format string syntax.\r
976 @param ... Variable argument list whose contents are accessed based on \r
977 the format string specified by Format. \r
978\r
979 @return The number of Unicode characters printed.\r
980\r
981**/\r
982UINTN\r
983EFIAPI\r
984PrintXY (\r
985 IN UINTN X,\r
986 IN UINTN Y,\r
987 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
988 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
989 IN CONST CHAR16 *Format,\r
990 ...\r
991 );\r
992\r
993/**\r
994 Prints a formatted ASCII string to a graphics console device specified by \r
995 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
996\r
997 This function prints a formatted ASCII string to the graphics console device \r
998 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r
999 ASCII characters printed. If the length of the formatted ASCII string is\r
1000 greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
1001 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
1002 is used to convert the string to a bitmap using the glyphs registered with the \r
1003 HII database. No wrapping is performed, so any portions of the string the fall\r
1004 outside the active display region will not be displayed.\r
1005\r
1006 If a graphics console device is not associated with the ConsoleOutputHandle \r
1007 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
1008 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r
1009 string is printed, and 0 is returned.\r
1010 If Format is NULL, then ASSERT().\r
1011 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
1012\r
1013 @param X X coordinate to print the string.\r
1014 @param Y Y coordinate to print the string.\r
1015 @param ForeGround The forground color of the string being printed. This is\r
1016 an optional parameter that may be NULL. If it is NULL,\r
1017 then the foreground color of the current ConOut device\r
1018 in the EFI_SYSTEM_TABLE is used.\r
1019 @param BackGround The background color of the string being printed. This is\r
1020 an optional parameter that may be NULL. If it is NULL, \r
1021 then the background color of the current ConOut device\r
1022 in the EFI_SYSTEM_TABLE is used.\r
1023 @param Format Null-terminated ASCII format string. See Print Library \r
1024 for the supported format string syntax.\r
1025 @param ... Variable argument list whose contents are accessed based on \r
1026 the format string specified by Format. \r
1027\r
1028 @return The number of ASCII characters printed.\r
1029\r
1030**/\r
1031UINTN\r
1032EFIAPI\r
1033AsciiPrintXY (\r
1034 IN UINTN X,\r
1035 IN UINTN Y,\r
1036 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1037 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1038 IN CONST CHAR8 *Format,\r
1039 ...\r
1040 );\r
1041\r
c7d265a9 1042/**\r
0c9d7395 1043 Initializes a driver by installing the Driver Binding Protocol onto the driver's\r
1d37ab9f 1044 DriverBindingHandle.\r
1045\r
1046 This is typically the same as the driver's ImageHandle, but\r
f662c194 1047 it can be different if the driver produces multiple DriverBinding Protocols. \r
0c9d7395 1048 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 1049 If the installation fails, then ASSERT ().\r
c7d265a9 1050\r
f662c194 1051 @param ImageHandle The image handle of the driver.\r
1052 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1053 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 1054 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 1055 parameter is NULL, then a new handle is created.\r
c7d265a9 1056\r
f662c194 1057 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1d37ab9f 1058 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.\r
f662c194 1059 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 1060\r
1061**/\r
1062EFI_STATUS\r
1063EFIAPI\r
1064EfiLibInstallDriverBinding (\r
1065 IN CONST EFI_HANDLE ImageHandle,\r
1066 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1067 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1068 IN EFI_HANDLE DriverBindingHandle\r
1069 );\r
1070\r
c7d265a9 1071\r
f662c194 1072/**\r
0c9d7395 1073 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
1d37ab9f 1074 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle.\r
1075\r
1076 This is typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
f662c194 1077 DriverBinding Protocols. \r
0c9d7395 1078 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 1079 If the installation fails, then ASSERT ().\r
1080\r
1081 @param ImageHandle The image handle of the driver.\r
1082 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1083 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 1084 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 1085 parameter is NULL, then a new handle is created.\r
1086 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1087 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1088 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1089\r
1090 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1091 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 1092\r
1093**/\r
1094EFI_STATUS\r
1095EFIAPI\r
1096EfiLibInstallAllDriverProtocols (\r
1097 IN CONST EFI_HANDLE ImageHandle,\r
1098 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1099 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1100 IN EFI_HANDLE DriverBindingHandle,\r
1101 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1102 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1103 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
1104 );\r
1105\r
1106\r
f662c194 1107\r
c7d265a9 1108/**\r
0c9d7395 1109 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
f662c194 1110 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's\r
1111 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols. \r
0c9d7395 1112 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 1113 If the installation fails, then ASSERT ().\r
1114\r
1115 @param ImageHandle The image handle of the driver.\r
1116 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1117 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 1118 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 1119 parameter is NULL, then a new handle is created.\r
1120 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1121 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
c7d265a9 1122\r
f662c194 1123 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1124 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
1125\r
1126**/\r
1127EFI_STATUS\r
1128EFIAPI\r
1129EfiLibInstallDriverBindingComponentName2 (\r
1130 IN CONST EFI_HANDLE ImageHandle,\r
1131 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1132 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1133 IN EFI_HANDLE DriverBindingHandle,\r
1134 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1135 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
1136 );\r
1137\r
1138\r
1139/**\r
def220c4 1140 Intialize a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
f662c194 1141 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's\r
1d37ab9f 1142 DriverBindingHandle.\r
1143\r
1144 This is typically the same as the driver's ImageHandle, but it can be different if\r
f662c194 1145 the driver produces multiple DriverBinding Protocols. \r
def220c4 1146 If the Drvier Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 1147 If the installation fails, then ASSERT ().\r
1148\r
1149 @param ImageHandle The image handle of the driver.\r
1150 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1151 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
def220c4 1152 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
f662c194 1153 parameter is NULL, then a new handle is created.\r
1154 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1155 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1156 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
def220c4 1157 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.\r
f662c194 1158 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1159 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
1160\r
1161 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1162 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 1163\r
1164**/\r
1165EFI_STATUS\r
1166EFIAPI\r
1167EfiLibInstallAllDriverProtocols2 (\r
1168 IN CONST EFI_HANDLE ImageHandle,\r
1169 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1170 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1171 IN EFI_HANDLE DriverBindingHandle,\r
def220c4 1172 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1173 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
1174 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1175 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration2, OPTIONAL\r
1176 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
1177 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
c7d265a9 1178 );\r
1179\r
f8d18bad 1180/**\r
1181 Determine what is the current language setting. The space reserved for Lang\r
1182 must be at least RFC_3066_ENTRY_SIZE bytes;\r
1183\r
1184 If Lang is NULL, then ASSERT.\r
1185\r
1d37ab9f 1186 @param Lang Pointer of system language. Lang will always be filled with a valid RFC 3066\r
1187 language string. If "PlatformLang" is not set in the system, the default\r
1188 language specifed by PcdUefiVariableDefaultPlatformLang is returned.\r
f8d18bad 1189\r
1190 @return EFI_SUCCESS If the EFI Variable with "PlatformLang" is set and return in Lang.\r
1191 @return EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.\r
1192\r
1193**/\r
1194EFI_STATUS\r
1195EFIAPI\r
1196GetCurrentLanguage (\r
1197 OUT CHAR8 *Lang\r
1198 );\r
1199\r
1200\r
fb3df220 1201#endif\r