]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | MDE UEFI library functions and macros\r | |
3 | \r | |
ca21f1a2 | 4 | Copyright (c) 2006 - 2007, Intel Corporation \r |
878ddf1f | 5 | All rights reserved. This program and the accompanying materials \r |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __UEFI_LIB_H__\r | |
16 | #define __UEFI_LIB_H__\r | |
17 | \r | |
18 | //\r | |
19 | // Unicode String Table\r | |
20 | //\r | |
21 | typedef struct {\r | |
22 | CHAR8 *Language;\r | |
23 | CHAR16 *UnicodeString;\r | |
24 | } EFI_UNICODE_STRING_TABLE;\r | |
25 | \r | |
26 | //\r | |
27 | // EFI Lock Status\r | |
28 | //\r | |
29 | typedef enum {\r | |
30 | EfiLockUninitialized = 0,\r | |
31 | EfiLockReleased = 1,\r | |
32 | EfiLockAcquired = 2\r | |
33 | } EFI_LOCK_STATE;\r | |
34 | \r | |
35 | //\r | |
36 | // EFI Lock \r | |
37 | //\r | |
38 | typedef struct {\r | |
39 | EFI_TPL Tpl;\r | |
40 | EFI_TPL OwnerTpl;\r | |
41 | EFI_LOCK_STATE Lock;\r | |
42 | } EFI_LOCK;\r | |
43 | \r | |
44 | \r | |
45 | /**\r | |
46 | This function searches the list of configuration tables stored in the EFI System \r | |
47 | Table for a table with a GUID that matches TableGuid. If a match is found, \r | |
48 | then a pointer to the configuration table is returned in Table, and EFI_SUCCESS \r | |
49 | is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.\r | |
50 | \r | |
51 | @param TableGuid Pointer to table's GUID type..\r | |
52 | @param Table Pointer to the table associated with TableGuid in the EFI System Table.\r | |
53 | \r | |
54 | @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r | |
55 | @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.\r | |
56 | \r | |
57 | **/\r | |
58 | EFI_STATUS\r | |
59 | EFIAPI\r | |
60 | EfiGetSystemConfigurationTable ( \r | |
61 | IN EFI_GUID *TableGuid,\r | |
62 | OUT VOID **Table\r | |
63 | );\r | |
64 | \r | |
65 | /**\r | |
66 | This function causes the notification function to be executed for every protocol \r | |
67 | of type ProtocolGuid instance that exists in the system when this function is \r | |
68 | invoked. In addition, every time a protocol of type ProtocolGuid instance is \r | |
69 | installed or reinstalled, the notification function is also executed.\r | |
70 | \r | |
71 | @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.\r | |
72 | @param NotifyTpl Supplies the task priority level of the event notifications.\r | |
73 | @param NotifyFunction Supplies the function to notify when the event is signaled.\r | |
74 | @param NotifyContext The context parameter to pass to NotifyFunction.\r | |
75 | @param Registration A pointer to a memory location to receive the registration value.\r | |
76 | \r | |
77 | @return The notification event that was created. \r | |
78 | \r | |
79 | **/\r | |
80 | EFI_EVENT\r | |
81 | EFIAPI\r | |
82 | EfiCreateProtocolNotifyEvent(\r | |
83 | IN EFI_GUID *ProtocolGuid,\r | |
84 | IN EFI_TPL NotifyTpl,\r | |
85 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
86 | IN VOID *NotifyContext, OPTIONAL\r | |
13c84604 | 87 | OUT VOID **Registration\r |
878ddf1f | 88 | );\r |
89 | \r | |
90 | /**\r | |
91 | This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r | |
92 | This event is signaled with EfiNamedEventSignal(). This provide the ability for \r | |
93 | one or more listeners on the same event named by the GUID specified by Name.\r | |
94 | \r | |
95 | @param Name Supplies GUID name of the event.\r | |
96 | @param NotifyTpl Supplies the task priority level of the event notifications.\r | |
97 | @param NotifyFunction Supplies the function to notify when the event is signaled.\r | |
98 | @param NotifyContext The context parameter to pass to NotifyFunction. \r | |
99 | @param Registration A pointer to a memory location to receive the registration value.\r | |
100 | \r | |
101 | @retval EFI_SUCCESS A named event was created.\r | |
102 | @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.\r | |
103 | \r | |
104 | **/\r | |
105 | EFI_STATUS\r | |
106 | EFIAPI\r | |
107 | EfiNamedEventListen (\r | |
108 | IN CONST EFI_GUID *Name,\r | |
109 | IN EFI_TPL NotifyTpl,\r | |
110 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
111 | IN CONST VOID *NotifyContext, OPTIONAL\r | |
13c84604 | 112 | OUT VOID *Registration OPTIONAL\r |
878ddf1f | 113 | );\r |
114 | \r | |
115 | /**\r | |
116 | This function signals the named event specified by Name. The named event must \r | |
117 | have been created with EfiNamedEventListen().\r | |
118 | \r | |
119 | @param Name Supplies GUID name of the event.\r | |
120 | \r | |
121 | @retval EFI_SUCCESS A named event was signaled.\r | |
122 | @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.\r | |
123 | \r | |
124 | **/\r | |
125 | EFI_STATUS\r | |
126 | EFIAPI\r | |
127 | EfiNamedEventSignal (\r | |
128 | IN CONST EFI_GUID *Name\r | |
129 | );\r | |
130 | \r | |
d958721a | 131 | /** \r |
132 | Returns the current TPL.\r | |
133 | \r | |
134 | This function returns the current TPL. There is no EFI service to directly \r | |
135 | retrieve the current TPL. Instead, the RaiseTPL() function is used to raise \r | |
136 | the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level \r | |
137 | can then immediately be restored back to the current TPL level with a call \r | |
138 | to RestoreTPL().\r | |
139 | \r | |
140 | @param VOID\r | |
141 | \r | |
142 | @retvale EFI_TPL The current TPL.\r | |
143 | \r | |
144 | **/\r | |
145 | EFI_TPL\r | |
146 | EFIAPI\r | |
147 | EfiGetCurrentTpl (\r | |
148 | VOID\r | |
149 | );\r | |
150 | \r | |
878ddf1f | 151 | /**\r |
152 | This function initializes a basic mutual exclusion lock to the released state \r | |
153 | and returns the lock. Each lock provides mutual exclusion access at its task \r | |
154 | priority level. Since there is no preemption or multiprocessor support in EFI,\r | |
155 | acquiring the lock only consists of raising to the locks TPL.\r | |
156 | \r | |
157 | @param Lock A pointer to the lock data structure to initialize.\r | |
158 | @param Priority EFI TPL associated with the lock.\r | |
159 | \r | |
160 | @return The lock.\r | |
161 | \r | |
162 | **/\r | |
163 | EFI_LOCK *\r | |
164 | EFIAPI\r | |
165 | EfiInitializeLock (\r | |
166 | IN OUT EFI_LOCK *Lock,\r | |
167 | IN EFI_TPL Priority\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | This macro initializes the contents of a basic mutual exclusion lock to the \r | |
172 | released state. Each lock provides mutual exclusion access at its task \r | |
173 | priority level. Since there is no preemption or multiprocessor support in EFI,\r | |
174 | acquiring the lock only consists of raising to the locks TPL.\r | |
175 | \r | |
176 | @param Lock A pointer to the lock data structure to initialize.\r | |
177 | @param Priority The task priority level of the lock.\r | |
178 | \r | |
179 | @return The lock.\r | |
180 | \r | |
181 | **/\r | |
182 | #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \\r | |
183 | {Priority, EFI_TPL_APPLICATION, EfiLockReleased }\r | |
184 | \r | |
185 | \r | |
186 | /**\r | |
187 | \r | |
188 | Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.\r | |
189 | \r | |
190 | If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set, \r | |
191 | then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock \r | |
192 | is not in the locked state, then DebugAssert() is called passing in the source \r | |
193 | filename, source line number, and Lock.\r | |
194 | \r | |
195 | If Lock is NULL, then ASSERT().\r | |
196 | \r | |
197 | @param LockParameter A pointer to the lock to acquire.\r | |
198 | \r | |
199 | **/\r | |
200 | #define ASSERT_LOCKED(LockParameter) \\r | |
201 | do { \\r | |
202 | if (DebugAssertEnabled ()) { \\r | |
203 | ASSERT (LockParameter != NULL); \\r | |
204 | if ((LockParameter)->Lock != EfiLockAcquired) { \\r | |
205 | _ASSERT (LockParameter not locked); \\r | |
206 | } \\r | |
207 | } \\r | |
208 | } while (FALSE)\r | |
209 | \r | |
210 | \r | |
211 | /**\r | |
511710d6 | 212 | This function raises the system's current task priority level to the task \r |
878ddf1f | 213 | priority level of the mutual exclusion lock. Then, it places the lock in the \r |
214 | acquired state.\r | |
215 | \r | |
216 | @param Priority The task priority level of the lock.\r | |
217 | \r | |
218 | **/\r | |
219 | VOID\r | |
220 | EFIAPI\r | |
221 | EfiAcquireLock (\r | |
222 | IN EFI_LOCK *Lock\r | |
223 | );\r | |
224 | \r | |
225 | /**\r | |
511710d6 | 226 | This function raises the system's current task priority level to the task \r |
878ddf1f | 227 | priority level of the mutual exclusion lock. Then, it attempts to place the \r |
228 | lock in the acquired state.\r | |
229 | \r | |
230 | @param Lock A pointer to the lock to acquire.\r | |
231 | \r | |
232 | @retval EFI_SUCCESS The lock was acquired.\r | |
233 | @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.\r | |
234 | \r | |
235 | **/\r | |
236 | EFI_STATUS\r | |
237 | EFIAPI\r | |
238 | EfiAcquireLockOrFail (\r | |
239 | IN EFI_LOCK *Lock\r | |
240 | );\r | |
241 | \r | |
242 | /**\r | |
243 | This function transitions a mutual exclusion lock from the acquired state to \r | |
511710d6 | 244 | the released state, and restores the system's task priority level to its \r |
878ddf1f | 245 | previous level.\r |
246 | \r | |
247 | @param Lock A pointer to the lock to release.\r | |
248 | \r | |
249 | **/\r | |
250 | VOID\r | |
251 | EFIAPI\r | |
252 | EfiReleaseLock (\r | |
253 | IN EFI_LOCK *Lock\r | |
254 | );\r | |
255 | \r | |
ca21f1a2 | 256 | /** |
0d49d8f6 | 257 | Tests whether a controller handle is being managed by a specific driver. |
ca21f1a2 | 258 | |
0d49d8f6 | 259 | This function tests whether the driver specified by DriverBindingHandle is\r |
260 | currently managing the controller specified by ControllerHandle. This test\r | |
261 | is performed by evaluating if the the protocol specified by ProtocolGuid is\r | |
262 | present on ControllerHandle and is was opened by DriverBindingHandle with an\r | |
263 | attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. \r | |
ca21f1a2 | 264 | If ProtocolGuid is NULL, then ASSERT().\r |
265 | ||
266 | @param ControllerHandle A handle for a controller to test. | |
267 | @param DriverBindingHandle Specifies the driver binding handle for the | |
268 | driver. | |
0d49d8f6 | 269 | @param ProtocolGuid Specifies the protocol that the driver specified |
270 | by DriverBindingHandle opens in its Start() | |
271 | function. | |
ca21f1a2 | 272 | |
0d49d8f6 | 273 | @retval EFI_SUCCESS ControllerHandle is managed by the driver |
274 | specifed by DriverBindingHandle. | |
275 | @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver | |
276 | specifed by DriverBindingHandle. | |
ca21f1a2 | 277 | |
278 | **/\r | |
279 | EFI_STATUS\r | |
280 | EFIAPI\r | |
281 | EfiTestManagedDevice (\r | |
282 | IN CONST EFI_HANDLE ControllerHandle,\r | |
283 | IN CONST EFI_HANDLE DriverBindingHandle,\r | |
284 | IN CONST EFI_GUID *ProtocolGuid\r | |
285 | );\r | |
286 | \r | |
287 | /** | |
0d49d8f6 | 288 | Tests whether a child handle is a child device of the controller. |
ca21f1a2 | 289 | |
0d49d8f6 | 290 | This function tests whether ChildHandle is one of the children of\r |
291 | ControllerHandle. This test is performed by checking to see if the protocol\r | |
292 | specified by ProtocolGuid is present on ControllerHandle and opened by\r | |
293 | ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
294 | If ProtocolGuid is NULL, then ASSERT().\r | |
ca21f1a2 | 295 | |
296 | @param ControllerHandle A handle for a (parent) controller to test. | |
297 | @param ChildHandle A child handle to test. | |
0d49d8f6 | 298 | @param ConsumsedGuid Supplies the protocol that the child controller |
299 | opens on its parent controller. | |
ca21f1a2 | 300 | |
301 | @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle. | |
302 | @retval EFI_UNSUPPORTED ChildHandle is not a child of the | |
303 | ControllerHandle. | |
304 | ||
305 | **/\r | |
306 | EFI_STATUS\r | |
307 | EFIAPI\r | |
308 | EfiTestChildHandle (\r | |
309 | IN CONST EFI_HANDLE ControllerHandle,\r | |
310 | IN CONST EFI_HANDLE ChildHandle,\r | |
311 | IN CONST EFI_GUID *ProtocolGuid\r | |
312 | );\r | |
313 | \r | |
878ddf1f | 314 | /**\r |
315 | This function looks up a Unicode string in UnicodeStringTable. If Language is \r | |
316 | a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable\r | |
317 | that matches the language code specified by Language, then it is returned in \r | |
318 | UnicodeString.\r | |
319 | \r | |
320 | @param Language A pointer to the ISO 639-2 language code for the \r | |
321 | Unicode string to look up and return.\r | |
322 | @param SupportedLanguages A pointer to the set of ISO 639-2 language codes \r | |
323 | that the Unicode string table supports. Language \r | |
324 | must be a member of this set.\r | |
325 | @param UnicodeStringTable A pointer to the table of Unicode strings.\r | |
326 | @param UnicodeString A pointer to the Unicode string from UnicodeStringTable\r | |
327 | that matches the language specified by Language.\r | |
328 | \r | |
329 | @retval EFI_SUCCESS The Unicode string that matches the language \r | |
330 | specified by Language was found\r | |
331 | in the table of Unicoide strings UnicodeStringTable, \r | |
332 | and it was returned in UnicodeString.\r | |
333 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
334 | @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r | |
335 | @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r | |
336 | @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r | |
337 | @retval EFI_UNSUPPORTED The language specified by Language is not a \r | |
338 | member of SupportedLanguages.\r | |
339 | @retval EFI_UNSUPPORTED The language specified by Language is not \r | |
340 | supported by UnicodeStringTable.\r | |
341 | \r | |
342 | **/\r | |
343 | EFI_STATUS\r | |
344 | EFIAPI\r | |
345 | LookupUnicodeString (\r | |
346 | IN CONST CHAR8 *Language,\r | |
347 | IN CONST CHAR8 *SupportedLanguages,\r | |
348 | IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r | |
349 | OUT CHAR16 **UnicodeString\r | |
350 | );\r | |
351 | \r | |
352 | /**\r | |
353 | This function adds a Unicode string to UnicodeStringTable.\r | |
354 | If Language is a member of SupportedLanguages then UnicodeString is added to \r | |
355 | UnicodeStringTable. New buffers are allocated for both Language and \r | |
356 | UnicodeString. The contents of Language and UnicodeString are copied into \r | |
357 | these new buffers. These buffers are automatically freed when \r | |
358 | FreeUnicodeStringTable() is called.\r | |
359 | \r | |
360 | @param Language A pointer to the ISO 639-2 language code for the Unicode \r | |
361 | string to add.\r | |
362 | @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r | |
363 | that the Unicode string table supports.\r | |
364 | Language must be a member of this set.\r | |
365 | @param UnicodeStringTable A pointer to the table of Unicode strings.\r | |
366 | @param UnicodeString A pointer to the Unicode string to add.\r | |
367 | \r | |
368 | @retval EFI_SUCCESS The Unicode string that matches the language \r | |
369 | specified by Language was found in the table of \r | |
370 | Unicode strings UnicodeStringTable, and it was \r | |
371 | returned in UnicodeString.\r | |
372 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
373 | @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r | |
374 | @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r | |
375 | @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r | |
376 | @retval EFI_ALREADY_STARTED A Unicode string with language Language is \r | |
377 | already present in UnicodeStringTable.\r | |
378 | @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another \r | |
379 | Unicode string to UnicodeStringTable.\r | |
380 | @retval EFI_UNSUPPORTED The language specified by Language is not a \r | |
381 | member of SupportedLanguages.\r | |
382 | \r | |
383 | **/\r | |
384 | EFI_STATUS\r | |
385 | EFIAPI\r | |
386 | AddUnicodeString (\r | |
387 | IN CONST CHAR8 *Language,\r | |
388 | IN CONST CHAR8 *SupportedLanguages,\r | |
389 | IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r | |
390 | IN CONST CHAR16 *UnicodeString\r | |
391 | );\r | |
392 | \r | |
393 | /**\r | |
394 | This function frees the table of Unicode strings in UnicodeStringTable.\r | |
395 | If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r | |
396 | Otherwise, each language code, and each Unicode string in the Unicode string \r | |
397 | table are freed, and EFI_SUCCESS is returned.\r | |
398 | \r | |
399 | @param UnicodeStringTable A pointer to the table of Unicode strings.\r | |
400 | \r | |
401 | @retval EFI_SUCCESS The Unicode string table was freed.\r | |
402 | \r | |
403 | **/\r | |
404 | EFI_STATUS\r | |
405 | EFIAPI\r | |
406 | FreeUnicodeStringTable (\r | |
407 | IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r | |
408 | );\r | |
409 | \r | |
410 | /**\r | |
411 | This function computes and returns the width of the Unicode character \r | |
412 | specified by UnicodeChar.\r | |
413 | \r | |
414 | @param UnicodeChar A Unicode character.\r | |
415 | \r | |
416 | @retval 0 The width if UnicodeChar could not be determined.\r | |
417 | @retval 1 UnicodeChar is a narrow glyph.\r | |
418 | @retval 2 UnicodeChar is a wide glyph.\r | |
419 | \r | |
420 | **/\r | |
421 | UINTN\r | |
422 | EFIAPI\r | |
423 | GetGlyphWidth (\r | |
424 | IN CHAR16 UnicodeChar\r | |
425 | );\r | |
426 | \r | |
427 | /**\r | |
428 | This function computes and returns the display length of\r | |
429 | the Null-terminated Unicode string specified by String.\r | |
430 | If String is NULL, then 0 is returned.\r | |
431 | If any of the widths of the Unicode characters in String\r | |
432 | can not be determined, then 0 is returned.\r | |
433 | \r | |
434 | @param String A pointer to a Null-terminated Unicode string.\r | |
435 | \r | |
436 | @return The display length of the Null-terminated Unicode string specified by String.\r | |
437 | \r | |
438 | **/\r | |
439 | UINTN\r | |
440 | EFIAPI\r | |
441 | UnicodeStringDisplayLength (\r | |
442 | IN CONST CHAR16 *String\r | |
443 | );\r | |
444 | \r | |
445 | //\r | |
446 | // Functions that abstract early Framework contamination of UEFI.\r | |
447 | //\r | |
448 | /**\r | |
449 | Signal a Ready to Boot Event. \r | |
450 | \r | |
451 | Create a Ready to Boot Event. Signal it and close it. This causes other \r | |
452 | events of the same event group to be signaled in other modules. \r | |
453 | \r | |
454 | **/\r | |
455 | VOID\r | |
456 | EFIAPI\r | |
457 | EfiSignalEventReadyToBoot (\r | |
458 | VOID\r | |
459 | );\r | |
460 | \r | |
461 | /**\r | |
462 | Signal a Legacy Boot Event. \r | |
463 | \r | |
464 | Create a legacy Boot Event. Signal it and close it. This causes other \r | |
465 | events of the same event group to be signaled in other modules. \r | |
466 | \r | |
467 | **/\r | |
468 | VOID\r | |
469 | EFIAPI\r | |
470 | EfiSignalEventLegacyBoot (\r | |
471 | VOID\r | |
472 | );\r | |
473 | \r | |
474 | /**\r | |
475 | Create a Legacy Boot Event. \r | |
476 | \r | |
477 | Tiano extended the CreateEvent Type enum to add a legacy boot event type. \r | |
478 | This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r | |
479 | added and now it's possible to not voilate the UEFI specification by \r | |
480 | declaring a GUID for the legacy boot event class. This library supports\r | |
a537f148 | 481 | the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to \r |
878ddf1f | 482 | work both ways.\r |
483 | \r | |
484 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r | |
485 | \r | |
486 | @retval EFI_SUCCESS Event was created.\r | |
487 | @retval Other Event was not created.\r | |
488 | \r | |
489 | **/\r | |
490 | EFI_STATUS\r | |
491 | EFIAPI\r | |
492 | EfiCreateEventLegacyBoot (\r | |
abea19db | 493 | OUT EFI_EVENT *LegacyBootEvent\r |
878ddf1f | 494 | );\r |
495 | \r | |
9a462b41 | 496 | /**\r |
497 | Create an EFI event in the Legacy Boot Event Group and allows\r | |
498 | the caller to specify a notification function. \r | |
499 | \r | |
500 | This function abstracts the creation of the Legacy Boot Event.\r | |
501 | The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r | |
502 | This library abstracts the caller from how this event is created to prevent\r | |
503 | to code form having to change with the version of the specification supported.\r | |
504 | If LegacyBootEvent is NULL, then ASSERT().\r | |
505 | \r | |
506 | @param NotifyTpl The task priority level of the event.\r | |
507 | @param NotifyFunction The notification function to call when the event is signaled.\r | |
508 | @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r | |
509 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r | |
510 | \r | |
511 | @retval EFI_SUCCESS Event was created.\r | |
512 | @retval Other Event was not created.\r | |
513 | \r | |
514 | **/\r | |
515 | EFI_STATUS\r | |
516 | EFIAPI\r | |
517 | EfiCreateEventLegacyBootEx (\r | |
518 | IN EFI_TPL NotifyTpl,\r | |
519 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
520 | IN VOID *NotifyContext, OPTIONAL\r | |
521 | OUT EFI_EVENT *LegacyBootEvent\r | |
522 | );\r | |
523 | \r | |
878ddf1f | 524 | /**\r |
525 | Create a Read to Boot Event. \r | |
526 | \r | |
527 | Tiano extended the CreateEvent Type enum to add a ready to boot event type. \r | |
528 | This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was\r | |
529 | added and now it's possible to not voilate the UEFI specification and use \r | |
530 | the ready to boot event class defined in UEFI 2.0. This library supports\r | |
a537f148 | 531 | the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to \r |
878ddf1f | 532 | work both ways.\r |
533 | \r | |
534 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r | |
535 | \r | |
536 | @retval EFI_SUCCESS Event was created.\r | |
537 | @retval Other Event was not created.\r | |
538 | \r | |
539 | **/\r | |
540 | EFI_STATUS\r | |
541 | EFIAPI\r | |
542 | EfiCreateEventReadyToBoot (\r | |
abea19db | 543 | OUT EFI_EVENT *ReadyToBootEvent\r |
878ddf1f | 544 | );\r |
545 | \r | |
9a462b41 | 546 | /**\r |
547 | Create an EFI event in the Ready To Boot Event Group and allows\r | |
548 | the caller to specify a notification function. \r | |
549 | \r | |
550 | This function abstracts the creation of the Ready to Boot Event.\r | |
551 | The Framework moved from a proprietary to UEFI 2.0 based mechanism.\r | |
552 | This library abstracts the caller from how this event is created to prevent\r | |
553 | to code form having to change with the version of the specification supported.\r | |
554 | If ReadyToBootEvent is NULL, then ASSERT().\r | |
555 | \r | |
556 | @param NotifyTpl The task priority level of the event.\r | |
557 | @param NotifyFunction The notification function to call when the event is signaled.\r | |
558 | @param NotifyContext The content to pass to NotifyFunction when the event is signaled.\r | |
559 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).\r | |
560 | \r | |
561 | @retval EFI_SUCCESS Event was created.\r | |
562 | @retval Other Event was not created.\r | |
563 | \r | |
564 | **/\r | |
565 | EFI_STATUS\r | |
566 | EFIAPI\r | |
567 | EfiCreateEventReadyToBootEx (\r | |
568 | IN EFI_TPL NotifyTpl,\r | |
569 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r | |
570 | IN VOID *NotifyContext, OPTIONAL\r | |
571 | OUT EFI_EVENT *ReadyToBootEvent\r | |
572 | );\r | |
573 | \r | |
878ddf1f | 574 | /**\r |
575 | Initialize a Firmware Volume (FV) Media Device Path node.\r | |
576 | \r | |
577 | Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r | |
578 | so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r | |
579 | the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r | |
a537f148 | 580 | device path is defined for Tiano extensions of device path. If the code \r |
878ddf1f | 581 | is compiled to conform with the UEFI 2.0 specification use the new device path\r |
582 | else use the old form for backwards compatability.\r | |
583 | \r | |
584 | @param FvDevicePathNode Pointer to a FV device path node to initialize\r | |
585 | @param NameGuid FV file name to use in FvDevicePathNode\r | |
586 | \r | |
587 | **/\r | |
588 | VOID\r | |
589 | EFIAPI\r | |
590 | EfiInitializeFwVolDevicepathNode (\r | |
abea19db | 591 | IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,\r |
592 | IN CONST EFI_GUID *NameGuid\r | |
878ddf1f | 593 | );\r |
594 | \r | |
595 | /**\r | |
596 | Check to see if the Firmware Volume (FV) Media Device Path is valid \r | |
597 | \r | |
598 | Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r | |
599 | so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r | |
600 | the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r | |
a537f148 | 601 | device path is defined for Tiano extensions of device path. If the code \r |
878ddf1f | 602 | is compiled to conform with the UEFI 2.0 specification use the new device path\r |
603 | else use the old form for backwards compatability. The return value to this\r | |
604 | function points to a location in FvDevicePathNode and it does not allocate\r | |
605 | new memory for the GUID pointer that is returned.\r | |
606 | \r | |
607 | @param FvDevicePathNode Pointer to FV device path to check.\r | |
608 | \r | |
609 | @retval NULL FvDevicePathNode is not valid.\r | |
610 | @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.\r | |
611 | \r | |
612 | **/\r | |
613 | EFI_GUID *\r | |
614 | EFIAPI\r | |
615 | EfiGetNameGuidFromFwVolDevicePathNode (\r | |
abea19db | 616 | IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode\r |
878ddf1f | 617 | );\r |
618 | \r | |
22d9199f | 619 | /** \r |
620 | Prints a formatted Unicode string to the console output device specified by \r | |
621 | ConOut defined in the EFI_SYSTEM_TABLE.\r | |
622 | \r | |
623 | This function prints a formatted Unicode string to the console output device \r | |
624 | specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode \r | |
625 | characters that printed to ConOut. If the length of the formatted Unicode \r | |
626 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
627 | PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r | |
628 | \r | |
629 | @param Format Null-terminated Unicode format string.\r | |
630 | @param ... VARARG list consumed to process Format.\r | |
631 | If Format is NULL, then ASSERT().\r | |
632 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
633 | \r | |
634 | **/\r | |
635 | UINTN\r | |
636 | EFIAPI\r | |
637 | Print (\r | |
638 | IN CONST CHAR16 *Format,\r | |
639 | ...\r | |
640 | );\r | |
641 | \r | |
642 | /** \r | |
643 | Prints a formatted Unicode string to the console output device specified by \r | |
644 | StdErr defined in the EFI_SYSTEM_TABLE.\r | |
645 | \r | |
646 | This function prints a formatted Unicode string to the console output device \r | |
647 | specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode \r | |
648 | characters that printed to StdErr. If the length of the formatted Unicode \r | |
649 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
650 | PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r | |
651 | \r | |
652 | @param Format Null-terminated Unicode format string.\r | |
653 | @param ... VARARG list consumed to process Format.\r | |
654 | If Format is NULL, then ASSERT().\r | |
655 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
656 | \r | |
657 | **/\r | |
658 | UINTN\r | |
659 | EFIAPI\r | |
660 | ErrorPrint (\r | |
661 | IN CONST CHAR16 *Format,\r | |
662 | ...\r | |
663 | );\r | |
664 | \r | |
665 | /** \r | |
666 | Prints a formatted ASCII string to the console output device specified by \r | |
667 | ConOut defined in the EFI_SYSTEM_TABLE.\r | |
668 | \r | |
669 | This function prints a formatted ASCII string to the console output device \r | |
670 | specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII \r | |
671 | characters that printed to ConOut. If the length of the formatted ASCII \r | |
672 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
673 | PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r | |
674 | \r | |
675 | @param Format Null-terminated ASCII format string.\r | |
676 | @param ... VARARG list consumed to process Format.\r | |
677 | If Format is NULL, then ASSERT().\r | |
678 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
679 | \r | |
680 | **/\r | |
681 | UINTN\r | |
682 | EFIAPI\r | |
683 | AsciiPrint (\r | |
684 | IN CONST CHAR8 *Format,\r | |
685 | ...\r | |
686 | );\r | |
687 | \r | |
688 | /** \r | |
689 | Prints a formatted ASCII string to the console output device specified by \r | |
690 | StdErr defined in the EFI_SYSTEM_TABLE.\r | |
691 | \r | |
692 | This function prints a formatted ASCII string to the console output device \r | |
693 | specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII \r | |
694 | characters that printed to StdErr. If the length of the formatted ASCII \r | |
695 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r | |
696 | PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r | |
697 | \r | |
698 | @param Format Null-terminated ASCII format string.\r | |
699 | @param ... VARARG list consumed to process Format.\r | |
700 | If Format is NULL, then ASSERT().\r | |
701 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
702 | \r | |
703 | **/\r | |
704 | UINTN\r | |
705 | EFIAPI\r | |
706 | AsciiErrorPrint (\r | |
707 | IN CONST CHAR8 *Format,\r | |
708 | ...\r | |
709 | );\r | |
710 | \r | |
878ddf1f | 711 | #endif\r |