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