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