]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UefiLib.h
Checked in part of MDE library instances following PI and UEFI. It includes:
[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
190 {Priority, EFI_TPL_APPLICATION, EfiLockReleased }\r
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
359/**\r
360 This function adds a Unicode string to UnicodeStringTable.\r
361 If Language is a member of SupportedLanguages then UnicodeString is added to \r
362 UnicodeStringTable. New buffers are allocated for both Language and \r
363 UnicodeString. The contents of Language and UnicodeString are copied into \r
364 these new buffers. These buffers are automatically freed when \r
365 FreeUnicodeStringTable() is called.\r
366\r
367 @param Language A pointer to the ISO 639-2 language code for the Unicode \r
368 string to add.\r
369 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
370 that the Unicode string table supports.\r
371 Language must be a member of this set.\r
372 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
373 @param UnicodeString A pointer to the Unicode string to add.\r
374\r
375 @retval EFI_SUCCESS The Unicode string that matches the language \r
376 specified by Language was found in the table of \r
377 Unicode strings UnicodeStringTable, and it was \r
378 returned in UnicodeString.\r
379 @retval EFI_INVALID_PARAMETER Language is NULL.\r
380 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
381 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
382 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
383 @retval EFI_ALREADY_STARTED A Unicode string with language Language is \r
384 already present in UnicodeStringTable.\r
385 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another \r
386 Unicode string to UnicodeStringTable.\r
387 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
388 member of SupportedLanguages.\r
389\r
390**/\r
391EFI_STATUS\r
392EFIAPI\r
393AddUnicodeString (\r
394 IN CONST CHAR8 *Language,\r
395 IN CONST CHAR8 *SupportedLanguages,\r
396 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
397 IN CONST CHAR16 *UnicodeString\r
398 );\r
399\r
400/**\r
401 This function frees the table of Unicode strings in UnicodeStringTable.\r
402 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
403 Otherwise, each language code, and each Unicode string in the Unicode string \r
404 table are freed, and EFI_SUCCESS is returned.\r
405\r
406 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
407\r
408 @retval EFI_SUCCESS The Unicode string table was freed.\r
409\r
410**/\r
411EFI_STATUS\r
412EFIAPI\r
413FreeUnicodeStringTable (\r
414 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
415 );\r
416\r
417/**\r
418 This function computes and returns the width of the Unicode character \r
419 specified by UnicodeChar.\r
420\r
421 @param UnicodeChar A Unicode character.\r
422\r
423 @retval 0 The width if UnicodeChar could not be determined.\r
424 @retval 1 UnicodeChar is a narrow glyph.\r
425 @retval 2 UnicodeChar is a wide glyph.\r
426\r
427**/\r
428UINTN\r
429EFIAPI\r
430GetGlyphWidth (\r
431 IN CHAR16 UnicodeChar\r
432 );\r
433\r
434/**\r
435 This function computes and returns the display length of\r
436 the Null-terminated Unicode string specified by String.\r
437 If String is NULL, then 0 is returned.\r
438 If any of the widths of the Unicode characters in String\r
439 can not be determined, then 0 is returned.\r
440\r
441 @param String A pointer to a Null-terminated Unicode string.\r
442\r
443 @return The display length of the Null-terminated Unicode string specified by String.\r
444 \r
445**/\r
446UINTN\r
447EFIAPI\r
448UnicodeStringDisplayLength (\r
449 IN CONST CHAR16 *String\r
450 );\r
451\r
452//\r
453// Functions that abstract early Framework contamination of UEFI.\r
454//\r
455/**\r
456 Signal a Ready to Boot Event. \r
457 \r
458 Create a Ready to Boot Event. Signal it and close it. This causes other \r
459 events of the same event group to be signaled in other modules. \r
460\r
461**/\r
462VOID\r
463EFIAPI\r
464EfiSignalEventReadyToBoot (\r
465 VOID\r
466 );\r
467\r
468/**\r
469 Signal a Legacy Boot Event. \r
470 \r
471 Create a legacy Boot Event. Signal it and close it. This causes other \r
472 events of the same event group to be signaled in other modules. \r
473\r
474**/\r
475VOID\r
476EFIAPI\r
477EfiSignalEventLegacyBoot (\r
478 VOID\r
479 );\r
480\r
481/**\r
482 Create a Legacy Boot Event. \r
483 \r
484 Tiano extended the CreateEvent Type enum to add a legacy boot event type. \r
485 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
486 added and now it's possible to not voilate the UEFI specification by \r
487 declaring a GUID for the legacy boot event class. This library supports\r
488 the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to \r
489 work both ways.\r
490\r
491 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
492\r
493 @retval EFI_SUCCESS Event was created.\r
494 @retval Other Event was not created.\r
495\r
496**/\r
497EFI_STATUS\r
498EFIAPI\r
499EfiCreateEventLegacyBoot (\r
500 OUT EFI_EVENT *LegacyBootEvent\r
501 );\r
502\r
503/**\r
504 Create an EFI event in the Legacy Boot Event Group and allows\r
505 the caller to specify a notification function. \r
506 \r
507 This function abstracts the creation of the Legacy Boot Event.\r
508 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
509 This library abstracts the caller from how this event is created to prevent\r
510 to code form having to change with the version of the specification supported.\r
511 If LegacyBootEvent is NULL, then ASSERT().\r
512\r
513 @param NotifyTpl The task priority level of the event.\r
514 @param NotifyFunction The notification function to call when the event is signaled.\r
515 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
516 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
517\r
518 @retval EFI_SUCCESS Event was created.\r
519 @retval Other Event was not created.\r
520\r
521**/\r
522EFI_STATUS\r
523EFIAPI\r
524EfiCreateEventLegacyBootEx (\r
525 IN EFI_TPL NotifyTpl,\r
526 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
527 IN VOID *NotifyContext, OPTIONAL\r
528 OUT EFI_EVENT *LegacyBootEvent\r
529 );\r
530\r
531/**\r
532 Create a Read to Boot Event. \r
533 \r
534 Tiano extended the CreateEvent Type enum to add a ready to boot event type. \r
535 This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r
536 added and now it's possible to not voilate the UEFI specification and use \r
537 the ready to boot event class defined in UEFI 2.0. This library supports\r
538 the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to \r
539 work both ways.\r
540\r
541 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
542\r
543 @retval EFI_SUCCESS Event was created.\r
544 @retval Other Event was not created.\r
545\r
546**/\r
547EFI_STATUS\r
548EFIAPI\r
549EfiCreateEventReadyToBoot (\r
550 OUT EFI_EVENT *ReadyToBootEvent\r
551 );\r
552\r
553/**\r
554 Create an EFI event in the Ready To Boot Event Group and allows\r
555 the caller to specify a notification function. \r
556 \r
557 This function abstracts the creation of the Ready to Boot Event.\r
558 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
559 This library abstracts the caller from how this event is created to prevent\r
560 to code form having to change with the version of the specification supported.\r
561 If ReadyToBootEvent is NULL, then ASSERT().\r
562\r
563 @param NotifyTpl The task priority level of the event.\r
564 @param NotifyFunction The notification function to call when the event is signaled.\r
565 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
566 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
567\r
568 @retval EFI_SUCCESS Event was created.\r
569 @retval Other Event was not created.\r
570\r
571**/\r
572EFI_STATUS\r
573EFIAPI\r
574EfiCreateEventReadyToBootEx (\r
575 IN EFI_TPL NotifyTpl,\r
576 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
577 IN VOID *NotifyContext, OPTIONAL\r
578 OUT EFI_EVENT *ReadyToBootEvent\r
579 );\r
580\r
581/**\r
582 Initialize a Firmware Volume (FV) Media Device Path node.\r
583 \r
584 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
585 so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
586 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r
587 device path is defined for Tiano extensions of device path. If the code \r
588 is compiled to conform with the UEFI 2.0 specification use the new device path\r
589 else use the old form for backwards compatability.\r
590\r
591 @param FvDevicePathNode Pointer to a FV device path node to initialize\r
592 @param NameGuid FV file name to use in FvDevicePathNode\r
593\r
594**/\r
595VOID\r
596EFIAPI\r
597EfiInitializeFwVolDevicepathNode (\r
598 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
599 IN CONST EFI_GUID *NameGuid\r
600 );\r
601\r
602/**\r
603 Check to see if the Firmware Volume (FV) Media Device Path is valid \r
604 \r
605 Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
606 so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
607 the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r
608 device path is defined for Tiano extensions of device path. If the code \r
609 is compiled to conform with the UEFI 2.0 specification use the new device path\r
610 else use the old form for backwards compatability. The return value to this\r
611 function points to a location in FvDevicePathNode and it does not allocate\r
612 new memory for the GUID pointer that is returned.\r
613\r
614 @param FvDevicePathNode Pointer to FV device path to check.\r
615\r
616 @retval NULL FvDevicePathNode is not valid.\r
617 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
618\r
619**/\r
620EFI_GUID *\r
621EFIAPI\r
622EfiGetNameGuidFromFwVolDevicePathNode (\r
623 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
624 );\r
625\r
626/** \r
627 Prints a formatted Unicode string to the console output device specified by \r
628 ConOut defined in the EFI_SYSTEM_TABLE.\r
629\r
630 This function prints a formatted Unicode string to the console output device \r
631 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r
632 characters that printed to ConOut. If the length of the formatted Unicode \r
633 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
634 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
635\r
636 @param Format Null-terminated Unicode format string.\r
637 @param ... VARARG list consumed to process Format.\r
638 If Format is NULL, then ASSERT().\r
639 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
640\r
641**/\r
642UINTN\r
643EFIAPI\r
644Print (\r
645 IN CONST CHAR16 *Format,\r
646 ...\r
647 );\r
648\r
649/** \r
650 Prints a formatted Unicode string to the console output device specified by \r
651 StdErr defined in the EFI_SYSTEM_TABLE.\r
652\r
653 This function prints a formatted Unicode string to the console output device \r
654 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r
655 characters that printed to StdErr. If the length of the formatted Unicode \r
656 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
657 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
658\r
659 @param Format Null-terminated Unicode format string.\r
660 @param ... VARARG list consumed to process Format.\r
661 If Format is NULL, then ASSERT().\r
662 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
663\r
664**/\r
665UINTN\r
666EFIAPI\r
667ErrorPrint (\r
668 IN CONST CHAR16 *Format,\r
669 ...\r
670 );\r
671\r
672/** \r
673 Prints a formatted ASCII string to the console output device specified by \r
674 ConOut defined in the EFI_SYSTEM_TABLE.\r
675\r
676 This function prints a formatted ASCII string to the console output device \r
677 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r
678 characters that printed to ConOut. If the length of the formatted ASCII \r
679 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
680 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
681\r
682 @param Format Null-terminated ASCII format string.\r
683 @param ... VARARG list consumed to process Format.\r
684 If Format is NULL, then ASSERT().\r
685 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
686\r
687**/\r
688UINTN\r
689EFIAPI\r
690AsciiPrint (\r
691 IN CONST CHAR8 *Format,\r
692 ...\r
693 );\r
694\r
695/** \r
696 Prints a formatted ASCII string to the console output device specified by \r
697 StdErr defined in the EFI_SYSTEM_TABLE.\r
698\r
699 This function prints a formatted ASCII string to the console output device \r
700 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r
701 characters that printed to StdErr. If the length of the formatted ASCII \r
702 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
703 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
704\r
705 @param Format Null-terminated ASCII format string.\r
706 @param ... VARARG list consumed to process Format.\r
707 If Format is NULL, then ASSERT().\r
708 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
709\r
710**/\r
711UINTN\r
712EFIAPI\r
713AsciiErrorPrint (\r
714 IN CONST CHAR8 *Format,\r
715 ...\r
716 );\r
717\r
c7d265a9 718/**\r
719 Intialize a driver by installing the Driver Binding Protocol onto the\r
720 driver's DriverBindingHandle. This is typically the same as the driver's\r
721 ImageHandle, but it can be different if the driver produces multiple\r
722 DriverBinding Protocols. This function also initializes the EFI Driver\r
723 Library that initializes the global variables gST, gBS, gRT.\r
724\r
725 @param ImageHandle The image handle of the driver\r
726 @param SystemTable The EFI System Table that was passed to the driver's entry point\r
727 @param DriverBinding A Driver Binding Protocol instance that this driver is producing\r
728 @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
729 parameter is NULL, then a new handle is created.\r
730\r
731 @retval EFI_SUCCESS DriverBinding is installed onto DriverBindingHandle\r
732 @retval Other Status from gBS->InstallProtocolInterface()\r
733\r
734**/\r
735EFI_STATUS\r
736EFIAPI\r
737EfiLibInstallDriverBinding (\r
738 IN CONST EFI_HANDLE ImageHandle,\r
739 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
740 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
741 IN EFI_HANDLE DriverBindingHandle\r
742 );\r
743\r
744/**\r
745 Intialize a driver by installing the Driver Binding Protocol onto the\r
746 driver's DriverBindingHandle. This is typically the same as the driver's\r
747 ImageHandle, but it can be different if the driver produces multiple\r
748 DriverBinding Protocols. This function also initializes the EFI Driver\r
749 Library that initializes the global variables gST, gBS, gRT.\r
750\r
751 @ImageHandle The image handle of the driver\r
752 @SystemTable The EFI System Table that was passed to the driver's entry point\r
753 @DriverBinding A Driver Binding Protocol instance that this driver is producing\r
754 @DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r
755 parameter is NULL, then a new handle is created.\r
756 @ComponentName A Component Name Protocol instance that this driver is producing\r
757 @DriverConfiguration A Driver Configuration Protocol instance that this driver is producing\r
758 @DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing\r
759\r
760 @retval EFI_SUCCESS DriverBinding is installed onto DriverBindingHandle\r
761 @retval Other Status from gBS->InstallProtocolInterface()\r
762\r
763**/\r
764EFI_STATUS\r
765EFIAPI\r
766EfiLibInstallAllDriverProtocols (\r
767 IN CONST EFI_HANDLE ImageHandle,\r
768 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
769 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
770 IN EFI_HANDLE DriverBindingHandle,\r
771 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
772 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
773 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
774 );\r
775\r
776\r
777/**\r
778 Intialize a driver by installing the Driver Binding Protocol\r
779 onto the driver's DriverBindingHandle. This is typically the\r
780 same as the driver's ImageHandle, but it can be different if\r
781 the driver produces multiple DriverBinding Protocols. This\r
782 function also initializes the EFI Driver Library that\r
783 initializes the global variables gST, gBS, gRT.\r
784\r
785 @ImageHandle The image handle of the driver\r
786 \r
787 @SystemTable The EFI System Table that was\r
788 passed to the driver's entry\r
789 point\r
790 \r
791 @DriverBinding A Driver Binding Protocol\r
792 instance that this driver is\r
793 producing\r
794 \r
795 @DriverBindingHandle The handle that DriverBinding is\r
796 to be installe onto. If this\r
797 parameter is NULL, then a new\r
798 handle is created.\r
799 \r
800 @ComponentName A Component Name Protocol\r
801 instance that this driver is\r
802 producing\r
803 \r
804 @ComponentName2 A Component Name 2 Protocol\r
805 instance that this driver is\r
806 producing\r
807 \r
808 @DriverConfiguration A Driver Configuration Protocol\r
809 instance that this driver is\r
810 producing\r
811 \r
812 @DriverDiagnostics A Driver Diagnostics Protocol\r
813 instance that this driver is\r
814 producing\r
815 \r
816 @DriverDiagnostics2 A Driver Diagnostics 2 Protocol\r
817 instance that this driver is\r
818 producing\r
819\r
820 @retval EFI_SUCCESS DriverBinding is installed onto DriverBindingHandle\r
821 @retval Other Status from gBS->InstallProtocolInterface()\r
822\r
823**/\r
824EFI_STATUS\r
825EFIAPI\r
826EfiLibInstallAllDriverProtocols2 (\r
827 IN CONST EFI_HANDLE ImageHandle,\r
828 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
829 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
830 IN EFI_HANDLE DriverBindingHandle,\r
831 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
832 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
833 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
834 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
835 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
836 );\r
837\r
838\r
fb3df220 839#endif\r