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