]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Library/UefiLib.h
Second set of changes based on a review of the code comments in the Include directory...
[mirror_edk2.git] / MdePkg / Include / Library / UefiLib.h
... / ...
CommitLineData
1/** @file\r
2 Provides library functions for common UEFI operations. Only available to DXE\r
3 and UEFI module types.\r
4\r
5 The UEFI Library provides functions and macros that simplify the development of \r
6 UEFI Drivers and UEFI Applications. These functions and macros help manage EFI \r
7 events, build simple locks utilizing EFI Task Priority Levels (TPLs), install \r
8 EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, \r
9 and print messages on the console output and standard error devices.\r
10\r
11Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
12All rights reserved. This program and the accompanying materials\r
13are licensed and made available under the terms and conditions of the BSD License\r
14which accompanies this distribution. The full text of the license may be found at\r
15http://opensource.org/licenses/bsd-license.php\r
16\r
17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
18WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
19\r
20**/\r
21\r
22#ifndef __UEFI_LIB_H__\r
23#define __UEFI_LIB_H__\r
24\r
25#include <Protocol/DriverBinding.h>\r
26#include <Protocol/DriverConfiguration.h>\r
27#include <Protocol/ComponentName.h>\r
28#include <Protocol/ComponentName2.h>\r
29#include <Protocol/DriverDiagnostics.h>\r
30#include <Protocol/DriverDiagnostics2.h>\r
31#include <Protocol/GraphicsOutput.h>\r
32\r
33#include <Library/BaseLib.h>\r
34\r
35///\r
36/// Unicode String Table\r
37///\r
38typedef struct {\r
39 CHAR8 *Language;\r
40 CHAR16 *UnicodeString;\r
41} EFI_UNICODE_STRING_TABLE;\r
42\r
43///\r
44/// EFI Lock Status\r
45///\r
46typedef enum {\r
47 EfiLockUninitialized = 0,\r
48 EfiLockReleased = 1,\r
49 EfiLockAcquired = 2\r
50} EFI_LOCK_STATE;\r
51\r
52///\r
53/// EFI Lock \r
54///\r
55typedef struct {\r
56 EFI_TPL Tpl;\r
57 EFI_TPL OwnerTpl;\r
58 EFI_LOCK_STATE Lock;\r
59} EFI_LOCK;\r
60\r
61/**\r
62 Macro that returns the number of 100 ns units for a specified number of microseconds.\r
63 Useful for managing EFI timer events.\r
64\r
65 @param Microseconds Number of microseconds.\r
66\r
67 @return The number of 100 ns units equivalent to the number of microseconds specified\r
68 by Microseconds.\r
69\r
70**/\r
71#define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10)\r
72\r
73/**\r
74 Macro that returns the number of 100 ns units for a specified number of milliseconds.\r
75 Useful for managing EFI timer events.\r
76\r
77 @param Milliseconds Number of milliseconds.\r
78\r
79 @return The number of 100 ns units equivalent to the number of milliseconds specified\r
80 by Milliseconds.\r
81\r
82**/\r
83#define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000)\r
84\r
85/**\r
86 Macro that returns the number of 100 ns units for a specified number of seconds.\r
87 Useful for managing EFI timer events.\r
88\r
89 @param Seconds Number of seconds.\r
90\r
91 @return The number of 100 ns units equivalent to the number of seconds specified\r
92 by Seconds.\r
93\r
94**/\r
95#define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)\r
96\r
97/**\r
98 Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array \r
99 returned from GetMemoryMap(). \r
100\r
101 @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR.\r
102\r
103 @param Size The size, in bytes, of the current EFI_MEMORY_DESCRIPTOR.\r
104\r
105 @return A pointer to the next EFI_MEMORY_DESCRIPTOR.\r
106\r
107**/\r
108#define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \\r
109 ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))\r
110\r
111/**\r
112 Retrieves a pointer to the system configuration table from the EFI System Table\r
113 based on a specified GUID.\r
114 \r
115 This function searches the list of configuration tables stored in the EFI System Table\r
116 for a table with a GUID that matches TableGuid. If a match is found, then a pointer to\r
117 the configuration table is returned in Table, and EFI_SUCCESS is returned. If a matching GUID\r
118 is not found, then EFI_NOT_FOUND is returned.\r
119 If TableGuid is NULL, then ASSERT().\r
120 If Table is NULL, then ASSERT().\r
121\r
122 @param TableGuid Pointer to table's GUID type..\r
123 @param Table Pointer to the table associated with TableGuid in the EFI System Table.\r
124\r
125 @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
126 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.\r
127\r
128**/\r
129EFI_STATUS\r
130EFIAPI\r
131EfiGetSystemConfigurationTable ( \r
132 IN EFI_GUID *TableGuid,\r
133 OUT VOID **Table\r
134 );\r
135\r
136/**\r
137 Creates and returns a notification event and registers that event with all the protocol\r
138 instances specified by ProtocolGuid.\r
139\r
140 This function causes the notification function to be executed for every protocol of type\r
141 ProtocolGuid instance that exists in the system when this function is invoked. If there are\r
142 no instances of ProtocolGuid in the handle database at the time this function is invoked,\r
143 then the notification function is still executed one time. In addition, every time a protocol\r
144 of type ProtocolGuid instance is installed or reinstalled, the notification function is also\r
145 executed. This function returns the notification event that was created. \r
146 If ProtocolGuid is NULL, then ASSERT().\r
147 If NotifyTpl is not a legal TPL value, then ASSERT().\r
148 If NotifyFunction is NULL, then ASSERT().\r
149 If Registration is NULL, then ASSERT().\r
150\r
151\r
152 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.\r
153 @param NotifyTpl Supplies the task priority level of the event notifications.\r
154 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
155 @param NotifyContext The context parameter to pass to NotifyFunction.\r
156 @param Registration A pointer to a memory location to receive the registration value.\r
157 This value is passed to LocateHandle() to obtain new handles that\r
158 have been added that support the ProtocolGuid-specified protocol. \r
159\r
160 @return The notification event that was created.\r
161\r
162**/\r
163EFI_EVENT\r
164EFIAPI\r
165EfiCreateProtocolNotifyEvent(\r
166 IN EFI_GUID *ProtocolGuid,\r
167 IN EFI_TPL NotifyTpl,\r
168 IN EFI_EVENT_NOTIFY NotifyFunction,\r
169 IN VOID *NotifyContext, OPTIONAL\r
170 OUT VOID **Registration\r
171 );\r
172\r
173/**\r
174 Creates a named event that can be signaled with EfiNamedEventSignal().\r
175\r
176 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r
177 This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more\r
178 listeners on the same event named by the GUID specified by Name. \r
179 If Name is NULL, then ASSERT().\r
180 If NotifyTpl is not a legal TPL value, then ASSERT().\r
181 If NotifyFunction is NULL, then ASSERT().\r
182\r
183 @param Name Supplies GUID name of the event.\r
184 @param NotifyTpl Supplies the task priority level of the event notifications.\r
185 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
186 @param NotifyContext The context parameter to pass to NotifyFunction. \r
187 @param Registration A pointer to a memory location to receive the registration value.\r
188\r
189 @retval EFI_SUCCESS A named event was created.\r
190 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.\r
191\r
192**/\r
193EFI_STATUS\r
194EFIAPI\r
195EfiNamedEventListen (\r
196 IN CONST EFI_GUID *Name,\r
197 IN EFI_TPL NotifyTpl,\r
198 IN EFI_EVENT_NOTIFY NotifyFunction,\r
199 IN CONST VOID *NotifyContext, OPTIONAL\r
200 OUT VOID *Registration OPTIONAL\r
201 );\r
202\r
203/**\r
204 Signals a named event created with EfiNamedEventListen().\r
205\r
206 This function signals the named event specified by Name. The named event must have been\r
207 created with EfiNamedEventListen().\r
208 If Name is NULL, then ASSERT().\r
209\r
210 @param Name Supplies GUID name of the event.\r
211\r
212 @retval EFI_SUCCESS A named event was signaled.\r
213 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.\r
214\r
215**/\r
216EFI_STATUS\r
217EFIAPI\r
218EfiNamedEventSignal (\r
219 IN CONST EFI_GUID *Name\r
220 );\r
221\r
222/** \r
223 Returns the current TPL.\r
224\r
225 This function returns the current TPL. There is no EFI service to directly \r
226 retrieve the current TPL. Instead, the RaiseTPL() function is used to raise \r
227 the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level \r
228 can then immediately be restored back to the current TPL level with a call \r
229 to RestoreTPL().\r
230\r
231 @return The current TPL.\r
232\r
233**/\r
234EFI_TPL\r
235EFIAPI\r
236EfiGetCurrentTpl (\r
237 VOID\r
238 );\r
239\r
240/**\r
241 Initializes a basic mutual exclusion lock.\r
242\r
243 This function initializes a basic mutual exclusion lock to the released state \r
244 and returns the lock. Each lock provides mutual exclusion access at its task \r
245 priority level. Since there is no preemption or multiprocessor support in EFI,\r
246 acquiring the lock only consists of raising to the locks TPL.\r
247 If Lock is NULL, then ASSERT().\r
248 If Priority is not a valid TPL value, then ASSERT().\r
249\r
250 @param Lock A pointer to the lock data structure to initialize.\r
251 @param Priority EFI TPL associated with the lock.\r
252\r
253 @return The lock.\r
254\r
255**/\r
256EFI_LOCK *\r
257EFIAPI\r
258EfiInitializeLock (\r
259 IN OUT EFI_LOCK *Lock,\r
260 IN EFI_TPL Priority\r
261 );\r
262\r
263/**\r
264 Initializes a basic mutual exclusion lock.\r
265\r
266 This macro initializes the contents of a basic mutual exclusion lock to the \r
267 released state. Each lock provides mutual exclusion access at its task \r
268 priority level. Since there is no preemption or multiprocessor support in EFI,\r
269 acquiring the lock only consists of raising to the locks TPL.\r
270\r
271 @param Priority The task priority level of the lock.\r
272\r
273 @return The lock.\r
274\r
275**/\r
276#define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \\r
277 {Priority, TPL_APPLICATION, EfiLockReleased }\r
278\r
279\r
280/**\r
281 Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.\r
282\r
283 If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set, \r
284 then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock \r
285 is not in the locked state, then DebugAssert() is called passing in the source \r
286 filename, source line number, and Lock.\r
287 If Lock is NULL, then ASSERT().\r
288\r
289 @param LockParameter A pointer to the lock to acquire.\r
290\r
291**/\r
292#define ASSERT_LOCKED(LockParameter) \\r
293 do { \\r
294 if (DebugAssertEnabled ()) { \\r
295 ASSERT (LockParameter != NULL); \\r
296 if ((LockParameter)->Lock != EfiLockAcquired) { \\r
297 _ASSERT (LockParameter not locked); \\r
298 } \\r
299 } \\r
300 } while (FALSE)\r
301\r
302\r
303/**\r
304 Acquires ownership of a lock.\r
305\r
306 This function raises the system's current task priority level to the task \r
307 priority level of the mutual exclusion lock. Then, it places the lock in the \r
308 acquired state.\r
309 If Lock is NULL, then ASSERT().\r
310 If Lock is not initialized, then ASSERT().\r
311 If Lock is already in the acquired state, then ASSERT().\r
312\r
313 @param Lock A pointer to the lock to acquire.\r
314\r
315**/\r
316VOID\r
317EFIAPI\r
318EfiAcquireLock (\r
319 IN EFI_LOCK *Lock\r
320 );\r
321\r
322/**\r
323 Acquires ownership of a lock.\r
324\r
325 This function raises the system's current task priority level to the task priority\r
326 level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.\r
327 If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.\r
328 Otherwise, EFI_SUCCESS is returned.\r
329 If Lock is NULL, then ASSERT().\r
330 If Lock is not initialized, then ASSERT().\r
331\r
332 @param Lock A pointer to the lock to acquire.\r
333\r
334 @retval EFI_SUCCESS The lock was acquired.\r
335 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.\r
336\r
337**/\r
338EFI_STATUS\r
339EFIAPI\r
340EfiAcquireLockOrFail (\r
341 IN EFI_LOCK *Lock\r
342 );\r
343\r
344/**\r
345 Releases ownership of a lock.\r
346\r
347 This function transitions a mutual exclusion lock from the acquired state to \r
348 the released state, and restores the system's task priority level to its \r
349 previous level.\r
350 If Lock is NULL, then ASSERT().\r
351 If Lock is not initialized, then ASSERT().\r
352 If Lock is already in the released state, then ASSERT().\r
353\r
354 @param Lock A pointer to the lock to release.\r
355\r
356**/\r
357VOID\r
358EFIAPI\r
359EfiReleaseLock (\r
360 IN EFI_LOCK *Lock\r
361 );\r
362\r
363/**\r
364 Tests whether a controller handle is being managed by a specific driver.\r
365\r
366 This function tests whether the driver specified by DriverBindingHandle is\r
367 currently managing the controller specified by ControllerHandle. This test\r
368 is performed by evaluating if the the protocol specified by ProtocolGuid is\r
369 present on ControllerHandle and is was opened by DriverBindingHandle with an\r
370 attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r
371 If ProtocolGuid is NULL, then ASSERT().\r
372\r
373 @param ControllerHandle A handle for a controller to test.\r
374 @param DriverBindingHandle Specifies the driver binding handle for the\r
375 driver.\r
376 @param ProtocolGuid Specifies the protocol that the driver specified\r
377 by DriverBindingHandle opens in its Start()\r
378 function.\r
379\r
380 @retval EFI_SUCCESS ControllerHandle is managed by the driver\r
381 specified by DriverBindingHandle.\r
382 @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver\r
383 specified by DriverBindingHandle.\r
384\r
385**/\r
386EFI_STATUS\r
387EFIAPI\r
388EfiTestManagedDevice (\r
389 IN CONST EFI_HANDLE ControllerHandle,\r
390 IN CONST EFI_HANDLE DriverBindingHandle,\r
391 IN CONST EFI_GUID *ProtocolGuid\r
392 );\r
393\r
394/**\r
395 Tests whether a child handle is a child device of the controller.\r
396\r
397 This function tests whether ChildHandle is one of the children of\r
398 ControllerHandle. This test is performed by checking to see if the protocol\r
399 specified by ProtocolGuid is present on ControllerHandle and opened by\r
400 ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
401 If ProtocolGuid is NULL, then ASSERT().\r
402\r
403 @param ControllerHandle A handle for a (parent) controller to test. \r
404 @param ChildHandle A child handle to test.\r
405 @param ProtocolGuid Supplies the protocol that the child controller\r
406 opens on its parent controller. \r
407\r
408 @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.\r
409 @retval EFI_UNSUPPORTED ChildHandle is not a child of the\r
410 ControllerHandle.\r
411\r
412**/\r
413EFI_STATUS\r
414EFIAPI\r
415EfiTestChildHandle (\r
416 IN CONST EFI_HANDLE ControllerHandle,\r
417 IN CONST EFI_HANDLE ChildHandle,\r
418 IN CONST EFI_GUID *ProtocolGuid\r
419 );\r
420\r
421/**\r
422 This function looks up a Unicode string in UnicodeStringTable.\r
423\r
424 If Language is a member of SupportedLanguages and a Unicode string is found in\r
425 UnicodeStringTable that matches the language code specified by Language, then it\r
426 is returned in UnicodeString.\r
427\r
428 @param Language A pointer to the ISO 639-2 language code for the \r
429 Unicode string to look up and return.\r
430 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes \r
431 that the Unicode string table supports. Language \r
432 must be a member of this set.\r
433 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
434 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable\r
435 that matches the language specified by Language.\r
436\r
437 @retval EFI_SUCCESS The Unicode string that matches the language \r
438 specified by Language was found\r
439 in the table of Unicode strings UnicodeStringTable, \r
440 and it was returned in UnicodeString.\r
441 @retval EFI_INVALID_PARAMETER Language is NULL.\r
442 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
443 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
444 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r
445 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
446 member of SupportedLanguages.\r
447 @retval EFI_UNSUPPORTED The language specified by Language is not \r
448 supported by UnicodeStringTable.\r
449\r
450**/\r
451EFI_STATUS\r
452EFIAPI\r
453LookupUnicodeString (\r
454 IN CONST CHAR8 *Language,\r
455 IN CONST CHAR8 *SupportedLanguages,\r
456 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
457 OUT CHAR16 **UnicodeString\r
458 );\r
459\r
460/**\r
461 This function looks up a Unicode string in UnicodeStringTable.\r
462\r
463 If Language is a member of SupportedLanguages and a Unicode string is found in\r
464 UnicodeStringTable that matches the language code specified by Language, then\r
465 it is returned in UnicodeString.\r
466\r
467 @param Language A pointer to an ASCII string containing the ISO 639-2 or the\r
468 RFC 4646 language code for the Unicode string to look up and\r
469 return. If Iso639Language is TRUE, then this ASCII string is\r
470 not assumed to be Null-terminated, and only the first three\r
471 characters are used. If Iso639Language is FALSE, then this ASCII\r
472 string must be Null-terminated. \r
473 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a\r
474 set of ISO 639-2 or RFC 4646 language codes that the Unicode\r
475 string table supports. Language must be a member of this set.\r
476 If Iso639Language is TRUE, then this string contains one or more\r
477 ISO 639-2 language codes with no separator characters. If Iso639Language\r
478 is FALSE, then is string contains one or more RFC 4646 language\r
479 codes separated by ';'.\r
480 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE\r
481 is defined in "Related Definitions".\r
482 @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable\r
483 that matches the language specified by Language.\r
484 @param Iso639Language Specifies the supported language code format. If it is TRUE, then\r
485 Language and SupportedLanguages follow ISO 639-2 language code format.\r
486 Otherwise, they follow RFC 4646 language code format.\r
487\r
488\r
489 @retval EFI_SUCCESS The Unicode string that matches the language specified by Language\r
490 was found in the table of Unicode strings UnicodeStringTable, and\r
491 it was returned in UnicodeString.\r
492 @retval EFI_INVALID_PARAMETER Language is NULL. \r
493 @retval EFI_INVALID_PARAMETER UnicodeString is NULL. \r
494 @retval EFI_UNSUPPORTED SupportedLanguages is NULL. \r
495 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL. \r
496 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages. \r
497 @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.\r
498\r
499**/\r
500EFI_STATUS\r
501EFIAPI\r
502LookupUnicodeString2 (\r
503 IN CONST CHAR8 *Language,\r
504 IN CONST CHAR8 *SupportedLanguages,\r
505 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
506 OUT CHAR16 **UnicodeString,\r
507 IN BOOLEAN Iso639Language\r
508 );\r
509\r
510/**\r
511 This function adds a Unicode string to UnicodeStringTable.\r
512\r
513 If Language is a member of SupportedLanguages then UnicodeString is added to \r
514 UnicodeStringTable. New buffers are allocated for both Language and \r
515 UnicodeString. The contents of Language and UnicodeString are copied into \r
516 these new buffers. These buffers are automatically freed when \r
517 FreeUnicodeStringTable() is called.\r
518\r
519 @param Language A pointer to the ISO 639-2 language code for the Unicode \r
520 string to add.\r
521 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
522 that the Unicode string table supports.\r
523 Language must be a member of this set.\r
524 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
525 @param UnicodeString A pointer to the Unicode string to add.\r
526\r
527 @retval EFI_SUCCESS The Unicode string that matches the language \r
528 specified by Language was found in the table of \r
529 Unicode strings UnicodeStringTable, and it was \r
530 returned in UnicodeString.\r
531 @retval EFI_INVALID_PARAMETER Language is NULL.\r
532 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
533 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
534 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
535 @retval EFI_ALREADY_STARTED A Unicode string with language Language is \r
536 already present in UnicodeStringTable.\r
537 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another \r
538 Unicode string to UnicodeStringTable.\r
539 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
540 member of SupportedLanguages.\r
541\r
542**/\r
543EFI_STATUS\r
544EFIAPI\r
545AddUnicodeString (\r
546 IN CONST CHAR8 *Language,\r
547 IN CONST CHAR8 *SupportedLanguages,\r
548 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
549 IN CONST CHAR16 *UnicodeString\r
550 );\r
551\r
552/**\r
553 This function adds the Null-terminated Unicode string specified by UnicodeString\r
554 to UnicodeStringTable.\r
555\r
556 If Language is a member of SupportedLanguages then UnicodeString is added to\r
557 UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.\r
558 The contents of Language and UnicodeString are copied into these new buffers.\r
559 These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.\r
560\r
561 @param Language A pointer to an ASCII string containing the ISO 639-2 or\r
562 the RFC 4646 language code for the Unicode string to add.\r
563 If Iso639Language is TRUE, then this ASCII string is not\r
564 assumed to be Null-terminated, and only the first three\r
565 chacters are used. If Iso639Language is FALSE, then this\r
566 ASCII string must be Null-terminated.\r
567 @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains\r
568 a set of ISO 639-2 or RFC 4646 language codes that the Unicode\r
569 string table supports. Language must be a member of this set.\r
570 If Iso639Language is TRUE, then this string contains one or more\r
571 ISO 639-2 language codes with no separator characters.\r
572 If Iso639Language is FALSE, then is string contains one or more\r
573 RFC 4646 language codes separated by ';'.\r
574 @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE\r
575 is defined in "Related Definitions".\r
576 @param UnicodeString A pointer to the Unicode string to add. \r
577 @param Iso639Language Specifies the supported language code format. If it is TRUE,\r
578 then Language and SupportedLanguages follow ISO 639-2 language code format.\r
579 Otherwise, they follow RFC 4646 language code format.\r
580\r
581 @retval EFI_SUCCESS The Unicode string that matches the language specified by\r
582 Language was found in the table of Unicode strings UnicodeStringTable,\r
583 and it was returned in UnicodeString. \r
584 @retval EFI_INVALID_PARAMETER Language is NULL. \r
585 @retval EFI_INVALID_PARAMETER UnicodeString is NULL. \r
586 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string. \r
587 @retval EFI_UNSUPPORTED SupportedLanguages is NULL. \r
588 @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in\r
589 UnicodeStringTable. \r
590 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable. \r
591 @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.\r
592\r
593**/\r
594EFI_STATUS\r
595EFIAPI\r
596AddUnicodeString2 (\r
597 IN CONST CHAR8 *Language,\r
598 IN CONST CHAR8 *SupportedLanguages,\r
599 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
600 IN CONST CHAR16 *UnicodeString,\r
601 IN BOOLEAN Iso639Language\r
602 );\r
603\r
604/**\r
605 This function frees the table of Unicode strings in UnicodeStringTable.\r
606\r
607 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
608 Otherwise, each language code, and each Unicode string in the Unicode string \r
609 table are freed, and EFI_SUCCESS is returned.\r
610\r
611 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
612\r
613 @retval EFI_SUCCESS The Unicode string table was freed.\r
614\r
615**/\r
616EFI_STATUS\r
617EFIAPI\r
618FreeUnicodeStringTable (\r
619 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
620 );\r
621\r
622\r
623/**\r
624 Returns a pointer to an allocated buffer that contains the contents of a \r
625 variable retrieved through the UEFI Runtime Service GetVariable(). The \r
626 returned buffer is allocated using AllocatePool(). The caller is responsible\r
627 for freeing this buffer with FreePool().\r
628\r
629 If Name is NULL, then ASSERT().\r
630 If Guid is NULL, then ASSERT().\r
631\r
632 @param[in] Name Pointer to a Null-terminated Unicode string.\r
633 @param[in] Guid Pointer to an EFI_GUID structure\r
634\r
635 @retval NULL The variable could not be retrieved.\r
636 @retval NULL There are not enough resources available for the variable contents.\r
637 @retval Other A pointer to allocated buffer containing the variable contents.\r
638\r
639**/\r
640VOID *\r
641EFIAPI\r
642GetVariable (\r
643 IN CONST CHAR16 *Name,\r
644 IN CONST EFI_GUID *Guid\r
645 );\r
646\r
647/**\r
648 Returns a pointer to an allocated buffer that contains the contents of a \r
649 variable retrieved through the UEFI Runtime Service GetVariable(). This \r
650 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.\r
651 The returned buffer is allocated using AllocatePool(). The caller is \r
652 responsible for freeing this buffer with FreePool().\r
653\r
654 If Name is NULL, then ASSERT().\r
655\r
656 @param[in] Name Pointer to a Null-terminated Unicode string.\r
657\r
658 @retval NULL The variable could not be retrieved.\r
659 @retval NULL There are not enough resources available for the variable contents.\r
660 @retval Other A pointer to allocated buffer containing the variable contents.\r
661\r
662**/\r
663VOID *\r
664EFIAPI\r
665GetEfiGlobalVariable (\r
666 IN CONST CHAR16 *Name\r
667 );\r
668\r
669\r
670/**\r
671 Returns a pointer to an allocated buffer that contains the best matching language \r
672 from a set of supported languages. \r
673 \r
674 This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
675 code types may not be mixed in a single call to this function. The language \r
676 code returned is allocated using AllocatePool(). The caller is responsible for \r
677 freeing the allocated buffer using FreePool(). This function supports a variable\r
678 argument list that allows the caller to pass in a prioritized list of language \r
679 codes to test against all the language codes in SupportedLanguages. \r
680\r
681 If SupportedLanguages is NULL, then ASSERT().\r
682\r
683 @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that\r
684 contains a set of language codes in the format \r
685 specified by Iso639Language.\r
686 @param[in] Iso639Language If TRUE, then all language codes are assumed to be\r
687 in ISO 639-2 format. If FALSE, then all language\r
688 codes are assumed to be in RFC 4646 language format\r
689 @param[in] ... A variable argument list that contains pointers to \r
690 Null-terminated ASCII strings that contain one or more\r
691 language codes in the format specified by Iso639Language.\r
692 The first language code from each of these language\r
693 code lists is used to determine if it is an exact or\r
694 close match to any of the language codes in \r
695 SupportedLanguages. Close matches only apply to RFC 4646\r
696 language codes, and the matching algorithm from RFC 4647\r
697 is used to determine if a close match is present. If \r
698 an exact or close match is found, then the matching\r
699 language code from SupportedLanguages is returned. If\r
700 no matches are found, then the next variable argument\r
701 parameter is evaluated. The variable argument list \r
702 is terminated by a NULL.\r
703\r
704 @retval NULL The best matching language could not be found in SupportedLanguages.\r
705 @retval NULL There are not enough resources available to return the best matching \r
706 language.\r
707 @retval Other A pointer to a Null-terminated ASCII string that is the best matching \r
708 language in SupportedLanguages.\r
709\r
710**/\r
711CHAR8 *\r
712EFIAPI\r
713GetBestLanguage (\r
714 IN CONST CHAR8 *SupportedLanguages, \r
715 IN BOOLEAN Iso639Language,\r
716 ...\r
717 );\r
718\r
719/**\r
720 Draws a dialog box to the console output device specified by \r
721 ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke\r
722 from the console input device specified by ConIn defined in the \r
723 EFI_SYSTEM_TABLE.\r
724\r
725 If there are no strings in the variable argument list, then ASSERT().\r
726 If all the strings in the variable argument list are empty, then ASSERT().\r
727\r
728 @param[in] Attribute Specifies the foreground and background color of the popup.\r
729 @param[out] Key A pointer to the EFI_KEY value of the key that was \r
730 pressed. This is an optional parameter that may be NULL.\r
731 If it is NULL then no wait for a keypress will be performed.\r
732 @param[in] ... The variable argument list that contains pointers to Null-\r
733 terminated Unicode strings to display in the dialog box. \r
734 The variable argument list is terminated by a NULL.\r
735\r
736**/\r
737VOID\r
738EFIAPI\r
739CreatePopUp (\r
740 IN UINTN Attribute, \r
741 OUT EFI_INPUT_KEY *Key, OPTIONAL\r
742 ...\r
743 );\r
744\r
745/**\r
746 Retrieves the width of a Unicode character.\r
747\r
748 This function computes and returns the width of the Unicode character specified\r
749 by UnicodeChar.\r
750\r
751 @param UnicodeChar A Unicode character.\r
752\r
753 @retval 0 The width if UnicodeChar could not be determined.\r
754 @retval 1 UnicodeChar is a narrow glyph.\r
755 @retval 2 UnicodeChar is a wide glyph.\r
756\r
757**/\r
758UINTN\r
759EFIAPI\r
760GetGlyphWidth (\r
761 IN CHAR16 UnicodeChar\r
762 );\r
763\r
764/**\r
765 Computes the display length of a Null-terminated Unicode String.\r
766\r
767 This function computes and returns the display length of the Null-terminated Unicode\r
768 string specified by String. If String is NULL then 0 is returned. If any of the widths\r
769 of the Unicode characters in String can not be determined, then 0 is returned. The display\r
770 width of String can be computed by summing the display widths of each Unicode character\r
771 in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode\r
772 characters that are width glyphs have a width of 2. \r
773 If String is not aligned on a 16-bit boundary, then ASSERT().\r
774\r
775 @param String A pointer to a Null-terminated Unicode string.\r
776\r
777 @return The display length of the Null-terminated Unicode string specified by String.\r
778 \r
779**/\r
780UINTN\r
781EFIAPI\r
782UnicodeStringDisplayLength (\r
783 IN CONST CHAR16 *String\r
784 );\r
785\r
786//\r
787// Functions that abstract early Framework contamination of UEFI.\r
788//\r
789/**\r
790 Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r
791 \r
792 This function abstracts the signaling of the Ready to Boot Event. The Framework moved\r
793 from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller\r
794 from how this event is created to prevent to code form having to change with the\r
795 version of the specification supported.\r
796\r
797**/\r
798VOID\r
799EFIAPI\r
800EfiSignalEventReadyToBoot (\r
801 VOID\r
802 );\r
803\r
804/**\r
805 Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().\r
806\r
807 This function abstracts the signaling of the Legacy Boot Event. The Framework moved from\r
808 a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how\r
809 this event is created to prevent to code form having to change with the version of the\r
810 specification supported.\r
811\r
812**/\r
813VOID\r
814EFIAPI\r
815EfiSignalEventLegacyBoot (\r
816 VOID\r
817 );\r
818\r
819/**\r
820 Creates an EFI event in the Legacy Boot Event Group.\r
821\r
822 Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library\r
823 abstracts the implementation mechanism of this event from the caller. This function\r
824 abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary\r
825 to UEFI 2.0 based mechanism. This library abstracts the caller from how this event\r
826 is created to prevent to code form having to change with the version of the\r
827 specification supported.\r
828 If LegacyBootEvent is NULL, then ASSERT().\r
829\r
830 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
831\r
832 @retval EFI_SUCCESS Event was created.\r
833 @retval Other Event was not created.\r
834\r
835**/\r
836EFI_STATUS\r
837EFIAPI\r
838EfiCreateEventLegacyBoot (\r
839 OUT EFI_EVENT *LegacyBootEvent\r
840 );\r
841\r
842/**\r
843 Create an EFI event in the Legacy Boot Event Group and allows\r
844 the caller to specify a notification function. \r
845 \r
846 This function abstracts the creation of the Legacy Boot Event.\r
847 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
848 This library abstracts the caller from how this event is created to prevent\r
849 to code form having to change with the version of the specification supported.\r
850 If LegacyBootEvent is NULL, then ASSERT().\r
851\r
852 @param NotifyTpl The task priority level of the event.\r
853 @param NotifyFunction The notification function to call when the event is signaled.\r
854 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
855 @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
856\r
857 @retval EFI_SUCCESS Event was created.\r
858 @retval Other Event was not created.\r
859\r
860**/\r
861EFI_STATUS\r
862EFIAPI\r
863EfiCreateEventLegacyBootEx (\r
864 IN EFI_TPL NotifyTpl,\r
865 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
866 IN VOID *NotifyContext, OPTIONAL\r
867 OUT EFI_EVENT *LegacyBootEvent\r
868 );\r
869\r
870/**\r
871 Create an EFI event in the Ready To Boot Event Group.\r
872\r
873 Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library\r
874 abstracts the implementation mechanism of this event from the caller. \r
875 This function abstracts the creation of the Ready to Boot Event. The Framework \r
876 moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts \r
877 the caller from how this event is created to prevent the code form having to \r
878 change with the version of the specification supported.\r
879 If ReadyToBootEvent is NULL, then ASSERT().\r
880\r
881 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
882\r
883 @retval EFI_SUCCESS Event was created.\r
884 @retval Other Event was not created.\r
885\r
886**/\r
887EFI_STATUS\r
888EFIAPI\r
889EfiCreateEventReadyToBoot (\r
890 OUT EFI_EVENT *ReadyToBootEvent\r
891 );\r
892\r
893/**\r
894 Create an EFI event in the Ready To Boot Event Group and allows\r
895 the caller to specify a notification function. \r
896 \r
897 This function abstracts the creation of the Ready to Boot Event.\r
898 The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r
899 This library abstracts the caller from how this event is created to prevent\r
900 to code form having to change with the version of the specification supported.\r
901 If ReadyToBootEvent is NULL, then ASSERT().\r
902\r
903 @param NotifyTpl The task priority level of the event.\r
904 @param NotifyFunction The notification function to call when the event is signaled.\r
905 @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r
906 @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r
907\r
908 @retval EFI_SUCCESS Event was created.\r
909 @retval Other Event was not created.\r
910\r
911**/\r
912EFI_STATUS\r
913EFIAPI\r
914EfiCreateEventReadyToBootEx (\r
915 IN EFI_TPL NotifyTpl,\r
916 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
917 IN VOID *NotifyContext, OPTIONAL\r
918 OUT EFI_EVENT *ReadyToBootEvent\r
919 );\r
920\r
921/**\r
922 Initialize a Firmware Volume (FV) Media Device Path node.\r
923 \r
924 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. \r
925 This library function abstracts initializing a device path node. \r
926 Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device \r
927 path changed in the DXE CIS version 0.92 in a non back ward compatible way to \r
928 not conflict with the UEFI 2.0 specification. This function abstracts the \r
929 differences from the caller.\r
930 If FvDevicePathNode is NULL, then ASSERT().\r
931 If NameGuid is NULL, then ASSERT().\r
932 \r
933 @param FvDevicePathNode Pointer to a FV device path node to initialize\r
934 @param NameGuid FV file name to use in FvDevicePathNode\r
935\r
936**/\r
937VOID\r
938EFIAPI\r
939EfiInitializeFwVolDevicepathNode (\r
940 IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r
941 IN CONST EFI_GUID *NameGuid\r
942 );\r
943\r
944/**\r
945 Check to see if the Firmware Volume (FV) Media Device Path is valid \r
946 \r
947 The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. \r
948 This library function abstracts validating a device path node.\r
949 Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid. \r
950 If it is valid, then return the GUID file name from the device path node. Otherwise, \r
951 return NULL. This device path changed in the DXE CIS version 0.92 in a non backward \r
952 compatible way to not conflict with the UEFI 2.0 specification. This function abstracts \r
953 the differences from the caller.\r
954 If FvDevicePathNode is NULL, then ASSERT().\r
955\r
956 @param FvDevicePathNode Pointer to FV device path to check.\r
957\r
958 @retval NULL FvDevicePathNode is not valid.\r
959 @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r
960\r
961**/\r
962EFI_GUID *\r
963EFIAPI\r
964EfiGetNameGuidFromFwVolDevicePathNode (\r
965 IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r
966 );\r
967\r
968/** \r
969 Prints a formatted Unicode string to the console output device specified by \r
970 ConOut defined in the EFI_SYSTEM_TABLE.\r
971\r
972 This function prints a formatted Unicode string to the console output device \r
973 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r
974 characters that printed to ConOut. If the length of the formatted Unicode \r
975 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
976 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
977 If Format is NULL, then ASSERT().\r
978 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
979\r
980 @param Format Null-terminated Unicode format string.\r
981 @param ... Variable argument list whose contents are accessed based \r
982 on the format string specified by Format.\r
983 \r
984 @return Number of Unicode characters printed to ConOut.\r
985\r
986**/\r
987UINTN\r
988EFIAPI\r
989Print (\r
990 IN CONST CHAR16 *Format,\r
991 ...\r
992 );\r
993\r
994/** \r
995 Prints a formatted Unicode string to the console output device specified by \r
996 StdErr defined in the EFI_SYSTEM_TABLE.\r
997\r
998 This function prints a formatted Unicode string to the console output device \r
999 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r
1000 characters that printed to StdErr. If the length of the formatted Unicode \r
1001 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
1002 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1003 If Format is NULL, then ASSERT().\r
1004 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
1005\r
1006 @param Format Null-terminated Unicode format string.\r
1007 @param ... Variable argument list whose contents are accessed based \r
1008 on the format string specified by Format.\r
1009 \r
1010 @return Number of Unicode characters printed to StdErr.\r
1011\r
1012**/\r
1013UINTN\r
1014EFIAPI\r
1015ErrorPrint (\r
1016 IN CONST CHAR16 *Format,\r
1017 ...\r
1018 );\r
1019\r
1020/** \r
1021 Prints a formatted ASCII string to the console output device specified by \r
1022 ConOut defined in the EFI_SYSTEM_TABLE.\r
1023\r
1024 This function prints a formatted ASCII string to the console output device \r
1025 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r
1026 characters that printed to ConOut. If the length of the formatted ASCII \r
1027 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
1028 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
1029 If Format is NULL, then ASSERT().\r
1030\r
1031 @param Format Null-terminated ASCII format string.\r
1032 @param ... Variable argument list whose contents are accessed based \r
1033 on the format string specified by Format.\r
1034 \r
1035 @return Number of ASCII characters printed to ConOut.\r
1036\r
1037**/\r
1038UINTN\r
1039EFIAPI\r
1040AsciiPrint (\r
1041 IN CONST CHAR8 *Format,\r
1042 ...\r
1043 );\r
1044\r
1045/** \r
1046 Prints a formatted ASCII string to the console output device specified by \r
1047 StdErr defined in the EFI_SYSTEM_TABLE.\r
1048\r
1049 This function prints a formatted ASCII string to the console output device \r
1050 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r
1051 characters that printed to StdErr. If the length of the formatted ASCII \r
1052 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
1053 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
1054 If Format is NULL, then ASSERT().\r
1055\r
1056 @param Format Null-terminated ASCII format string.\r
1057 @param ... Variable argument list whose contents are accessed based \r
1058 on the format string specified by Format.\r
1059 \r
1060 @return Number of ASCII characters printed to ConErr.\r
1061\r
1062**/\r
1063UINTN\r
1064EFIAPI\r
1065AsciiErrorPrint (\r
1066 IN CONST CHAR8 *Format,\r
1067 ...\r
1068 );\r
1069\r
1070\r
1071/**\r
1072 Prints a formatted Unicode string to a graphics console device specified by \r
1073 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
1074\r
1075 This function prints a formatted Unicode string to the graphics console device \r
1076 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r
1077 Unicode characters displayed, not including partial characters that may be clipped \r
1078 by the right edge of the display. If the length of the formatted Unicode string is\r
1079 greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
1080 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
1081 is used to convert the string to a bitmap using the glyphs registered with the \r
1082 HII database. No wrapping is performed, so any portions of the string the fall\r
1083 outside the active display region will not be displayed.\r
1084\r
1085 If a graphics console device is not associated with the ConsoleOutputHandle \r
1086 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
1087 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r
1088 string is printed, and 0 is returned.\r
1089 If Format is NULL, then ASSERT().\r
1090 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
1091\r
1092 @param PointX X coordinate to print the string.\r
1093 @param PointY Y coordinate to print the string.\r
1094 @param ForeGround The foreground color of the string being printed. This is\r
1095 an optional parameter that may be NULL. If it is NULL,\r
1096 then the foreground color of the current ConOut device\r
1097 in the EFI_SYSTEM_TABLE is used.\r
1098 @param BackGround The background color of the string being printed. This is\r
1099 an optional parameter that may be NULL. If it is NULL, \r
1100 then the background color of the current ConOut device\r
1101 in the EFI_SYSTEM_TABLE is used.\r
1102 @param Format Null-terminated Unicode format string. See Print Library \r
1103 for the supported format string syntax.\r
1104 @param ... Variable argument list whose contents are accessed based on \r
1105 the format string specified by Format. \r
1106\r
1107 @return The number of Unicode characters printed.\r
1108\r
1109**/\r
1110UINTN\r
1111EFIAPI\r
1112PrintXY (\r
1113 IN UINTN PointX,\r
1114 IN UINTN PointY,\r
1115 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1116 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1117 IN CONST CHAR16 *Format,\r
1118 ...\r
1119 );\r
1120\r
1121/**\r
1122 Prints a formatted ASCII string to a graphics console device specified by \r
1123 ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r
1124\r
1125 This function prints a formatted ASCII string to the graphics console device \r
1126 specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r
1127 ASCII characters displayed, not including partial characters that may be clipped \r
1128 by the right edge of the display. If the length of the formatted ASCII string is\r
1129 greater than PcdUefiLibMaxPrintBufferSize, then at most the first \r
1130 PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r
1131 is used to convert the string to a bitmap using the glyphs registered with the \r
1132 HII database. No wrapping is performed, so any portions of the string the fall\r
1133 outside the active display region will not be displayed.\r
1134\r
1135 If a graphics console device is not associated with the ConsoleOutputHandle \r
1136 defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r
1137 If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r
1138 string is printed, and 0 is returned.\r
1139 If Format is NULL, then ASSERT().\r
1140\r
1141 @param PointX X coordinate to print the string.\r
1142 @param PointY Y coordinate to print the string.\r
1143 @param ForeGround The foreground color of the string being printed. This is\r
1144 an optional parameter that may be NULL. If it is NULL,\r
1145 then the foreground color of the current ConOut device\r
1146 in the EFI_SYSTEM_TABLE is used.\r
1147 @param BackGround The background color of the string being printed. This is\r
1148 an optional parameter that may be NULL. If it is NULL, \r
1149 then the background color of the current ConOut device\r
1150 in the EFI_SYSTEM_TABLE is used.\r
1151 @param Format Null-terminated ASCII format string. See Print Library \r
1152 for the supported format string syntax.\r
1153 @param ... Variable argument list whose contents are accessed based on \r
1154 the format string specified by Format. \r
1155\r
1156 @return The number of ASCII characters printed.\r
1157\r
1158**/\r
1159UINTN\r
1160EFIAPI\r
1161AsciiPrintXY (\r
1162 IN UINTN PointX,\r
1163 IN UINTN PointY,\r
1164 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r
1165 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r
1166 IN CONST CHAR8 *Format,\r
1167 ...\r
1168 );\r
1169\r
1170/**\r
1171 Installs and completes the initialization of a Driver Binding Protocol instance.\r
1172 \r
1173 Installs the Driver Binding Protocol specified by DriverBinding onto the handle\r
1174 specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding\r
1175 is installed onto a newly created handle. DriverBindingHandle is typically the same\r
1176 as the driver's ImageHandle, but it can be different if the driver produces multiple\r
1177 Driver Binding Protocols. \r
1178 If DriverBinding is NULL, then ASSERT(). \r
1179 If DriverBinding can not be installed onto a handle, then ASSERT().\r
1180\r
1181 @param ImageHandle The image handle of the driver.\r
1182 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1183 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1184 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1185 parameter is NULL, then a new handle is created.\r
1186\r
1187 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1188 @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.\r
1189 @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r
1190\r
1191**/\r
1192EFI_STATUS\r
1193EFIAPI\r
1194EfiLibInstallDriverBinding (\r
1195 IN CONST EFI_HANDLE ImageHandle,\r
1196 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1197 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1198 IN EFI_HANDLE DriverBindingHandle\r
1199 );\r
1200\r
1201\r
1202/**\r
1203 Installs and completes the initialization of a Driver Binding Protocol instance and\r
1204 optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.\r
1205\r
1206 Initializes a driver by installing the Driver Binding Protocol together with the\r
1207 optional Component Name, optional Driver Configure and optional Driver Diagnostic\r
1208 Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,\r
1209 then the protocols are installed onto a newly created handle. DriverBindingHandle\r
1210 is typically the same as the driver's ImageHandle, but it can be different if the\r
1211 driver produces multiple Driver Binding Protocols. \r
1212 If DriverBinding is NULL, then ASSERT(). \r
1213 If the installation fails, then ASSERT().\r
1214 \r
1215 @param ImageHandle The image handle of the driver.\r
1216 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1217 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1218 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1219 parameter is NULL, then a new handle is created.\r
1220 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1221 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1222 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1223\r
1224 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1225 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
1226\r
1227**/\r
1228EFI_STATUS\r
1229EFIAPI\r
1230EfiLibInstallAllDriverProtocols (\r
1231 IN CONST EFI_HANDLE ImageHandle,\r
1232 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1233 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1234 IN EFI_HANDLE DriverBindingHandle,\r
1235 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1236 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1237 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r
1238 );\r
1239\r
1240\r
1241\r
1242/**\r
1243 Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r
1244\r
1245 Initializes a driver by installing the Driver Binding Protocol together with the\r
1246 optional Component Name and optional Component Name 2 protocols onto the driver's\r
1247 DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed\r
1248 onto a newly created handle. DriverBindingHandle is typically the same as the driver's\r
1249 ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols. \r
1250 If DriverBinding is NULL, then ASSERT(). \r
1251 If the installation fails, then ASSERT().\r
1252\r
1253 @param ImageHandle The image handle of the driver.\r
1254 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1255 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1256 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1257 parameter is NULL, then a new handle is created.\r
1258 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1259 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1260\r
1261 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1262 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
1263\r
1264**/\r
1265EFI_STATUS\r
1266EFIAPI\r
1267EfiLibInstallDriverBindingComponentName2 (\r
1268 IN CONST EFI_HANDLE ImageHandle,\r
1269 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1270 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1271 IN EFI_HANDLE DriverBindingHandle,\r
1272 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1273 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r
1274 );\r
1275\r
1276\r
1277/**\r
1278 Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r
1279 Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r
1280\r
1281 Initializes a driver by installing the Driver Binding Protocol together with the optional\r
1282 Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,\r
1283 optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.\r
1284 DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver\r
1285 produces multiple Driver Binding Protocols. \r
1286 If DriverBinding is NULL, then ASSERT(). \r
1287 If the installation fails, then ASSERT().\r
1288\r
1289\r
1290 @param ImageHandle The image handle of the driver.\r
1291 @param SystemTable The EFI System Table that was passed to the driver's entry point.\r
1292 @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r
1293 @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r
1294 parameter is NULL, then a new handle is created.\r
1295 @param ComponentName A Component Name Protocol instance that this driver is producing.\r
1296 @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r
1297 @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r
1298 @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.\r
1299 @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r
1300 @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r
1301\r
1302 @retval EFI_SUCCESS The protocol installation is completed successfully.\r
1303 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
1304\r
1305**/\r
1306EFI_STATUS\r
1307EFIAPI\r
1308EfiLibInstallAllDriverProtocols2 (\r
1309 IN CONST EFI_HANDLE ImageHandle,\r
1310 IN CONST EFI_SYSTEM_TABLE *SystemTable,\r
1311 IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r
1312 IN EFI_HANDLE DriverBindingHandle,\r
1313 IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r
1314 IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r
1315 IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r
1316 IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL\r
1317 IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r
1318 IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r
1319 );\r
1320\r
1321#endif\r