Subrata Banik | 20fe24b | 2021-12-09 02:46:38 +0530 | [diff] [blame] | 1 | /** @file |
| 2 | Provides library functions for common UEFI operations. Only available to DXE |
| 3 | and UEFI module types. |
| 4 | |
| 5 | The UEFI Library provides functions and macros that simplify the development of |
| 6 | UEFI Drivers and UEFI Applications. These functions and macros help manage EFI |
| 7 | events, build simple locks utilizing EFI Task Priority Levels (TPLs), install |
| 8 | EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, |
| 9 | and print messages on the console output and standard error devices. |
| 10 | |
| 11 | Note that a reserved macro named MDEPKG_NDEBUG is introduced for the intention |
| 12 | of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is |
| 13 | defined, then debug and assert related macros wrapped by it are the NULL implementations. |
| 14 | |
| 15 | Copyright (c) 2019, NVIDIA Corporation. All rights reserved. |
| 16 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> |
| 17 | SPDX-License-Identifier: BSD-2-Clause-Patent |
| 18 | |
| 19 | **/ |
| 20 | |
| 21 | #ifndef __UEFI_LIB_H__ |
| 22 | #define __UEFI_LIB_H__ |
| 23 | |
| 24 | #include <IndustryStandard/Acpi.h> |
| 25 | |
| 26 | #include <Protocol/DriverBinding.h> |
| 27 | #include <Protocol/DriverConfiguration.h> |
| 28 | #include <Protocol/ComponentName.h> |
| 29 | #include <Protocol/ComponentName2.h> |
| 30 | #include <Protocol/DriverDiagnostics.h> |
| 31 | #include <Protocol/DriverDiagnostics2.h> |
| 32 | #include <Protocol/GraphicsOutput.h> |
| 33 | #include <Protocol/DevicePath.h> |
| 34 | #include <Protocol/SimpleFileSystem.h> |
| 35 | |
| 36 | #include <Library/BaseLib.h> |
| 37 | |
| 38 | /// |
| 39 | /// Unicode String Table |
| 40 | /// |
| 41 | typedef struct { |
| 42 | CHAR8 *Language; |
| 43 | CHAR16 *UnicodeString; |
| 44 | } EFI_UNICODE_STRING_TABLE; |
| 45 | |
| 46 | /// |
| 47 | /// EFI Lock Status |
| 48 | /// |
| 49 | typedef enum { |
| 50 | EfiLockUninitialized = 0, |
| 51 | EfiLockReleased = 1, |
| 52 | EfiLockAcquired = 2 |
| 53 | } EFI_LOCK_STATE; |
| 54 | |
| 55 | /// |
| 56 | /// EFI Lock |
| 57 | /// |
| 58 | typedef struct { |
| 59 | EFI_TPL Tpl; |
| 60 | EFI_TPL OwnerTpl; |
| 61 | EFI_LOCK_STATE Lock; |
| 62 | } EFI_LOCK; |
| 63 | |
| 64 | /** |
| 65 | Macro that returns the number of 100 ns units for a specified number of microseconds. |
| 66 | This is useful for managing EFI timer events. |
| 67 | |
| 68 | @param Microseconds The number of microseconds. |
| 69 | |
| 70 | @return The number of 100 ns units equivalent to the number of microseconds specified |
| 71 | by Microseconds. |
| 72 | |
| 73 | **/ |
| 74 | #define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds) MultU64x32((UINT64)(Microseconds), 10) |
| 75 | |
| 76 | /** |
| 77 | Macro that returns the number of 100 ns units for a specified number of milliseconds. |
| 78 | This is useful for managing EFI timer events. |
| 79 | |
| 80 | @param Milliseconds The number of milliseconds. |
| 81 | |
| 82 | @return The number of 100 ns units equivalent to the number of milliseconds specified |
| 83 | by Milliseconds. |
| 84 | |
| 85 | **/ |
| 86 | #define EFI_TIMER_PERIOD_MILLISECONDS(Milliseconds) MultU64x32((UINT64)(Milliseconds), 10000) |
| 87 | |
| 88 | /** |
| 89 | Macro that returns the number of 100 ns units for a specified number of seconds. |
| 90 | This is useful for managing EFI timer events. |
| 91 | |
| 92 | @param Seconds The number of seconds. |
| 93 | |
| 94 | @return The number of 100 ns units equivalent to the number of seconds specified |
| 95 | by Seconds. |
| 96 | |
| 97 | **/ |
| 98 | #define EFI_TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000) |
| 99 | |
| 100 | /** |
| 101 | Macro that returns the a pointer to the next EFI_MEMORY_DESCRIPTOR in an array |
| 102 | returned from GetMemoryMap(). |
| 103 | |
| 104 | @param MemoryDescriptor A pointer to an EFI_MEMORY_DESCRIPTOR. |
| 105 | |
| 106 | @param Size The size, in bytes, of the current EFI_MEMORY_DESCRIPTOR. |
| 107 | |
| 108 | @return A pointer to the next EFI_MEMORY_DESCRIPTOR. |
| 109 | |
| 110 | **/ |
| 111 | #define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \ |
| 112 | ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size))) |
| 113 | |
| 114 | /** |
| 115 | Retrieves a pointer to the system configuration table from the EFI System Table |
| 116 | based on a specified GUID. |
| 117 | |
| 118 | This function searches the list of configuration tables stored in the EFI System Table |
| 119 | for a table with a GUID that matches TableGuid. If a match is found, then a pointer to |
| 120 | the configuration table is returned in Table, and EFI_SUCCESS is returned. If a matching GUID |
| 121 | is not found, then EFI_NOT_FOUND is returned. |
| 122 | If TableGuid is NULL, then ASSERT(). |
| 123 | If Table is NULL, then ASSERT(). |
| 124 | |
| 125 | @param TableGuid The pointer to table's GUID type.. |
| 126 | @param Table The pointer to the table associated with TableGuid in the EFI System Table. |
| 127 | |
| 128 | @retval EFI_SUCCESS A configuration table matching TableGuid was found. |
| 129 | @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found. |
| 130 | |
| 131 | **/ |
| 132 | EFI_STATUS |
| 133 | EFIAPI |
| 134 | EfiGetSystemConfigurationTable ( |
| 135 | IN EFI_GUID *TableGuid, |
| 136 | OUT VOID **Table |
| 137 | ); |
| 138 | |
| 139 | /** |
| 140 | Creates and returns a notification event and registers that event with all the protocol |
| 141 | instances specified by ProtocolGuid. |
| 142 | |
| 143 | This function causes the notification function to be executed for every protocol of type |
| 144 | ProtocolGuid instance that exists in the system when this function is invoked. If there are |
| 145 | no instances of ProtocolGuid in the handle database at the time this function is invoked, |
| 146 | then the notification function is still executed one time. In addition, every time a protocol |
| 147 | of type ProtocolGuid instance is installed or reinstalled, the notification function is also |
| 148 | executed. This function returns the notification event that was created. |
| 149 | If ProtocolGuid is NULL, then ASSERT(). |
| 150 | If NotifyTpl is not a legal TPL value, then ASSERT(). |
| 151 | If NotifyFunction is NULL, then ASSERT(). |
| 152 | If Registration is NULL, then ASSERT(). |
| 153 | |
| 154 | |
| 155 | @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired. |
| 156 | @param NotifyTpl Supplies the task priority level of the event notifications. |
| 157 | @param NotifyFunction Supplies the function to notify when the event is signaled. |
| 158 | @param NotifyContext The context parameter to pass to NotifyFunction. |
| 159 | @param Registration A pointer to a memory location to receive the registration value. |
| 160 | This value is passed to LocateHandle() to obtain new handles that |
| 161 | have been added that support the ProtocolGuid-specified protocol. |
| 162 | |
| 163 | @return The notification event that was created. |
| 164 | |
| 165 | **/ |
| 166 | EFI_EVENT |
| 167 | EFIAPI |
| 168 | EfiCreateProtocolNotifyEvent( |
| 169 | IN EFI_GUID *ProtocolGuid, |
| 170 | IN EFI_TPL NotifyTpl, |
| 171 | IN EFI_EVENT_NOTIFY NotifyFunction, |
| 172 | IN VOID *NotifyContext, OPTIONAL |
| 173 | OUT VOID **Registration |
| 174 | ); |
| 175 | |
| 176 | /** |
| 177 | Creates a named event that can be signaled with EfiNamedEventSignal(). |
| 178 | |
| 179 | This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext. |
| 180 | This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more |
| 181 | listeners on the same event named by the GUID specified by Name. |
| 182 | If Name is NULL, then ASSERT(). |
| 183 | If NotifyTpl is not a legal TPL value, then ASSERT(). |
| 184 | If NotifyFunction is NULL, then ASSERT(). |
| 185 | |
| 186 | @param Name Supplies GUID name of the event. |
| 187 | @param NotifyTpl Supplies the task priority level of the event notifications. |
| 188 | @param NotifyFunction Supplies the function to notify when the event is signaled. |
| 189 | @param NotifyContext The context parameter to pass to NotifyFunction. |
| 190 | @param Registration A pointer to a memory location to receive the registration value. |
| 191 | |
| 192 | @retval EFI_SUCCESS A named event was created. |
| 193 | @retval EFI_OUT_OF_RESOURCES There are not enough resources to create the named event. |
| 194 | |
| 195 | **/ |
| 196 | EFI_STATUS |
| 197 | EFIAPI |
| 198 | EfiNamedEventListen ( |
| 199 | IN CONST EFI_GUID *Name, |
| 200 | IN EFI_TPL NotifyTpl, |
| 201 | IN EFI_EVENT_NOTIFY NotifyFunction, |
| 202 | IN CONST VOID *NotifyContext, OPTIONAL |
| 203 | OUT VOID *Registration OPTIONAL |
| 204 | ); |
| 205 | |
| 206 | /** |
| 207 | Signals a named event created with EfiNamedEventListen(). |
| 208 | |
| 209 | This function signals the named event specified by Name. The named event must have been |
| 210 | created with EfiNamedEventListen(). |
| 211 | If Name is NULL, then ASSERT(). |
| 212 | |
| 213 | @param Name Supplies the GUID name of the event. |
| 214 | |
| 215 | @retval EFI_SUCCESS A named event was signaled. |
| 216 | @retval EFI_OUT_OF_RESOURCES There are not enough resources to signal the named event. |
| 217 | |
| 218 | **/ |
| 219 | EFI_STATUS |
| 220 | EFIAPI |
| 221 | EfiNamedEventSignal ( |
| 222 | IN CONST EFI_GUID *Name |
| 223 | ); |
| 224 | |
| 225 | /** |
| 226 | Signals an event group by placing a new event in the group temporarily and |
| 227 | signaling it. |
| 228 | |
| 229 | @param[in] EventGroup Supplies the unique identifier of the event |
| 230 | group to signal. |
| 231 | |
| 232 | @retval EFI_SUCCESS The event group was signaled successfully. |
| 233 | @retval EFI_INVALID_PARAMETER EventGroup is NULL. |
| 234 | @return Error codes that report problems about event |
| 235 | creation or signaling. |
| 236 | **/ |
| 237 | EFI_STATUS |
| 238 | EFIAPI |
| 239 | EfiEventGroupSignal ( |
| 240 | IN CONST EFI_GUID *EventGroup |
| 241 | ); |
| 242 | |
| 243 | /** |
| 244 | An empty function that can be used as NotifyFunction parameter of |
| 245 | CreateEvent() or CreateEventEx(). |
| 246 | |
| 247 | @param Event Event whose notification function is being invoked. |
| 248 | @param Context The pointer to the notification function's context, |
| 249 | which is implementation-dependent. |
| 250 | |
| 251 | **/ |
| 252 | VOID |
| 253 | EFIAPI |
| 254 | EfiEventEmptyFunction ( |
| 255 | IN EFI_EVENT Event, |
| 256 | IN VOID *Context |
| 257 | ); |
| 258 | |
| 259 | /** |
| 260 | Returns the current TPL. |
| 261 | |
| 262 | This function returns the current TPL. There is no EFI service to directly |
| 263 | retrieve the current TPL. Instead, the RaiseTPL() function is used to raise |
| 264 | the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level |
| 265 | can then immediately be restored back to the current TPL level with a call |
| 266 | to RestoreTPL(). |
| 267 | |
| 268 | @return The current TPL. |
| 269 | |
| 270 | **/ |
| 271 | EFI_TPL |
| 272 | EFIAPI |
| 273 | EfiGetCurrentTpl ( |
| 274 | VOID |
| 275 | ); |
| 276 | |
| 277 | /** |
| 278 | Initializes a basic mutual exclusion lock. |
| 279 | |
| 280 | This function initializes a basic mutual exclusion lock to the released state |
| 281 | and returns the lock. Each lock provides mutual exclusion access at its task |
| 282 | priority level. Since there is no preemption or multiprocessor support in EFI, |
| 283 | acquiring the lock only consists of raising to the locks TPL. |
| 284 | If Lock is NULL, then ASSERT(). |
| 285 | If Priority is not a valid TPL value, then ASSERT(). |
| 286 | |
| 287 | @param Lock A pointer to the lock data structure to initialize. |
| 288 | @param Priority The EFI TPL associated with the lock. |
| 289 | |
| 290 | @return The lock. |
| 291 | |
| 292 | **/ |
| 293 | EFI_LOCK * |
| 294 | EFIAPI |
| 295 | EfiInitializeLock ( |
| 296 | IN OUT EFI_LOCK *Lock, |
| 297 | IN EFI_TPL Priority |
| 298 | ); |
| 299 | |
| 300 | /** |
| 301 | Initializes a basic mutual exclusion lock. |
| 302 | |
| 303 | This macro initializes the contents of a basic mutual exclusion lock to the |
| 304 | released state. Each lock provides mutual exclusion access at its task |
| 305 | priority level. Since there is no preemption or multiprocessor support in EFI, |
| 306 | acquiring the lock only consists of raising to the locks TPL. |
| 307 | |
| 308 | @param Priority The task priority level of the lock. |
| 309 | |
| 310 | @return The lock. |
| 311 | |
| 312 | **/ |
| 313 | #define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \ |
| 314 | {Priority, TPL_APPLICATION, EfiLockReleased } |
| 315 | |
| 316 | |
| 317 | /** |
| 318 | Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state. |
| 319 | |
| 320 | If MDEPKG_NDEBUG is not defined and the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED |
| 321 | bit of PcdDebugProperyMask is set, then this macro evaluates the EFI_LOCK |
| 322 | structure specified by Lock. If Lock is not in the locked state, then |
| 323 | DebugAssert() is called passing in the source filename, source line number, |
| 324 | and Lock. |
| 325 | |
| 326 | If Lock is NULL, then ASSERT(). |
| 327 | |
| 328 | @param LockParameter A pointer to the lock to acquire. |
| 329 | |
| 330 | **/ |
| 331 | #if !defined(MDEPKG_NDEBUG) |
| 332 | #define ASSERT_LOCKED(LockParameter) \ |
| 333 | do { \ |
| 334 | if (DebugAssertEnabled ()) { \ |
| 335 | ASSERT (LockParameter != NULL); \ |
| 336 | if ((LockParameter)->Lock != EfiLockAcquired) { \ |
| 337 | _ASSERT (LockParameter not locked); \ |
| 338 | } \ |
| 339 | } \ |
| 340 | } while (FALSE) |
| 341 | #else |
| 342 | #define ASSERT_LOCKED(LockParameter) |
| 343 | #endif |
| 344 | |
| 345 | |
| 346 | /** |
| 347 | Acquires ownership of a lock. |
| 348 | |
| 349 | This function raises the system's current task priority level to the task |
| 350 | priority level of the mutual exclusion lock. Then, it places the lock in the |
| 351 | acquired state. |
| 352 | If Lock is NULL, then ASSERT(). |
| 353 | If Lock is not initialized, then ASSERT(). |
| 354 | If Lock is already in the acquired state, then ASSERT(). |
| 355 | |
| 356 | @param Lock A pointer to the lock to acquire. |
| 357 | |
| 358 | **/ |
| 359 | VOID |
| 360 | EFIAPI |
| 361 | EfiAcquireLock ( |
| 362 | IN EFI_LOCK *Lock |
| 363 | ); |
| 364 | |
| 365 | /** |
| 366 | Acquires ownership of a lock. |
| 367 | |
| 368 | This function raises the system's current task priority level to the task priority |
| 369 | level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state. |
| 370 | If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. |
| 371 | Otherwise, EFI_SUCCESS is returned. |
| 372 | If Lock is NULL, then ASSERT(). |
| 373 | If Lock is not initialized, then ASSERT(). |
| 374 | |
| 375 | @param Lock A pointer to the lock to acquire. |
| 376 | |
| 377 | @retval EFI_SUCCESS The lock was acquired. |
| 378 | @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned. |
| 379 | |
| 380 | **/ |
| 381 | EFI_STATUS |
| 382 | EFIAPI |
| 383 | EfiAcquireLockOrFail ( |
| 384 | IN EFI_LOCK *Lock |
| 385 | ); |
| 386 | |
| 387 | /** |
| 388 | Releases ownership of a lock. |
| 389 | |
| 390 | This function transitions a mutual exclusion lock from the acquired state to |
| 391 | the released state, and restores the system's task priority level to its |
| 392 | previous level. |
| 393 | If Lock is NULL, then ASSERT(). |
| 394 | If Lock is not initialized, then ASSERT(). |
| 395 | If Lock is already in the released state, then ASSERT(). |
| 396 | |
| 397 | @param Lock A pointer to the lock to release. |
| 398 | |
| 399 | **/ |
| 400 | VOID |
| 401 | EFIAPI |
| 402 | EfiReleaseLock ( |
| 403 | IN EFI_LOCK *Lock |
| 404 | ); |
| 405 | |
| 406 | /** |
| 407 | Tests whether a controller handle is being managed by a specific driver. |
| 408 | |
| 409 | This function tests whether the driver specified by DriverBindingHandle is |
| 410 | currently managing the controller specified by ControllerHandle. This test |
| 411 | is performed by evaluating if the the protocol specified by ProtocolGuid is |
| 412 | present on ControllerHandle and is was opened by DriverBindingHandle with an |
| 413 | attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. |
| 414 | If ProtocolGuid is NULL, then ASSERT(). |
| 415 | |
| 416 | @param ControllerHandle A handle for a controller to test. |
| 417 | @param DriverBindingHandle Specifies the driver binding handle for the |
| 418 | driver. |
| 419 | @param ProtocolGuid Specifies the protocol that the driver specified |
| 420 | by DriverBindingHandle opens in its Start() |
| 421 | function. |
| 422 | |
| 423 | @retval EFI_SUCCESS ControllerHandle is managed by the driver |
| 424 | specified by DriverBindingHandle. |
| 425 | @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver |
| 426 | specified by DriverBindingHandle. |
| 427 | |
| 428 | **/ |
| 429 | EFI_STATUS |
| 430 | EFIAPI |
| 431 | EfiTestManagedDevice ( |
| 432 | IN CONST EFI_HANDLE ControllerHandle, |
| 433 | IN CONST EFI_HANDLE DriverBindingHandle, |
| 434 | IN CONST EFI_GUID *ProtocolGuid |
| 435 | ); |
| 436 | |
| 437 | /** |
| 438 | Tests whether a child handle is a child device of the controller. |
| 439 | |
| 440 | This function tests whether ChildHandle is one of the children of |
| 441 | ControllerHandle. This test is performed by checking to see if the protocol |
| 442 | specified by ProtocolGuid is present on ControllerHandle and opened by |
| 443 | ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. |
| 444 | If ProtocolGuid is NULL, then ASSERT(). |
| 445 | |
| 446 | @param ControllerHandle A handle for a (parent) controller to test. |
| 447 | @param ChildHandle A child handle to test. |
| 448 | @param ProtocolGuid Supplies the protocol that the child controller |
| 449 | opens on its parent controller. |
| 450 | |
| 451 | @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle. |
| 452 | @retval EFI_UNSUPPORTED ChildHandle is not a child of the |
| 453 | ControllerHandle. |
| 454 | |
| 455 | **/ |
| 456 | EFI_STATUS |
| 457 | EFIAPI |
| 458 | EfiTestChildHandle ( |
| 459 | IN CONST EFI_HANDLE ControllerHandle, |
| 460 | IN CONST EFI_HANDLE ChildHandle, |
| 461 | IN CONST EFI_GUID *ProtocolGuid |
| 462 | ); |
| 463 | |
| 464 | /** |
| 465 | This function checks the supported languages list for a target language, |
| 466 | This only supports RFC 4646 Languages. |
| 467 | |
| 468 | @param SupportedLanguages The supported languages |
| 469 | @param TargetLanguage The target language |
| 470 | |
| 471 | @retval Returns EFI_SUCCESS if the language is supported, |
| 472 | EFI_UNSUPPORTED otherwise |
| 473 | |
| 474 | **/ |
| 475 | EFI_STATUS |
| 476 | EFIAPI |
| 477 | IsLanguageSupported ( |
| 478 | IN CONST CHAR8 *SupportedLanguages, |
| 479 | IN CONST CHAR8 *TargetLanguage |
| 480 | ); |
| 481 | |
| 482 | /** |
| 483 | This function looks up a Unicode string in UnicodeStringTable. |
| 484 | |
| 485 | If Language is a member of SupportedLanguages and a Unicode string is found in |
| 486 | UnicodeStringTable that matches the language code specified by Language, then it |
| 487 | is returned in UnicodeString. |
| 488 | |
| 489 | @param Language A pointer to the ISO 639-2 language code for the |
| 490 | Unicode string to look up and return. |
| 491 | @param SupportedLanguages A pointer to the set of ISO 639-2 language codes |
| 492 | that the Unicode string table supports. Language |
| 493 | must be a member of this set. |
| 494 | @param UnicodeStringTable A pointer to the table of Unicode strings. |
| 495 | @param UnicodeString A pointer to the Unicode string from UnicodeStringTable |
| 496 | that matches the language specified by Language. |
| 497 | |
| 498 | @retval EFI_SUCCESS The Unicode string that matches the language |
| 499 | specified by Language was found |
| 500 | in the table of Unicode strings UnicodeStringTable, |
| 501 | and it was returned in UnicodeString. |
| 502 | @retval EFI_INVALID_PARAMETER Language is NULL. |
| 503 | @retval EFI_INVALID_PARAMETER UnicodeString is NULL. |
| 504 | @retval EFI_UNSUPPORTED SupportedLanguages is NULL. |
| 505 | @retval EFI_UNSUPPORTED UnicodeStringTable is NULL. |
| 506 | @retval EFI_UNSUPPORTED The language specified by Language is not a |
| 507 | member of SupportedLanguages. |
| 508 | @retval EFI_UNSUPPORTED The language specified by Language is not |
| 509 | supported by UnicodeStringTable. |
| 510 | |
| 511 | **/ |
| 512 | EFI_STATUS |
| 513 | EFIAPI |
| 514 | LookupUnicodeString ( |
| 515 | IN CONST CHAR8 *Language, |
| 516 | IN CONST CHAR8 *SupportedLanguages, |
| 517 | IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, |
| 518 | OUT CHAR16 **UnicodeString |
| 519 | ); |
| 520 | |
| 521 | /** |
| 522 | This function looks up a Unicode string in UnicodeStringTable. |
| 523 | |
| 524 | If Language is a member of SupportedLanguages and a Unicode string is found in |
| 525 | UnicodeStringTable that matches the language code specified by Language, then |
| 526 | it is returned in UnicodeString. |
| 527 | |
| 528 | @param Language A pointer to an ASCII string containing the ISO 639-2 or the |
| 529 | RFC 4646 language code for the Unicode string to look up and |
| 530 | return. If Iso639Language is TRUE, then this ASCII string is |
| 531 | not assumed to be Null-terminated, and only the first three |
| 532 | characters are used. If Iso639Language is FALSE, then this ASCII |
| 533 | string must be Null-terminated. |
| 534 | @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a |
| 535 | set of ISO 639-2 or RFC 4646 language codes that the Unicode |
| 536 | string table supports. Language must be a member of this set. |
| 537 | If Iso639Language is TRUE, then this string contains one or more |
| 538 | ISO 639-2 language codes with no separator characters. If Iso639Language |
| 539 | is FALSE, then is string contains one or more RFC 4646 language |
| 540 | codes separated by ';'. |
| 541 | @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE |
| 542 | is defined in "Related Definitions". |
| 543 | @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable |
| 544 | that matches the language specified by Language. |
| 545 | @param Iso639Language Specifies the supported language code format. If it is TRUE, then |
| 546 | Language and SupportedLanguages follow ISO 639-2 language code format. |
| 547 | Otherwise, they follow the RFC 4646 language code format. |
| 548 | |
| 549 | |
| 550 | @retval EFI_SUCCESS The Unicode string that matches the language specified by Language |
| 551 | was found in the table of Unicode strings UnicodeStringTable, and |
| 552 | it was returned in UnicodeString. |
| 553 | @retval EFI_INVALID_PARAMETER Language is NULL. |
| 554 | @retval EFI_INVALID_PARAMETER UnicodeString is NULL. |
| 555 | @retval EFI_UNSUPPORTED SupportedLanguages is NULL. |
| 556 | @retval EFI_UNSUPPORTED UnicodeStringTable is NULL. |
| 557 | @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages. |
| 558 | @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable. |
| 559 | |
| 560 | **/ |
| 561 | EFI_STATUS |
| 562 | EFIAPI |
| 563 | LookupUnicodeString2 ( |
| 564 | IN CONST CHAR8 *Language, |
| 565 | IN CONST CHAR8 *SupportedLanguages, |
| 566 | IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable, |
| 567 | OUT CHAR16 **UnicodeString, |
| 568 | IN BOOLEAN Iso639Language |
| 569 | ); |
| 570 | |
| 571 | /** |
| 572 | This function adds a Unicode string to UnicodeStringTable. |
| 573 | |
| 574 | If Language is a member of SupportedLanguages then UnicodeString is added to |
| 575 | UnicodeStringTable. New buffers are allocated for both Language and |
| 576 | UnicodeString. The contents of Language and UnicodeString are copied into |
| 577 | these new buffers. These buffers are automatically freed when |
| 578 | FreeUnicodeStringTable() is called. |
| 579 | |
| 580 | @param Language A pointer to the ISO 639-2 language code for the Unicode |
| 581 | string to add. |
| 582 | @param SupportedLanguages A pointer to the set of ISO 639-2 language codes |
| 583 | that the Unicode string table supports. |
| 584 | Language must be a member of this set. |
| 585 | @param UnicodeStringTable A pointer to the table of Unicode strings. |
| 586 | @param UnicodeString A pointer to the Unicode string to add. |
| 587 | |
| 588 | @retval EFI_SUCCESS The Unicode string that matches the language |
| 589 | specified by Language was found in the table of |
| 590 | Unicode strings UnicodeStringTable, and it was |
| 591 | returned in UnicodeString. |
| 592 | @retval EFI_INVALID_PARAMETER Language is NULL. |
| 593 | @retval EFI_INVALID_PARAMETER UnicodeString is NULL. |
| 594 | @retval EFI_INVALID_PARAMETER UnicodeString is an empty string. |
| 595 | @retval EFI_UNSUPPORTED SupportedLanguages is NULL. |
| 596 | @retval EFI_ALREADY_STARTED A Unicode string with language Language is |
| 597 | already present in UnicodeStringTable. |
| 598 | @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another |
| 599 | Unicode string to UnicodeStringTable. |
| 600 | @retval EFI_UNSUPPORTED The language specified by Language is not a |
| 601 | member of SupportedLanguages. |
| 602 | |
| 603 | **/ |
| 604 | EFI_STATUS |
| 605 | EFIAPI |
| 606 | AddUnicodeString ( |
| 607 | IN CONST CHAR8 *Language, |
| 608 | IN CONST CHAR8 *SupportedLanguages, |
| 609 | IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, |
| 610 | IN CONST CHAR16 *UnicodeString |
| 611 | ); |
| 612 | |
| 613 | /** |
| 614 | This function adds the Null-terminated Unicode string specified by UnicodeString |
| 615 | to UnicodeStringTable. |
| 616 | |
| 617 | If Language is a member of SupportedLanguages then UnicodeString is added to |
| 618 | UnicodeStringTable. New buffers are allocated for both Language and UnicodeString. |
| 619 | The contents of Language and UnicodeString are copied into these new buffers. |
| 620 | These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called. |
| 621 | |
| 622 | @param Language A pointer to an ASCII string containing the ISO 639-2 or |
| 623 | the RFC 4646 language code for the Unicode string to add. |
| 624 | If Iso639Language is TRUE, then this ASCII string is not |
| 625 | assumed to be Null-terminated, and only the first three |
| 626 | chacters are used. If Iso639Language is FALSE, then this |
| 627 | ASCII string must be Null-terminated. |
| 628 | @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains |
| 629 | a set of ISO 639-2 or RFC 4646 language codes that the Unicode |
| 630 | string table supports. Language must be a member of this set. |
| 631 | If Iso639Language is TRUE, then this string contains one or more |
| 632 | ISO 639-2 language codes with no separator characters. |
| 633 | If Iso639Language is FALSE, then is string contains one or more |
| 634 | RFC 4646 language codes separated by ';'. |
| 635 | @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE |
| 636 | is defined in "Related Definitions". |
| 637 | @param UnicodeString A pointer to the Unicode string to add. |
| 638 | @param Iso639Language Specifies the supported language code format. If it is TRUE, |
| 639 | then Language and SupportedLanguages follow ISO 639-2 language code format. |
| 640 | Otherwise, they follow RFC 4646 language code format. |
| 641 | |
| 642 | @retval EFI_SUCCESS The Unicode string that matches the language specified by |
| 643 | Language was found in the table of Unicode strings UnicodeStringTable, |
| 644 | and it was returned in UnicodeString. |
| 645 | @retval EFI_INVALID_PARAMETER Language is NULL. |
| 646 | @retval EFI_INVALID_PARAMETER UnicodeString is NULL. |
| 647 | @retval EFI_INVALID_PARAMETER UnicodeString is an empty string. |
| 648 | @retval EFI_UNSUPPORTED SupportedLanguages is NULL. |
| 649 | @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in |
| 650 | UnicodeStringTable. |
| 651 | @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable. |
| 652 | @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages. |
| 653 | |
| 654 | **/ |
| 655 | EFI_STATUS |
| 656 | EFIAPI |
| 657 | AddUnicodeString2 ( |
| 658 | IN CONST CHAR8 *Language, |
| 659 | IN CONST CHAR8 *SupportedLanguages, |
| 660 | IN OUT EFI_UNICODE_STRING_TABLE **UnicodeStringTable, |
| 661 | IN CONST CHAR16 *UnicodeString, |
| 662 | IN BOOLEAN Iso639Language |
| 663 | ); |
| 664 | |
| 665 | /** |
| 666 | This function frees the table of Unicode strings in UnicodeStringTable. |
| 667 | |
| 668 | If UnicodeStringTable is NULL, then EFI_SUCCESS is returned. |
| 669 | Otherwise, each language code, and each Unicode string in the Unicode string |
| 670 | table are freed, and EFI_SUCCESS is returned. |
| 671 | |
| 672 | @param UnicodeStringTable A pointer to the table of Unicode strings. |
| 673 | |
| 674 | @retval EFI_SUCCESS The Unicode string table was freed. |
| 675 | |
| 676 | **/ |
| 677 | EFI_STATUS |
| 678 | EFIAPI |
| 679 | FreeUnicodeStringTable ( |
| 680 | IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable |
| 681 | ); |
| 682 | |
| 683 | |
| 684 | /** |
| 685 | Returns the status whether get the variable success. The function retrieves |
| 686 | variable through the UEFI Runtime Service GetVariable(). The |
| 687 | returned buffer is allocated using AllocatePool(). The caller is responsible |
| 688 | for freeing this buffer with FreePool(). |
| 689 | |
| 690 | If Name is NULL, then ASSERT(). |
| 691 | If Guid is NULL, then ASSERT(). |
| 692 | If Value is NULL, then ASSERT(). |
| 693 | |
| 694 | @param[in] Name The pointer to a Null-terminated Unicode string. |
| 695 | @param[in] Guid The pointer to an EFI_GUID structure |
| 696 | @param[out] Value The buffer point saved the variable info. |
| 697 | @param[out] Size The buffer size of the variable. |
| 698 | |
| 699 | @retval EFI_OUT_OF_RESOURCES Allocate buffer failed. |
| 700 | @retval EFI_SUCCESS Find the specified variable. |
| 701 | @retval Others Errors Return errors from call to gRT->GetVariable. |
| 702 | |
| 703 | **/ |
| 704 | EFI_STATUS |
| 705 | EFIAPI |
| 706 | GetVariable2 ( |
| 707 | IN CONST CHAR16 *Name, |
| 708 | IN CONST EFI_GUID *Guid, |
| 709 | OUT VOID **Value, |
| 710 | OUT UINTN *Size OPTIONAL |
| 711 | ); |
| 712 | |
| 713 | /** |
| 714 | Returns a pointer to an allocated buffer that contains the contents of a |
| 715 | variable retrieved through the UEFI Runtime Service GetVariable(). This |
| 716 | function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. |
| 717 | The returned buffer is allocated using AllocatePool(). The caller is |
| 718 | responsible for freeing this buffer with FreePool(). |
| 719 | |
| 720 | If Name is NULL, then ASSERT(). |
| 721 | If Value is NULL, then ASSERT(). |
| 722 | |
| 723 | @param[in] Name The pointer to a Null-terminated Unicode string. |
| 724 | @param[out] Value The buffer point saved the variable info. |
| 725 | @param[out] Size The buffer size of the variable. |
| 726 | |
| 727 | @retval EFI_OUT_OF_RESOURCES Allocate buffer failed. |
| 728 | @retval EFI_SUCCESS Find the specified variable. |
| 729 | @retval Others Errors Return errors from call to gRT->GetVariable. |
| 730 | |
| 731 | **/ |
| 732 | EFI_STATUS |
| 733 | EFIAPI |
| 734 | GetEfiGlobalVariable2 ( |
| 735 | IN CONST CHAR16 *Name, |
| 736 | OUT VOID **Value, |
| 737 | OUT UINTN *Size OPTIONAL |
| 738 | ); |
| 739 | |
| 740 | /** Return the attributes of the variable. |
| 741 | |
| 742 | Returns the status whether get the variable success. The function retrieves |
| 743 | variable through the UEFI Runtime Service GetVariable(). The |
| 744 | returned buffer is allocated using AllocatePool(). The caller is responsible |
| 745 | for freeing this buffer with FreePool(). The attributes are returned if |
| 746 | the caller provides a valid Attribute parameter. |
| 747 | |
| 748 | If Name is NULL, then ASSERT(). |
| 749 | If Guid is NULL, then ASSERT(). |
| 750 | If Value is NULL, then ASSERT(). |
| 751 | |
| 752 | @param[in] Name The pointer to a Null-terminated Unicode string. |
| 753 | @param[in] Guid The pointer to an EFI_GUID structure |
| 754 | @param[out] Value The buffer point saved the variable info. |
| 755 | @param[out] Size The buffer size of the variable. |
| 756 | @param[out] Attr The pointer to the variable attributes as found in var store |
| 757 | |
| 758 | @retval EFI_OUT_OF_RESOURCES Allocate buffer failed. |
| 759 | @retval EFI_SUCCESS Find the specified variable. |
| 760 | @retval Others Errors Return errors from call to gRT->GetVariable. |
| 761 | |
| 762 | **/ |
| 763 | EFI_STATUS |
| 764 | EFIAPI |
| 765 | GetVariable3( |
| 766 | IN CONST CHAR16 *Name, |
| 767 | IN CONST EFI_GUID *Guid, |
| 768 | OUT VOID **Value, |
| 769 | OUT UINTN *Size OPTIONAL, |
| 770 | OUT UINT32 *Attr OPTIONAL |
| 771 | ); |
| 772 | |
| 773 | /** |
| 774 | Returns a pointer to an allocated buffer that contains the best matching language |
| 775 | from a set of supported languages. |
| 776 | |
| 777 | This function supports both ISO 639-2 and RFC 4646 language codes, but language |
| 778 | code types may not be mixed in a single call to this function. The language |
| 779 | code returned is allocated using AllocatePool(). The caller is responsible for |
| 780 | freeing the allocated buffer using FreePool(). This function supports a variable |
| 781 | argument list that allows the caller to pass in a prioritized list of language |
| 782 | codes to test against all the language codes in SupportedLanguages. |
| 783 | |
| 784 | If SupportedLanguages is NULL, then ASSERT(). |
| 785 | |
| 786 | @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that |
| 787 | contains a set of language codes in the format |
| 788 | specified by Iso639Language. |
| 789 | @param[in] Iso639Language If not zero, then all language codes are assumed to be |
| 790 | in ISO 639-2 format. If zero, then all language |
| 791 | codes are assumed to be in RFC 4646 language format |
| 792 | @param[in] ... A variable argument list that contains pointers to |
| 793 | Null-terminated ASCII strings that contain one or more |
| 794 | language codes in the format specified by Iso639Language. |
| 795 | The first language code from each of these language |
| 796 | code lists is used to determine if it is an exact or |
| 797 | close match to any of the language codes in |
| 798 | SupportedLanguages. Close matches only apply to RFC 4646 |
| 799 | language codes, and the matching algorithm from RFC 4647 |
| 800 | is used to determine if a close match is present. If |
| 801 | an exact or close match is found, then the matching |
| 802 | language code from SupportedLanguages is returned. If |
| 803 | no matches are found, then the next variable argument |
| 804 | parameter is evaluated. The variable argument list |
| 805 | is terminated by a NULL. |
| 806 | |
| 807 | @retval NULL The best matching language could not be found in SupportedLanguages. |
| 808 | @retval NULL There are not enough resources available to return the best matching |
| 809 | language. |
| 810 | @retval Other A pointer to a Null-terminated ASCII string that is the best matching |
| 811 | language in SupportedLanguages. |
| 812 | |
| 813 | **/ |
| 814 | CHAR8 * |
| 815 | EFIAPI |
| 816 | GetBestLanguage ( |
| 817 | IN CONST CHAR8 *SupportedLanguages, |
| 818 | IN UINTN Iso639Language, |
| 819 | ... |
| 820 | ); |
| 821 | |
| 822 | /** |
| 823 | Draws a dialog box to the console output device specified by |
| 824 | ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke |
| 825 | from the console input device specified by ConIn defined in the |
| 826 | EFI_SYSTEM_TABLE. |
| 827 | |
| 828 | If there are no strings in the variable argument list, then ASSERT(). |
| 829 | If all the strings in the variable argument list are empty, then ASSERT(). |
| 830 | |
| 831 | @param[in] Attribute Specifies the foreground and background color of the popup. |
| 832 | @param[out] Key A pointer to the EFI_KEY value of the key that was |
| 833 | pressed. This is an optional parameter that may be NULL. |
| 834 | If it is NULL then no wait for a keypress will be performed. |
| 835 | @param[in] ... The variable argument list that contains pointers to Null- |
| 836 | terminated Unicode strings to display in the dialog box. |
| 837 | The variable argument list is terminated by a NULL. |
| 838 | |
| 839 | **/ |
| 840 | VOID |
| 841 | EFIAPI |
| 842 | CreatePopUp ( |
| 843 | IN UINTN Attribute, |
| 844 | OUT EFI_INPUT_KEY *Key, OPTIONAL |
| 845 | ... |
| 846 | ); |
| 847 | |
| 848 | /** |
| 849 | Retrieves the width of a Unicode character. |
| 850 | |
| 851 | This function computes and returns the width of the Unicode character specified |
| 852 | by UnicodeChar. |
| 853 | |
| 854 | @param UnicodeChar A Unicode character. |
| 855 | |
| 856 | @retval 0 The width if UnicodeChar could not be determined. |
| 857 | @retval 1 UnicodeChar is a narrow glyph. |
| 858 | @retval 2 UnicodeChar is a wide glyph. |
| 859 | |
| 860 | **/ |
| 861 | UINTN |
| 862 | EFIAPI |
| 863 | GetGlyphWidth ( |
| 864 | IN CHAR16 UnicodeChar |
| 865 | ); |
| 866 | |
| 867 | /** |
| 868 | Computes the display length of a Null-terminated Unicode String. |
| 869 | |
| 870 | This function computes and returns the display length of the Null-terminated Unicode |
| 871 | string specified by String. If String is NULL then 0 is returned. If any of the widths |
| 872 | of the Unicode characters in String can not be determined, then 0 is returned. The display |
| 873 | width of String can be computed by summing the display widths of each Unicode character |
| 874 | in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode |
| 875 | characters that are width glyphs have a width of 2. |
| 876 | If String is not aligned on a 16-bit boundary, then ASSERT(). |
| 877 | |
| 878 | @param String A pointer to a Null-terminated Unicode string. |
| 879 | |
| 880 | @return The display length of the Null-terminated Unicode string specified by String. |
| 881 | |
| 882 | **/ |
| 883 | UINTN |
| 884 | EFIAPI |
| 885 | UnicodeStringDisplayLength ( |
| 886 | IN CONST CHAR16 *String |
| 887 | ); |
| 888 | |
| 889 | // |
| 890 | // Functions that abstract early Framework contamination of UEFI. |
| 891 | // |
| 892 | /** |
| 893 | Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot(). |
| 894 | |
| 895 | This function abstracts the signaling of the Ready to Boot Event. The Framework moved |
| 896 | from a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller |
| 897 | from how this event is created to prevent to code form having to change with the |
| 898 | version of the specification supported. |
| 899 | |
| 900 | **/ |
| 901 | VOID |
| 902 | EFIAPI |
| 903 | EfiSignalEventReadyToBoot ( |
| 904 | VOID |
| 905 | ); |
| 906 | |
| 907 | /** |
| 908 | Create, Signal, and Close the Ready to Boot event using EfiSignalEventLegacyBoot(). |
| 909 | |
| 910 | This function abstracts the signaling of the Legacy Boot Event. The Framework moved from |
| 911 | a proprietary to UEFI 2.0 based mechanism. This library abstracts the caller from how |
| 912 | this event is created to prevent to code form having to change with the version of the |
| 913 | specification supported. |
| 914 | |
| 915 | **/ |
| 916 | VOID |
| 917 | EFIAPI |
| 918 | EfiSignalEventLegacyBoot ( |
| 919 | VOID |
| 920 | ); |
| 921 | |
| 922 | /** |
| 923 | Creates an EFI event in the Legacy Boot Event Group. |
| 924 | |
| 925 | Prior to UEFI 2.0 this was done via a non blessed UEFI extensions and this library |
| 926 | abstracts the implementation mechanism of this event from the caller. This function |
| 927 | abstracts the creation of the Legacy Boot Event. The Framework moved from a proprietary |
| 928 | to UEFI 2.0 based mechanism. This library abstracts the caller from how this event |
| 929 | is created to prevent to code form having to change with the version of the |
| 930 | specification supported. |
| 931 | If LegacyBootEvent is NULL, then ASSERT(). |
| 932 | |
| 933 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). |
| 934 | |
| 935 | @retval EFI_SUCCESS The event was created. |
| 936 | @retval Other The event was not created. |
| 937 | |
| 938 | **/ |
| 939 | EFI_STATUS |
| 940 | EFIAPI |
| 941 | EfiCreateEventLegacyBoot ( |
| 942 | OUT EFI_EVENT *LegacyBootEvent |
| 943 | ); |
| 944 | |
| 945 | /** |
| 946 | Create an EFI event in the Legacy Boot Event Group and allows |
| 947 | the caller to specify a notification function. |
| 948 | |
| 949 | This function abstracts the creation of the Legacy Boot Event. |
| 950 | The Framework moved from a proprietary to UEFI 2.0 based mechanism. |
| 951 | This library abstracts the caller from how this event is created to prevent |
| 952 | to code form having to change with the version of the specification supported. |
| 953 | If LegacyBootEvent is NULL, then ASSERT(). |
| 954 | |
| 955 | @param NotifyTpl The task priority level of the event. |
| 956 | @param NotifyFunction The notification function to call when the event is signaled. |
| 957 | @param NotifyContext The content to pass to NotifyFunction when the event is signaled. |
| 958 | @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). |
| 959 | |
| 960 | @retval EFI_SUCCESS The event was created. |
| 961 | @retval Other The event was not created. |
| 962 | |
| 963 | **/ |
| 964 | EFI_STATUS |
| 965 | EFIAPI |
| 966 | EfiCreateEventLegacyBootEx ( |
| 967 | IN EFI_TPL NotifyTpl, |
| 968 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL |
| 969 | IN VOID *NotifyContext, OPTIONAL |
| 970 | OUT EFI_EVENT *LegacyBootEvent |
| 971 | ); |
| 972 | |
| 973 | /** |
| 974 | Create an EFI event in the Ready To Boot Event Group. |
| 975 | |
| 976 | Prior to UEFI 2.0 this was done via a non-standard UEFI extension, and this library |
| 977 | abstracts the implementation mechanism of this event from the caller. |
| 978 | This function abstracts the creation of the Ready to Boot Event. The Framework |
| 979 | moved from a proprietary to UEFI 2.0-based mechanism. This library abstracts |
| 980 | the caller from how this event is created to prevent the code form having to |
| 981 | change with the version of the specification supported. |
| 982 | If ReadyToBootEvent is NULL, then ASSERT(). |
| 983 | |
| 984 | @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). |
| 985 | |
| 986 | @retval EFI_SUCCESS The event was created. |
| 987 | @retval Other The event was not created. |
| 988 | |
| 989 | **/ |
| 990 | EFI_STATUS |
| 991 | EFIAPI |
| 992 | EfiCreateEventReadyToBoot ( |
| 993 | OUT EFI_EVENT *ReadyToBootEvent |
| 994 | ); |
| 995 | |
| 996 | /** |
| 997 | Create an EFI event in the Ready To Boot Event Group and allows |
| 998 | the caller to specify a notification function. |
| 999 | |
| 1000 | This function abstracts the creation of the Ready to Boot Event. |
| 1001 | The Framework moved from a proprietary to UEFI 2.0 based mechanism. |
| 1002 | This library abstracts the caller from how this event is created to prevent |
| 1003 | to code form having to change with the version of the specification supported. |
| 1004 | If ReadyToBootEvent is NULL, then ASSERT(). |
| 1005 | |
| 1006 | @param NotifyTpl The task priority level of the event. |
| 1007 | @param NotifyFunction The notification function to call when the event is signaled. |
| 1008 | @param NotifyContext The content to pass to NotifyFunction when the event is signaled. |
| 1009 | @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex). |
| 1010 | |
| 1011 | @retval EFI_SUCCESS The event was created. |
| 1012 | @retval Other The event was not created. |
| 1013 | |
| 1014 | **/ |
| 1015 | EFI_STATUS |
| 1016 | EFIAPI |
| 1017 | EfiCreateEventReadyToBootEx ( |
| 1018 | IN EFI_TPL NotifyTpl, |
| 1019 | IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL |
| 1020 | IN VOID *NotifyContext, OPTIONAL |
| 1021 | OUT EFI_EVENT *ReadyToBootEvent |
| 1022 | ); |
| 1023 | |
| 1024 | /** |
| 1025 | Initialize a Firmware Volume (FV) Media Device Path node. |
| 1026 | |
| 1027 | The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. |
| 1028 | This library function abstracts initializing a device path node. |
| 1029 | Initialize the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure. This device |
| 1030 | path changed in the DXE CIS version 0.92 in a non back ward compatible way to |
| 1031 | not conflict with the UEFI 2.0 specification. This function abstracts the |
| 1032 | differences from the caller. |
| 1033 | If FvDevicePathNode is NULL, then ASSERT(). |
| 1034 | If NameGuid is NULL, then ASSERT(). |
| 1035 | |
| 1036 | @param FvDevicePathNode The pointer to a FV device path node to initialize |
| 1037 | @param NameGuid FV file name to use in FvDevicePathNode |
| 1038 | |
| 1039 | **/ |
| 1040 | VOID |
| 1041 | EFIAPI |
| 1042 | EfiInitializeFwVolDevicepathNode ( |
| 1043 | IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, |
| 1044 | IN CONST EFI_GUID *NameGuid |
| 1045 | ); |
| 1046 | |
| 1047 | /** |
| 1048 | Check to see if the Firmware Volume (FV) Media Device Path is valid |
| 1049 | |
| 1050 | The Framework FwVol Device Path changed to conform to the UEFI 2.0 specification. |
| 1051 | This library function abstracts validating a device path node. |
| 1052 | Check the MEDIA_FW_VOL_FILEPATH_DEVICE_PATH data structure to see if it's valid. |
| 1053 | If it is valid, then return the GUID file name from the device path node. Otherwise, |
| 1054 | return NULL. This device path changed in the DXE CIS version 0.92 in a non backward |
| 1055 | compatible way to not conflict with the UEFI 2.0 specification. This function abstracts |
| 1056 | the differences from the caller. |
| 1057 | If FvDevicePathNode is NULL, then ASSERT(). |
| 1058 | |
| 1059 | @param FvDevicePathNode The pointer to FV device path to check. |
| 1060 | |
| 1061 | @retval NULL FvDevicePathNode is not valid. |
| 1062 | @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned. |
| 1063 | |
| 1064 | **/ |
| 1065 | EFI_GUID * |
| 1066 | EFIAPI |
| 1067 | EfiGetNameGuidFromFwVolDevicePathNode ( |
| 1068 | IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode |
| 1069 | ); |
| 1070 | |
| 1071 | /** |
| 1072 | Prints a formatted Unicode string to the console output device specified by |
| 1073 | ConOut defined in the EFI_SYSTEM_TABLE. |
| 1074 | |
| 1075 | This function prints a formatted Unicode string to the console output device |
| 1076 | specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode |
| 1077 | characters that printed to ConOut. If the length of the formatted Unicode |
| 1078 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first |
| 1079 | PcdUefiLibMaxPrintBufferSize characters are sent to ConOut. |
| 1080 | If Format is NULL, then ASSERT(). |
| 1081 | If Format is not aligned on a 16-bit boundary, then ASSERT(). |
| 1082 | If gST->ConOut is NULL, then ASSERT(). |
| 1083 | |
| 1084 | @param Format A null-terminated Unicode format string. |
| 1085 | @param ... The variable argument list whose contents are accessed based |
| 1086 | on the format string specified by Format. |
| 1087 | |
| 1088 | @return Number of Unicode characters printed to ConOut. |
| 1089 | |
| 1090 | **/ |
| 1091 | UINTN |
| 1092 | EFIAPI |
| 1093 | Print ( |
| 1094 | IN CONST CHAR16 *Format, |
| 1095 | ... |
| 1096 | ); |
| 1097 | |
| 1098 | /** |
| 1099 | Prints a formatted Unicode string to the console output device specified by |
| 1100 | StdErr defined in the EFI_SYSTEM_TABLE. |
| 1101 | |
| 1102 | This function prints a formatted Unicode string to the console output device |
| 1103 | specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode |
| 1104 | characters that printed to StdErr. If the length of the formatted Unicode |
| 1105 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first |
| 1106 | PcdUefiLibMaxPrintBufferSize characters are sent to StdErr. |
| 1107 | If Format is NULL, then ASSERT(). |
| 1108 | If Format is not aligned on a 16-bit boundary, then ASSERT(). |
| 1109 | If gST->StdErr is NULL, then ASSERT(). |
| 1110 | |
| 1111 | @param Format A null-terminated Unicode format string. |
| 1112 | @param ... The variable argument list whose contents are accessed based |
| 1113 | on the format string specified by Format. |
| 1114 | |
| 1115 | @return Number of Unicode characters printed to StdErr. |
| 1116 | |
| 1117 | **/ |
| 1118 | UINTN |
| 1119 | EFIAPI |
| 1120 | ErrorPrint ( |
| 1121 | IN CONST CHAR16 *Format, |
| 1122 | ... |
| 1123 | ); |
| 1124 | |
| 1125 | /** |
| 1126 | Prints a formatted ASCII string to the console output device specified by |
| 1127 | ConOut defined in the EFI_SYSTEM_TABLE. |
| 1128 | |
| 1129 | This function prints a formatted ASCII string to the console output device |
| 1130 | specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII |
| 1131 | characters that printed to ConOut. If the length of the formatted ASCII |
| 1132 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first |
| 1133 | PcdUefiLibMaxPrintBufferSize characters are sent to ConOut. |
| 1134 | If Format is NULL, then ASSERT(). |
| 1135 | If gST->ConOut is NULL, then ASSERT(). |
| 1136 | |
| 1137 | @param Format A null-terminated ASCII format string. |
| 1138 | @param ... The variable argument list whose contents are accessed based |
| 1139 | on the format string specified by Format. |
| 1140 | |
| 1141 | @return Number of ASCII characters printed to ConOut. |
| 1142 | |
| 1143 | **/ |
| 1144 | UINTN |
| 1145 | EFIAPI |
| 1146 | AsciiPrint ( |
| 1147 | IN CONST CHAR8 *Format, |
| 1148 | ... |
| 1149 | ); |
| 1150 | |
| 1151 | /** |
| 1152 | Prints a formatted ASCII string to the console output device specified by |
| 1153 | StdErr defined in the EFI_SYSTEM_TABLE. |
| 1154 | |
| 1155 | This function prints a formatted ASCII string to the console output device |
| 1156 | specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII |
| 1157 | characters that printed to StdErr. If the length of the formatted ASCII |
| 1158 | string is greater than PcdUefiLibMaxPrintBufferSize, then only the first |
| 1159 | PcdUefiLibMaxPrintBufferSize characters are sent to StdErr. |
| 1160 | If Format is NULL, then ASSERT(). |
| 1161 | If gST->StdErr is NULL, then ASSERT(). |
| 1162 | |
| 1163 | @param Format A null-terminated ASCII format string. |
| 1164 | @param ... The variable argument list whose contents are accessed based |
| 1165 | on the format string specified by Format. |
| 1166 | |
| 1167 | @return Number of ASCII characters printed to ConErr. |
| 1168 | |
| 1169 | **/ |
| 1170 | UINTN |
| 1171 | EFIAPI |
| 1172 | AsciiErrorPrint ( |
| 1173 | IN CONST CHAR8 *Format, |
| 1174 | ... |
| 1175 | ); |
| 1176 | |
| 1177 | |
| 1178 | /** |
| 1179 | Prints a formatted Unicode string to a graphics console device specified by |
| 1180 | ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates. |
| 1181 | |
| 1182 | This function prints a formatted Unicode string to the graphics console device |
| 1183 | specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of |
| 1184 | Unicode characters displayed, not including partial characters that may be clipped |
| 1185 | by the right edge of the display. If the length of the formatted Unicode string is |
| 1186 | greater than PcdUefiLibMaxPrintBufferSize, then at most the first |
| 1187 | PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL |
| 1188 | is used to convert the string to a bitmap using the glyphs registered with the |
| 1189 | HII database. No wrapping is performed, so any portions of the string the fall |
| 1190 | outside the active display region will not be displayed. |
| 1191 | |
| 1192 | If a graphics console device is not associated with the ConsoleOutputHandle |
| 1193 | defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. |
| 1194 | If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no |
| 1195 | string is printed, and 0 is returned. |
| 1196 | If Format is NULL, then ASSERT(). |
| 1197 | If Format is not aligned on a 16-bit boundary, then ASSERT(). |
| 1198 | If gST->ConsoleOutputHandle is NULL, then ASSERT(). |
| 1199 | |
| 1200 | @param PointX X coordinate to print the string. |
| 1201 | @param PointY Y coordinate to print the string. |
| 1202 | @param ForeGround The foreground color of the string being printed. This is |
| 1203 | an optional parameter that may be NULL. If it is NULL, |
| 1204 | then the foreground color of the current ConOut device |
| 1205 | in the EFI_SYSTEM_TABLE is used. |
| 1206 | @param BackGround The background color of the string being printed. This is |
| 1207 | an optional parameter that may be NULL. If it is NULL, |
| 1208 | then the background color of the current ConOut device |
| 1209 | in the EFI_SYSTEM_TABLE is used. |
| 1210 | @param Format A null-terminated Unicode format string. See Print Library |
| 1211 | for the supported format string syntax. |
| 1212 | @param ... Variable argument list whose contents are accessed based on |
| 1213 | the format string specified by Format. |
| 1214 | |
| 1215 | @return The number of Unicode characters printed. |
| 1216 | |
| 1217 | **/ |
| 1218 | UINTN |
| 1219 | EFIAPI |
| 1220 | PrintXY ( |
| 1221 | IN UINTN PointX, |
| 1222 | IN UINTN PointY, |
| 1223 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL |
| 1224 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL |
| 1225 | IN CONST CHAR16 *Format, |
| 1226 | ... |
| 1227 | ); |
| 1228 | |
| 1229 | /** |
| 1230 | Prints a formatted ASCII string to a graphics console device specified by |
| 1231 | ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates. |
| 1232 | |
| 1233 | This function prints a formatted ASCII string to the graphics console device |
| 1234 | specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of |
| 1235 | ASCII characters displayed, not including partial characters that may be clipped |
| 1236 | by the right edge of the display. If the length of the formatted ASCII string is |
| 1237 | greater than PcdUefiLibMaxPrintBufferSize, then at most the first |
| 1238 | PcdUefiLibMaxPrintBufferSize characters are printed. The EFI_HII_FONT_PROTOCOL |
| 1239 | is used to convert the string to a bitmap using the glyphs registered with the |
| 1240 | HII database. No wrapping is performed, so any portions of the string the fall |
| 1241 | outside the active display region will not be displayed. |
| 1242 | |
| 1243 | If a graphics console device is not associated with the ConsoleOutputHandle |
| 1244 | defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned. |
| 1245 | If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no |
| 1246 | string is printed, and 0 is returned. |
| 1247 | If Format is NULL, then ASSERT(). |
| 1248 | If gST->ConsoleOutputHandle is NULL, then ASSERT(). |
| 1249 | |
| 1250 | @param PointX X coordinate to print the string. |
| 1251 | @param PointY Y coordinate to print the string. |
| 1252 | @param ForeGround The foreground color of the string being printed. This is |
| 1253 | an optional parameter that may be NULL. If it is NULL, |
| 1254 | then the foreground color of the current ConOut device |
| 1255 | in the EFI_SYSTEM_TABLE is used. |
| 1256 | @param BackGround The background color of the string being printed. This is |
| 1257 | an optional parameter that may be NULL. If it is NULL, |
| 1258 | then the background color of the current ConOut device |
| 1259 | in the EFI_SYSTEM_TABLE is used. |
| 1260 | @param Format A null-terminated ASCII format string. See Print Library |
| 1261 | for the supported format string syntax. |
| 1262 | @param ... The variable argument list whose contents are accessed based on |
| 1263 | the format string specified by Format. |
| 1264 | |
| 1265 | @return The number of ASCII characters printed. |
| 1266 | |
| 1267 | **/ |
| 1268 | UINTN |
| 1269 | EFIAPI |
| 1270 | AsciiPrintXY ( |
| 1271 | IN UINTN PointX, |
| 1272 | IN UINTN PointY, |
| 1273 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL |
| 1274 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL |
| 1275 | IN CONST CHAR8 *Format, |
| 1276 | ... |
| 1277 | ); |
| 1278 | |
| 1279 | |
| 1280 | /** |
| 1281 | Installs and completes the initialization of a Driver Binding Protocol instance. |
| 1282 | |
| 1283 | Installs the Driver Binding Protocol specified by DriverBinding onto the handle |
| 1284 | specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding |
| 1285 | is installed onto a newly created handle. DriverBindingHandle is typically the same |
| 1286 | as the driver's ImageHandle, but it can be different if the driver produces multiple |
| 1287 | Driver Binding Protocols. |
| 1288 | If DriverBinding is NULL, then ASSERT(). |
| 1289 | If DriverBinding can not be installed onto a handle, then ASSERT(). |
| 1290 | |
| 1291 | @param ImageHandle The image handle of the driver. |
| 1292 | @param SystemTable The EFI System Table that was passed to the driver's entry point. |
| 1293 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing. |
| 1294 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this |
| 1295 | parameter is NULL, then a new handle is created. |
| 1296 | |
| 1297 | @retval EFI_SUCCESS The protocol installation completed successfully. |
| 1298 | @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol. |
| 1299 | @retval Others Status from gBS->InstallMultipleProtocolInterfaces(). |
| 1300 | |
| 1301 | **/ |
| 1302 | EFI_STATUS |
| 1303 | EFIAPI |
| 1304 | EfiLibInstallDriverBinding ( |
| 1305 | IN CONST EFI_HANDLE ImageHandle, |
| 1306 | IN CONST EFI_SYSTEM_TABLE *SystemTable, |
| 1307 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1308 | IN EFI_HANDLE DriverBindingHandle |
| 1309 | ); |
| 1310 | |
| 1311 | |
| 1312 | /** |
| 1313 | Uninstalls a Driver Binding Protocol instance. |
| 1314 | |
| 1315 | If DriverBinding is NULL, then ASSERT(). |
| 1316 | If DriverBinding can not be uninstalled, then ASSERT(). |
| 1317 | |
| 1318 | @param DriverBinding A Driver Binding Protocol instance that this driver produced. |
| 1319 | |
| 1320 | @retval EFI_SUCCESS The protocol uninstallation successfully completed. |
| 1321 | @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). |
| 1322 | |
| 1323 | **/ |
| 1324 | EFI_STATUS |
| 1325 | EFIAPI |
| 1326 | EfiLibUninstallDriverBinding ( |
| 1327 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding |
| 1328 | ); |
| 1329 | |
| 1330 | |
| 1331 | /** |
| 1332 | Installs and completes the initialization of a Driver Binding Protocol instance and |
| 1333 | optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols. |
| 1334 | |
| 1335 | Initializes a driver by installing the Driver Binding Protocol together with the |
| 1336 | optional Component Name, optional Driver Configure and optional Driver Diagnostic |
| 1337 | Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL, |
| 1338 | then the protocols are installed onto a newly created handle. DriverBindingHandle |
| 1339 | is typically the same as the driver's ImageHandle, but it can be different if the |
| 1340 | driver produces multiple Driver Binding Protocols. |
| 1341 | If DriverBinding is NULL, then ASSERT(). |
| 1342 | If the installation fails, then ASSERT(). |
| 1343 | |
| 1344 | @param ImageHandle The image handle of the driver. |
| 1345 | @param SystemTable The EFI System Table that was passed to the driver's entry point. |
| 1346 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing. |
| 1347 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this |
| 1348 | parameter is NULL, then a new handle is created. |
| 1349 | @param ComponentName A Component Name Protocol instance that this driver is producing. |
| 1350 | @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing. |
| 1351 | @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing. |
| 1352 | |
| 1353 | @retval EFI_SUCCESS The protocol installation completed successfully. |
| 1354 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in the pool to install all the protocols. |
| 1355 | |
| 1356 | **/ |
| 1357 | EFI_STATUS |
| 1358 | EFIAPI |
| 1359 | EfiLibInstallAllDriverProtocols ( |
| 1360 | IN CONST EFI_HANDLE ImageHandle, |
| 1361 | IN CONST EFI_SYSTEM_TABLE *SystemTable, |
| 1362 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1363 | IN EFI_HANDLE DriverBindingHandle, |
| 1364 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL |
| 1365 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL |
| 1366 | IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL |
| 1367 | ); |
| 1368 | |
| 1369 | |
| 1370 | /** |
| 1371 | Uninstalls a Driver Binding Protocol instance and optionally uninstalls the |
| 1372 | Component Name, Driver Configuration and Driver Diagnostics Protocols. |
| 1373 | |
| 1374 | If DriverBinding is NULL, then ASSERT(). |
| 1375 | If the uninstallation fails, then ASSERT(). |
| 1376 | |
| 1377 | @param DriverBinding A Driver Binding Protocol instance that this driver produced. |
| 1378 | @param ComponentName A Component Name Protocol instance that this driver produced. |
| 1379 | @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced. |
| 1380 | @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced. |
| 1381 | |
| 1382 | @retval EFI_SUCCESS The protocol uninstallation successfully completed. |
| 1383 | @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). |
| 1384 | |
| 1385 | **/ |
| 1386 | EFI_STATUS |
| 1387 | EFIAPI |
| 1388 | EfiLibUninstallAllDriverProtocols ( |
| 1389 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1390 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL |
| 1391 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL |
| 1392 | IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL |
| 1393 | ); |
| 1394 | |
| 1395 | |
| 1396 | /** |
| 1397 | Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols. |
| 1398 | |
| 1399 | Initializes a driver by installing the Driver Binding Protocol together with the |
| 1400 | optional Component Name and optional Component Name 2 protocols onto the driver's |
| 1401 | DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed |
| 1402 | onto a newly created handle. DriverBindingHandle is typically the same as the driver's |
| 1403 | ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols. |
| 1404 | If DriverBinding is NULL, then ASSERT(). |
| 1405 | If the installation fails, then ASSERT(). |
| 1406 | |
| 1407 | @param ImageHandle The image handle of the driver. |
| 1408 | @param SystemTable The EFI System Table that was passed to the driver's entry point. |
| 1409 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing. |
| 1410 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this |
| 1411 | parameter is NULL, then a new handle is created. |
| 1412 | @param ComponentName A Component Name Protocol instance that this driver is producing. |
| 1413 | @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing. |
| 1414 | |
| 1415 | @retval EFI_SUCCESS The protocol installation completed successfully. |
| 1416 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols. |
| 1417 | |
| 1418 | **/ |
| 1419 | EFI_STATUS |
| 1420 | EFIAPI |
| 1421 | EfiLibInstallDriverBindingComponentName2 ( |
| 1422 | IN CONST EFI_HANDLE ImageHandle, |
| 1423 | IN CONST EFI_SYSTEM_TABLE *SystemTable, |
| 1424 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1425 | IN EFI_HANDLE DriverBindingHandle, |
| 1426 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL |
| 1427 | IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL |
| 1428 | ); |
| 1429 | |
| 1430 | |
| 1431 | /** |
| 1432 | Uninstalls Driver Binding Protocol with optional Component Name and Component Name 2 Protocols. |
| 1433 | |
| 1434 | If DriverBinding is NULL, then ASSERT(). |
| 1435 | If the uninstallation fails, then ASSERT(). |
| 1436 | |
| 1437 | @param DriverBinding A Driver Binding Protocol instance that this driver produced. |
| 1438 | @param ComponentName A Component Name Protocol instance that this driver produced. |
| 1439 | @param ComponentName2 A Component Name 2 Protocol instance that this driver produced. |
| 1440 | |
| 1441 | @retval EFI_SUCCESS The protocol installation successfully completed. |
| 1442 | @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). |
| 1443 | |
| 1444 | **/ |
| 1445 | EFI_STATUS |
| 1446 | EFIAPI |
| 1447 | EfiLibUninstallDriverBindingComponentName2 ( |
| 1448 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1449 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL |
| 1450 | IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL |
| 1451 | ); |
| 1452 | |
| 1453 | |
| 1454 | /** |
| 1455 | Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver |
| 1456 | Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols. |
| 1457 | |
| 1458 | Initializes a driver by installing the Driver Binding Protocol together with the optional |
| 1459 | Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2, |
| 1460 | optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle. |
| 1461 | DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver |
| 1462 | produces multiple Driver Binding Protocols. |
| 1463 | If DriverBinding is NULL, then ASSERT(). |
| 1464 | If the installation fails, then ASSERT(). |
| 1465 | |
| 1466 | |
| 1467 | @param ImageHandle The image handle of the driver. |
| 1468 | @param SystemTable The EFI System Table that was passed to the driver's entry point. |
| 1469 | @param DriverBinding A Driver Binding Protocol instance that this driver is producing. |
| 1470 | @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this |
| 1471 | parameter is NULL, then a new handle is created. |
| 1472 | @param ComponentName A Component Name Protocol instance that this driver is producing. |
| 1473 | @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing. |
| 1474 | @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing. |
| 1475 | @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing. |
| 1476 | @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing. |
| 1477 | @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing. |
| 1478 | |
| 1479 | @retval EFI_SUCCESS The protocol installation completed successfully. |
| 1480 | @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols. |
| 1481 | |
| 1482 | **/ |
| 1483 | EFI_STATUS |
| 1484 | EFIAPI |
| 1485 | EfiLibInstallAllDriverProtocols2 ( |
| 1486 | IN CONST EFI_HANDLE ImageHandle, |
| 1487 | IN CONST EFI_SYSTEM_TABLE *SystemTable, |
| 1488 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1489 | IN EFI_HANDLE DriverBindingHandle, |
| 1490 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL |
| 1491 | IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL |
| 1492 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL |
| 1493 | IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL |
| 1494 | IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL |
| 1495 | IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL |
| 1496 | ); |
| 1497 | |
| 1498 | |
| 1499 | /** |
| 1500 | Uninstalls Driver Binding Protocol with optional Component Name, Component Name 2, Driver |
| 1501 | Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols. |
| 1502 | |
| 1503 | If DriverBinding is NULL, then ASSERT(). |
| 1504 | If the installation fails, then ASSERT(). |
| 1505 | |
| 1506 | |
| 1507 | @param DriverBinding A Driver Binding Protocol instance that this driver produced. |
| 1508 | @param ComponentName A Component Name Protocol instance that this driver produced. |
| 1509 | @param ComponentName2 A Component Name 2 Protocol instance that this driver produced. |
| 1510 | @param DriverConfiguration A Driver Configuration Protocol instance that this driver produced. |
| 1511 | @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver produced. |
| 1512 | @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver produced. |
| 1513 | @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver produced. |
| 1514 | |
| 1515 | @retval EFI_SUCCESS The protocol uninstallation successfully completed. |
| 1516 | @retval Others Status from gBS->UninstallMultipleProtocolInterfaces(). |
| 1517 | |
| 1518 | **/ |
| 1519 | EFI_STATUS |
| 1520 | EFIAPI |
| 1521 | EfiLibUninstallAllDriverProtocols2 ( |
| 1522 | IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, |
| 1523 | IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL |
| 1524 | IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL |
| 1525 | IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL |
| 1526 | IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL |
| 1527 | IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL |
| 1528 | IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL |
| 1529 | ); |
| 1530 | |
| 1531 | |
| 1532 | /** |
| 1533 | Appends a formatted Unicode string to a Null-terminated Unicode string |
| 1534 | |
| 1535 | This function appends a formatted Unicode string to the Null-terminated |
| 1536 | Unicode string specified by String. String is optional and may be NULL. |
| 1537 | Storage for the formatted Unicode string returned is allocated using |
| 1538 | AllocatePool(). The pointer to the appended string is returned. The caller |
| 1539 | is responsible for freeing the returned string. |
| 1540 | |
| 1541 | If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). |
| 1542 | If FormatString is NULL, then ASSERT(). |
| 1543 | If FormatString is not aligned on a 16-bit boundary, then ASSERT(). |
| 1544 | |
| 1545 | @param[in] String A Null-terminated Unicode string. |
| 1546 | @param[in] FormatString A Null-terminated Unicode format string. |
| 1547 | @param[in] Marker VA_LIST marker for the variable argument list. |
| 1548 | |
| 1549 | @retval NULL There was not enough available memory. |
| 1550 | @return Null-terminated Unicode string is that is the formatted |
| 1551 | string appended to String. |
| 1552 | **/ |
| 1553 | CHAR16* |
| 1554 | EFIAPI |
| 1555 | CatVSPrint ( |
| 1556 | IN CHAR16 *String, OPTIONAL |
| 1557 | IN CONST CHAR16 *FormatString, |
| 1558 | IN VA_LIST Marker |
| 1559 | ); |
| 1560 | |
| 1561 | /** |
| 1562 | Appends a formatted Unicode string to a Null-terminated Unicode string |
| 1563 | |
| 1564 | This function appends a formatted Unicode string to the Null-terminated |
| 1565 | Unicode string specified by String. String is optional and may be NULL. |
| 1566 | Storage for the formatted Unicode string returned is allocated using |
| 1567 | AllocatePool(). The pointer to the appended string is returned. The caller |
| 1568 | is responsible for freeing the returned string. |
| 1569 | |
| 1570 | If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). |
| 1571 | If FormatString is NULL, then ASSERT(). |
| 1572 | If FormatString is not aligned on a 16-bit boundary, then ASSERT(). |
| 1573 | |
| 1574 | @param[in] String A Null-terminated Unicode string. |
| 1575 | @param[in] FormatString A Null-terminated Unicode format string. |
| 1576 | @param[in] ... The variable argument list whose contents are |
| 1577 | accessed based on the format string specified by |
| 1578 | FormatString. |
| 1579 | |
| 1580 | @retval NULL There was not enough available memory. |
| 1581 | @return Null-terminated Unicode string is that is the formatted |
| 1582 | string appended to String. |
| 1583 | **/ |
| 1584 | CHAR16 * |
| 1585 | EFIAPI |
| 1586 | CatSPrint ( |
| 1587 | IN CHAR16 *String, OPTIONAL |
| 1588 | IN CONST CHAR16 *FormatString, |
| 1589 | ... |
| 1590 | ); |
| 1591 | |
| 1592 | /** |
| 1593 | Returns an array of protocol instance that matches the given protocol. |
| 1594 | |
| 1595 | @param[in] Protocol Provides the protocol to search for. |
| 1596 | @param[out] NoProtocols The number of protocols returned in Buffer. |
| 1597 | @param[out] Buffer A pointer to the buffer to return the requested |
| 1598 | array of protocol instances that match Protocol. |
| 1599 | The returned buffer is allocated using |
| 1600 | EFI_BOOT_SERVICES.AllocatePool(). The caller is |
| 1601 | responsible for freeing this buffer with |
| 1602 | EFI_BOOT_SERVICES.FreePool(). |
| 1603 | |
| 1604 | @retval EFI_SUCCESS The array of protocols was returned in Buffer, |
| 1605 | and the number of protocols in Buffer was |
| 1606 | returned in NoProtocols. |
| 1607 | @retval EFI_NOT_FOUND No protocols found. |
| 1608 | @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the |
| 1609 | matching results. |
| 1610 | @retval EFI_INVALID_PARAMETER Protocol is NULL. |
| 1611 | @retval EFI_INVALID_PARAMETER NoProtocols is NULL. |
| 1612 | @retval EFI_INVALID_PARAMETER Buffer is NULL. |
| 1613 | |
| 1614 | **/ |
| 1615 | EFI_STATUS |
| 1616 | EFIAPI |
| 1617 | EfiLocateProtocolBuffer ( |
| 1618 | IN EFI_GUID *Protocol, |
| 1619 | OUT UINTN *NoProtocols, |
| 1620 | OUT VOID ***Buffer |
| 1621 | ); |
| 1622 | |
| 1623 | /** |
| 1624 | Open or create a file or directory, possibly creating the chain of |
| 1625 | directories leading up to the directory. |
| 1626 | |
| 1627 | EfiOpenFileByDevicePath() first locates EFI_SIMPLE_FILE_SYSTEM_PROTOCOL on |
| 1628 | FilePath, and opens the root directory of that filesystem with |
| 1629 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume(). |
| 1630 | |
| 1631 | On the remaining device path, the longest initial sequence of |
| 1632 | FILEPATH_DEVICE_PATH nodes is node-wise traversed with |
| 1633 | EFI_FILE_PROTOCOL.Open(). |
| 1634 | |
| 1635 | (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes |
| 1636 | includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single |
| 1637 | pathname component, then EfiOpenFileByDevicePath() ensures that the specified |
| 1638 | series of subdirectories exist on return.) |
| 1639 | |
| 1640 | The EFI_FILE_PROTOCOL identified by the last FILEPATH_DEVICE_PATH node is |
| 1641 | output to the caller; intermediate EFI_FILE_PROTOCOL instances are closed. If |
| 1642 | there are no FILEPATH_DEVICE_PATH nodes past the node that identifies the |
| 1643 | filesystem, then the EFI_FILE_PROTOCOL of the root directory of the |
| 1644 | filesystem is output to the caller. If a device path node that is different |
| 1645 | from FILEPATH_DEVICE_PATH is encountered relative to the filesystem, the |
| 1646 | traversal is stopped with an error, and a NULL EFI_FILE_PROTOCOL is output. |
| 1647 | |
| 1648 | @param[in,out] FilePath On input, the device path to the file or directory |
| 1649 | to open or create. The caller is responsible for |
| 1650 | ensuring that the device path pointed-to by FilePath |
| 1651 | is well-formed. On output, FilePath points one past |
| 1652 | the last node in the original device path that has |
| 1653 | been successfully processed. FilePath is set on |
| 1654 | output even if EfiOpenFileByDevicePath() returns an |
| 1655 | error. |
| 1656 | |
| 1657 | @param[out] File On error, File is set to NULL. On success, File is |
| 1658 | set to the EFI_FILE_PROTOCOL of the root directory |
| 1659 | of the filesystem, if there are no |
| 1660 | FILEPATH_DEVICE_PATH nodes in FilePath; otherwise, |
| 1661 | File is set to the EFI_FILE_PROTOCOL identified by |
| 1662 | the last node in FilePath. |
| 1663 | |
| 1664 | @param[in] OpenMode The OpenMode parameter to pass to |
| 1665 | EFI_FILE_PROTOCOL.Open(). |
| 1666 | |
| 1667 | @param[in] Attributes The Attributes parameter to pass to |
| 1668 | EFI_FILE_PROTOCOL.Open(). |
| 1669 | |
| 1670 | @retval EFI_SUCCESS The file or directory has been opened or |
| 1671 | created. |
| 1672 | |
| 1673 | @retval EFI_INVALID_PARAMETER FilePath is NULL; or File is NULL; or FilePath |
| 1674 | contains a device path node, past the node |
| 1675 | that identifies |
| 1676 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, that is not a |
| 1677 | FILEPATH_DEVICE_PATH node. |
| 1678 | |
| 1679 | @retval EFI_OUT_OF_RESOURCES Memory allocation failed. |
| 1680 | |
| 1681 | @return Error codes propagated from the |
| 1682 | LocateDevicePath() and OpenProtocol() boot |
| 1683 | services, and from the |
| 1684 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.OpenVolume() |
| 1685 | and EFI_FILE_PROTOCOL.Open() member functions. |
| 1686 | **/ |
| 1687 | EFI_STATUS |
| 1688 | EFIAPI |
| 1689 | EfiOpenFileByDevicePath ( |
| 1690 | IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, |
| 1691 | OUT EFI_FILE_PROTOCOL **File, |
| 1692 | IN UINT64 OpenMode, |
| 1693 | IN UINT64 Attributes |
| 1694 | ); |
| 1695 | |
| 1696 | /** |
| 1697 | This function locates next ACPI table in XSDT/RSDT based on Signature and |
| 1698 | previous returned Table. |
| 1699 | |
| 1700 | If PreviousTable is NULL: |
| 1701 | This function will locate the first ACPI table in XSDT/RSDT based on |
| 1702 | Signature in gEfiAcpi20TableGuid system configuration table first, and then |
| 1703 | gEfiAcpi10TableGuid system configuration table. |
| 1704 | This function will locate in XSDT first, and then RSDT. |
| 1705 | For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in |
| 1706 | FADT. |
| 1707 | For FACS, this function will locate XFirmwareCtrl in FADT first, and then |
| 1708 | FirmwareCtrl in FADT. |
| 1709 | |
| 1710 | If PreviousTable is not NULL: |
| 1711 | 1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration |
| 1712 | table, then this function will just locate next table in XSDT in |
| 1713 | gEfiAcpi20TableGuid system configuration table. |
| 1714 | 2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration |
| 1715 | table, then this function will just locate next table in RSDT in |
| 1716 | gEfiAcpi20TableGuid system configuration table. |
| 1717 | 3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration |
| 1718 | table, then this function will just locate next table in RSDT in |
| 1719 | gEfiAcpi10TableGuid system configuration table. |
| 1720 | |
| 1721 | It's not supported that PreviousTable is not NULL but PreviousTable->Signature |
| 1722 | is not same with Signature, NULL will be returned. |
| 1723 | |
| 1724 | @param Signature ACPI table signature. |
| 1725 | @param PreviousTable Pointer to previous returned table to locate next |
| 1726 | table, or NULL to locate first table. |
| 1727 | |
| 1728 | @return Next ACPI table or NULL if not found. |
| 1729 | |
| 1730 | **/ |
| 1731 | EFI_ACPI_COMMON_HEADER * |
| 1732 | EFIAPI |
| 1733 | EfiLocateNextAcpiTable ( |
| 1734 | IN UINT32 Signature, |
| 1735 | IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL |
| 1736 | ); |
| 1737 | |
| 1738 | /** |
| 1739 | This function locates first ACPI table in XSDT/RSDT based on Signature. |
| 1740 | |
| 1741 | This function will locate the first ACPI table in XSDT/RSDT based on |
| 1742 | Signature in gEfiAcpi20TableGuid system configuration table first, and then |
| 1743 | gEfiAcpi10TableGuid system configuration table. |
| 1744 | This function will locate in XSDT first, and then RSDT. |
| 1745 | For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in |
| 1746 | FADT. |
| 1747 | For FACS, this function will locate XFirmwareCtrl in FADT first, and then |
| 1748 | FirmwareCtrl in FADT. |
| 1749 | |
| 1750 | @param Signature ACPI table signature. |
| 1751 | |
| 1752 | @return First ACPI table or NULL if not found. |
| 1753 | |
| 1754 | **/ |
| 1755 | EFI_ACPI_COMMON_HEADER * |
| 1756 | EFIAPI |
| 1757 | EfiLocateFirstAcpiTable ( |
| 1758 | IN UINT32 Signature |
| 1759 | ); |
| 1760 | |
| 1761 | #endif |