PageRenderTime 58ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiDriverLib.h

https://bitbucket.org/incubaid/edk2
C Header | 1284 lines | 344 code | 56 blank | 884 comment | 1 complexity | 804e1a2465a3fd8291d2ac917884efb0 MD5 | raw file
  1. /*++
  2. Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
  3. This program and the accompanying materials
  4. are licensed and made available under the terms and conditions of the BSD License
  5. which accompanies this distribution. The full text of the license may be found at
  6. http://opensource.org/licenses/bsd-license.php
  7. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  9. Module Name:
  10. EfiDriverLib.h
  11. Abstract:
  12. Light weight lib to support EFI drivers.
  13. --*/
  14. #ifndef _EFI_DRIVER_LIB_H_
  15. #define _EFI_DRIVER_LIB_H_
  16. #include "EfiStatusCode.h"
  17. #include "EfiCommonLib.h"
  18. #include "EfiPerf.h"
  19. #include "LinkedList.h"
  20. #include "GetImage.h"
  21. #include "EfiImageFormat.h"
  22. #include "EfiCompNameSupport.h"
  23. #include EFI_GUID_DEFINITION (DxeServices)
  24. #include EFI_GUID_DEFINITION (EventGroup)
  25. #include EFI_GUID_DEFINITION (EventLegacyBios)
  26. #include EFI_GUID_DEFINITION (FrameworkDevicePath)
  27. #include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
  28. #include EFI_PROTOCOL_DEFINITION (FirmwareVolume2)
  29. #include EFI_PROTOCOL_DEFINITION (DataHub)
  30. #include EFI_PROTOCOL_DEFINITION (DriverBinding)
  31. #include EFI_PROTOCOL_DEFINITION (ComponentName)
  32. #include EFI_PROTOCOL_DEFINITION (ComponentName2)
  33. #include EFI_PROTOCOL_DEFINITION (DriverConfiguration)
  34. #include EFI_PROTOCOL_DEFINITION (DriverConfiguration2)
  35. #include EFI_PROTOCOL_DEFINITION (DriverDiagnostics)
  36. #include EFI_PROTOCOL_DEFINITION (DriverDiagnostics2)
  37. #include EFI_PROTOCOL_DEFINITION (DebugMask)
  38. #if defined(__GNUC__) && defined(ECP_CPU_IPF)
  39. VOID
  40. EFIAPI
  41. EcpEfiBreakPoint (
  42. VOID
  43. )
  44. /*++
  45. Routine Description:
  46. Generates a breakpoint on the CPU.
  47. Generates a breakpoint on the CPU. The breakpoint must be implemented such
  48. that code can resume normal execution after the breakpoint.
  49. Arguments:
  50. VOID
  51. Returns:
  52. VOID
  53. --*/
  54. ;
  55. VOID
  56. EFIAPI
  57. EcpMemoryFence (
  58. VOID
  59. )
  60. /*++
  61. Routine Description:
  62. Used to serialize load and store operations.
  63. All loads and stores that proceed calls to this function are guaranteed to be
  64. globally visible when this function returns.
  65. Arguments:
  66. VOID
  67. Returns:
  68. VOID
  69. --*/
  70. ;
  71. #endif
  72. typedef struct {
  73. CHAR8 *Language;
  74. CHAR16 *UnicodeString;
  75. } EFI_UNICODE_STRING_TABLE;
  76. #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
  77. #define LANGUAGE_CODE_ENGLISH "en-US"
  78. #else
  79. #define LANGUAGE_CODE_ENGLISH "eng"
  80. #endif
  81. //
  82. // Macros for EFI Driver Library Functions that are really EFI Boot Services
  83. //
  84. #define EfiCopyMem(_Destination, _Source, _Length) gBS->CopyMem ((_Destination), (_Source), (_Length))
  85. #define EfiSetMem(_Destination, _Length, _Value) gBS->SetMem ((_Destination), (_Length), (_Value))
  86. #define EfiZeroMem(_Destination, _Length) gBS->SetMem ((_Destination), (_Length), 0)
  87. //
  88. // Driver Lib Globals.
  89. //
  90. extern EFI_BOOT_SERVICES *gBS;
  91. extern EFI_DXE_SERVICES *gDS;
  92. extern EFI_RUNTIME_SERVICES *gRT;
  93. extern EFI_SYSTEM_TABLE *gST;
  94. extern UINTN gErrorLevel;
  95. extern EFI_GUID gEfiCallerIdGuid;
  96. extern EFI_DEBUG_MASK_PROTOCOL *gDebugMaskInterface;
  97. EFI_STATUS
  98. EfiInitializeDriverLib (
  99. IN EFI_HANDLE ImageHandle,
  100. IN EFI_SYSTEM_TABLE *SystemTable
  101. )
  102. /*++
  103. Routine Description:
  104. Intialize Driver Lib if it has not yet been initialized.
  105. Arguments:
  106. ImageHandle - The firmware allocated handle for the EFI image.
  107. SystemTable - A pointer to the EFI System Table.
  108. Returns:
  109. EFI_STATUS always returns EFI_SUCCESS
  110. --*/
  111. ;
  112. EFI_STATUS
  113. DxeInitializeDriverLib (
  114. IN EFI_HANDLE ImageHandle,
  115. IN EFI_SYSTEM_TABLE *SystemTable
  116. )
  117. /*++
  118. Routine Description:
  119. Intialize Driver Lib if it has not yet been initialized.
  120. Arguments:
  121. ImageHandle - The firmware allocated handle for the EFI image.
  122. SystemTable - A pointer to the EFI System Table.
  123. Returns:
  124. EFI_STATUS always returns EFI_SUCCESS
  125. --*/
  126. ;
  127. EFI_STATUS
  128. EfiLibInstallDriverBinding (
  129. IN EFI_HANDLE ImageHandle,
  130. IN EFI_SYSTEM_TABLE *SystemTable,
  131. IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
  132. IN EFI_HANDLE DriverBindingHandle
  133. )
  134. /*++
  135. Routine Description:
  136. Intialize a driver by installing the Driver Binding Protocol onto the
  137. driver's DriverBindingHandle. This is typically the same as the driver's
  138. ImageHandle, but it can be different if the driver produces multiple
  139. DriverBinding Protocols. This function also initializes the EFI Driver
  140. Library that initializes the global variables gST, gBS, gRT.
  141. Arguments:
  142. ImageHandle - The image handle of the driver
  143. SystemTable - The EFI System Table that was passed to the driver's entry point
  144. DriverBinding - A Driver Binding Protocol instance that this driver is producing
  145. DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this
  146. parameter is NULL, then a new handle is created.
  147. Returns:
  148. EFI_SUCCESS is DriverBinding is installed onto DriverBindingHandle
  149. Otherwise, then return status from gBS->InstallProtocolInterface()
  150. --*/
  151. ;
  152. EFI_STATUS
  153. EfiLibInstallAllDriverProtocols (
  154. IN EFI_HANDLE ImageHandle,
  155. IN EFI_SYSTEM_TABLE *SystemTable,
  156. IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
  157. IN EFI_HANDLE DriverBindingHandle,
  158. IN EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
  159. IN EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
  160. IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
  161. )
  162. /*++
  163. Routine Description:
  164. Intialize a driver by installing the Driver Binding Protocol onto the
  165. driver's DriverBindingHandle. This is typically the same as the driver's
  166. ImageHandle, but it can be different if the driver produces multiple
  167. DriverBinding Protocols. This function also initializes the EFI Driver
  168. Library that initializes the global variables gST, gBS, gRT.
  169. Arguments:
  170. ImageHandle - The image handle of the driver
  171. SystemTable - The EFI System Table that was passed to the driver's entry point
  172. DriverBinding - A Driver Binding Protocol instance that this driver is producing
  173. DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this
  174. parameter is NULL, then a new handle is created.
  175. ComponentName - A Component Name Protocol instance that this driver is producing
  176. DriverConfiguration - A Driver Configuration Protocol instance that this driver is producing
  177. DriverDiagnostics - A Driver Diagnostics Protocol instance that this driver is producing
  178. Returns:
  179. EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle
  180. Otherwise, then return status from gBS->InstallProtocolInterface()
  181. --*/
  182. ;
  183. EFI_STATUS
  184. EfiLibInstallAllDriverProtocols2 (
  185. IN EFI_HANDLE ImageHandle,
  186. IN EFI_SYSTEM_TABLE *SystemTable,
  187. IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
  188. IN EFI_HANDLE DriverBindingHandle,
  189. IN EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
  190. IN EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
  191. IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
  192. )
  193. /*++
  194. Routine Description:
  195. Intialize a driver by installing the Driver Binding Protocol onto the
  196. driver's DriverBindingHandle. This is typically the same as the driver's
  197. ImageHandle, but it can be different if the driver produces multiple
  198. DriverBinding Protocols. This function also initializes the EFI Driver
  199. Library that initializes the global variables gST, gBS, gRT.
  200. Arguments:
  201. ImageHandle - The image handle of the driver
  202. SystemTable - The EFI System Table that was passed to the driver's entry point
  203. DriverBinding - A Driver Binding Protocol instance that this driver is producing
  204. DriverBindingHandle - The handle that DriverBinding is to be installe onto. If this
  205. parameter is NULL, then a new handle is created.
  206. ComponentName2 - A Component Name2 Protocol instance that this driver is producing
  207. DriverConfiguration2- A Driver Configuration2 Protocol instance that this driver is producing
  208. DriverDiagnostics2 - A Driver Diagnostics2 Protocol instance that this driver is producing
  209. Returns:
  210. EFI_SUCCESS if all the protocols were installed onto DriverBindingHandle
  211. Otherwise, then return status from gBS->InstallProtocolInterface()
  212. --*/
  213. ;
  214. EFI_STATUS
  215. EfiLibGetSystemConfigurationTable (
  216. IN EFI_GUID *TableGuid,
  217. OUT VOID **Table
  218. )
  219. /*++
  220. Routine Description:
  221. Return the EFI 1.0 System Tabl entry with TableGuid
  222. Arguments:
  223. TableGuid - Name of entry to return in the system table
  224. Table - Pointer in EFI system table associated with TableGuid
  225. Returns:
  226. EFI_SUCCESS - Table returned;
  227. EFI_NOT_FOUND - TableGuid not in EFI system table
  228. --*/
  229. ;
  230. BOOLEAN
  231. EfiLibCompareLanguage (
  232. CHAR8 *Language1,
  233. CHAR8 *Language2
  234. )
  235. /*++
  236. Routine Description:
  237. Compare two languages to say whether they are identical.
  238. Arguments:
  239. Language1 - first language
  240. Language2 - second language
  241. Returns:
  242. TRUE - identical
  243. FALSE - not identical
  244. --*/
  245. ;
  246. //
  247. // DevicePath.c
  248. //
  249. BOOLEAN
  250. EfiIsDevicePathMultiInstance (
  251. IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
  252. )
  253. /*++
  254. Routine Description:
  255. Return TRUE is this is a multi instance device path.
  256. Arguments:
  257. DevicePath - A pointer to a device path data structure.
  258. Returns:
  259. TRUE - If DevicePath is multi instance.
  260. FALSE - If DevicePath is not multi instance.
  261. --*/
  262. ;
  263. EFI_DEVICE_PATH_PROTOCOL *
  264. EfiDevicePathInstance (
  265. IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
  266. OUT UINTN *Size
  267. )
  268. /*++
  269. Routine Description:
  270. Function retrieves the next device path instance from a device path data structure.
  271. Arguments:
  272. DevicePath - A pointer to a device path data structure.
  273. Size - A pointer to the size of a device path instance in bytes.
  274. Returns:
  275. This function returns a pointer to the current device path instance.
  276. In addition, it returns the size in bytes of the current device path instance in Size,
  277. and a pointer to the next device path instance in DevicePath.
  278. If there are no more device path instances in DevicePath, then DevicePath will be set to NULL.
  279. --*/
  280. ;
  281. UINTN
  282. EfiDevicePathSize (
  283. IN EFI_DEVICE_PATH_PROTOCOL *DevPath
  284. )
  285. /*++
  286. Routine Description:
  287. Calculate the size of a whole device path.
  288. Arguments:
  289. DevPath - The pointer to the device path data.
  290. Returns:
  291. Size of device path data structure..
  292. --*/
  293. ;
  294. EFI_DEVICE_PATH_PROTOCOL *
  295. EfiAppendDevicePath (
  296. IN EFI_DEVICE_PATH_PROTOCOL *Src1,
  297. IN EFI_DEVICE_PATH_PROTOCOL *Src2
  298. )
  299. /*++
  300. Routine Description:
  301. Function is used to append a Src1 and Src2 together.
  302. Arguments:
  303. Src1 - A pointer to a device path data structure.
  304. Src2 - A pointer to a device path data structure.
  305. Returns:
  306. A pointer to the new device path is returned.
  307. NULL is returned if space for the new device path could not be allocated from pool.
  308. It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.
  309. --*/
  310. ;
  311. EFI_DEVICE_PATH_PROTOCOL *
  312. EfiDevicePathFromHandle (
  313. IN EFI_HANDLE Handle
  314. )
  315. /*++
  316. Routine Description:
  317. Locate device path protocol interface on a device handle.
  318. Arguments:
  319. Handle - The device handle
  320. Returns:
  321. Device path protocol interface located.
  322. --*/
  323. ;
  324. EFI_DEVICE_PATH_PROTOCOL *
  325. EfiDuplicateDevicePath (
  326. IN EFI_DEVICE_PATH_PROTOCOL *DevPath
  327. )
  328. /*++
  329. Routine Description:
  330. Duplicate a new device path data structure from the old one.
  331. Arguments:
  332. DevPath - A pointer to a device path data structure.
  333. Returns:
  334. A pointer to the new allocated device path data.
  335. Caller must free the memory used by DevicePath if it is no longer needed.
  336. --*/
  337. ;
  338. EFI_DEVICE_PATH_PROTOCOL *
  339. EfiAppendDevicePathNode (
  340. IN EFI_DEVICE_PATH_PROTOCOL *Src1,
  341. IN EFI_DEVICE_PATH_PROTOCOL *Src2
  342. )
  343. /*++
  344. Routine Description:
  345. Function is used to append a device path node to the end of another device path.
  346. Arguments:
  347. Src1 - A pointer to a device path data structure.
  348. Src2 - A pointer to a device path data structure.
  349. Returns:
  350. This function returns a pointer to the new device path.
  351. If there is not enough temporary pool memory available to complete this function,
  352. then NULL is returned.
  353. --*/
  354. ;
  355. EFI_DEVICE_PATH_PROTOCOL *
  356. EfiFileDevicePath (
  357. IN EFI_HANDLE Device OPTIONAL,
  358. IN CHAR16 *FileName
  359. )
  360. /*++
  361. Routine Description:
  362. Create a device path that appends a MEDIA_DEVICE_PATH with
  363. FileNameGuid to the device path of DeviceHandle.
  364. Arguments:
  365. Device - Optional Device Handle to use as Root of the Device Path
  366. FileName - FileName
  367. Returns:
  368. EFI_DEVICE_PATH_PROTOCOL that was allocated from dynamic memory
  369. or NULL pointer.
  370. --*/
  371. ;
  372. EFI_DEVICE_PATH_PROTOCOL *
  373. EfiAppendDevicePathInstance (
  374. IN EFI_DEVICE_PATH_PROTOCOL *Src,
  375. IN EFI_DEVICE_PATH_PROTOCOL *Instance
  376. )
  377. /*++
  378. Routine Description:
  379. Append a device path instance to another.
  380. Arguments:
  381. Src - The device path instance to be appended with.
  382. Instance - The device path instance appending the other.
  383. Returns:
  384. The contaction of these two.
  385. --*/
  386. ;
  387. //
  388. // Lock.c
  389. //
  390. typedef struct {
  391. EFI_TPL Tpl;
  392. EFI_TPL OwnerTpl;
  393. UINTN Lock;
  394. } EFI_LOCK;
  395. VOID
  396. EfiInitializeLock (
  397. IN OUT EFI_LOCK *Lock,
  398. IN EFI_TPL Priority
  399. )
  400. /*++
  401. Routine Description:
  402. Initialize a basic mutual exclusion lock. Each lock
  403. provides mutual exclusion access at it's task priority
  404. level. Since there is no-premption (at any TPL) or
  405. multiprocessor support, acquiring the lock only consists
  406. of raising to the locks TPL.
  407. Note on a check build ASSERT()s are used to ensure proper
  408. lock usage.
  409. Arguments:
  410. Lock - The EFI_LOCK structure to initialize
  411. Priority - The task priority level of the lock
  412. Returns:
  413. An initialized Efi Lock structure.
  414. --*/
  415. ;
  416. //
  417. // Macro to initialize the state of a lock when a lock variable is declared
  418. //
  419. #define EFI_INITIALIZE_LOCK_VARIABLE(Tpl) {Tpl,0,0}
  420. VOID
  421. EfiAcquireLock (
  422. IN EFI_LOCK *Lock
  423. )
  424. /*++
  425. Routine Description:
  426. Raising to the task priority level of the mutual exclusion
  427. lock, and then acquires ownership of the lock.
  428. Arguments:
  429. Lock - The lock to acquire
  430. Returns:
  431. None
  432. --*/
  433. ;
  434. EFI_STATUS
  435. EfiAcquireLockOrFail (
  436. IN EFI_LOCK *Lock
  437. )
  438. /*++
  439. Routine Description:
  440. Initialize a basic mutual exclusion lock. Each lock
  441. provides mutual exclusion access at it's task priority
  442. level. Since there is no-premption (at any TPL) or
  443. multiprocessor support, acquiring the lock only consists
  444. of raising to the locks TPL.
  445. Arguments:
  446. Lock - The EFI_LOCK structure to initialize
  447. Returns:
  448. EFI_SUCCESS - Lock Owned.
  449. EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.
  450. --*/
  451. ;
  452. VOID
  453. EfiReleaseLock (
  454. IN EFI_LOCK *Lock
  455. )
  456. /*++
  457. Routine Description:
  458. Releases ownership of the mutual exclusion lock, and
  459. restores the previous task priority level.
  460. Arguments:
  461. Lock - The lock to release
  462. Returns:
  463. None
  464. --*/
  465. ;
  466. VOID *
  467. EfiLibAllocatePool (
  468. IN UINTN AllocationSize
  469. )
  470. /*++
  471. Routine Description:
  472. Allocate EfiBootServicesData pool of size AllocationSize
  473. Arguments:
  474. AllocationSize - Pool size
  475. Returns:
  476. Pointer to the pool allocated
  477. --*/
  478. ;
  479. VOID *
  480. EfiLibAllocateRuntimePool (
  481. IN UINTN AllocationSize
  482. )
  483. /*++
  484. Routine Description:
  485. Allocate EfiRuntimeServicesData pool of size AllocationSize
  486. Arguments:
  487. AllocationSize - Pool size
  488. Returns:
  489. Pointer to the pool allocated
  490. --*/
  491. ;
  492. VOID *
  493. EfiLibAllocateZeroPool (
  494. IN UINTN AllocationSize
  495. )
  496. /*++
  497. Routine Description:
  498. Allocate EfiBootServicesData pool of size AllocationSize and set memory to zero.
  499. Arguments:
  500. AllocationSize - Pool size
  501. Returns:
  502. Pointer to the pool allocated
  503. --*/
  504. ;
  505. VOID *
  506. EfiLibAllocateRuntimeZeroPool (
  507. IN UINTN AllocationSize
  508. )
  509. /*++
  510. Routine Description:
  511. Allocate EfiRuntimeServicesData pool of size AllocationSize and set memory to zero.
  512. Arguments:
  513. AllocationSize - Pool size
  514. Returns:
  515. Pointer to the pool allocated
  516. --*/
  517. ;
  518. VOID *
  519. EfiLibAllocateCopyPool (
  520. IN UINTN AllocationSize,
  521. IN VOID *Buffer
  522. )
  523. /*++
  524. Routine Description:
  525. Allocate BootServicesData pool and use a buffer provided by
  526. caller to fill it.
  527. Arguments:
  528. AllocationSize - The size to allocate
  529. Buffer - Buffer that will be filled into the buffer allocated
  530. Returns:
  531. Pointer of the buffer allocated.
  532. --*/
  533. ;
  534. VOID *
  535. EfiLibAllocateRuntimeCopyPool (
  536. IN UINTN AllocationSize,
  537. IN VOID *Buffer
  538. )
  539. /*++
  540. Routine Description:
  541. Allocate RuntimeServicesData pool and use a buffer provided by
  542. caller to fill it.
  543. Arguments:
  544. AllocationSize - The size to allocate
  545. Buffer - Buffer that will be filled into the buffer allocated
  546. Returns:
  547. Pointer of the buffer allocated.
  548. --*/
  549. ;
  550. //
  551. // Event.c
  552. //
  553. EFI_EVENT
  554. EfiLibCreateProtocolNotifyEvent (
  555. IN EFI_GUID *ProtocolGuid,
  556. IN EFI_TPL NotifyTpl,
  557. IN EFI_EVENT_NOTIFY NotifyFunction,
  558. IN VOID *NotifyContext,
  559. OUT VOID **Registration
  560. )
  561. /*++
  562. Routine Description:
  563. Create a protocol notification event and return it.
  564. Arguments:
  565. ProtocolGuid - Protocol to register notification event on.
  566. NotifyTpl - Maximum TPL to single the NotifyFunction.
  567. NotifyFunction - EFI notification routine.
  568. NotifyContext - Context passed into Event when it is created.
  569. Registration - Registration key returned from RegisterProtocolNotify().
  570. Returns:
  571. The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
  572. is added to the system.
  573. --*/
  574. ;
  575. EFI_STATUS
  576. EfiLibNamedEventSignal (
  577. IN EFI_GUID *Name
  578. )
  579. /*++
  580. Routine Description:
  581. Signals a named event. All registered listeners will run.
  582. The listeners should register using EfiLibNamedEventListen() function.
  583. NOTE: For now, the named listening/signalling is implemented
  584. on a protocol interface being installed and uninstalled.
  585. In the future, this maybe implemented based on a dedicated mechanism.
  586. Arguments:
  587. Name - Name to perform the signaling on. The name is a GUID.
  588. Returns:
  589. EFI_SUCCESS if successfull.
  590. --*/
  591. ;
  592. EFI_STATUS
  593. EfiLibNamedEventListen (
  594. IN EFI_GUID * Name,
  595. IN EFI_TPL NotifyTpl,
  596. IN EFI_EVENT_NOTIFY NotifyFunction,
  597. IN VOID *NotifyContext
  598. )
  599. /*++
  600. Routine Description:
  601. Listenes to signals on the name.
  602. EfiLibNamedEventSignal() signals the event.
  603. NOTE: For now, the named listening/signalling is implemented
  604. on a protocol interface being installed and uninstalled.
  605. In the future, this maybe implemented based on a dedicated mechanism.
  606. Arguments:
  607. Name - Name to register the listener on.
  608. NotifyTpl - Maximum TPL to singnal the NotifyFunction.
  609. NotifyFunction - The listener routine.
  610. NotifyContext - Context passed into the listener routine.
  611. Returns:
  612. EFI_SUCCESS if successful.
  613. --*/
  614. ;
  615. //
  616. // Handle.c
  617. //
  618. EFI_STATUS
  619. EfiLibLocateHandleProtocolByProtocols (
  620. IN OUT EFI_HANDLE * Handle, OPTIONAL
  621. OUT VOID **Interface, OPTIONAL
  622. ...
  623. )
  624. /*++
  625. Routine Description:
  626. Function locates Protocol and/or Handle on which all Protocols specified
  627. as a variable list are installed.
  628. It supports continued search. The caller must assure that no handles are added
  629. or removed while performing continued search, by e.g., rising the TPL and not
  630. calling any handle routines. Otherwise the behavior is undefined.
  631. Arguments:
  632. Handle - The address of handle to receive the handle on which protocols
  633. indicated by the variable list are installed.
  634. If points to NULL, all handles are searched. If pointing to a
  635. handle returned from previous call, searches starting from next handle.
  636. If NULL, the parameter is ignored.
  637. Interface - The address of a pointer to a protocol interface that will receive
  638. the interface indicated by first variable argument.
  639. If NULL, the parameter is ignored.
  640. ... - A variable argument list containing protocol GUIDs. Must end with NULL.
  641. Returns:
  642. EFI_SUCCESS - All the protocols where found on same handle.
  643. EFI_NOT_FOUND - A Handle with all the protocols installed was not found.
  644. Other values as may be returned from LocateHandleBuffer() or HandleProtocol().
  645. --*/
  646. ;
  647. //
  648. // Debug.c init
  649. //
  650. EFI_STATUS
  651. EfiDebugAssertInit (
  652. VOID
  653. )
  654. /*++
  655. Routine Description:
  656. Locate Debug Assert Protocol and set as mDebugAssert
  657. Arguments:
  658. None
  659. Returns:
  660. Status code
  661. --*/
  662. ;
  663. //
  664. // Unicode String Support
  665. //
  666. EFI_STATUS
  667. EfiLibLookupUnicodeString (
  668. CHAR8 *Language,
  669. CHAR8 *SupportedLanguages,
  670. EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
  671. CHAR16 **UnicodeString
  672. )
  673. /*++
  674. Routine Description:
  675. Translate a unicode string to a specified language if supported.
  676. Arguments:
  677. Language - The name of language to translate to
  678. SupportedLanguages - Supported languages set
  679. UnicodeStringTable - Pointer of one item in translation dictionary
  680. UnicodeString - The translated string
  681. Returns:
  682. EFI_INVALID_PARAMETER - Invalid parameter
  683. EFI_UNSUPPORTED - System not supported this language or this string translation
  684. EFI_SUCCESS - String successfully translated
  685. --*/
  686. ;
  687. EFI_STATUS
  688. EfiLibAddUnicodeString (
  689. CHAR8 *Language,
  690. CHAR8 *SupportedLanguages,
  691. EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
  692. CHAR16 *UnicodeString
  693. )
  694. /*++
  695. Routine Description:
  696. Add an translation to the dictionary if this language if supported.
  697. Arguments:
  698. Language - The name of language to translate to
  699. SupportedLanguages - Supported languages set
  700. UnicodeStringTable - Translation dictionary
  701. UnicodeString - The corresponding string for the language to be translated to
  702. Returns:
  703. EFI_INVALID_PARAMETER - Invalid parameter
  704. EFI_UNSUPPORTED - System not supported this language
  705. EFI_ALREADY_STARTED - Already has a translation item of this language
  706. EFI_OUT_OF_RESOURCES - No enough buffer to be allocated
  707. EFI_SUCCESS - String successfully translated
  708. --*/
  709. ;
  710. EFI_STATUS
  711. EfiLibFreeUnicodeStringTable (
  712. EFI_UNICODE_STRING_TABLE *UnicodeStringTable
  713. )
  714. /*++
  715. Routine Description:
  716. Free a string table.
  717. Arguments:
  718. UnicodeStringTable - The string table to be freed.
  719. Returns:
  720. EFI_SUCCESS - The table successfully freed.
  721. --*/
  722. ;
  723. EFI_STATUS
  724. EfiLibReportStatusCode (
  725. IN EFI_STATUS_CODE_TYPE Type,
  726. IN EFI_STATUS_CODE_VALUE Value,
  727. IN UINT32 Instance,
  728. IN EFI_GUID *CallerId OPTIONAL,
  729. IN EFI_STATUS_CODE_DATA *Data OPTIONAL
  730. )
  731. /*++
  732. Routine Description:
  733. Report status code.
  734. Arguments:
  735. Type - Code type
  736. Value - Code value
  737. Instance - Instance number
  738. CallerId - Caller name
  739. DevicePath - Device path that to be reported
  740. Returns:
  741. Status code.
  742. EFI_OUT_OF_RESOURCES - No enough buffer could be allocated
  743. --*/
  744. ;
  745. EFI_STATUS
  746. ReportStatusCodeWithDevicePath (
  747. IN EFI_STATUS_CODE_TYPE Type,
  748. IN EFI_STATUS_CODE_VALUE Value,
  749. IN UINT32 Instance,
  750. IN EFI_GUID * CallerId OPTIONAL,
  751. IN EFI_DEVICE_PATH_PROTOCOL * DevicePath
  752. )
  753. /*++
  754. Routine Description:
  755. Report device path through status code.
  756. Arguments:
  757. Type - Code type
  758. Value - Code value
  759. Instance - Instance number
  760. CallerId - Caller name
  761. DevicePath - Device path that to be reported
  762. Returns:
  763. Status code.
  764. EFI_OUT_OF_RESOURCES - No enough buffer could be allocated
  765. --*/
  766. ;
  767. EFI_STATUS
  768. EFIAPI
  769. EfiCreateEventLegacyBoot (
  770. IN EFI_TPL NotifyTpl,
  771. IN EFI_EVENT_NOTIFY NotifyFunction,
  772. IN VOID *NotifyContext,
  773. OUT EFI_EVENT *LegacyBootEvent
  774. )
  775. /*++
  776. Routine Description:
  777. Create a Legacy Boot Event.
  778. Tiano extended the CreateEvent Type enum to add a legacy boot event type.
  779. This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
  780. added and now it's possible to not voilate the UEFI specification by
  781. declaring a GUID for the legacy boot event class. This library supports
  782. the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to
  783. work both ways.
  784. Arguments:
  785. LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)
  786. Returns:
  787. EFI_SUCCESS Event was created.
  788. Other Event was not created.
  789. --*/
  790. ;
  791. EFI_STATUS
  792. EFIAPI
  793. EfiCreateEventReadyToBoot (
  794. IN EFI_TPL NotifyTpl,
  795. IN EFI_EVENT_NOTIFY NotifyFunction,
  796. IN VOID *NotifyContext,
  797. OUT EFI_EVENT *ReadyToBootEvent
  798. )
  799. /*++
  800. Routine Description:
  801. Create a Read to Boot Event.
  802. Tiano extended the CreateEvent Type enum to add a ready to boot event type.
  803. This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
  804. added and now it's possible to not voilate the UEFI specification and use
  805. the ready to boot event class defined in UEFI 2.0. This library supports
  806. the R8.5/EFI 1.10 form and R8.6/UEFI 2.0 form and allows common code to
  807. work both ways.
  808. Arguments:
  809. @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex)
  810. Return:
  811. EFI_SUCCESS - Event was created.
  812. Other - Event was not created.
  813. --*/
  814. ;
  815. VOID
  816. EFIAPI
  817. EfiInitializeFwVolDevicepathNode (
  818. IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
  819. IN EFI_GUID *NameGuid
  820. )
  821. /*++
  822. Routine Description:
  823. Initialize a Firmware Volume (FV) Media Device Path node.
  824. Arguments:
  825. FvDevicePathNode - Pointer to a FV device path node to initialize
  826. NameGuid - FV file name to use in FvDevicePathNode
  827. --*/
  828. ;
  829. EFI_GUID *
  830. EFIAPI
  831. EfiGetNameGuidFromFwVolDevicePathNode (
  832. IN MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
  833. )
  834. /*++
  835. Routine Description:
  836. Check to see if the Firmware Volume (FV) Media Device Path is valid.
  837. Arguments:
  838. FvDevicePathNode - Pointer to FV device path to check
  839. Return:
  840. NULL - FvDevicePathNode is not valid.
  841. Other - FvDevicePathNode is valid and pointer to NameGuid was returned.
  842. --*/
  843. ;
  844. VOID
  845. EfiLibSafeFreePool (
  846. IN VOID *Buffer
  847. )
  848. /*++
  849. Routine Description:
  850. Free pool safely.
  851. Arguments:
  852. Buffer - The allocated pool entry to free
  853. Returns:
  854. Pointer of the buffer allocated.
  855. --*/
  856. ;
  857. EFI_STATUS
  858. EfiLibTestManagedDevice (
  859. IN EFI_HANDLE ControllerHandle,
  860. IN EFI_HANDLE DriverBindingHandle,
  861. IN EFI_GUID *ManagedProtocolGuid
  862. )
  863. /*++
  864. Routine Description:
  865. Test to see if the controller is managed by a specific driver.
  866. Arguments:
  867. ControllerHandle - Handle for controller to test
  868. DriverBindingHandle - Driver binding handle for controller
  869. ManagedProtocolGuid - The protocol guid the driver opens on controller
  870. Returns:
  871. EFI_SUCCESS - The controller is managed by the driver
  872. EFI_UNSUPPORTED - The controller is not managed by the driver
  873. --*/
  874. ;
  875. EFI_STATUS
  876. EfiLibTestChildHandle (
  877. IN EFI_HANDLE ControllerHandle,
  878. IN EFI_HANDLE ChildHandle,
  879. IN EFI_GUID *ConsumedGuid
  880. )
  881. /*++
  882. Routine Description:
  883. Test to see if the child handle is the child of the controller
  884. Arguments:
  885. ControllerHandle - Handle for controller (parent)
  886. ChildHandle - Child handle to test
  887. ConsumsedGuid - Protocol guid consumed by child from controller
  888. Returns:
  889. EFI_SUCCESS - The child handle is the child of the controller
  890. EFI_UNSUPPORTED - The child handle is not the child of the controller
  891. --*/
  892. ;
  893. #endif