]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.h
1. Correct File header to ## @file
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.h
CommitLineData
779ae357 1/** @file\r
2 Header file for driver binding protocol and HII config access protocol.\r
3\r
4Copyright (c) 2009, Intel Corporation.<BR>\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions\r
7of the BSD License which accompanies this distribution. The full\r
8text of the license may be found at<BR>\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT 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
42extern EFI_COMPONENT_NAME2_PROTOCOL gVlanConfigComponentName2;\r
43extern EFI_COMPONENT_NAME_PROTOCOL gVlanConfigComponentName;\r
44\r
45//\r
46// Tool generated IFR binary data and String package data\r
47//\r
48extern UINT8 VlanConfigBin[];\r
49extern UINT8 VlanConfigDxeStrings[];\r
50\r
51#define VLAN_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (VLAN_CONFIGURATION, VlanList))\r
52\r
53typedef 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
74extern 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
111EFI_STATUS\r
112EFIAPI\r
113VlanConfigComponentNameGetDriverName (\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
165 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
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
177EFI_STATUS\r
178EFIAPI\r
179VlanConfigComponentNameGetControllerName (\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
200EFI_STATUS\r
201EFIAPI\r
202VlanConfigDriverBindingSupported (\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
221EFI_STATUS\r
222EFIAPI\r
223VlanConfigDriverBindingStart (\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
242EFI_STATUS\r
243EFIAPI\r
244VlanConfigDriverBindingStop (\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
257VOID\r
258VlanUpdateForm (\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
274EFI_STATUS\r
275InstallVlanConfigForm (\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
285**/\r
286VOID\r
287UninstallVlanConfigForm (\r
288 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
289 );\r
290\r
291/**\r
292 This function allows a caller to extract the current configuration for one\r
293 or more named elements from the target driver.\r
294\r
295 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
296 @param[in] Request A null-terminated Unicode string in\r
297 <ConfigRequest> format.\r
298 @param[out] Progress On return, points to a character in the Request\r
299 string. Points to the string's null terminator if\r
300 request was successful. Points to the most recent\r
301 '&' before the first failing name/value pair (or\r
302 the beginning of the string if the failure is in\r
303 the first name/value pair) if the request was not\r
304 successful.\r
305 @param[out] Results A null-terminated Unicode string in\r
306 <ConfigAltResp> format which has all values filled\r
307 in for the names in the Request string. String to\r
308 be allocated by the called function.\r
309\r
310 @retval EFI_SUCCESS The Results is filled with the requested values.\r
311 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
312 @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
313 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
314 driver.\r
315\r
316**/\r
317EFI_STATUS\r
318EFIAPI\r
319VlanExtractConfig (\r
320 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
321 IN CONST EFI_STRING Request,\r
322 OUT EFI_STRING *Progress,\r
323 OUT EFI_STRING *Results\r
324 );\r
325\r
326/**\r
327 This function processes the results of changes in configuration.\r
328\r
329 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
330 @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r
331 format.\r
332 @param[out] Progress A pointer to a string filled in with the offset of\r
333 the most recent '&' before the first failing\r
334 name/value pair (or the beginning of the string if\r
335 the failure is in the first name/value pair) or\r
336 the terminating NULL if all was successful.\r
337\r
338 @retval EFI_SUCCESS The Results is processed successfully.\r
339 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
340 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
341 driver.\r
342\r
343**/\r
344EFI_STATUS\r
345EFIAPI\r
346VlanRouteConfig (\r
347 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
348 IN CONST EFI_STRING Configuration,\r
349 OUT EFI_STRING *Progress\r
350 );\r
351\r
352/**\r
353 This function processes the results of changes in configuration.\r
354\r
355 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
356 @param[in] Action Specifies the type of action taken by the browser.\r
357 @param[in] QuestionId A unique value which is sent to the original\r
358 exporting driver so that it can identify the type\r
359 of data to expect.\r
360 @param[in] Type The type of value for the question.\r
361 @param[in] Value A pointer to the data being sent to the original\r
362 exporting driver.\r
363 @param[out] ActionRequest On return, points to the action requested by the\r
364 callback function.\r
365\r
366 @retval EFI_SUCCESS The callback successfully handled the action.\r
367 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
368 variable and its data.\r
369 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
370 @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
371 callback.\r
372\r
373**/\r
374EFI_STATUS\r
375EFIAPI\r
376VlanCallback (\r
377 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
378 IN EFI_BROWSER_ACTION Action,\r
379 IN EFI_QUESTION_ID QuestionId,\r
380 IN UINT8 Type,\r
381 IN EFI_IFR_TYPE_VALUE *Value,\r
382 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
383 );\r
384\r
385#endif\r