]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UefiLib.h
Use doxygen comment style for document entity such as struct, enum, variable that...
[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
420 )\r
421;\r
422\r
fb3df220 423/**\r
424 This function adds a Unicode string to UnicodeStringTable.\r
425 If Language is a member of SupportedLanguages then UnicodeString is added to \r
426 UnicodeStringTable. New buffers are allocated for both Language and \r
427 UnicodeString. The contents of Language and UnicodeString are copied into \r
428 these new buffers. These buffers are automatically freed when \r
429 FreeUnicodeStringTable() is called.\r
430\r
431 @param Language A pointer to the ISO 639-2 language code for the Unicode \r
432 string to add.\r
433 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
434 that the Unicode string table supports.\r
435 Language must be a member of this set.\r
436 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
437 @param UnicodeString A pointer to the Unicode string to add.\r
438\r
439 @retval EFI_SUCCESS The Unicode string that matches the language \r
440 specified by Language was found in the table of \r
441 Unicode strings UnicodeStringTable, and it was \r
442 returned in UnicodeString.\r
443 @retval EFI_INVALID_PARAMETER Language is NULL.\r
444 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
445 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
446 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
447 @retval EFI_ALREADY_STARTED A Unicode string with language Language is \r
448 already present in UnicodeStringTable.\r
449 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another \r
450 Unicode string to UnicodeStringTable.\r
451 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
452 member of SupportedLanguages.\r
453\r
454**/\r
455EFI_STATUS\r
456EFIAPI\r
457AddUnicodeString (\r
458 IN CONST CHAR8 *Language,\r
459 IN CONST CHAR8 *SupportedLanguages,\r
460 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
461 IN CONST CHAR16 *UnicodeString\r
462 );\r
463\r
a73480f6 464/**\r
465 \r
466 This function adds a Unicode string to UnicodeStringTable.\r
467 If Language is a member of SupportedLanguages then\r
468 UnicodeString is added to UnicodeStringTable. New buffers are\r
469 allocated for both Language and UnicodeString. The contents\r
470 of Language and UnicodeString are copied into these new\r
471 buffers. These buffers are automatically freed when\r
472 FreeUnicodeStringTable() is called.\r
473\r
474 @param Language A pointer to the ISO 639-2 or\r
475 RFC 3066 language code for the\r
476 Unicode string to add.\r
477 \r
478 @param SupportedLanguages A pointer to the set of ISO\r
0c9d7395 479 639-2 or RFC 3066 language\r
a73480f6 480 codes that the Unicode string\r
481 table supports. Language must\r
482 be a member of this set.\r
483 \r
484 @param UnicodeStringTable A pointer to the table of\r
485 Unicode strings.\r
486 \r
487 @param UnicodeString A pointer to the Unicode\r
488 string to add.\r
489 \r
490 @param Iso639Language Specify the language code\r
491 format supported. If true,\r
492 then the format follow ISO\r
493 639-2. If false, then it\r
494 follows RFC3066.\r
495\r
496 @retval EFI_SUCCESS The Unicode string that\r
497 matches the language specified\r
498 by Language was found in the\r
499 table of Unicode strings\r
500 UnicodeStringTable, and it was\r
501 returned in UnicodeString.\r
502 \r
503 @retval EFI_INVALID_PARAMETER Language is NULL.\r
504 \r
505 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
506 \r
507 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
508 \r
509 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
510 \r
511 @retval EFI_ALREADY_STARTED A Unicode string with language\r
512 Language is already present in\r
513 UnicodeStringTable.\r
514 \r
515 @retval EFI_OUT_OF_RESOURCES There is not enough memory to\r
516 add another Unicode string to\r
517 UnicodeStringTable.\r
518 \r
519 @retval EFI_UNSUPPORTED The language specified by\r
520 Language is not a member of\r
521 SupportedLanguages.\r
522\r
523**/\r
524EFI_STATUS\r
525EFIAPI\r
526AddUnicodeString2 (\r
527 IN CONST CHAR8 *Language,\r
528 IN CONST CHAR8 *SupportedLanguages,\r
529 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
530 IN CONST CHAR16 *UnicodeString,\r
531 IN BOOLEAN Iso639Language\r
532 )\r
533;\r
534\r
fb3df220 535/**\r
536 This function frees the table of Unicode strings in UnicodeStringTable.\r
537 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
538 Otherwise, each language code, and each Unicode string in the Unicode string \r
539 table are freed, and EFI_SUCCESS is returned.\r
540\r
541 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
542\r
543 @retval EFI_SUCCESS The Unicode string table was freed.\r
544\r
545**/\r
546EFI_STATUS\r
547EFIAPI\r
548FreeUnicodeStringTable (\r
549 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
550 );\r
551\r
552/**\r
553 This function computes and returns the width of the Unicode character \r
554 specified by UnicodeChar.\r
555\r
556 @param UnicodeChar A Unicode character.\r
557\r
558 @retval 0 The width if UnicodeChar could not be determined.\r
559 @retval 1 UnicodeChar is a narrow glyph.\r
560 @retval 2 UnicodeChar is a wide glyph.\r
561\r
562**/\r
563UINTN\r
564EFIAPI\r
565GetGlyphWidth (\r
566 IN CHAR16 UnicodeChar\r
567 );\r
568\r
569/**\r
570 This function computes and returns the display length of\r
571 the Null-terminated Unicode string specified by String.\r
572 If String is NULL, then 0 is returned.\r
573 If any of the widths of the Unicode characters in String\r
574 can not be determined, then 0 is returned.\r
575\r
576 @param String A pointer to a Null-terminated Unicode string.\r
577\r
578 @return The display length of the Null-terminated Unicode string specified by String.\r
579 \r
580**/\r
581UINTN\r
582EFIAPI\r
583UnicodeStringDisplayLength (\r
584 IN CONST CHAR16 *String\r
585 );\r
586\r
587//\r
588// Functions that abstract early Framework contamination of UEFI.\r
589//\r
590/**\r
591 Signal a Ready to Boot Event. \r
592 \r
593 Create a Ready to Boot Event. Signal it and close it. This causes other \r
594 events of the same event group to be signaled in other modules. \r
595\r
596**/\r
597VOID\r
598EFIAPI\r
599EfiSignalEventReadyToBoot (\r
600 VOID\r
601 );\r
602\r
603/**\r
604 Signal a Legacy Boot Event. \r
605 \r
606 Create a legacy Boot Event. Signal it and close it. This causes other \r
607 events of the same event group to be signaled in other modules. \r
608\r
609**/\r
610VOID\r
611EFIAPI\r
612EfiSignalEventLegacyBoot (\r
613 VOID\r
614 );\r
615\r
616/**\r
617 Create a Legacy Boot Event. \r
618 \r
619 Tiano extended the CreateEvent Type enum to add a legacy boot event type. \r
620 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
621 added and now it's possible to not voilate the UEFI specification by \r
622 declaring a GUID for the legacy boot event class. This library supports\r
623 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to \r
624 work both ways.\r
625\r
626 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
627\r
628 @retval EFI_SUCCESS Event was created.\r
629 @retval Other Event was not created.\r
630\r
631**/\r
632EFI_STATUS\r
633EFIAPI\r
634EfiCreateEventLegacyBoot (\r
635 OUT EFI_EVENT *LegacyBootEvent\r
636 );\r
637\r
638/**\r
639 Create an EFI event in the Legacy Boot Event Group and allows\r
640 the caller to specify a notification function. \r
641 \r
642 This function abstracts the creation of the Legacy Boot Event.\r
643 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
644 This library abstracts the caller from how this event is created to prevent\r
645 to code form having to change with the version of the specification supported.\r
646 If LegacyBootEvent is NULL, then ASSERT().\r
647\r
648 @param NotifyTpl The task priority level of the event.\r
649 @param NotifyFunction The notification function to call when the event is signaled.\r
650 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
651 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
652\r
653 @retval EFI_SUCCESS Event was created.\r
654 @retval Other Event was not created.\r
655\r
656**/\r
657EFI_STATUS\r
658EFIAPI\r
659EfiCreateEventLegacyBootEx (\r
660 IN EFI_TPL NotifyTpl,\r
661 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
662 IN VOID *NotifyContext, OPTIONAL\r
663 OUT EFI_EVENT *LegacyBootEvent\r
664 );\r
665\r
666/**\r
667 Create a Read to Boot Event. \r
668 \r
669 Tiano extended the CreateEvent Type enum to add a ready to boot event type. \r
670 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
671 added and now it's possible to not voilate the UEFI specification and use \r
672 the ready to boot event class defined in UEFI 2.0. This library supports\r
673 the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to \r
674 work both ways.\r
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
719 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
720 so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
721 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r
722 device path is defined for Tiano extensions of device path. If the code \r
723 is compiled to conform with the UEFI 2.0 specification use the new device path\r
724 else use the old form for backwards compatability.\r
725\r
726 @param FvDevicePathNode Pointer to a FV device path node to initialize\r
727 @param NameGuid FV file name to use in FvDevicePathNode\r
728\r
729**/\r
730VOID\r
731EFIAPI\r
732EfiInitializeFwVolDevicepathNode (\r
733 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
734 IN CONST EFI_GUID *NameGuid\r
735 );\r
736\r
737/**\r
738 Check to see if the Firmware Volume (FV) Media Device Path is valid \r
739 \r
740 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
741 so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
742 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r
743 device path is defined for Tiano extensions of device path. If the code \r
744 is compiled to conform with the UEFI 2.0 specification use the new device path\r
745 else use the old form for backwards compatability. The return value to this\r
746 function points to a location in FvDevicePathNode and it does not allocate\r
747 new memory for the GUID pointer that is returned.\r
748\r
749 @param FvDevicePathNode Pointer to FV device path to check.\r
750\r
751 @retval NULL FvDevicePathNode is not valid.\r
752 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
753\r
754**/\r
755EFI_GUID *\r
756EFIAPI\r
757EfiGetNameGuidFromFwVolDevicePathNode (\r
758 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
759 );\r
760\r
761/** \r
762 Prints a formatted Unicode string to the console output device specified by \r
763 ConOut defined in the EFI_SYSTEM_TABLE.\r
764\r
765 This function prints a formatted Unicode string to the console output device \r
766 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r
767 characters that printed to ConOut. If the length of the formatted Unicode \r
768 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
769 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
770\r
771 @param Format Null-terminated Unicode format string.\r
772 @param ... VARARG list consumed to process Format.\r
773 If Format is NULL, then ASSERT().\r
774 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
9199040c 775 \r
776 @return Number of Unicode characters printed to ConOut.\r
fb3df220 777\r
778**/\r
779UINTN\r
780EFIAPI\r
781Print (\r
782 IN CONST CHAR16 *Format,\r
783 ...\r
784 );\r
785\r
786/** \r
787 Prints a formatted Unicode string to the console output device specified by \r
788 StdErr defined in the EFI_SYSTEM_TABLE.\r
789\r
790 This function prints a formatted Unicode string to the console output device \r
791 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r
792 characters that printed to StdErr. If the length of the formatted Unicode \r
793 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
794 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
795\r
796 @param Format Null-terminated Unicode format string.\r
797 @param ... VARARG list consumed to process Format.\r
798 If Format is NULL, then ASSERT().\r
799 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
9199040c 800 \r
801 @return Number of Unicode characters printed to StdErr.\r
fb3df220 802\r
803**/\r
804UINTN\r
805EFIAPI\r
806ErrorPrint (\r
807 IN CONST CHAR16 *Format,\r
808 ...\r
809 );\r
810\r
811/** \r
812 Prints a formatted ASCII string to the console output device specified by \r
813 ConOut defined in the EFI_SYSTEM_TABLE.\r
814\r
815 This function prints a formatted ASCII string to the console output device \r
816 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r
817 characters that printed to ConOut. If the length of the formatted ASCII \r
818 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
819 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
820\r
821 @param Format Null-terminated ASCII format string.\r
822 @param ... VARARG list consumed to process Format.\r
823 If Format is NULL, then ASSERT().\r
824 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
9199040c 825 \r
826 @return Number of ASCII characters printed to ConOut.\r
fb3df220 827\r
828**/\r
829UINTN\r
830EFIAPI\r
831AsciiPrint (\r
832 IN CONST CHAR8 *Format,\r
833 ...\r
834 );\r
835\r
836/** \r
837 Prints a formatted ASCII string to the console output device specified by \r
838 StdErr defined in the EFI_SYSTEM_TABLE.\r
839\r
840 This function prints a formatted ASCII string to the console output device \r
841 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r
842 characters that printed to StdErr. If the length of the formatted ASCII \r
843 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
844 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
845\r
846 @param Format Null-terminated ASCII format string.\r
847 @param ... VARARG list consumed to process Format.\r
848 If Format is NULL, then ASSERT().\r
849 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
9199040c 850 \r
851 @return Number of ASCII characters printed to ConErr.\r
fb3df220 852\r
853**/\r
854UINTN\r
855EFIAPI\r
856AsciiErrorPrint (\r
857 IN CONST CHAR8 *Format,\r
858 ...\r
859 );\r
860\r
c7d265a9 861/**\r
0c9d7395 862 Initializes a driver by installing the Driver Binding Protocol onto the driver's\r
f662c194 863 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but\r
864 it can be different if the driver produces multiple DriverBinding Protocols. \r
0c9d7395 865 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 866 If the installation fails, then ASSERT ().\r
c7d265a9 867\r
f662c194 868 @param ImageHandle The image handle of the driver.\r
869 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
870 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 871 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 872 parameter is NULL, then a new handle is created.\r
c7d265a9 873\r
f662c194 874 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
875 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 876\r
877**/\r
878EFI_STATUS\r
879EFIAPI\r
880EfiLibInstallDriverBinding (\r
881 IN CONST EFI_HANDLE ImageHandle,\r
882 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
883 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
884 IN EFI_HANDLE DriverBindingHandle\r
885 );\r
886\r
c7d265a9 887\r
f662c194 888/**\r
0c9d7395 889 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
f662c194 890 Driver Configure and Driver Diagnostic Protocols onto the driver's DriverBindingHandle. This is\r
891 typically the same as the driver's ImageHandle, but it can be different if the driver produces multiple\r
892 DriverBinding Protocols. \r
0c9d7395 893 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 894 If the installation fails, then ASSERT ().\r
895\r
896 @param ImageHandle The image handle of the driver.\r
897 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
898 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 899 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 900 parameter is NULL, then a new handle is created.\r
901 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
902 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
903 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
904\r
905 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
906 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 907\r
908**/\r
909EFI_STATUS\r
910EFIAPI\r
911EfiLibInstallAllDriverProtocols (\r
912 IN CONST EFI_HANDLE ImageHandle,\r
913 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
914 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
915 IN EFI_HANDLE DriverBindingHandle,\r
916 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
917 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
918 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
919 );\r
920\r
921\r
f662c194 922\r
c7d265a9 923/**\r
0c9d7395 924 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
f662c194 925 Component Name 2 onto the driver's DriverBindingHandle. This is typically the same as the driver's\r
926 ImageHandle, but it can be different if the driver produces multiple DriverBinding Protocols. \r
0c9d7395 927 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 928 If the installation fails, then ASSERT ().\r
929\r
930 @param ImageHandle The image handle of the driver.\r
931 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
932 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 933 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 934 parameter is NULL, then a new handle is created.\r
935 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
936 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
c7d265a9 937\r
f662c194 938 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
939 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
940\r
941**/\r
942EFI_STATUS\r
943EFIAPI\r
944EfiLibInstallDriverBindingComponentName2 (\r
945 IN CONST EFI_HANDLE ImageHandle,\r
946 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
947 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
948 IN EFI_HANDLE DriverBindingHandle,\r
949 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
950 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
951 );\r
952\r
953\r
954/**\r
0c9d7395 955 Initializes a driver by installing the Driver Binding Protocol together with the optional Component Name,\r
f662c194 956 Component Name 2, Driver Configure, Driver Diagnostic and Driver Diagnostic 2 Protocols onto the driver's\r
957 DriverBindingHandle. This is typically the same as the driver's ImageHandle, but it can be different if\r
958 the driver produces multiple DriverBinding Protocols. \r
0c9d7395 959 If the Driver Binding Protocol interface is NULL, then ASSERT (). \r
f662c194 960 If the installation fails, then ASSERT ().\r
961\r
962 @param ImageHandle The image handle of the driver.\r
963 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
964 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
0c9d7395 965 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
f662c194 966 parameter is NULL, then a new handle is created.\r
967 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
968 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
969 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
970 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
971 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
972\r
973 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
974 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
c7d265a9 975\r
976**/\r
977EFI_STATUS\r
978EFIAPI\r
979EfiLibInstallAllDriverProtocols2 (\r
980 IN CONST EFI_HANDLE ImageHandle,\r
981 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
982 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
983 IN EFI_HANDLE DriverBindingHandle,\r
984 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
985 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
986 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
987 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
988 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
989 );\r
990\r
fb3df220 991#endif\r