RedfishRestExDriver.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /** @file
  2. RedfishRestExDxe support functions definitions.
  3. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  4. (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef EFI_REDFISH_RESTEX_DRIVER_H_
  8. #define EFI_REDFISH_RESTEX_DRIVER_H_
  9. ///
  10. /// Libraries classes
  11. ///
  12. #include <Library/BaseLib.h>
  13. #include <Library/BaseMemoryLib.h>
  14. #include <Library/DebugLib.h>
  15. #include <Library/DevicePathLib.h>
  16. #include <Library/HttpIoLib.h>
  17. #include <Library/MemoryAllocationLib.h>
  18. #include <Library/NetLib.h>
  19. #include <Library/UefiLib.h>
  20. #include <Library/UefiBootServicesTableLib.h>
  21. #include <Library/UefiDriverEntryPoint.h>
  22. ///
  23. /// UEFI Driver Model Protocols
  24. ///
  25. #include <Protocol/DriverBinding.h>
  26. #include <Protocol/RestEx.h>
  27. #include <Protocol/ServiceBinding.h>
  28. ///
  29. /// Protocol instances
  30. ///
  31. extern EFI_COMPONENT_NAME_PROTOCOL gRedfishRestExComponentName;
  32. extern EFI_COMPONENT_NAME2_PROTOCOL gRedfishRestExComponentName2;
  33. extern EFI_UNICODE_STRING_TABLE *gRedfishRestExControllerNameTable;
  34. extern EFI_DRIVER_BINDING_PROTOCOL gRedfishRestExDriverBinding;
  35. extern EFI_SERVICE_BINDING_PROTOCOL mRedfishRestExServiceBinding;
  36. extern EFI_REST_EX_PROTOCOL mRedfishRestExProtocol;
  37. ///
  38. /// RestEx service block
  39. ///
  40. typedef struct _RESTEX_SERVICE RESTEX_SERVICE;
  41. ///
  42. /// RestEx instance block
  43. ///
  44. typedef struct _RESTEX_INSTANCE RESTEX_INSTANCE;
  45. ///
  46. /// Driver Version
  47. ///
  48. #define REDFISH_RESTEX_DRIVER_VERSION 0x0100
  49. #define RESTEX_SERVICE_SIGNATURE SIGNATURE_32 ('R', 'E', 'S', 'S')
  50. #define RESTEX_INSTANCE_SIGNATURE SIGNATURE_32 ('R', 'E', 'I', 'S')
  51. #define RESTEX_SERVICE_FROM_THIS(a) \
  52. CR (a, RESTEX_SERVICE, ServiceBinding, RESTEX_SERVICE_SIGNATURE)
  53. #define RESTEX_INSTANCE_FROM_THIS(a) \
  54. CR (a, RESTEX_INSTANCE, RestEx, RESTEX_INSTANCE_SIGNATURE)
  55. #define RESTEX_STATE_UNCONFIGED 0
  56. #define RESTEX_STATE_CONFIGED 1
  57. struct _RESTEX_SERVICE {
  58. UINT32 Signature;
  59. EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
  60. UINT16 RestExChildrenNum;
  61. LIST_ENTRY RestExChildrenList;
  62. EFI_HANDLE ControllerHandle;
  63. EFI_HANDLE ImageHandle;
  64. //
  65. // Use to establish the parent-child relationship.
  66. //
  67. EFI_HANDLE HttpChildHandle;
  68. UINT32 Id;
  69. EFI_REST_EX_SERVICE_INFO RestExServiceInfo;
  70. };
  71. #define RESTEX_INSTANCE_FLAGS_TLS_RETRY 0x00000001
  72. #define RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY 0x00000002
  73. struct _RESTEX_INSTANCE {
  74. UINT32 Signature;
  75. LIST_ENTRY Link;
  76. EFI_REST_EX_PROTOCOL RestEx;
  77. INTN State;
  78. BOOLEAN InDestroy;
  79. RESTEX_SERVICE *Service;
  80. EFI_HANDLE ChildHandle;
  81. EFI_REST_EX_CONFIG_DATA ConfigData;
  82. //
  83. // HTTP_IO to access the HTTP service
  84. //
  85. HTTP_IO HttpIo;
  86. UINT32 Flags;
  87. };
  88. typedef struct {
  89. EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
  90. UINTN NumberOfChildren;
  91. EFI_HANDLE *ChildHandleBuffer;
  92. } RESTEX_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT;
  93. /**
  94. Provides a simple HTTP-like interface to send and receive resources from a REST service.
  95. The SendReceive() function sends an HTTP request to this REST service, and returns a
  96. response when the data is retrieved from the service. RequestMessage contains the HTTP
  97. request to the REST resource identified by RequestMessage.Request.Url. The
  98. ResponseMessage is the returned HTTP response for that request, including any HTTP
  99. status.
  100. @param[in] This Pointer to EFI_REST_EX_PROTOCOL instance for a particular
  101. REST service.
  102. @param[in] RequestMessage Pointer to the HTTP request data for this resource
  103. @param[out] ResponseMessage Pointer to the HTTP response data obtained for this requested.
  104. @retval EFI_SUCCESS operation succeeded.
  105. @retval EFI_INVALID_PARAMETER This, RequestMessage, or ResponseMessage are NULL.
  106. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  107. **/
  108. EFI_STATUS
  109. EFIAPI
  110. RedfishRestExSendReceive (
  111. IN EFI_REST_EX_PROTOCOL *This,
  112. IN EFI_HTTP_MESSAGE *RequestMessage,
  113. OUT EFI_HTTP_MESSAGE *ResponseMessage
  114. );
  115. /**
  116. Obtain the current time from this REST service instance.
  117. The GetServiceTime() function is an optional interface to obtain the current time from
  118. this REST service instance. If this REST service does not support to retrieve the time,
  119. this function returns EFI_UNSUPPORTED. This function must returns EFI_UNSUPPORTED if
  120. EFI_REST_EX_SERVICE_TYPE returned in EFI_REST_EX_SERVICE_INFO from GetService() is
  121. EFI_REST_EX_SERVICE_UNSPECIFIC.
  122. @param[in] This Pointer to EFI_REST_EX_PROTOCOL instance for a particular
  123. REST service.
  124. @param[out] Time A pointer to storage to receive a snapshot of the current time of
  125. the REST service.
  126. @retval EFI_SUCCESS operation succeeded.
  127. @retval EFI_INVALID_PARAMETER This or Time are NULL.
  128. @retval EFI_UNSUPPORTED The RESTful service does not support returning the time.
  129. @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
  130. @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must
  131. be executed and returns successfully prior to invoke this function.
  132. **/
  133. EFI_STATUS
  134. EFIAPI
  135. RedfishRestExGetServiceTime (
  136. IN EFI_REST_EX_PROTOCOL *This,
  137. OUT EFI_TIME *Time
  138. );
  139. /**
  140. This function returns the information of REST service provided by this EFI REST EX driver instance.
  141. The information such as the type of REST service and the access mode of REST EX driver instance
  142. (In-band or Out-of-band) are described in EFI_REST_EX_SERVICE_INFO structure. For the vendor-specific
  143. REST service, vendor-specific REST service information is returned in VendorSpecifcData.
  144. REST EX driver designer is well know what REST service this REST EX driver instance intends to
  145. communicate with. The designer also well know this driver instance is used to talk to BMC through
  146. specific platform mechanism or talk to REST server through UEFI HTTP protocol. REST EX driver is
  147. responsible to fill up the correct information in EFI_REST_EX_SERVICE_INFO. EFI_REST_EX_SERVICE_INFO
  148. is referred by EFI REST clients to pickup the proper EFI REST EX driver instance to get and set resource.
  149. GetService() is a basic and mandatory function which must be able to use even Configure() is not invoked
  150. in previously.
  151. @param[in] This Pointer to EFI_REST_EX_PROTOCOL instance for a particular
  152. REST service.
  153. @param[out] RestExServiceInfo Pointer to receive a pointer to EFI_REST_EX_SERVICE_INFO structure. The
  154. format of EFI_REST_EX_SERVICE_INFO is version controlled for the future
  155. extension. The version of EFI_REST_EX_SERVICE_INFO structure is returned
  156. in the header within this structure. EFI REST client refers to the correct
  157. format of structure according to the version number. The pointer to
  158. EFI_REST_EX_SERVICE_INFO is a memory block allocated by EFI REST EX driver
  159. instance. That is caller's responsibility to free this memory when this
  160. structure is no longer needed. Refer to Related Definitions below for the
  161. definitions of EFI_REST_EX_SERVICE_INFO structure.
  162. @retval EFI_SUCCESS EFI_REST_EX_SERVICE_INFO is returned in RestExServiceInfo. This function
  163. is not supported in this REST EX Protocol driver instance.
  164. @retval EFI_UNSUPPORTED This function is not supported in this REST EX Protocol driver instance.
  165. **/
  166. EFI_STATUS
  167. EFIAPI
  168. RedfishRestExGetService (
  169. IN EFI_REST_EX_PROTOCOL *This,
  170. OUT EFI_REST_EX_SERVICE_INFO **RestExServiceInfo
  171. );
  172. /**
  173. This function returns operational configuration of current EFI REST EX child instance.
  174. This function returns the current configuration of EFI REST EX child instance. The format of
  175. operational configuration depends on the implementation of EFI REST EX driver instance. For
  176. example, HTTP-aware EFI REST EX driver instance uses EFI HTTP protocol as the undying protocol
  177. to communicate with REST service. In this case, the type of configuration is
  178. EFI_REST_EX_CONFIG_TYPE_HTTP returned from GetService(). EFI_HTTP_CONFIG_DATA is used as EFI REST
  179. EX configuration format and returned to EFI REST client. User has to type cast RestExConfigData
  180. to EFI_HTTP_CONFIG_DATA. For those non HTTP-aware REST EX driver instances, the type of configuration
  181. is EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC returned from GetService(). In this case, the format of
  182. returning data could be non industrial. Instead, the format of configuration data is system/platform
  183. specific definition such as BMC mechanism used in EFI REST EX driver instance. EFI REST client and
  184. EFI REST EX driver instance have to refer to the specific system /platform spec which is out of UEFI scope.
  185. @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
  186. @param[out] RestExConfigData Pointer to receive a pointer to EFI_REST_EX_CONFIG_DATA.
  187. The memory allocated for configuration data should be freed
  188. by caller. See Related Definitions for the details.
  189. @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is returned in successfully.
  190. @retval EFI_UNSUPPORTED This function is not supported in this REST EX Protocol driver instance.
  191. @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must be
  192. executed and returns successfully prior to invoke this function.
  193. **/
  194. EFI_STATUS
  195. EFIAPI
  196. RedfishRestExGetModeData (
  197. IN EFI_REST_EX_PROTOCOL *This,
  198. OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
  199. );
  200. /**
  201. This function is used to configure EFI REST EX child instance.
  202. This function is used to configure the setting of underlying protocol of REST EX child
  203. instance. The type of configuration is according to the implementation of EFI REST EX
  204. driver instance. For example, HTTP-aware EFI REST EX driver instance uses EFI HTTP protocol
  205. as the undying protocol to communicate with REST service. The type of configuration is
  206. EFI_REST_EX_CONFIG_TYPE_HTTP and RestExConfigData is the same format with EFI_HTTP_CONFIG_DATA.
  207. Akin to HTTP configuration, REST EX child instance can be configure to use different HTTP
  208. local access point for the data transmission. Multiple REST clients may use different
  209. configuration of HTTP to distinguish themselves, such as to use the different TCP port.
  210. For those non HTTP-aware REST EX driver instance, the type of configuration is
  211. EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC. RestExConfigData refers to the non industrial standard.
  212. Instead, the format of configuration data is system/platform specific definition such as BMC.
  213. In this case, EFI REST client and EFI REST EX driver instance have to refer to the specific
  214. system/platform spec which is out of the UEFI scope. Besides GetService()function, no other
  215. EFI REST EX functions can be executed by this instance until Configure()is executed and returns
  216. successfully. All other functions must returns EFI_NOT_READY if this instance is not configured
  217. yet. Set RestExConfigData to NULL means to put EFI REST EX child instance into the unconfigured
  218. state.
  219. @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
  220. @param[in] RestExConfigData Pointer to EFI_REST_EX_CONFIG_DATA. See Related Definitions in
  221. GetModeData() protocol interface.
  222. @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is set in successfully.
  223. @retval EFI_DEVICE_ERROR Configuration for this REST EX child instance is failed with the given
  224. EFI_REST_EX_CONFIG_DATA.
  225. @retval EFI_UNSUPPORTED This function is not supported in this REST EX Protocol driver instance.
  226. **/
  227. EFI_STATUS
  228. EFIAPI
  229. RedfishRestExConfigure (
  230. IN EFI_REST_EX_PROTOCOL *This,
  231. IN EFI_REST_EX_CONFIG_DATA RestExConfigData
  232. );
  233. /**
  234. This function sends REST request to REST service and signal caller's event asynchronously when
  235. the final response is received by REST EX Protocol driver instance.
  236. The essential design of this function is to handle asynchronous send/receive implicitly according
  237. to REST service asynchronous request mechanism. Caller will get the notification once the response
  238. is returned from REST service.
  239. @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
  240. @param[in] RequestMessage This is the HTTP request message sent to REST service. Set RequestMessage
  241. to NULL to cancel the previous asynchronous request associated with the
  242. corresponding RestExToken. See descriptions for the details.
  243. @param[in] RestExToken REST EX token which REST EX Protocol instance uses to notify REST client
  244. the status of response of asynchronous REST request. See related definition
  245. of EFI_REST_EX_TOKEN.
  246. @param[in] TimeOutInMilliSeconds The pointer to the timeout in milliseconds which REST EX Protocol driver
  247. instance refers as the duration to drop asynchronous REST request. NULL
  248. pointer means no timeout for this REST request. REST EX Protocol driver
  249. signals caller's event with EFI_STATUS set to EFI_TIMEOUT in RestExToken
  250. if REST EX Protocol can't get the response from REST service within
  251. TimeOutInMilliSeconds.
  252. @retval EFI_SUCCESS Asynchronous REST request is established.
  253. @retval EFI_UNSUPPORTED This REST EX Protocol driver instance doesn't support asynchronous request.
  254. @retval EFI_TIMEOUT Asynchronous REST request is not established and timeout is expired.
  255. @retval EFI_ABORT Previous asynchronous REST request has been canceled.
  256. @retval EFI_DEVICE_ERROR Otherwise, returns EFI_DEVICE_ERROR for other errors according to HTTP Status Code.
  257. @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must be executed
  258. and returns successfully prior to invoke this function.
  259. **/
  260. EFI_STATUS
  261. EFIAPI
  262. RedfishRestExAyncSendReceive (
  263. IN EFI_REST_EX_PROTOCOL *This,
  264. IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
  265. IN EFI_REST_EX_TOKEN *RestExToken,
  266. IN UINTN *TimeOutInMilliSeconds OPTIONAL
  267. );
  268. /**
  269. This function sends REST request to a REST Event service and signals caller's event
  270. token asynchronously when the URI resource change event is received by REST EX
  271. Protocol driver instance.
  272. The essential design of this function is to monitor event implicitly according to
  273. REST service event service mechanism. Caller will get the notification if certain
  274. resource is changed.
  275. @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
  276. @param[in] RequestMessage This is the HTTP request message sent to REST service. Set RequestMessage
  277. to NULL to cancel the previous event service associated with the corresponding
  278. RestExToken. See descriptions for the details.
  279. @param[in] RestExToken REST EX token which REST EX Protocol driver instance uses to notify REST client
  280. the URI resource which monitored by REST client has been changed. See the related
  281. definition of EFI_REST_EX_TOKEN in EFI_REST_EX_PROTOCOL.AsyncSendReceive().
  282. @retval EFI_SUCCESS Asynchronous REST request is established.
  283. @retval EFI_UNSUPPORTED This REST EX Protocol driver instance doesn't support asynchronous request.
  284. @retval EFI_ABORT Previous asynchronous REST request has been canceled or event subscription has been
  285. delete from service.
  286. @retval EFI_DEVICE_ERROR Otherwise, returns EFI_DEVICE_ERROR for other errors according to HTTP Status Code.
  287. @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must be executed
  288. and returns successfully prior to invoke this function.
  289. **/
  290. EFI_STATUS
  291. EFIAPI
  292. RedfishRestExEventService (
  293. IN EFI_REST_EX_PROTOCOL *This,
  294. IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
  295. IN EFI_REST_EX_TOKEN *RestExToken
  296. );
  297. /**
  298. Create a new TLS session becuase the previous on is closed.
  299. status.
  300. @param[in] Instance Pointer to EFI_REST_EX_PROTOCOL instance for a particular
  301. REST service.
  302. @retval EFI_SUCCESS operation succeeded.
  303. @retval EFI Errors Other errors.
  304. **/
  305. EFI_STATUS
  306. ResetHttpTslSession (
  307. IN RESTEX_INSTANCE *Instance
  308. );
  309. /**
  310. Callback function which provided by user to remove one node in NetDestroyLinkList process.
  311. @param[in] Entry The entry to be removed.
  312. @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
  313. @retval EFI_SUCCESS The entry has been removed successfully.
  314. @retval Others Fail to remove the entry.
  315. **/
  316. EFI_STATUS
  317. EFIAPI
  318. RestExDestroyChildEntryInHandleBuffer (
  319. IN LIST_ENTRY *Entry,
  320. IN VOID *Context
  321. );
  322. /**
  323. Destroy the RestEx instance and recycle the resources.
  324. @param[in] Instance The pointer to the RestEx instance.
  325. **/
  326. VOID
  327. RestExDestroyInstance (
  328. IN RESTEX_INSTANCE *Instance
  329. );
  330. /**
  331. Create the RestEx instance and initialize it.
  332. @param[in] Service The pointer to the RestEx service.
  333. @param[out] Instance The pointer to the RestEx instance.
  334. @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
  335. @retval EFI_SUCCESS The RestEx instance is created.
  336. **/
  337. EFI_STATUS
  338. RestExCreateInstance (
  339. IN RESTEX_SERVICE *Service,
  340. OUT RESTEX_INSTANCE **Instance
  341. );
  342. /**
  343. Release all the resource used the RestEx service binding instance.
  344. @param RestExSb The RestEx service binding instance.
  345. **/
  346. VOID
  347. RestExDestroyService (
  348. IN RESTEX_SERVICE *RestExSb
  349. );
  350. /**
  351. Create then initialize a RestEx service binding instance.
  352. @param[in] Controller The controller to install the RestEx service
  353. binding on.
  354. @param[in] Image The driver binding image of the RestEx driver.
  355. @param[out] Service The variable to receive the created service
  356. binding instance.
  357. @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to create the instance.
  358. @retval EFI_SUCCESS The service instance is created for the controller.
  359. **/
  360. EFI_STATUS
  361. RestExCreateService (
  362. IN EFI_HANDLE Controller,
  363. IN EFI_HANDLE Image,
  364. OUT RESTEX_SERVICE **Service
  365. );
  366. /**
  367. This is the declaration of an EFI image entry point. This entry point is
  368. the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
  369. both device drivers and bus drivers.
  370. @param[in] ImageHandle The firmware allocated handle for the UEFI image.
  371. @param[in] SystemTable A pointer to the EFI System Table.
  372. @retval EFI_SUCCESS The operation completed successfully.
  373. @retval Others An unexpected error occurred.
  374. **/
  375. EFI_STATUS
  376. EFIAPI
  377. RedfishRestExDriverEntryPoint (
  378. IN EFI_HANDLE ImageHandle,
  379. IN EFI_SYSTEM_TABLE *SystemTable
  380. );
  381. /**
  382. Tests to see if this driver supports a given controller. If a child device is provided,
  383. it further tests to see if this driver supports creating a handle for the specified child device.
  384. This function checks to see if the driver specified by This supports the device specified by
  385. ControllerHandle. Drivers will typically use the device path attached to
  386. ControllerHandle and/or the services from the bus I/O abstraction attached to
  387. ControllerHandle to determine if the driver supports ControllerHandle. This function
  388. may be called many times during platform initialization. In order to reduce boot times, the tests
  389. performed by this function must be very small, and take as little time as possible to execute. This
  390. function must not change the state of any hardware devices, and this function must be aware that the
  391. device specified by ControllerHandle may already be managed by the same driver or a
  392. different driver. This function must match its calls to AllocatePages() with FreePages(),
  393. AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
  394. Because ControllerHandle may have been previously started by the same driver, if a protocol is
  395. already in the opened state, then it must not be closed with CloseProtocol(). This is required
  396. to guarantee the state of ControllerHandle is not modified by this function.
  397. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  398. @param[in] ControllerHandle The handle of the controller to test. This handle
  399. must support a protocol interface that supplies
  400. an I/O abstraction to the driver.
  401. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  402. parameter is ignored by device drivers, and is optional for bus
  403. drivers. For bus drivers, if this parameter is not NULL, then
  404. the bus driver must determine if the bus controller specified
  405. by ControllerHandle and the child controller specified
  406. by RemainingDevicePath are both supported by this
  407. bus driver.
  408. @retval EFI_SUCCESS The device specified by ControllerHandle and
  409. RemainingDevicePath is supported by the driver specified by This.
  410. @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
  411. RemainingDevicePath is already being managed by the driver
  412. specified by This.
  413. @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
  414. RemainingDevicePath is already being managed by a different
  415. driver or an application that requires exclusive access.
  416. Currently not implemented.
  417. @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
  418. RemainingDevicePath is not supported by the driver specified by This.
  419. **/
  420. EFI_STATUS
  421. EFIAPI
  422. RedfishRestExDriverBindingSupported (
  423. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  424. IN EFI_HANDLE ControllerHandle,
  425. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  426. );
  427. /**
  428. Starts a device controller or a bus controller.
  429. The Start() function is designed to be invoked from the EFI boot service ConnectController().
  430. As a result, much of the error checking on the parameters to Start() has been moved into this
  431. common boot service. It is legal to call Start() from other locations,
  432. but the following calling restrictions must be followed, or the system behavior will not be deterministic.
  433. 1. ControllerHandle must be a valid EFI_HANDLE.
  434. 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
  435. EFI_DEVICE_PATH_PROTOCOL.
  436. 3. Prior to calling Start(), the Supported() function for the driver specified by This must
  437. have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
  438. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  439. @param[in] ControllerHandle The handle of the controller to start. This handle
  440. must support a protocol interface that supplies
  441. an I/O abstraction to the driver.
  442. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  443. parameter is ignored by device drivers, and is optional for bus
  444. drivers. For a bus driver, if this parameter is NULL, then handles
  445. for all the children of Controller are created by this driver.
  446. If this parameter is not NULL and the first Device Path Node is
  447. not the End of Device Path Node, then only the handle for the
  448. child device specified by the first Device Path Node of
  449. RemainingDevicePath is created by this driver.
  450. If the first Device Path Node of RemainingDevicePath is
  451. the End of Device Path Node, no child handle is created by this
  452. driver.
  453. @retval EFI_SUCCESS The device was started.
  454. @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
  455. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
  456. @retval Others The driver failded to start the device.
  457. **/
  458. EFI_STATUS
  459. EFIAPI
  460. RedfishRestExDriverBindingStart (
  461. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  462. IN EFI_HANDLE ControllerHandle,
  463. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  464. );
  465. /**
  466. Stops a device controller or a bus controller.
  467. The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
  468. As a result, much of the error checking on the parameters to Stop() has been moved
  469. into this common boot service. It is legal to call Stop() from other locations,
  470. but the following calling restrictions must be followed, or the system behavior will not be deterministic.
  471. 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
  472. same driver's Start() function.
  473. 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
  474. EFI_HANDLE. In addition, all of these handles must have been created in this driver's
  475. Start() function, and the Start() function must have called OpenProtocol() on
  476. ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
  477. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  478. @param[in] ControllerHandle A handle to the device being stopped. The handle must
  479. support a bus specific I/O protocol for the driver
  480. to use to stop the device.
  481. @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
  482. @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
  483. if NumberOfChildren is 0.
  484. @retval EFI_SUCCESS The device was stopped.
  485. @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
  486. **/
  487. EFI_STATUS
  488. EFIAPI
  489. RedfishRestExDriverBindingStop (
  490. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  491. IN EFI_HANDLE ControllerHandle,
  492. IN UINTN NumberOfChildren,
  493. IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
  494. );
  495. /**
  496. Creates a child handle and installs a protocol.
  497. The CreateChild() function installs a protocol on ChildHandle.
  498. If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
  499. If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
  500. @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
  501. @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,
  502. then a new handle is created. If it is a pointer to an existing UEFI handle,
  503. then the protocol is added to the existing UEFI handle.
  504. @retval EFI_SUCCES The protocol was added to ChildHandle.
  505. @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
  506. @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
  507. the child
  508. @retval other The child handle was not created
  509. **/
  510. EFI_STATUS
  511. EFIAPI
  512. RedfishRestExServiceBindingCreateChild (
  513. IN EFI_SERVICE_BINDING_PROTOCOL *This,
  514. IN EFI_HANDLE *ChildHandle
  515. );
  516. /**
  517. Destroys a child handle with a protocol installed on it.
  518. The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
  519. that was installed by CreateChild() from ChildHandle. If the removed protocol is the
  520. last protocol on ChildHandle, then ChildHandle is destroyed.
  521. @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
  522. @param[in] ChildHandle Handle of the child to destroy
  523. @retval EFI_SUCCES The protocol was removed from ChildHandle.
  524. @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
  525. @retval EFI_INVALID_PARAMETER Child handle is NULL.
  526. @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
  527. because its services are being used.
  528. @retval other The child handle was not destroyed
  529. **/
  530. EFI_STATUS
  531. EFIAPI
  532. RedfishRestExServiceBindingDestroyChild (
  533. IN EFI_SERVICE_BINDING_PROTOCOL *This,
  534. IN EFI_HANDLE ChildHandle
  535. );
  536. #endif