]>
Commit | Line | Data |
---|---|---|
779ae357 | 1 | /** @file\r |
2 | Header file for driver binding protocol and HII config access protocol.\r | |
3 | \r | |
ca4e58d8 | 4 | Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r |
e5eed7d3 | 5 | This program and the accompanying materials\r |
779ae357 | 6 | are licensed and made available under the terms and conditions\r |
7 | of the BSD License which accompanies this distribution. The full\r | |
8 | text of the license may be found at<BR>\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __VLAN_CONFIG_IMPL_H__\r | |
17 | #define __VLAN_CONFIG_IMPL_H__\r | |
18 | \r | |
19 | #include <Uefi.h>\r | |
20 | \r | |
21 | #include <Protocol/ComponentName.h>\r | |
22 | #include <Protocol/ComponentName2.h>\r | |
23 | #include <Protocol/HiiConfigAccess.h>\r | |
24 | #include <Protocol/HiiConfigRouting.h>\r | |
25 | #include <Protocol/VlanConfig.h>\r | |
26 | \r | |
27 | #include <Library/BaseLib.h>\r | |
28 | #include <Library/BaseMemoryLib.h>\r | |
29 | #include <Library/DebugLib.h>\r | |
30 | #include <Library/MemoryAllocationLib.h>\r | |
31 | #include <Library/UefiBootServicesTableLib.h>\r | |
32 | #include <Library/UefiLib.h>\r | |
33 | #include <Library/NetLib.h>\r | |
34 | #include <Library/HiiLib.h>\r | |
35 | #include <Library/DevicePathLib.h>\r | |
36 | #include <Library/PrintLib.h>\r | |
37 | \r | |
38 | #include <Guid/MdeModuleHii.h>\r | |
39 | \r | |
40 | #include "VlanConfigNvData.h"\r | |
41 | \r | |
42 | extern EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2;\r | |
43 | extern EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName;\r | |
44 | \r | |
45 | //\r | |
46 | // Tool generated IFR binary data and String package data\r | |
47 | //\r | |
48 | extern UINT8 VlanConfigBin[];\r | |
49 | extern UINT8 VlanConfigDxeStrings[];\r | |
50 | \r | |
51 | #define VLAN_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (VLAN_CONFIGURATION, VlanList))\r | |
52 | \r | |
53 | typedef struct {\r | |
54 | UINTN Signature;\r | |
55 | \r | |
56 | EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r | |
57 | EFI_HII_HANDLE HiiHandle;\r | |
58 | EFI_HANDLE DriverHandle;\r | |
59 | EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;\r | |
60 | \r | |
61 | EFI_HANDLE ControllerHandle;\r | |
62 | EFI_HANDLE ImageHandle;\r | |
63 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r | |
64 | EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;\r | |
65 | CHAR16 *MacString;\r | |
66 | \r | |
67 | UINT16 NumberOfVlan;\r | |
68 | UINT16 VlanId[MAX_VLAN_NUMBER];\r | |
69 | } VLAN_CONFIG_PRIVATE_DATA;\r | |
70 | \r | |
71 | #define VLAN_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('V', 'C', 'P', 'D')\r | |
72 | #define VLAN_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, VLAN_CONFIG_PRIVATE_DATA, ConfigAccess, VLAN_CONFIG_PRIVATE_DATA_SIGNATURE)\r | |
73 | \r | |
74 | extern VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate;\r | |
75 | \r | |
76 | \r | |
77 | /**\r | |
78 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
79 | \r | |
80 | This function retrieves the user readable name of a driver in the form of a\r | |
81 | Unicode string. If the driver specified by This has a user readable name in\r | |
82 | the language specified by Language, then a pointer to the driver name is\r | |
83 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
84 | by This does not support the language specified by Language,\r | |
85 | then EFI_UNSUPPORTED is returned.\r | |
86 | \r | |
87 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
88 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
89 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
90 | array indicating the language. This is the\r | |
91 | language of the driver name that the caller is\r | |
92 | requesting, and it must match one of the\r | |
93 | languages specified in SupportedLanguages. The\r | |
94 | number of languages supported by a driver is up\r | |
95 | to the driver writer. Language is specified\r | |
96 | in RFC 4646 or ISO 639-2 language code format.\r | |
97 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
98 | This Unicode string is the name of the\r | |
99 | driver specified by This in the language\r | |
100 | specified by Language.\r | |
101 | \r | |
102 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
103 | This and the language specified by Language was\r | |
104 | returned in DriverName.\r | |
105 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
106 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
107 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
108 | the language specified by Language.\r | |
109 | \r | |
110 | **/\r | |
111 | EFI_STATUS\r | |
112 | EFIAPI\r | |
113 | VlanConfigComponentNameGetDriverName (\r | |
114 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
115 | IN CHAR8 *Language,\r | |
116 | OUT CHAR16 **DriverName\r | |
117 | );\r | |
118 | \r | |
119 | /**\r | |
120 | Retrieves a Unicode string that is the user readable name of the controller\r | |
121 | that is being managed by a driver.\r | |
122 | \r | |
123 | This function retrieves the user readable name of the controller specified by\r | |
124 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
125 | driver specified by This has a user readable name in the language specified by\r | |
126 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
127 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
128 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
129 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
130 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
131 | \r | |
132 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
133 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
134 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
135 | specified by This is managing. This handle\r | |
136 | specifies the controller whose name is to be\r | |
137 | returned.\r | |
138 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
139 | the name of. This is an optional parameter that\r | |
140 | may be NULL. It will be NULL for device\r | |
141 | drivers. It will also be NULL for a bus drivers\r | |
142 | that wish to retrieve the name of the bus\r | |
143 | controller. It will not be NULL for a bus\r | |
144 | driver that wishes to retrieve the name of a\r | |
145 | child controller.\r | |
146 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
147 | array indicating the language. This is the\r | |
148 | language of the driver name that the caller is\r | |
149 | requesting, and it must match one of the\r | |
150 | languages specified in SupportedLanguages. The\r | |
151 | number of languages supported by a driver is up\r | |
152 | to the driver writer. Language is specified in\r | |
153 | RFC 4646 or ISO 639-2 language code format.\r | |
154 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
155 | This Unicode string is the name of the\r | |
156 | controller specified by ControllerHandle and\r | |
157 | ChildHandle in the language specified by\r | |
158 | Language from the point of view of the driver\r | |
159 | specified by This.\r | |
160 | \r | |
161 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
162 | the language specified by Language for the\r | |
163 | driver specified by This was returned in\r | |
164 | DriverName.\r | |
284ee2e8 | 165 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
779ae357 | 166 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r |
167 | EFI_HANDLE.\r | |
168 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
169 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
170 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
171 | managing the controller specified by\r | |
172 | ControllerHandle and ChildHandle.\r | |
173 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
174 | the language specified by Language.\r | |
175 | \r | |
176 | **/\r | |
177 | EFI_STATUS\r | |
178 | EFIAPI\r | |
179 | VlanConfigComponentNameGetControllerName (\r | |
180 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
181 | IN EFI_HANDLE ControllerHandle,\r | |
182 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
183 | IN CHAR8 *Language,\r | |
184 | OUT CHAR16 **ControllerName\r | |
185 | );\r | |
186 | \r | |
187 | /**\r | |
188 | Test to see if this driver supports ControllerHandle.\r | |
189 | \r | |
190 | @param[in] This Protocol instance pointer.\r | |
191 | @param[in] ControllerHandle Handle of device to test\r | |
192 | @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r | |
193 | device to start.\r | |
194 | \r | |
195 | @retval EFI_SUCCES This driver supports this device\r | |
196 | @retval EFI_ALREADY_STARTED This driver is already running on this device\r | |
197 | @retval other This driver does not support this device\r | |
198 | \r | |
199 | **/\r | |
200 | EFI_STATUS\r | |
201 | EFIAPI\r | |
202 | VlanConfigDriverBindingSupported (\r | |
203 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
204 | IN EFI_HANDLE ControllerHandle,\r | |
205 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
206 | );\r | |
207 | \r | |
208 | /**\r | |
209 | Start this driver on ControllerHandle.\r | |
210 | \r | |
211 | @param[in] This Protocol instance pointer.\r | |
212 | @param[in] ControllerHandle Handle of device to bind driver to\r | |
213 | @param[in] RemainingDevicePath Optional parameter use to pick a specific child\r | |
214 | device to start.\r | |
215 | \r | |
216 | @retval EFI_SUCCES This driver is added to ControllerHandle\r | |
217 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
218 | @retval other This driver does not support this device\r | |
219 | \r | |
220 | **/\r | |
221 | EFI_STATUS\r | |
222 | EFIAPI\r | |
223 | VlanConfigDriverBindingStart (\r | |
224 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
225 | IN EFI_HANDLE ControllerHandle,\r | |
226 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
227 | );\r | |
228 | \r | |
229 | /**\r | |
230 | Stop this driver on ControllerHandle.\r | |
231 | \r | |
232 | @param[in] This Protocol instance pointer.\r | |
233 | @param[in] ControllerHandle Handle of device to stop driver on\r | |
234 | @param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number\r | |
235 | of children is zero stop the entire bus driver.\r | |
236 | @param[in] ChildHandleBuffer List of Child Handles to Stop.\r | |
237 | \r | |
238 | @retval EFI_SUCCES This driver is removed ControllerHandle\r | |
239 | @retval other This driver was not removed from this device\r | |
240 | \r | |
241 | **/\r | |
242 | EFI_STATUS\r | |
243 | EFIAPI\r | |
244 | VlanConfigDriverBindingStop (\r | |
245 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
246 | IN EFI_HANDLE ControllerHandle,\r | |
247 | IN UINTN NumberOfChildren,\r | |
248 | IN EFI_HANDLE *ChildHandleBuffer\r | |
249 | );\r | |
250 | \r | |
251 | /**\r | |
252 | This function update VLAN list in the VLAN configuration Form.\r | |
253 | \r | |
254 | @param[in, out] PrivateData Points to VLAN configuration private data.\r | |
255 | \r | |
256 | **/\r | |
257 | VOID\r | |
258 | VlanUpdateForm (\r | |
259 | IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r | |
260 | );\r | |
261 | \r | |
262 | /**\r | |
263 | This function publish the VLAN configuration Form for a network device. The\r | |
264 | HII Config Access protocol will be installed on a child handle of the network\r | |
265 | device.\r | |
266 | \r | |
267 | @param[in, out] PrivateData Points to VLAN configuration private data.\r | |
268 | \r | |
269 | @retval EFI_SUCCESS HII Form is installed for this network device.\r | |
270 | @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r | |
271 | @retval Others Other errors as indicated.\r | |
272 | \r | |
273 | **/\r | |
274 | EFI_STATUS\r | |
275 | InstallVlanConfigForm (\r | |
276 | IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r | |
277 | );\r | |
278 | \r | |
279 | /**\r | |
280 | This function remove the VLAN configuration Form for a network device. The\r | |
281 | child handle for HII Config Access protocol will be destroyed.\r | |
282 | \r | |
283 | @param[in, out] PrivateData Points to VLAN configuration private data.\r | |
284 | \r | |
ca4e58d8 FS |
285 | @retval EFI_SUCCESS HII Form has been uninstalled successfully.\r |
286 | @retval Others Other errors as indicated.\r | |
287 | \r | |
779ae357 | 288 | **/\r |
ca4e58d8 | 289 | EFI_STATUS\r |
779ae357 | 290 | UninstallVlanConfigForm (\r |
291 | IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r | |
292 | );\r | |
293 | \r | |
294 | /**\r | |
295 | This function allows a caller to extract the current configuration for one\r | |
296 | or more named elements from the target driver.\r | |
297 | \r | |
298 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
299 | @param[in] Request A null-terminated Unicode string in\r | |
300 | <ConfigRequest> format.\r | |
301 | @param[out] Progress On return, points to a character in the Request\r | |
302 | string. Points to the string's null terminator if\r | |
303 | request was successful. Points to the most recent\r | |
304 | '&' before the first failing name/value pair (or\r | |
305 | the beginning of the string if the failure is in\r | |
306 | the first name/value pair) if the request was not\r | |
307 | successful.\r | |
308 | @param[out] Results A null-terminated Unicode string in\r | |
309 | <ConfigAltResp> format which has all values filled\r | |
310 | in for the names in the Request string. String to\r | |
311 | be allocated by the called function.\r | |
312 | \r | |
313 | @retval EFI_SUCCESS The Results is filled with the requested values.\r | |
314 | @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r | |
315 | @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r | |
316 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r | |
317 | driver.\r | |
318 | \r | |
319 | **/\r | |
320 | EFI_STATUS\r | |
321 | EFIAPI\r | |
322 | VlanExtractConfig (\r | |
323 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
324 | IN CONST EFI_STRING Request,\r | |
325 | OUT EFI_STRING *Progress,\r | |
326 | OUT EFI_STRING *Results\r | |
327 | );\r | |
328 | \r | |
329 | /**\r | |
330 | This function processes the results of changes in configuration.\r | |
331 | \r | |
332 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
333 | @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r | |
334 | format.\r | |
335 | @param[out] Progress A pointer to a string filled in with the offset of\r | |
336 | the most recent '&' before the first failing\r | |
337 | name/value pair (or the beginning of the string if\r | |
338 | the failure is in the first name/value pair) or\r | |
339 | the terminating NULL if all was successful.\r | |
340 | \r | |
341 | @retval EFI_SUCCESS The Results is processed successfully.\r | |
342 | @retval EFI_INVALID_PARAMETER Configuration is NULL.\r | |
343 | @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r | |
344 | driver.\r | |
345 | \r | |
346 | **/\r | |
347 | EFI_STATUS\r | |
348 | EFIAPI\r | |
349 | VlanRouteConfig (\r | |
350 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
351 | IN CONST EFI_STRING Configuration,\r | |
352 | OUT EFI_STRING *Progress\r | |
353 | );\r | |
354 | \r | |
355 | /**\r | |
356 | This function processes the results of changes in configuration.\r | |
357 | \r | |
358 | @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r | |
359 | @param[in] Action Specifies the type of action taken by the browser.\r | |
360 | @param[in] QuestionId A unique value which is sent to the original\r | |
361 | exporting driver so that it can identify the type\r | |
362 | of data to expect.\r | |
363 | @param[in] Type The type of value for the question.\r | |
364 | @param[in] Value A pointer to the data being sent to the original\r | |
365 | exporting driver.\r | |
366 | @param[out] ActionRequest On return, points to the action requested by the\r | |
367 | callback function.\r | |
368 | \r | |
369 | @retval EFI_SUCCESS The callback successfully handled the action.\r | |
370 | @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r | |
371 | variable and its data.\r | |
372 | @retval EFI_DEVICE_ERROR The variable could not be saved.\r | |
373 | @retval EFI_UNSUPPORTED The specified Action is not supported by the\r | |
374 | callback.\r | |
375 | \r | |
376 | **/\r | |
377 | EFI_STATUS\r | |
378 | EFIAPI\r | |
379 | VlanCallback (\r | |
380 | IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r | |
381 | IN EFI_BROWSER_ACTION Action,\r | |
382 | IN EFI_QUESTION_ID QuestionId,\r | |
383 | IN UINT8 Type,\r | |
384 | IN EFI_IFR_TYPE_VALUE *Value,\r | |
385 | OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r | |
386 | );\r | |
387 | \r | |
388 | #endif\r |