1 | /** @file
|
---|
2 | Header file of Redfish Configuration Handler UEFI driver.
|
---|
3 |
|
---|
4 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
---|
5 | (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
|
---|
6 |
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 |
|
---|
9 | **/
|
---|
10 |
|
---|
11 | #ifndef EFI_REDFISH_CONFIG_HANDLER_DRIVER_H_
|
---|
12 | #define EFI_REDFISH_CONFIG_HANDLER_DRIVER_H_
|
---|
13 |
|
---|
14 | #include "RedfishConfigHandlerCommon.h"
|
---|
15 |
|
---|
16 | //
|
---|
17 | // UEFI Driver Model Protocols
|
---|
18 | //
|
---|
19 |
|
---|
20 | #include <Protocol/DriverBinding.h>
|
---|
21 | #include <Protocol/RedfishDiscover.h>
|
---|
22 | #include <Protocol/RestEx.h>
|
---|
23 |
|
---|
24 | //
|
---|
25 | // Protocol instances
|
---|
26 | //
|
---|
27 | extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding;
|
---|
28 |
|
---|
29 | extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData;
|
---|
30 | extern EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential;
|
---|
31 | extern EFI_EVENT gEndOfDxeEvent;
|
---|
32 | extern EFI_EVENT gExitBootServiceEvent;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | Tests to see if this driver supports a given controller. If a child device is provided,
|
---|
36 | it further tests to see if this driver supports creating a handle for the specified child device.
|
---|
37 |
|
---|
38 | This function checks to see if the driver specified by This supports the device specified by
|
---|
39 | ControllerHandle. Drivers will typically use the device path attached to
|
---|
40 | ControllerHandle and/or the services from the bus I/O abstraction attached to
|
---|
41 | ControllerHandle to determine if the driver supports ControllerHandle. This function
|
---|
42 | may be called many times during platform initialization. In order to reduce boot times, the tests
|
---|
43 | performed by this function must be very small, and take as little time as possible to execute. This
|
---|
44 | function must not change the state of any hardware devices, and this function must be aware that the
|
---|
45 | device specified by ControllerHandle may already be managed by the same driver or a
|
---|
46 | different driver. This function must match its calls to AllocatePages() with FreePages(),
|
---|
47 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
|
---|
48 | Because ControllerHandle may have been previously started by the same driver, if a protocol is
|
---|
49 | already in the opened state, then it must not be closed with CloseProtocol(). This is required
|
---|
50 | to guarantee the state of ControllerHandle is not modified by this function.
|
---|
51 |
|
---|
52 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
---|
53 | @param[in] ControllerHandle The handle of the controller to test. This handle
|
---|
54 | must support a protocol interface that supplies
|
---|
55 | an I/O abstraction to the driver.
|
---|
56 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
---|
57 | parameter is ignored by device drivers, and is optional for bus
|
---|
58 | drivers. For bus drivers, if this parameter is not NULL, then
|
---|
59 | the bus driver must determine if the bus controller specified
|
---|
60 | by ControllerHandle and the child controller specified
|
---|
61 | by RemainingDevicePath are both supported by this
|
---|
62 | bus driver.
|
---|
63 |
|
---|
64 | @retval EFI_SUCCESS The device specified by ControllerHandle and
|
---|
65 | RemainingDevicePath is supported by the driver specified by This.
|
---|
66 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
|
---|
67 | RemainingDevicePath is already being managed by the driver
|
---|
68 | specified by This.
|
---|
69 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
|
---|
70 | RemainingDevicePath is already being managed by a different
|
---|
71 | driver or an application that requires exclusive access.
|
---|
72 | Currently not implemented.
|
---|
73 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
|
---|
74 | RemainingDevicePath is not supported by the driver specified by This.
|
---|
75 | **/
|
---|
76 | EFI_STATUS
|
---|
77 | EFIAPI
|
---|
78 | RedfishConfigDriverBindingSupported (
|
---|
79 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
80 | IN EFI_HANDLE ControllerHandle,
|
---|
81 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
---|
82 | );
|
---|
83 |
|
---|
84 | /**
|
---|
85 | Starts a device controller or a bus controller.
|
---|
86 |
|
---|
87 | The Start() function is designed to be invoked from the EFI boot service ConnectController().
|
---|
88 | As a result, much of the error checking on the parameters to Start() has been moved into this
|
---|
89 | common boot service. It is legal to call Start() from other locations,
|
---|
90 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
---|
91 | 1. ControllerHandle must be a valid EFI_HANDLE.
|
---|
92 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
---|
93 | EFI_DEVICE_PATH_PROTOCOL.
|
---|
94 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
---|
95 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
---|
96 |
|
---|
97 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
---|
98 | @param[in] ControllerHandle The handle of the controller to start. This handle
|
---|
99 | must support a protocol interface that supplies
|
---|
100 | an I/O abstraction to the driver.
|
---|
101 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
|
---|
102 | parameter is ignored by device drivers, and is optional for bus
|
---|
103 | drivers. For a bus driver, if this parameter is NULL, then handles
|
---|
104 | for all the children of Controller are created by this driver.
|
---|
105 | If this parameter is not NULL and the first Device Path Node is
|
---|
106 | not the End of Device Path Node, then only the handle for the
|
---|
107 | child device specified by the first Device Path Node of
|
---|
108 | RemainingDevicePath is created by this driver.
|
---|
109 | If the first Device Path Node of RemainingDevicePath is
|
---|
110 | the End of Device Path Node, no child handle is created by this
|
---|
111 | driver.
|
---|
112 |
|
---|
113 | @retval EFI_SUCCESS The driver is started.
|
---|
114 | @retval EFI_ALREADY_STARTED The driver was already started.
|
---|
115 |
|
---|
116 | **/
|
---|
117 | EFI_STATUS
|
---|
118 | EFIAPI
|
---|
119 | RedfishConfigDriverBindingStart (
|
---|
120 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
121 | IN EFI_HANDLE ControllerHandle,
|
---|
122 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
---|
123 | );
|
---|
124 |
|
---|
125 | /**
|
---|
126 | Stops a device controller or a bus controller.
|
---|
127 |
|
---|
128 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
|
---|
129 | As a result, much of the error checking on the parameters to Stop() has been moved
|
---|
130 | into this common boot service. It is legal to call Stop() from other locations,
|
---|
131 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.
|
---|
132 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
---|
133 | same driver's Start() function.
|
---|
134 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
|
---|
135 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
---|
136 | Start() function, and the Start() function must have called OpenProtocol() on
|
---|
137 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
---|
138 |
|
---|
139 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
---|
140 | @param[in] ControllerHandle A handle to the device being stopped. The handle must
|
---|
141 | support a bus specific I/O protocol for the driver
|
---|
142 | to use to stop the device.
|
---|
143 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
---|
144 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
---|
145 | if NumberOfChildren is 0.
|
---|
146 |
|
---|
147 | @retval EFI_SUCCESS The device was stopped.
|
---|
148 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
---|
149 |
|
---|
150 | **/
|
---|
151 | EFI_STATUS
|
---|
152 | EFIAPI
|
---|
153 | RedfishConfigDriverBindingStop (
|
---|
154 | IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
---|
155 | IN EFI_HANDLE ControllerHandle,
|
---|
156 | IN UINTN NumberOfChildren,
|
---|
157 | IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
|
---|
158 | );
|
---|
159 |
|
---|
160 | #endif
|
---|