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