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