]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
0c323d07 | 2 | ARP driver header file.\r |
d1102dba LG |
3 | \r |
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
9d510e61 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
83cbd279 | 6 | \r |
83cbd279 | 7 | **/\r |
8 | \r | |
9 | #ifndef _ARP_DRIVER_H_\r | |
10 | #define _ARP_DRIVER_H_\r | |
11 | \r | |
772db4bb | 12 | \r |
2517435c | 13 | #include <Uefi.h>\r |
772db4bb | 14 | \r |
15 | #include <Protocol/Arp.h>\r | |
83cbd279 | 16 | #include <Protocol/ManagedNetwork.h>\r |
772db4bb | 17 | #include <Protocol/ServiceBinding.h>\r |
18 | \r | |
19 | #include <Library/DebugLib.h>\r | |
20 | #include <Library/UefiDriverEntryPoint.h>\r | |
21 | #include <Library/UefiBootServicesTableLib.h>\r | |
83cbd279 | 22 | #include <Library/UefiLib.h>\r |
23 | \r | |
83cbd279 | 24 | \r |
25 | //\r | |
26 | // Global variables\r | |
27 | //\r | |
28 | extern EFI_DRIVER_BINDING_PROTOCOL gArpDriverBinding;\r | |
29 | extern EFI_COMPONENT_NAME_PROTOCOL gArpComponentName;\r | |
30 | extern EFI_COMPONENT_NAME2_PROTOCOL gArpComponentName2;\r | |
31 | \r | |
c6d0ee4b | 32 | //\r |
33 | // Function prototypes for the Drivr Binding Protocol\r | |
34 | //\r | |
7bce0c5a | 35 | /**\r |
d1102dba LG |
36 | Tests to see if this driver supports a given controller.\r |
37 | \r | |
38 | If a child device is provided, it further tests to see if this driver supports\r | |
0c323d07 | 39 | creating a handle for the specified child device.\r |
40 | \r | |
41 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
d1102dba LG |
42 | @param[in] ControllerHandle The handle of the controller to test. This handle\r |
43 | must support a protocol interface that supplies\r | |
0c323d07 | 44 | an I/O abstraction to the driver.\r |
d1102dba LG |
45 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.\r |
46 | This parameter is ignored by device drivers,\r | |
0c323d07 | 47 | and is optional for bus drivers.\r |
48 | \r | |
49 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
d1102dba | 50 | RemainingDevicePath is supported by the driver\r |
0c323d07 | 51 | specified by This.\r |
52 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
d1102dba | 53 | RemainingDevicePath is already being managed\r |
0c323d07 | 54 | by the driver specified by This.\r |
55 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
d1102dba LG |
56 | RemainingDevicePath is already being managed by\r |
57 | a different driver or an application that\r | |
0c323d07 | 58 | requires exclusive acces. Currently not implemented.\r |
59 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
d1102dba | 60 | RemainingDevicePath is not supported by the\r |
0c323d07 | 61 | driver specified by This.\r |
7bce0c5a | 62 | \r |
63 | **/\r | |
83cbd279 | 64 | EFI_STATUS\r |
65 | EFIAPI\r | |
66 | ArpDriverBindingSupported (\r | |
67 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
68 | IN EFI_HANDLE ControllerHandle,\r | |
69 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
70 | );\r | |
71 | \r | |
7bce0c5a | 72 | /**\r |
d1102dba LG |
73 | Start this driver on ControllerHandle.\r |
74 | \r | |
75 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
76 | As a result, much of the error checking on the parameters to Start() has been\r | |
77 | moved into this common boot service. It is legal to call Start() from other locations,\r | |
78 | but the following calling restrictions must be followed or the system behavior\r | |
0c323d07 | 79 | will not be deterministic.\r |
80 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
d1102dba | 81 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally\r |
0c323d07 | 82 | aligned EFI_DEVICE_PATH_PROTOCOL.\r |
d1102dba LG |
83 | 3. Prior to calling Start(), the Supported() function for the driver specified\r |
84 | by This must have been called with the same calling parameters, and Supported()\r | |
85 | must have returned EFI_SUCCESS.\r | |
0c323d07 | 86 | \r |
87 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
d1102dba LG |
88 | @param[in] ControllerHandle The handle of the controller to start. This handle\r |
89 | must support a protocol interface that supplies\r | |
0c323d07 | 90 | an I/O abstraction to the driver.\r |
d1102dba LG |
91 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.\r |
92 | This parameter is ignored by device drivers,\r | |
0c323d07 | 93 | and is optional for bus drivers.\r |
94 | \r | |
95 | @retval EFI_SUCCESS The device was started.\r | |
96 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.\r | |
97 | Currently not implemented.\r | |
d1102dba | 98 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of\r |
0c323d07 | 99 | resources.\r |
100 | @retval Others The driver failded to start the device.\r | |
7bce0c5a | 101 | \r |
102 | **/\r | |
83cbd279 | 103 | EFI_STATUS\r |
104 | EFIAPI\r | |
105 | ArpDriverBindingStart (\r | |
106 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
107 | IN EFI_HANDLE ControllerHandle,\r | |
108 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
109 | );\r | |
110 | \r | |
7bce0c5a | 111 | /**\r |
d1102dba LG |
112 | Stop this driver on ControllerHandle.\r |
113 | \r | |
0c323d07 | 114 | Release the control of this controller and remove the IScsi functions. The Stop()\r |
d1102dba LG |
115 | function is designed to be invoked from the EFI boot service DisconnectController().\r |
116 | As a result, much of the error checking on the parameters to Stop() has been moved\r | |
117 | into this common boot service. It is legal to call Stop() from other locations,\r | |
118 | but the following calling restrictions must be followed or the system behavior\r | |
0c323d07 | 119 | will not be deterministic.\r |
120 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
121 | same driver's Start() function.\r | |
122 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
123 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
124 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
125 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
d1102dba | 126 | \r |
0c323d07 | 127 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r |
d1102dba LG |
128 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r |
129 | support a bus specific I/O protocol for the driver\r | |
0c323d07 | 130 | to use to stop the device.\r |
131 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
132 | Not used.\r | |
d1102dba | 133 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r |
0c323d07 | 134 | if NumberOfChildren is 0.Not used.\r |
135 | \r | |
136 | @retval EFI_SUCCESS The device was stopped.\r | |
137 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
7bce0c5a | 138 | \r |
139 | **/\r | |
83cbd279 | 140 | EFI_STATUS\r |
141 | EFIAPI\r | |
142 | ArpDriverBindingStop (\r | |
143 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
144 | IN EFI_HANDLE ControllerHandle,\r | |
145 | IN UINTN NumberOfChildren,\r | |
146 | IN EFI_HANDLE *ChildHandleBuffer\r | |
147 | );\r | |
148 | \r | |
7bce0c5a | 149 | /**\r |
0c323d07 | 150 | Creates a child handle and installs a protocol.\r |
d1102dba LG |
151 | \r |
152 | The CreateChild() function installs a protocol on ChildHandle.\r | |
153 | If ChildHandle is a pointer to NULL, then a new handle is created and returned\r | |
154 | in ChildHandle. If ChildHandle is not a pointer to NULL, then the protocol\r | |
0c323d07 | 155 | installs on the existing ChildHandle.\r |
156 | \r | |
157 | @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r | |
158 | @param ChildHandle Pointer to the handle of the child to create. If it is NULL,\r | |
d1102dba | 159 | then a new handle is created. If it is a pointer to an existing\r |
0c323d07 | 160 | UEFI handle, then the protocol is added to the existing UEFI handle.\r |
161 | \r | |
162 | @retval EFI_SUCCES The protocol was added to ChildHandle.\r | |
163 | @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r | |
2048c585 | 164 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r |
0c323d07 | 165 | the child\r |
166 | @retval other The child handle was not created\r | |
7bce0c5a | 167 | \r |
168 | **/\r | |
83cbd279 | 169 | EFI_STATUS\r |
170 | EFIAPI\r | |
171 | ArpServiceBindingCreateChild (\r | |
172 | IN EFI_SERVICE_BINDING_PROTOCOL *This,\r | |
173 | IN EFI_HANDLE *ChildHandle\r | |
174 | );\r | |
175 | \r | |
7bce0c5a | 176 | /**\r |
0c323d07 | 177 | Destroys a child handle with a protocol installed on it.\r |
d1102dba LG |
178 | \r |
179 | The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r | |
180 | that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r | |
0c323d07 | 181 | last protocol on ChildHandle, then ChildHandle is destroyed.\r |
182 | \r | |
183 | @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r | |
184 | @param ChildHandle Handle of the child to destroy\r | |
185 | \r | |
186 | @retval EFI_SUCCES The protocol was removed from ChildHandle.\r | |
d1102dba | 187 | @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is\r |
0c323d07 | 188 | being removed.\r |
284ee2e8 | 189 | @retval EFI_INVALID_PARAMETER Child handle is NULL.\r |
0c323d07 | 190 | @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r |
191 | because its services are being used.\r | |
192 | @retval other The child handle was not destroyed\r | |
7bce0c5a | 193 | \r |
194 | **/\r | |
83cbd279 | 195 | EFI_STATUS\r |
196 | EFIAPI\r | |
197 | ArpServiceBindingDestroyChild (\r | |
198 | IN EFI_SERVICE_BINDING_PROTOCOL *This,\r | |
199 | IN EFI_HANDLE ChildHandle\r | |
200 | );\r | |
201 | \r | |
d354ab7f | 202 | \r |
203 | //\r | |
204 | // EFI Component Name Functions\r | |
205 | //\r | |
206 | /**\r | |
207 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
208 | \r | |
209 | This function retrieves the user readable name of a driver in the form of a\r | |
210 | Unicode string. If the driver specified by This has a user readable name in\r | |
211 | the language specified by Language, then a pointer to the driver name is\r | |
212 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
213 | by This does not support the language specified by Language,\r | |
214 | then EFI_UNSUPPORTED is returned.\r | |
215 | \r | |
c6d0ee4b | 216 | @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
d354ab7f | 217 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
218 | \r | |
c6d0ee4b | 219 | @param[in] Language A pointer to a Null-terminated ASCII string\r |
d354ab7f | 220 | array indicating the language. This is the\r |
221 | language of the driver name that the caller is\r | |
222 | requesting, and it must match one of the\r | |
223 | languages specified in SupportedLanguages. The\r | |
224 | number of languages supported by a driver is up\r | |
225 | to the driver writer. Language is specified\r | |
718a15c6 | 226 | in RFC 4646 or ISO 639-2 language code format.\r |
d354ab7f | 227 | \r |
c6d0ee4b | 228 | @param[out] DriverName A pointer to the Unicode string to return.\r |
d354ab7f | 229 | This Unicode string is the name of the\r |
230 | driver specified by This in the language\r | |
231 | specified by Language.\r | |
232 | \r | |
233 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
234 | This and the language specified by Language was\r | |
235 | returned in DriverName.\r | |
236 | \r | |
237 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
238 | \r | |
239 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
240 | \r | |
241 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
242 | the language specified by Language.\r | |
243 | \r | |
244 | **/\r | |
245 | EFI_STATUS\r | |
246 | EFIAPI\r | |
247 | ArpComponentNameGetDriverName (\r | |
248 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
249 | IN CHAR8 *Language,\r | |
250 | OUT CHAR16 **DriverName\r | |
251 | );\r | |
252 | \r | |
253 | \r | |
254 | /**\r | |
255 | Retrieves a Unicode string that is the user readable name of the controller\r | |
256 | that is being managed by a driver.\r | |
257 | \r | |
258 | This function retrieves the user readable name of the controller specified by\r | |
259 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
260 | driver specified by This has a user readable name in the language specified by\r | |
261 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
262 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
263 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
264 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
265 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
266 | \r | |
c6d0ee4b | 267 | @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
d354ab7f | 268 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
269 | \r | |
c6d0ee4b | 270 | @param[in] ControllerHandle The handle of a controller that the driver\r |
d354ab7f | 271 | specified by This is managing. This handle\r |
272 | specifies the controller whose name is to be\r | |
273 | returned.\r | |
274 | \r | |
c6d0ee4b | 275 | @param[in] ChildHandle The handle of the child controller to retrieve\r |
d354ab7f | 276 | the name of. This is an optional parameter that\r |
277 | may be NULL. It will be NULL for device\r | |
278 | drivers. It will also be NULL for a bus drivers\r | |
279 | that wish to retrieve the name of the bus\r | |
280 | controller. It will not be NULL for a bus\r | |
281 | driver that wishes to retrieve the name of a\r | |
282 | child controller.\r | |
283 | \r | |
c6d0ee4b | 284 | @param[in] Language A pointer to a Null-terminated ASCII string\r |
d354ab7f | 285 | array indicating the language. This is the\r |
286 | language of the driver name that the caller is\r | |
287 | requesting, and it must match one of the\r | |
288 | languages specified in SupportedLanguages. The\r | |
289 | number of languages supported by a driver is up\r | |
290 | to the driver writer. Language is specified in\r | |
718a15c6 | 291 | RFC 4646 or ISO 639-2 language code format.\r |
d354ab7f | 292 | \r |
c6d0ee4b | 293 | @param[out] ControllerName A pointer to the Unicode string to return.\r |
d354ab7f | 294 | This Unicode string is the name of the\r |
295 | controller specified by ControllerHandle and\r | |
296 | ChildHandle in the language specified by\r | |
297 | Language from the point of view of the driver\r | |
298 | specified by This.\r | |
299 | \r | |
300 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
301 | the language specified by Language for the\r | |
302 | driver specified by This was returned in\r | |
303 | DriverName.\r | |
304 | \r | |
284ee2e8 | 305 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
d354ab7f | 306 | \r |
307 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
308 | EFI_HANDLE.\r | |
309 | \r | |
310 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
311 | \r | |
312 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
313 | \r | |
314 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
315 | managing the controller specified by\r | |
316 | ControllerHandle and ChildHandle.\r | |
317 | \r | |
318 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
319 | the language specified by Language.\r | |
320 | \r | |
321 | **/\r | |
322 | EFI_STATUS\r | |
323 | EFIAPI\r | |
324 | ArpComponentNameGetControllerName (\r | |
325 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
326 | IN EFI_HANDLE ControllerHandle,\r | |
327 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
328 | IN CHAR8 *Language,\r | |
329 | OUT CHAR16 **ControllerName\r | |
330 | );\r | |
331 | \r | |
332 | \r | |
83cbd279 | 333 | #endif\r |
334 | \r |