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