handle.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. handle.h
  5. Abstract:
  6. This header contains definitions for UEFI core handles.
  7. Author:
  8. Evan Green 5-Mar-2014
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // ---------------------------------------------------------------- Definitions
  15. //
  16. //
  17. // Define magic constants in the various handle structures.
  18. //
  19. #define EFI_HANDLE_MAGIC 0x646E6148 // 'dnaH'
  20. #define EFI_PROTOCOL_ENTRY_MAGIC 0x746F7250 // 'torP'
  21. #define EFI_PROTOCOL_INTERFACE_MAGIC 0x72746E49 // 'rtnI'
  22. #define EFI_OPEN_PROTOCOL_MAGIC 0x6E65704F // 'nepO'
  23. #define EFI_PROTOCOL_NOTIFY_MAGIC 0x69746F4E // 'itoN'
  24. //
  25. // ------------------------------------------------------ Data Type Definitions
  26. //
  27. /*++
  28. Structure Description:
  29. This structure stores the internal structure of an EFI handle.
  30. Members:
  31. Magic - Stores the constant EFI_HANDLE_MAGIC.
  32. ListEntry - Stores pointers to the next and previous system handles in the
  33. global list of all handles.
  34. ProtocolList - Stores the head of the list of protocols supported on this
  35. handle.
  36. LocateRequest - Stores the locate request.
  37. Key - Stores the handle database key when this handle was last created or
  38. modified.
  39. --*/
  40. typedef struct _EFI_HANDLE_DATA {
  41. UINTN Magic;
  42. LIST_ENTRY ListEntry;
  43. LIST_ENTRY ProtocolList;
  44. UINTN LocateRequest;
  45. UINT64 Key;
  46. } EFI_HANDLE_DATA, *PEFI_HANDLE_DATA;
  47. /*++
  48. Structure Description:
  49. This structure stores information about an EFI protocol. It represents a
  50. protocol with a specific GUID. Each handler that supports this protocol is
  51. listed, along with a list of registered notifies.
  52. Members:
  53. Magic - Stores the constant EFI_PROTOCOL_ENTRY_MAGIC.
  54. ListEntry - Stores pointers to the next and previous protocols in the
  55. global protocol database.
  56. ProtocolList - Stores the head of the list of protocol interfaces for this
  57. protocol ID.
  58. NotifyList - Stores the list of registered notification handlers.
  59. ProtocolId - Stores the GUID of the protocol.
  60. --*/
  61. typedef struct _EFI_PROTOCOL_ENTRY {
  62. UINTN Magic;
  63. LIST_ENTRY ListEntry;
  64. LIST_ENTRY ProtocolList;
  65. LIST_ENTRY NotifyList;
  66. EFI_GUID ProtocolId;
  67. } EFI_PROTOCOL_ENTRY, *PEFI_PROTOCOL_ENTRY;
  68. /*++
  69. Structure Description:
  70. This structure stores information about a protocol interface, which tracks
  71. a protocol installed on a handle.
  72. Members:
  73. Magic - Stores the constant EFI_PROTOCOL_INTERFACE_MAGIC.
  74. ListEntry - Stores pointers to the next and previous protocol interfaces
  75. on the handle's protocol list.
  76. Handle - Stores a pointer back to the handle this interface is bound to.
  77. ProtocolListEntry - Stores pointers to the next and previous protocol
  78. interfaces with the same protocol GUID.
  79. Protocol - Stores a pointer to the protocol this interface belongs to.
  80. Interface - Stores the interface value.
  81. OpenList - Stores the list of open protocol data structures.
  82. OpenCount - Stores the number of open protocol entry structures on the
  83. open list.
  84. --*/
  85. typedef struct _EFI_PROTOCOL_INTERFACE {
  86. UINTN Magic;
  87. LIST_ENTRY ListEntry;
  88. PEFI_HANDLE_DATA Handle;
  89. LIST_ENTRY ProtocolListEntry;
  90. PEFI_PROTOCOL_ENTRY Protocol;
  91. VOID *Interface;
  92. LIST_ENTRY OpenList;
  93. UINTN OpenCount;
  94. } EFI_PROTOCOL_INTERFACE, *PEFI_PROTOCOL_INTERFACE;
  95. /*++
  96. Structure Description:
  97. This structure stores information about an open protocol interface.
  98. Members:
  99. Magic - Stores the constant EFI_OPEN_PROTOCOL_MAGIC.
  100. ListEntry - Stores pointers to the next and previous open protocol data
  101. structures in the protocol interface's open list.
  102. AgentHandle - Stores the agent opening the protocol interface.
  103. ControllerHandle - Stores the optional controller associated with the open.
  104. Attributes - Stores attributes about the open.
  105. OpenCount - Stores the number of times the protocol interface has been
  106. opened with these parameters.
  107. --*/
  108. typedef struct _EFI_OPEN_PROTOCOL_DATA {
  109. UINTN Magic;
  110. LIST_ENTRY ListEntry;
  111. EFI_HANDLE AgentHandle;
  112. EFI_HANDLE ControllerHandle;
  113. UINT32 Attributes;
  114. UINT32 OpenCount;
  115. } EFI_OPEN_PROTOCOL_DATA, *PEFI_OPEN_PROTOCOL_DATA;
  116. /*++
  117. Structure Description:
  118. This structure stores information about a protocol notification
  119. registration.
  120. Members:
  121. Magic - Stores the constant EFI_PROTOCOL_NOTIFY_MAGIC.
  122. ListEntry - Stores pointers to the next and previous notification
  123. registrations in the protocol entry.
  124. Protocol - Stores a pointer back to the protocol this registration is
  125. bound to.
  126. Event - Stores a pointer to the event to notify.
  127. Position - Stores the last position notified.
  128. --*/
  129. typedef struct _EFI_PROTOCOL_NOTIFY {
  130. UINTN Magic;
  131. LIST_ENTRY ListEntry;
  132. PEFI_PROTOCOL_ENTRY Protocol;
  133. EFI_EVENT Event;
  134. PLIST_ENTRY Position;
  135. } EFI_PROTOCOL_NOTIFY, *PEFI_PROTOCOL_NOTIFY;
  136. //
  137. // -------------------------------------------------------------------- Globals
  138. //
  139. extern EFI_LOCK EfiProtocolDatabaseLock;
  140. extern LIST_ENTRY EfiHandleList;
  141. extern LIST_ENTRY EfiProtocolDatabase;
  142. extern UINTN EfiHandleDatabaseKey;
  143. //
  144. // -------------------------------------------------------- Function Prototypes
  145. //
  146. EFIAPI
  147. EFI_STATUS
  148. EfiCoreProtocolsPerHandle (
  149. EFI_HANDLE Handle,
  150. EFI_GUID ***ProtocolBuffer,
  151. UINTN *ProtocolBufferCount
  152. );
  153. /*++
  154. Routine Description:
  155. This routine retrieves the list of protocol interface GUIDs that are
  156. installed on a handle in a buffer allocated from pool.
  157. Arguments:
  158. Handle - Supplies the handle from which to retrieve the list of protocol
  159. interface GUIDs.
  160. ProtocolBuffer - Supplies a pointer to the list of protocol interface GUID
  161. pointers that are installed on the given handle.
  162. ProtocolBufferCount - Supplies a pointer to the number of GUID pointers
  163. present in the protocol buffer.
  164. Return Value:
  165. EFI_SUCCESS if the interface information was returned.
  166. EFI_OUT_OF_RESOURCES if an allocation failed.
  167. EFI_INVALID_PARAMETER if the handle is NULL or invalid, or the protocol
  168. buffer or count is NULL.
  169. --*/
  170. EFIAPI
  171. EFI_STATUS
  172. EfiCoreOpenProtocolInformation (
  173. EFI_HANDLE Handle,
  174. EFI_GUID *Protocol,
  175. EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
  176. UINTN *EntryCount
  177. );
  178. /*++
  179. Routine Description:
  180. This routine retrieves a list of agents that currently have a protocol
  181. interface opened.
  182. Arguments:
  183. Handle - Supplies the handle for the protocol interface being queried.
  184. Protocol - Supplies the published unique identifier of the protocol.
  185. EntryBuffer - Supplies a pointer where a pointer to a buffer of open
  186. protocol information in the form of EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
  187. structures will be returned.
  188. EntryCount - Supplies a pointer that receives the number of entries in the
  189. buffer.
  190. Return Value:
  191. EFI_SUCCESS if the interface information was returned.
  192. EFI_OUT_OF_RESOURCES if an allocation failed.
  193. EFI_NOT_FOUND if the handle does not support the given protocol.
  194. --*/
  195. EFIAPI
  196. EFI_STATUS
  197. EfiCoreOpenProtocol (
  198. EFI_HANDLE Handle,
  199. EFI_GUID *Protocol,
  200. VOID **Interface,
  201. EFI_HANDLE AgentHandle,
  202. EFI_HANDLE ControllerHandle,
  203. UINT32 Attributes
  204. );
  205. /*++
  206. Routine Description:
  207. This routine queries a handle to determine if it supports a specified
  208. protocol. If the protocol is supported by the handle, it opens the protocol
  209. on behalf of the calling agent.
  210. Arguments:
  211. Handle - Supplies the handle for the protocol interface that is being
  212. opened.
  213. Protocol - Supplies the published unique identifier of the protocol.
  214. Interface - Supplies the address where a pointer to the corresponding
  215. protocol interface is returned.
  216. AgentHandle - Supplies the handle of the agent that is opening the protocol
  217. interface specified by the protocol and interface.
  218. ControllerHandle - Supplies the controller handle that requires the
  219. protocl interface if the caller is a driver that follows the UEFI
  220. driver model. If the caller does not follow the UEFI Driver Model, then
  221. this parameter is optional.
  222. Attributes - Supplies the open mode of the protocol interface specified by
  223. the given handle and protocol.
  224. Return Value:
  225. EFI_SUCCESS if the interface information was returned.
  226. EFI_UNSUPPORTED if the handle not support the specified protocol.
  227. EFI_INVALID_PARAMETER if a parameter is invalid.
  228. EFI_ACCESS_DENIED if the required attributes can't be supported in the
  229. current environment.
  230. EFI_ALREADY_STARTED if the item on the open list already has required
  231. attributes whose agent handle is the same as the given one.
  232. --*/
  233. EFIAPI
  234. EFI_STATUS
  235. EfiCoreCloseProtocol (
  236. EFI_HANDLE Handle,
  237. EFI_GUID *Protocol,
  238. EFI_HANDLE AgentHandle,
  239. EFI_HANDLE ControllerHandle
  240. );
  241. /*++
  242. Routine Description:
  243. This routine closes a protocol on a handle that was previously opened.
  244. Arguments:
  245. Handle - Supplies the handle for the protocol interface was previously
  246. opened.
  247. Protocol - Supplies the published unique identifier of the protocol.
  248. AgentHandle - Supplies the handle of the agent that is closing the
  249. protocol interface.
  250. ControllerHandle - Supplies the controller handle that required the
  251. protocl interface if the caller is a driver that follows the UEFI
  252. driver model. If the caller does not follow the UEFI Driver Model, then
  253. this parameter is optional.
  254. Return Value:
  255. EFI_SUCCESS if the interface information was returned.
  256. EFI_INVALID_PARAMETER if the handle, agent, or protocol is NULL, or if the
  257. controller handle is not NULL and the controller handle is not valid.
  258. EFI_NOT_FOUND if the handle does not support the given protocol, or the
  259. protocol interface is not currently open by the agent and controller
  260. handles.
  261. --*/
  262. EFIAPI
  263. EFI_STATUS
  264. EfiCoreHandleProtocol (
  265. EFI_HANDLE Handle,
  266. EFI_GUID *Protocol,
  267. VOID **Interface
  268. );
  269. /*++
  270. Routine Description:
  271. This routine queries a handle to determine if it supports a specified
  272. protocol.
  273. Arguments:
  274. Handle - Supplies the handle being queried.
  275. Protocol - Supplies the published unique identifier of the protocol.
  276. Interface - Supplies the address where a pointer to the corresponding
  277. protocol interface is returned.
  278. Return Value:
  279. EFI_SUCCESS if the interface information was returned.
  280. EFI_UNSUPPORTED if the device not support the specified protocol.
  281. EFI_INVALID_PARAMETER if the handle, protocol, or interface is NULL.
  282. --*/
  283. EFIAPI
  284. EFI_STATUS
  285. EfiCoreInstallProtocolInterface (
  286. EFI_HANDLE *Handle,
  287. EFI_GUID *Protocol,
  288. EFI_INTERFACE_TYPE InterfaceType,
  289. VOID *Interface
  290. );
  291. /*++
  292. Routine Description:
  293. This routine installs a protocol interface on a device handle. If the
  294. handle does not exist, it is created and added to the list of handles in
  295. the system. InstallMultipleProtocolInterfaces performs more error checking
  296. than this routine, so it is recommended to be used in place of this
  297. routine.
  298. Arguments:
  299. Handle - Supplies a pointer to the EFI handle on which the interface is to
  300. be installed.
  301. Protocol - Supplies a pointer to the numeric ID of the protocol interface.
  302. InterfaceType - Supplies the interface type.
  303. Interface - Supplies a pointer to the protocol interface.
  304. Return Value:
  305. EFI_SUCCESS on success.
  306. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  307. EFI_INVALID_PARAMETER if the handle or protocol is NULL, the interface type
  308. is not native, or the protocol is already install on the given handle.
  309. --*/
  310. EFIAPI
  311. EFI_STATUS
  312. EfiCoreInstallMultipleProtocolInterfaces (
  313. EFI_HANDLE *Handle,
  314. ...
  315. );
  316. /*++
  317. Routine Description:
  318. This routine installs one or more protocol interface into the boot
  319. services environment.
  320. Arguments:
  321. Handle - Supplies a pointer to the EFI handle on which the interface is to
  322. be installed, or a pointer to NULL if a new handle is to be allocated.
  323. ... - Supplies a variable argument list containing pairs of protocol GUIDs
  324. and protocol interfaces.
  325. Return Value:
  326. EFI_SUCCESS on success.
  327. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  328. EFI_ALREADY_STARTED if a device path protocol instance was passed in that
  329. is already present in the handle database.
  330. EFI_INVALID_PARAMETER if the handle is NULL or the protocol is already
  331. installed on the given handle.
  332. --*/
  333. EFIAPI
  334. EFI_STATUS
  335. EfiCoreReinstallProtocolInterface (
  336. EFI_HANDLE Handle,
  337. EFI_GUID *Protocol,
  338. VOID *OldInterface,
  339. VOID *NewInterface
  340. );
  341. /*++
  342. Routine Description:
  343. This routine reinstalls a protocol interface on a device handle.
  344. Arguments:
  345. Handle - Supplies the device handle on which the interface is to be
  346. reinstalled.
  347. Protocol - Supplies a pointer to the numeric ID of the interface.
  348. OldInterface - Supplies a pointer to the old interface. NULL can be used if
  349. a structure is not associated with the protocol.
  350. NewInterface - Supplies a pointer to the new interface.
  351. Return Value:
  352. EFI_SUCCESS on success.
  353. EFI_NOT_FOUND if the old interface was not found.
  354. EFI_ACCESS_DENIED if the protocl interface could not be reinstalled because
  355. the old interface is still being used by a driver that will not release it.
  356. EFI_INVALID_PARAMETER if the handle or protocol is NULL.
  357. --*/
  358. EFI_STATUS
  359. EfiCoreUninstallProtocolInterface (
  360. EFI_HANDLE Handle,
  361. EFI_GUID *Protocol,
  362. VOID *Interface
  363. );
  364. /*++
  365. Routine Description:
  366. This routine removes a protocol interface from a device handle. It is
  367. recommended that UninstallMultipleProtocolInterfaces be used in place of
  368. this routine.
  369. Arguments:
  370. Handle - Supplies the device handle on which the interface is to be
  371. removed.
  372. Protocol - Supplies a pointer to the numeric ID of the interface.
  373. Interface - Supplies a pointer to the interface.
  374. Return Value:
  375. EFI_SUCCESS on success.
  376. EFI_NOT_FOUND if the old interface was not found.
  377. EFI_ACCESS_DENIED if the protocl interface could not be reinstalled because
  378. the old interface is still being used by a driver that will not release it.
  379. EFI_INVALID_PARAMETER if the handle or protocol is NULL.
  380. --*/
  381. EFIAPI
  382. EFI_STATUS
  383. EfiCoreUninstallMultipleProtocolInterfaces (
  384. EFI_HANDLE Handle,
  385. ...
  386. );
  387. /*++
  388. Routine Description:
  389. This routine removes one or more protocol interfaces into the boot services
  390. environment.
  391. Arguments:
  392. Handle - Supplies the device handle on which the interface is to be
  393. removed.
  394. ... - Supplies a variable argument list containing pairs of protocol GUIDs
  395. and protocol interfaces.
  396. Return Value:
  397. EFI_SUCCESS if all of the requested protocol interfaces were removed.
  398. EFI_INVALID_PARAMETER if one of the protocol interfaces was not previously
  399. installed on the given.
  400. --*/
  401. EFIAPI
  402. EFI_STATUS
  403. EfiCoreRegisterProtocolNotify (
  404. EFI_GUID *Protocol,
  405. EFI_EVENT Event,
  406. VOID **Registration
  407. );
  408. /*++
  409. Routine Description:
  410. This routine creates an event that is to be signaled whenever an interface
  411. is installed for a specified protocol.
  412. Arguments:
  413. Protocol - Supplies the numeric ID of the protocol for which the event is
  414. to be registered.
  415. Event - Supplies the event that is to be signaled whenever a protocol
  416. interface is registered for the given protocol.
  417. Registration - Supplies a pointer to a memory location to receive the
  418. registration value.
  419. Return Value:
  420. EFI_SUCCESS on success.
  421. EFI_OUT_OF_RESOURCES if an allocation failed.
  422. EFI_INVALID_PARAMETER if the protocol, event, or registration is NULL.
  423. --*/
  424. VOID
  425. EfiCoreInitializeHandleDatabase (
  426. VOID
  427. );
  428. /*++
  429. Routine Description:
  430. This routine initializes EFI handle and protocol support.
  431. Arguments:
  432. None.
  433. Return Value:
  434. None.
  435. --*/
  436. EFI_STATUS
  437. EfipCoreInstallProtocolInterfaceNotify (
  438. EFI_HANDLE *EfiHandle,
  439. EFI_GUID *Protocol,
  440. EFI_INTERFACE_TYPE InterfaceType,
  441. VOID *Interface,
  442. BOOLEAN Notify
  443. );
  444. /*++
  445. Routine Description:
  446. This routine installs a protocol interface into the boot services
  447. environment.
  448. Arguments:
  449. EfiHandle - Supplies a pointer to the handle to install the protocol
  450. handler on. If this points to NULL, a new handle will be allocated and
  451. the protocol is added to the handle.
  452. Protocol - Supplies a pointer to the GUID of the protocol to add.
  453. InterfaceType - Supplies the interface type.
  454. Interface - Supplies the interface value.
  455. Notify - Supplies a boolean indicating whether ot notify the notification
  456. list for this protocol.
  457. Return Value:
  458. EFI Status code.
  459. --*/
  460. EFI_STATUS
  461. EfipCoreUnregisterProtocolNotify (
  462. EFI_EVENT Event
  463. );
  464. /*++
  465. Routine Description:
  466. This routine removes all the events in the protocol database that match
  467. the given event.
  468. Arguments:
  469. Event - Supplies the event that is being destroyed.
  470. Return Value:
  471. EFI status code.
  472. --*/
  473. PEFI_PROTOCOL_ENTRY
  474. EfipCoreFindProtocolEntry (
  475. EFI_GUID *Protocol,
  476. BOOLEAN Create
  477. );
  478. /*++
  479. Routine Description:
  480. This routine findst the protocol entry for the given protocol ID. This
  481. routine assumes the protocol database lock is already held.
  482. Arguments:
  483. Protocol - Supplies a pointer to the protocol GUID to find.
  484. Create - Supplies a boolean indicating if an entry should be created if not
  485. found.
  486. Return Value:
  487. Returns a pointer to the protocol entry on success.
  488. NULL on failure.
  489. --*/
  490. EFI_STATUS
  491. EfipCoreValidateHandle (
  492. EFI_HANDLE Handle
  493. );
  494. /*++
  495. Routine Description:
  496. This routine validates that the given handle is a valid EFI_HANDLE.
  497. Arguments:
  498. Handle - Supplies the handle to validate.
  499. Return Value:
  500. EFI_SUCCESS if on success.
  501. EFI_INVALID_PARAMETER if the handle is not in fact valid.
  502. --*/
  503. UINT64
  504. EfipCoreGetHandleDatabaseKey (
  505. VOID
  506. );
  507. /*++
  508. Routine Description:
  509. This routine returns the current handle database key.
  510. Arguments:
  511. None.
  512. Return Value:
  513. Returns the current handle database key.
  514. --*/
  515. VOID
  516. EfipCoreConnectHandlesByKey (
  517. UINT64 Key
  518. );
  519. /*++
  520. Routine Description:
  521. This routine connects any handles that were created or modified while an
  522. image executed.
  523. Arguments:
  524. Key - Supplies the database key snapped when the image was started.
  525. Return Value:
  526. None.
  527. --*/
  528. //
  529. // Locate functions
  530. //
  531. EFIAPI
  532. EFI_STATUS
  533. EfiCoreLocateDevicePath (
  534. EFI_GUID *Protocol,
  535. EFI_DEVICE_PATH_PROTOCOL **DevicePath,
  536. EFI_HANDLE *Device
  537. );
  538. /*++
  539. Routine Description:
  540. This routine attempts to locate the handle to a device on the device path
  541. that supports the specified protocol.
  542. Arguments:
  543. Protocol - Supplies a pointer to the protocol to search for.
  544. DevicePath - Supplies a pointer that on input contains a pointer to the
  545. device path. On output, the path pointer is modified to point to the
  546. remaining part of the device path.
  547. Device - Supplies a pointer where the handle of the device will be
  548. returned.
  549. Return Value:
  550. EFI_SUCCESS if a handle was returned.
  551. EFI_NOT_FOUND if no handles match the search.
  552. EFI_INVALID_PARAMETER if the protocol is NULL, device path is NULL, or a
  553. handle matched and the device is NULL.
  554. --*/
  555. EFIAPI
  556. EFI_STATUS
  557. EfiCoreLocateHandleBuffer (
  558. EFI_LOCATE_SEARCH_TYPE SearchType,
  559. EFI_GUID *Protocol,
  560. VOID *SearchKey,
  561. UINTN *HandleCount,
  562. EFI_HANDLE **Buffer
  563. );
  564. /*++
  565. Routine Description:
  566. This routine returns an array of handles that support the requested
  567. protocol in a buffer allocated from pool.
  568. Arguments:
  569. SearchType - Supplies the search behavior.
  570. Protocol - Supplies a pointer to the protocol to search by.
  571. SearchKey - Supplies a pointer to the search key.
  572. HandleCount - Supplies a pointer where the number of handles will be
  573. returned.
  574. Buffer - Supplies a pointer where an array will be returned containing the
  575. requested handles.
  576. Return Value:
  577. EFI_SUCCESS on success.
  578. EFI_NOT_FOUND if no handles match the search.
  579. EFI_INVALID_PARAMETER if the handle count or buffer is NULL.
  580. EFI_OUT_OF_RESOURCES if an allocation failed.
  581. --*/
  582. EFIAPI
  583. EFI_STATUS
  584. EfiCoreLocateHandle (
  585. EFI_LOCATE_SEARCH_TYPE SearchType,
  586. EFI_GUID *Protocol,
  587. VOID *SearchKey,
  588. UINTN *BufferSize,
  589. EFI_HANDLE *Buffer
  590. );
  591. /*++
  592. Routine Description:
  593. This routine returns an array of handles that support a specified protocol.
  594. Arguments:
  595. SearchType - Supplies which handle(s) are to be returned.
  596. Protocol - Supplies an optional pointer to the protocols to search by.
  597. SearchKey - Supplies an optional pointer to the search key.
  598. BufferSize - Supplies a pointer that on input contains the size of the
  599. result buffer in bytes. On output, the size of the result array will be
  600. returned (even if the buffer was too small).
  601. Buffer - Supplies a pointer where the results will be returned.
  602. Return Value:
  603. EFI_SUCCESS on success.
  604. EFI_NOT_FOUND if no handles match the search.
  605. EFI_BUFFER_TOO_SMALL if the given buffer wasn't big enough to hold all the
  606. results.
  607. EFI_INVALID_PARAMETER if the serach type is invalid, one of the parameters
  608. required by the given search type was NULL, one or more matches are found
  609. and the buffer size is NULL, or the buffer size is large enough and the
  610. buffer is NULL.
  611. --*/
  612. EFIAPI
  613. EFI_STATUS
  614. EfiCoreLocateProtocol (
  615. EFI_GUID *Protocol,
  616. VOID *Registration,
  617. VOID **Interface
  618. );
  619. /*++
  620. Routine Description:
  621. This routine returns the first protocol instance that matches the given
  622. protocol.
  623. Arguments:
  624. Protocol - Supplies a pointer to the protocol to search by.
  625. Registration - Supplies a pointer to an optional registration key
  626. returned from RegisterProtocolNotify.
  627. Interface - Supplies a pointer where a pointer to the first interface that
  628. matches will be returned on success.
  629. Return Value:
  630. EFI_SUCCESS on success.
  631. EFI_NOT_FOUND if no protocol instances matched the search.
  632. EFI_INVALID_PARAMETER if the interface is NULL.
  633. --*/