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