RedfishRestExInternal.h 30 KB

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