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