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