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