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