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