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