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