]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides library functions for common UEFI operations. Only available to DXE\r |
3 | and UEFI module types.\r | |
4 | \r | |
e500088c | 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 | |
fb3df220 | 10 | \r |
cf8ae2f6 | 11 | Copyright (c) 2006 - 2008, Intel Corporation<BR>\r |
50a64e5b | 12 | All rights reserved. This program and the accompanying materials\r |
13 | are licensed and made available under the terms and conditions of the BSD License\r | |
14 | which accompanies this distribution. The full text of the license may be found at\r | |
15 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 16 | \r |
50a64e5b | 17 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
18 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 19 | \r |
20 | **/\r | |
21 | \r | |
22 | #ifndef __UEFI_LIB_H__\r | |
23 | #define __UEFI_LIB_H__\r | |
24 | \r | |
c7d265a9 | 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 | |
b3154720 | 31 | #include <Protocol/GraphicsOutput.h>\r |
c7d265a9 | 32 | \r |
52ca0d98 | 33 | #include <Library/BaseLib.h>\r |
34 | \r | |
fc30687f | 35 | ///\r |
36 | /// Unicode String Table\r | |
37 | ///\r | |
fb3df220 | 38 | typedef struct {\r |
39 | CHAR8 *Language;\r | |
40 | CHAR16 *UnicodeString;\r | |
41 | } EFI_UNICODE_STRING_TABLE;\r | |
42 | \r | |
fc30687f | 43 | ///\r |
44 | /// EFI Lock Status\r | |
45 | ///\r | |
fb3df220 | 46 | typedef enum {\r |
47 | EfiLockUninitialized = 0,\r | |
48 | EfiLockReleased = 1,\r | |
49 | EfiLockAcquired = 2\r | |
50 | } EFI_LOCK_STATE;\r | |
51 | \r | |
fc30687f | 52 | ///\r |
53 | /// EFI Lock \r | |
54 | ///\r | |
fb3df220 | 55 | typedef struct {\r |
56 | EFI_TPL Tpl;\r | |
57 | EFI_TPL OwnerTpl;\r | |
58 | EFI_LOCK_STATE Lock;\r | |
59 | } EFI_LOCK;\r | |
60 | \r | |
52ca0d98 | 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 microseonds.\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 | |
52ca0d98 | 73 | /**\r |
74 | Macro that returns the number of 100 ns units for a specified number of milliseoconds.\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 | |
52ca0d98 | 85 | /**\r |
86 | Macro that returns the number of 100 ns units for a specified number of seoconds.\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 | |
9bfdfa52 | 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 | |
daa6553a | 101 | @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR.\r |
9bfdfa52 | 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 | |
52ca0d98 | 110 | \r |
fb3df220 | 111 | /**\r |
1d37ab9f | 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 | |
fb3df220 | 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 | |
129 | EFI_STATUS\r | |
130 | EFIAPI\r | |
131 | EfiGetSystemConfigurationTable ( \r | |
132 | IN EFI_GUID *TableGuid,\r | |
133 | OUT VOID **Table\r | |
134 | );\r | |
135 | \r | |
136 | /**\r | |
1d37ab9f | 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 | |
f0a8eeb2 | 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 | |
1d37ab9f | 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 | |
fb3df220 | 150 | \r |
f0a8eeb2 | 151 | \r |
fb3df220 | 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 | |
1d37ab9f | 157 | This value is passed to LocateHandle() to obtain new handles that\r |
158 | have been added that support the ProtocolGuid-specified protocol. \r | |
fb3df220 | 159 | \r |
1d37ab9f | 160 | @return The notification event that was created.\r |
fb3df220 | 161 | \r |
162 | **/\r | |
163 | EFI_EVENT\r | |
164 | EFIAPI\r | |
165 | EfiCreateProtocolNotifyEvent(\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 | |
1d37ab9f | 174 | Creates a named event that can be signaled with EfiNamedEventSignal().\r |
175 | \r | |
fb3df220 | 176 | This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r |
1d37ab9f | 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 | |
fb3df220 | 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 | |
193 | EFI_STATUS\r | |
194 | EFIAPI\r | |
195 | EfiNamedEventListen (\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 | |
1d37ab9f | 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 | |
fb3df220 | 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 | |
216 | EFI_STATUS\r | |
217 | EFIAPI\r | |
218 | EfiNamedEventSignal (\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 | |
01aef47b | 231 | @return The current TPL.\r |
fb3df220 | 232 | \r |
233 | **/\r | |
234 | EFI_TPL\r | |
235 | EFIAPI\r | |
236 | EfiGetCurrentTpl (\r | |
237 | VOID\r | |
238 | );\r | |
239 | \r | |
240 | /**\r | |
1d37ab9f | 241 | Initializes a basic mutual exclusion lock.\r |
242 | \r | |
fb3df220 | 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 | |
1d37ab9f | 247 | If Lock is NULL, then ASSERT().\r |
248 | If Priority is not a valid TPL value, then ASSERT().\r | |
fb3df220 | 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 | |
256 | EFI_LOCK *\r | |
257 | EFIAPI\r | |
258 | EfiInitializeLock (\r | |
259 | IN OUT EFI_LOCK *Lock,\r | |
260 | IN EFI_TPL Priority\r | |
261 | );\r | |
262 | \r | |
263 | /**\r | |
cf8ae2f6 | 264 | Initializes a basic mutual exclusion lock.\r |
265 | \r | |
fb3df220 | 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 | |
fb3df220 | 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 | |
50615d1f | 277 | {Priority, TPL_APPLICATION, EfiLockReleased }\r |
fb3df220 | 278 | \r |
279 | \r | |
280 | /**\r | |
fb3df220 | 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 | |
fb3df220 | 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 | |
1d37ab9f | 304 | Acquires ownership of a lock.\r |
305 | \r | |
fb3df220 | 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 | |
1d37ab9f | 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 | |
fb3df220 | 312 | \r |
01aef47b | 313 | @param Lock A pointer to the lock to acquire.\r |
fb3df220 | 314 | \r |
315 | **/\r | |
316 | VOID\r | |
317 | EFIAPI\r | |
318 | EfiAcquireLock (\r | |
319 | IN EFI_LOCK *Lock\r | |
320 | );\r | |
321 | \r | |
322 | /**\r | |
cf8ae2f6 | 323 | Acquires ownership of a lock.\r |
1d37ab9f | 324 | \r |
cf8ae2f6 | 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 | |
1d37ab9f | 329 | If Lock is NULL, then ASSERT().\r |
330 | If Lock is not initialized, then ASSERT().\r | |
fb3df220 | 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 | |
338 | EFI_STATUS\r | |
339 | EFIAPI\r | |
340 | EfiAcquireLockOrFail (\r | |
341 | IN EFI_LOCK *Lock\r | |
342 | );\r | |
343 | \r | |
344 | /**\r | |
1d37ab9f | 345 | Releases ownership of a lock.\r |
346 | \r | |
fb3df220 | 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 | |
1d37ab9f | 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 | |
fb3df220 | 353 | \r |
354 | @param Lock A pointer to the lock to release.\r | |
355 | \r | |
356 | **/\r | |
357 | VOID\r | |
358 | EFIAPI\r | |
359 | EfiReleaseLock (\r | |
360 | IN EFI_LOCK *Lock\r | |
361 | );\r | |
362 | \r | |
0c9d7395 | 363 | /**\r |
364 | Tests whether a controller handle is being managed by a specific driver.\r | |
365 | \r | |
fb3df220 | 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 | |
0c9d7395 | 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 | specifed by DriverBindingHandle.\r | |
382 | @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver\r | |
383 | specifed by DriverBindingHandle.\r | |
384 | \r | |
fb3df220 | 385 | **/\r |
386 | EFI_STATUS\r | |
387 | EFIAPI\r | |
388 | EfiTestManagedDevice (\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 | |
0c9d7395 | 394 | /**\r |
395 | Tests whether a child handle is a child device of the controller.\r | |
396 | \r | |
fb3df220 | 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 | |
0c9d7395 | 402 | \r |
403 | @param ControllerHandle A handle for a (parent) controller to test. \r | |
404 | @param ChildHandle A child handle to test.\r | |
01aef47b | 405 | @param ProtocolGuid Supplies the protocol that the child controller\r |
0c9d7395 | 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 | |
fb3df220 | 412 | **/\r |
413 | EFI_STATUS\r | |
414 | EFIAPI\r | |
415 | EfiTestChildHandle (\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 | |
1d37ab9f | 422 | This function looks up a Unicode string in UnicodeStringTable.\r |
423 | \r | |
cf8ae2f6 | 424 | If Language is a member of SupportedLanguages and a Unicode string is found in\r |
1d37ab9f | 425 | UnicodeStringTable that matches the language code specified by Language, then it\r |
426 | is returned in UnicodeString.\r | |
fb3df220 | 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 Unicoide 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 | |
451 | EFI_STATUS\r | |
452 | EFIAPI\r | |
453 | LookupUnicodeString (\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 | |
a73480f6 | 460 | /**\r |
461 | This function looks up a Unicode string in UnicodeStringTable.\r | |
1d37ab9f | 462 | \r |
cf8ae2f6 | 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 | chacters 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 | |
1d37ab9f | 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 | |
cf8ae2f6 | 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 | |
a73480f6 | 498 | \r |
499 | **/\r | |
500 | EFI_STATUS\r | |
501 | EFIAPI\r | |
502 | LookupUnicodeString2 (\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 | |
ed66e1bc | 508 | );\r |
a73480f6 | 509 | \r |
fb3df220 | 510 | /**\r |
511 | This function adds a Unicode string to UnicodeStringTable.\r | |
1d37ab9f | 512 | \r |
fb3df220 | 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 | |
543 | EFI_STATUS\r | |
544 | EFIAPI\r | |
545 | AddUnicodeString (\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 | |
a73480f6 | 552 | /**\r |
cf8ae2f6 | 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 | |
a73480f6 | 592 | \r |
593 | **/\r | |
594 | EFI_STATUS\r | |
595 | EFIAPI\r | |
596 | AddUnicodeString2 (\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 | |
ed66e1bc | 602 | );\r |
a73480f6 | 603 | \r |
fb3df220 | 604 | /**\r |
605 | This function frees the table of Unicode strings in UnicodeStringTable.\r | |
1d37ab9f | 606 | \r |
fb3df220 | 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 | |
616 | EFI_STATUS\r | |
617 | EFIAPI\r | |
618 | FreeUnicodeStringTable (\r | |
619 | IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r | |
620 | );\r | |
621 | \r | |
622 | /**\r | |
cf8ae2f6 | 623 | Retrieves the width of a Unicode character.\r |
624 | \r | |
625 | This function computes and returns the width of the Unicode character specified\r | |
626 | by UnicodeChar.\r | |
fb3df220 | 627 | \r |
628 | @param UnicodeChar A Unicode character.\r | |
629 | \r | |
630 | @retval 0 The width if UnicodeChar could not be determined.\r | |
631 | @retval 1 UnicodeChar is a narrow glyph.\r | |
632 | @retval 2 UnicodeChar is a wide glyph.\r | |
633 | \r | |
634 | **/\r | |
635 | UINTN\r | |
636 | EFIAPI\r | |
637 | GetGlyphWidth (\r | |
638 | IN CHAR16 UnicodeChar\r | |
639 | );\r | |
640 | \r | |
641 | /**\r | |
1d37ab9f | 642 | Computes the display length of a Null-terminated Unicode String.\r |
643 | \r | |
cf8ae2f6 | 644 | This function computes and returns the display length of the Null-terminated Unicode\r |
645 | string specified by String. If String is NULL then 0 is returned. If any of the widths\r | |
646 | of the Unicode characters in String can not be determined, then 0 is returned. The display\r | |
647 | width of String can be computed by summing the display widths of each Unicode character\r | |
648 | in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode\r | |
649 | characters that are width glyphs have a width of 2. \r | |
650 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
fb3df220 | 651 | \r |
652 | @param String A pointer to a Null-terminated Unicode string.\r | |
653 | \r | |
654 | @return The display length of the Null-terminated Unicode string specified by String.\r | |
655 | \r | |
656 | **/\r | |
657 | UINTN\r | |
658 | EFIAPI\r | |
659 | UnicodeStringDisplayLength (\r | |
660 | IN CONST CHAR16 *String\r | |
661 | );\r | |
662 | \r | |
663 | //\r | |
664 | // Functions that abstract early Framework contamination of UEFI.\r | |
665 | //\r | |
666 | /**\r | |
1d37ab9f | 667 | Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().\r |
fb3df220 | 668 | \r |
1d37ab9f | 669 | This function abstracts the signaling of the Ready to Boot Event. The Framework moved\r |
cf8ae2f6 | 670 | from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller\r |
671 | from how this event is created to prevent to code form having to change with the\r | |
672 | version of the specification supported.\r | |
fb3df220 | 673 | \r |
674 | **/\r | |
675 | VOID\r | |
676 | EFIAPI\r | |
677 | EfiSignalEventReadyToBoot (\r | |
678 | VOID\r | |
679 | );\r | |
680 | \r | |
681 | /**\r | |
1d37ab9f | 682 | Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot().\r |
683 | \r | |
684 | This function abstracts the signaling of the Legacy Boot Event. The Framework moved from\r | |
685 | a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how\r | |
686 | this event is created to prevent to code form having to change with the version of the\r | |
687 | specification supported.\r | |
fb3df220 | 688 | \r |
689 | **/\r | |
690 | VOID\r | |
691 | EFIAPI\r | |
692 | EfiSignalEventLegacyBoot (\r | |
693 | VOID\r | |
694 | );\r | |
695 | \r | |
696 | /**\r | |
cf8ae2f6 | 697 | Creates an EFI event in the Legacy Boot Event Group.\r |
698 | \r | |
699 | Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library\r | |
700 | abstracts the implementation mechanism of this event from the caller. This function\r | |
701 | abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary\r | |
702 | to UEFI 2.0 based mechanism. This library abstracts the caller from how this event\r | |
703 | is created to prevent to code form having to change with the version of the\r | |
704 | specification supported.\r | |
7f1eba7b | 705 | If LegacyBootEvent is NULL, then ASSERT().\r |
fb3df220 | 706 | \r |
707 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r | |
708 | \r | |
709 | @retval EFI_SUCCESS Event was created.\r | |
710 | @retval Other Event was not created.\r | |
711 | \r | |
712 | **/\r | |
713 | EFI_STATUS\r | |
714 | EFIAPI\r | |
715 | EfiCreateEventLegacyBoot (\r | |
716 | OUT EFI_EVENT *LegacyBootEvent\r | |
717 | );\r | |
718 | \r | |
719 | /**\r | |
720 | Create an EFI event in the Legacy Boot Event Group and allows\r | |
721 | the caller to specify a notification function. \r | |
722 | \r | |
723 | This function abstracts the creation of the Legacy Boot Event.\r | |
724 | The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r | |
725 | This library abstracts the caller from how this event is created to prevent\r | |
726 | to code form having to change with the version of the specification supported.\r | |
727 | If LegacyBootEvent is NULL, then ASSERT().\r | |
728 | \r | |
729 | @param NotifyTpl The task priority level of the event.\r | |
730 | @param NotifyFunction The notification function to call when the event is signaled.\r | |
731 | @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r | |
732 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r | |
733 | \r | |
734 | @retval EFI_SUCCESS Event was created.\r | |
735 | @retval Other Event was not created.\r | |
736 | \r | |
737 | **/\r | |
738 | EFI_STATUS\r | |
739 | EFIAPI\r | |
740 | EfiCreateEventLegacyBootEx (\r | |
741 | IN EFI_TPL NotifyTpl,\r | |
742 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
743 | IN VOID *NotifyContext, OPTIONAL\r | |
744 | OUT EFI_EVENT *LegacyBootEvent\r | |
745 | );\r | |
746 | \r | |
747 | /**\r | |
cf8ae2f6 | 748 | Create an EFI event in the Ready To Boot Event Group.\r |
749 | \r | |
750 | Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library\r | |
751 | abstracts the implementation mechanism of this event from the caller. \r | |
7f1eba7b | 752 | This function abstracts the creation of the Ready to Boot Event. The Framework \r |
753 | moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts \r | |
754 | the caller from how this event is created to prevent the code form having to \r | |
755 | change with the version of the specification supported.\r | |
756 | If ReadyToBootEvent is NULL, then ASSERT().\r | |
fb3df220 | 757 | \r |
01aef47b | 758 | @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r |
fb3df220 | 759 | \r |
760 | @retval EFI_SUCCESS Event was created.\r | |
761 | @retval Other Event was not created.\r | |
762 | \r | |
763 | **/\r | |
764 | EFI_STATUS\r | |
765 | EFIAPI\r | |
766 | EfiCreateEventReadyToBoot (\r | |
767 | OUT EFI_EVENT *ReadyToBootEvent\r | |
768 | );\r | |
769 | \r | |
770 | /**\r | |
771 | Create an EFI event in the Ready To Boot Event Group and allows\r | |
772 | the caller to specify a notification function. \r | |
773 | \r | |
774 | This function abstracts the creation of the Ready to Boot Event.\r | |
775 | The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r | |
776 | This library abstracts the caller from how this event is created to prevent\r | |
777 | to code form having to change with the version of the specification supported.\r | |
778 | If ReadyToBootEvent is NULL, then ASSERT().\r | |
779 | \r | |
780 | @param NotifyTpl The task priority level of the event.\r | |
781 | @param NotifyFunction The notification function to call when the event is signaled.\r | |
782 | @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r | |
01aef47b | 783 | @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r |
fb3df220 | 784 | \r |
785 | @retval EFI_SUCCESS Event was created.\r | |
786 | @retval Other Event was not created.\r | |
787 | \r | |
788 | **/\r | |
789 | EFI_STATUS\r | |
790 | EFIAPI\r | |
791 | EfiCreateEventReadyToBootEx (\r | |
792 | IN EFI_TPL NotifyTpl,\r | |
793 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
794 | IN VOID *NotifyContext, OPTIONAL\r | |
795 | OUT EFI_EVENT *ReadyToBootEvent\r | |
796 | );\r | |
797 | \r | |
798 | /**\r | |
799 | Initialize a Firmware Volume (FV) Media Device Path node.\r | |
800 | \r | |
7f1eba7b | 801 | The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. \r |
1d37ab9f | 802 | This library function abstracts initializing a device path node. \r |
7f1eba7b | 803 | Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device \r |
804 | path changed in the DXE CIS version 0.92 in a non back ward compatible way to \r | |
805 | not conflict with the UEFI 2.0 specification. This function abstracts the \r | |
806 | differences from the caller.\r | |
7f1eba7b | 807 | If FvDevicePathNode is NULL, then ASSERT().\r |
808 | If NameGuid is NULL, then ASSERT().\r | |
809 | \r | |
fb3df220 | 810 | @param FvDevicePathNode Pointer to a FV device path node to initialize\r |
811 | @param NameGuid FV file name to use in FvDevicePathNode\r | |
812 | \r | |
813 | **/\r | |
814 | VOID\r | |
815 | EFIAPI\r | |
816 | EfiInitializeFwVolDevicepathNode (\r | |
817 | IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r | |
818 | IN CONST EFI_GUID *NameGuid\r | |
819 | );\r | |
820 | \r | |
821 | /**\r | |
822 | Check to see if the Firmware Volume (FV) Media Device Path is valid \r | |
823 | \r | |
7f1eba7b | 824 | The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. \r |
825 | This library function abstracts validating a device path node.\r | |
7f1eba7b | 826 | Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid. \r |
827 | If it is valid, then return the GUID file name from the device path node. Otherwise, \r | |
828 | return NULL. This device path changed in the DXE CIS version 0.92 in a non back ward \r | |
829 | compatible way to not conflict with the UEFI 2.0 specification. This function abstracts \r | |
830 | the differences from the caller.\r | |
831 | If FvDevicePathNode is NULL, then ASSERT().\r | |
fb3df220 | 832 | \r |
833 | @param FvDevicePathNode Pointer to FV device path to check.\r | |
834 | \r | |
835 | @retval NULL FvDevicePathNode is not valid.\r | |
836 | @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r | |
837 | \r | |
838 | **/\r | |
839 | EFI_GUID *\r | |
840 | EFIAPI\r | |
841 | EfiGetNameGuidFromFwVolDevicePathNode (\r | |
842 | IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r | |
843 | );\r | |
844 | \r | |
845 | /** \r | |
846 | Prints a formatted Unicode string to the console output device specified by \r | |
847 | ConOut defined in the EFI_SYSTEM_TABLE.\r | |
848 | \r | |
849 | This function prints a formatted Unicode string to the console output device \r | |
850 | specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r | |
851 | characters that printed to ConOut. If the length of the formatted Unicode \r | |
852 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
853 | PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r | |
1d37ab9f | 854 | If Format is NULL, then ASSERT().\r |
855 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
fb3df220 | 856 | \r |
857 | @param Format Null-terminated Unicode format string.\r | |
285010e7 | 858 | @param ... Variable argument list whose contents are accessed based \r |
859 | on the format string specified by Format.\r | |
9199040c | 860 | \r |
861 | @return Number of Unicode characters printed to ConOut.\r | |
fb3df220 | 862 | \r |
863 | **/\r | |
864 | UINTN\r | |
865 | EFIAPI\r | |
866 | Print (\r | |
867 | IN CONST CHAR16 *Format,\r | |
868 | ...\r | |
869 | );\r | |
870 | \r | |
871 | /** \r | |
872 | Prints a formatted Unicode string to the console output device specified by \r | |
873 | StdErr defined in the EFI_SYSTEM_TABLE.\r | |
874 | \r | |
875 | This function prints a formatted Unicode string to the console output device \r | |
876 | specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r | |
877 | characters that printed to StdErr. If the length of the formatted Unicode \r | |
878 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
879 | PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r | |
1d37ab9f | 880 | If Format is NULL, then ASSERT().\r |
881 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
fb3df220 | 882 | \r |
883 | @param Format Null-terminated Unicode format string.\r | |
285010e7 | 884 | @param ... Variable argument list whose contents are accessed based \r |
885 | on the format string specified by Format.\r | |
9199040c | 886 | \r |
887 | @return Number of Unicode characters printed to StdErr.\r | |
fb3df220 | 888 | \r |
889 | **/\r | |
890 | UINTN\r | |
891 | EFIAPI\r | |
892 | ErrorPrint (\r | |
893 | IN CONST CHAR16 *Format,\r | |
894 | ...\r | |
895 | );\r | |
896 | \r | |
897 | /** \r | |
898 | Prints a formatted ASCII string to the console output device specified by \r | |
899 | ConOut defined in the EFI_SYSTEM_TABLE.\r | |
900 | \r | |
901 | This function prints a formatted ASCII string to the console output device \r | |
902 | specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r | |
903 | characters that printed to ConOut. If the length of the formatted ASCII \r | |
904 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
905 | PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r | |
1d37ab9f | 906 | If Format is NULL, then ASSERT().\r |
fb3df220 | 907 | \r |
908 | @param Format Null-terminated ASCII format string.\r | |
285010e7 | 909 | @param ... Variable argument list whose contents are accessed based \r |
910 | on the format string specified by Format.\r | |
9199040c | 911 | \r |
912 | @return Number of ASCII characters printed to ConOut.\r | |
fb3df220 | 913 | \r |
914 | **/\r | |
915 | UINTN\r | |
916 | EFIAPI\r | |
917 | AsciiPrint (\r | |
918 | IN CONST CHAR8 *Format,\r | |
919 | ...\r | |
920 | );\r | |
921 | \r | |
922 | /** \r | |
923 | Prints a formatted ASCII string to the console output device specified by \r | |
924 | StdErr defined in the EFI_SYSTEM_TABLE.\r | |
925 | \r | |
926 | This function prints a formatted ASCII string to the console output device \r | |
927 | specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r | |
928 | characters that printed to StdErr. If the length of the formatted ASCII \r | |
929 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
930 | PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r | |
1d37ab9f | 931 | If Format is NULL, then ASSERT().\r |
fb3df220 | 932 | \r |
933 | @param Format Null-terminated ASCII format string.\r | |
285010e7 | 934 | @param ... Variable argument list whose contents are accessed based \r |
935 | on the format string specified by Format.\r | |
9199040c | 936 | \r |
937 | @return Number of ASCII characters printed to ConErr.\r | |
fb3df220 | 938 | \r |
939 | **/\r | |
940 | UINTN\r | |
941 | EFIAPI\r | |
942 | AsciiErrorPrint (\r | |
943 | IN CONST CHAR8 *Format,\r | |
944 | ...\r | |
945 | );\r | |
946 | \r | |
b3154720 | 947 | /**\r |
948 | Prints a formatted Unicode string to a graphics console device specified by \r | |
949 | ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r | |
950 | \r | |
951 | This function prints a formatted Unicode string to the graphics console device \r | |
952 | specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r | |
953 | Unicode characters printed. If the length of the formatted Unicode string is\r | |
954 | greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
955 | PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r | |
956 | is used to convert the string to a bitmap using the glyphs registered with the \r | |
957 | HII database. No wrapping is performed, so any portions of the string the fall\r | |
958 | outside the active display region will not be displayed.\r | |
959 | \r | |
960 | If a graphics console device is not associated with the ConsoleOutputHandle \r | |
961 | defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r | |
962 | If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r | |
963 | string is printed, and 0 is returned.\r | |
964 | If Format is NULL, then ASSERT().\r | |
965 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
966 | \r | |
967 | @param X X coordinate to print the string.\r | |
968 | @param Y Y coordinate to print the string.\r | |
969 | @param ForeGround The forground color of the string being printed. This is\r | |
970 | an optional parameter that may be NULL. If it is NULL,\r | |
971 | then the foreground color of the current ConOut device\r | |
972 | in the EFI_SYSTEM_TABLE is used.\r | |
973 | @param BackGround The background color of the string being printed. This is\r | |
974 | an optional parameter that may be NULL. If it is NULL, \r | |
975 | then the background color of the current ConOut device\r | |
976 | in the EFI_SYSTEM_TABLE is used.\r | |
977 | @param Format Null-terminated Unicode format string. See Print Library \r | |
978 | for the supported format string syntax.\r | |
979 | @param ... Variable argument list whose contents are accessed based on \r | |
980 | the format string specified by Format. \r | |
981 | \r | |
982 | @return The number of Unicode characters printed.\r | |
983 | \r | |
984 | **/\r | |
985 | UINTN\r | |
986 | EFIAPI\r | |
987 | PrintXY (\r | |
988 | IN UINTN X,\r | |
989 | IN UINTN Y,\r | |
990 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r | |
991 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r | |
992 | IN CONST CHAR16 *Format,\r | |
993 | ...\r | |
994 | );\r | |
995 | \r | |
996 | /**\r | |
997 | Prints a formatted ASCII string to a graphics console device specified by \r | |
998 | ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.\r | |
999 | \r | |
1000 | This function prints a formatted ASCII string to the graphics console device \r | |
1001 | specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of \r | |
1002 | ASCII characters printed. If the length of the formatted ASCII string is\r | |
1003 | greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
1004 | PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL\r | |
1005 | is used to convert the string to a bitmap using the glyphs registered with the \r | |
1006 | HII database. No wrapping is performed, so any portions of the string the fall\r | |
1007 | outside the active display region will not be displayed.\r | |
1008 | \r | |
1009 | If a graphics console device is not associated with the ConsoleOutputHandle \r | |
1010 | defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.\r | |
1011 | If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r | |
1012 | string is printed, and 0 is returned.\r | |
1013 | If Format is NULL, then ASSERT().\r | |
b3154720 | 1014 | \r |
1015 | @param X X coordinate to print the string.\r | |
1016 | @param Y Y coordinate to print the string.\r | |
1017 | @param ForeGround The forground color of the string being printed. This is\r | |
1018 | an optional parameter that may be NULL. If it is NULL,\r | |
1019 | then the foreground color of the current ConOut device\r | |
1020 | in the EFI_SYSTEM_TABLE is used.\r | |
1021 | @param BackGround The background color of the string being printed. This is\r | |
1022 | an optional parameter that may be NULL. If it is NULL, \r | |
1023 | then the background color of the current ConOut device\r | |
1024 | in the EFI_SYSTEM_TABLE is used.\r | |
1025 | @param Format Null-terminated ASCII format string. See Print Library \r | |
1026 | for the supported format string syntax.\r | |
1027 | @param ... Variable argument list whose contents are accessed based on \r | |
1028 | the format string specified by Format. \r | |
1029 | \r | |
1030 | @return The number of ASCII characters printed.\r | |
1031 | \r | |
1032 | **/\r | |
1033 | UINTN\r | |
1034 | EFIAPI\r | |
1035 | AsciiPrintXY (\r | |
1036 | IN UINTN X,\r | |
1037 | IN UINTN Y,\r | |
1038 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL\r | |
1039 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL\r | |
1040 | IN CONST CHAR8 *Format,\r | |
1041 | ...\r | |
1042 | );\r | |
1043 | \r | |
c7d265a9 | 1044 | /**\r |
cf8ae2f6 | 1045 | Installs and completes the initialization of a Driver Binding Protocol instance.\r |
1046 | \r | |
1047 | Installs the Driver Binding Protocol specified by DriverBinding onto the handle\r | |
1048 | specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding\r | |
1049 | is installed onto a newly created handle. DriverBindingHandle is typically the same\r | |
1050 | as the driver's ImageHandle, but it can be different if the driver produces multiple\r | |
1051 | Driver Binding Protocols. \r | |
1052 | If DriverBinding is NULL, then ASSERT(). \r | |
1053 | If DriverBinding can not be installed onto a handle, then ASSERT().\r | |
1054 | \r | |
1055 | @param ImageHandle The image handle of the driver.\r | |
1056 | @param SystemTable The EFI System Table that was passed to the driver's entry point.\r | |
1057 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r | |
1058 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r | |
1059 | parameter is NULL, then a new handle is created.\r | |
1060 | \r | |
1061 | @retval EFI_SUCCESS The protocol installation is completed successfully.\r | |
1062 | @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.\r | |
1063 | @retval Others Status from gBS->InstallMultipleProtocolInterfaces().\r | |
c7d265a9 | 1064 | \r |
1065 | **/\r | |
1066 | EFI_STATUS\r | |
1067 | EFIAPI\r | |
1068 | EfiLibInstallDriverBinding (\r | |
1069 | IN CONST EFI_HANDLE ImageHandle,\r | |
1070 | IN CONST EFI_SYSTEM_TABLE *SystemTable,\r | |
1071 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
1072 | IN EFI_HANDLE DriverBindingHandle\r | |
1073 | );\r | |
1074 | \r | |
c7d265a9 | 1075 | \r |
f662c194 | 1076 | /**\r |
cf8ae2f6 | 1077 | Installs and completes the initialization of a Driver Binding Protocol instance and\r |
1078 | optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.\r | |
1079 | \r | |
1080 | Initializes a driver by installing the Driver Binding Protocol together with the\r | |
1081 | optional Component Name, optional Driver Configure and optional Driver Diagnostic\r | |
1082 | Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,\r | |
1083 | then the protocols are installed onto a newly created handle. DriverBindingHandle\r | |
1084 | is typically the same as the driver's ImageHandle, but it can be different if the\r | |
1085 | driver produces multiple Driver Binding Protocols. \r | |
1086 | If DriverBinding is NULL, then ASSERT(). \r | |
1087 | If the installation fails, then ASSERT().\r | |
1088 | \r | |
1089 | @param ImageHandle The image handle of the driver.\r | |
1090 | @param SystemTable The EFI System Table that was passed to the driver's entry point.\r | |
1091 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r | |
1092 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r | |
1093 | parameter is NULL, then a new handle is created.\r | |
1094 | @param ComponentName A Component Name Protocol instance that this driver is producing.\r | |
1095 | @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r | |
1096 | @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r | |
1097 | \r | |
1098 | @retval EFI_SUCCESS The protocol installation is completed successfully.\r | |
1099 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r | |
c7d265a9 | 1100 | \r |
1101 | **/\r | |
1102 | EFI_STATUS\r | |
1103 | EFIAPI\r | |
1104 | EfiLibInstallAllDriverProtocols (\r | |
1105 | IN CONST EFI_HANDLE ImageHandle,\r | |
1106 | IN CONST EFI_SYSTEM_TABLE *SystemTable,\r | |
1107 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
1108 | IN EFI_HANDLE DriverBindingHandle,\r | |
1109 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r | |
1110 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r | |
1111 | IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL\r | |
1112 | );\r | |
1113 | \r | |
1114 | \r | |
f662c194 | 1115 | \r |
c7d265a9 | 1116 | /**\r |
cf8ae2f6 | 1117 | Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.\r |
1118 | \r | |
1119 | Initializes a driver by installing the Driver Binding Protocol together with the\r | |
1120 | optional Component Name and optional Component Name 2 protocols onto the driver's\r | |
1121 | DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed\r | |
1122 | onto a newly created handle. DriverBindingHandle is typically the same as the driver's\r | |
1123 | ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols. \r | |
1124 | If DriverBinding is NULL, then ASSERT(). \r | |
1125 | If the installation fails, then ASSERT().\r | |
1126 | \r | |
1127 | @param ImageHandle The image handle of the driver.\r | |
1128 | @param SystemTable The EFI System Table that was passed to the driver's entry point.\r | |
1129 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r | |
1130 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this\r | |
1131 | parameter is NULL, then a new handle is created.\r | |
1132 | @param ComponentName A Component Name Protocol instance that this driver is producing.\r | |
1133 | @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r | |
1134 | \r | |
1135 | @retval EFI_SUCCESS The protocol installation is completed successfully.\r | |
1136 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r | |
f662c194 | 1137 | \r |
1138 | **/\r | |
1139 | EFI_STATUS\r | |
1140 | EFIAPI\r | |
1141 | EfiLibInstallDriverBindingComponentName2 (\r | |
1142 | IN CONST EFI_HANDLE ImageHandle,\r | |
1143 | IN CONST EFI_SYSTEM_TABLE *SystemTable,\r | |
1144 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
1145 | IN EFI_HANDLE DriverBindingHandle,\r | |
1146 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r | |
1147 | IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL\r | |
1148 | );\r | |
1149 | \r | |
1150 | \r | |
1151 | /**\r | |
cf8ae2f6 | 1152 | Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver\r |
1153 | Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.\r | |
1154 | \r | |
1155 | Initializes a driver by installing the Driver Binding Protocol together with the optional\r | |
63ba999c | 1156 | Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,\r |
1157 | optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.\r | |
1158 | DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver\r | |
1159 | produces multiple Driver Binding Protocols. \r | |
cf8ae2f6 | 1160 | If DriverBinding is NULL, then ASSERT(). \r |
63ba999c | 1161 | If the installation fails, then ASSERT().\r |
1162 | \r | |
cf8ae2f6 | 1163 | \r |
1164 | @param ImageHandle The image handle of the driver.\r | |
1165 | @param SystemTable The EFI System Table that was passed to the driver's entry point.\r | |
1166 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing.\r | |
1167 | @param DriverBindingHandle The handle that DriverBinding is to be installe onto. If this\r | |
1168 | parameter is NULL, then a new handle is created.\r | |
1169 | @param ComponentName A Component Name Protocol instance that this driver is producing.\r | |
1170 | @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.\r | |
1171 | @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.\r | |
1172 | @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.\r | |
1173 | @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.\r | |
1174 | @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.\r | |
1175 | \r | |
1176 | @retval EFI_SUCCESS The protocol installation is completed successfully.\r | |
1177 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r | |
c7d265a9 | 1178 | \r |
1179 | **/\r | |
1180 | EFI_STATUS\r | |
1181 | EFIAPI\r | |
1182 | EfiLibInstallAllDriverProtocols2 (\r | |
1183 | IN CONST EFI_HANDLE ImageHandle,\r | |
1184 | IN CONST EFI_SYSTEM_TABLE *SystemTable,\r | |
1185 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,\r | |
1186 | IN EFI_HANDLE DriverBindingHandle,\r | |
def220c4 | 1187 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL\r |
1188 | IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL\r | |
1189 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL\r | |
1190 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration2, OPTIONAL\r | |
1191 | IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL\r | |
1192 | IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL\r | |
c7d265a9 | 1193 | );\r |
1194 | \r | |
fb3df220 | 1195 | #endif\r |