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