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