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