1
0

handle.h 22 KB

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