]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
Clean up the private GUID definition in module Level.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
CommitLineData
779ae357 1/** @file\r
2 HII Config Access protocol implementation of VLAN configuration module.\r
3\r
083f7c69 4Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
779ae357 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#include "VlanConfigImpl.h"\r
17\r
779ae357 18CHAR16 mVlanStorageName[] = L"VlanNvData";\r
19EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting = NULL;\r
20\r
21VLAN_CONFIG_PRIVATE_DATA mVlanConfigPrivateDateTemplate = {\r
22 VLAN_CONFIG_PRIVATE_DATA_SIGNATURE,\r
23 {\r
24 VlanExtractConfig,\r
25 VlanRouteConfig,\r
26 VlanCallback\r
27 }\r
28};\r
29\r
30VENDOR_DEVICE_PATH mHiiVendorDevicePathNode = {\r
31 {\r
32 HARDWARE_DEVICE_PATH,\r
33 HW_VENDOR_DP,\r
34 {\r
35 (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
36 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
37 }\r
38 },\r
c8ad2d7a 39 VLAN_CONFIG_FORM_SET_GUID\r
779ae357 40};\r
41\r
42/**\r
43 This function allows a caller to extract the current configuration for one\r
44 or more named elements from the target driver.\r
45\r
46 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
47 @param[in] Request A null-terminated Unicode string in\r
48 <ConfigRequest> format.\r
49 @param[out] Progress On return, points to a character in the Request\r
50 string. Points to the string's null terminator if\r
51 request was successful. Points to the most recent\r
52 '&' before the first failing name/value pair (or\r
53 the beginning of the string if the failure is in\r
54 the first name/value pair) if the request was not\r
55 successful.\r
56 @param[out] Results A null-terminated Unicode string in\r
57 <ConfigAltResp> format which has all values filled\r
58 in for the names in the Request string. String to\r
59 be allocated by the called function.\r
60\r
61 @retval EFI_SUCCESS The Results is filled with the requested values.\r
62 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
5a157365 63 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
779ae357 64 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
65 driver.\r
66\r
67**/\r
68EFI_STATUS\r
69EFIAPI\r
70VlanExtractConfig (\r
71 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
72 IN CONST EFI_STRING Request,\r
73 OUT EFI_STRING *Progress,\r
74 OUT EFI_STRING *Results\r
75 )\r
76{\r
59aefb7e
LG
77 EFI_STATUS Status;\r
78 UINTN BufferSize;\r
79 VLAN_CONFIGURATION Configuration;\r
80 VLAN_CONFIG_PRIVATE_DATA *PrivateData;\r
81 EFI_STRING ConfigRequestHdr;\r
82 EFI_STRING ConfigRequest;\r
83 BOOLEAN AllocatedRequest;\r
84 UINTN Size;\r
85\r
86 if (Progress == NULL || Results == NULL) {\r
779ae357 87 return EFI_INVALID_PARAMETER;\r
88 }\r
89\r
59aefb7e 90 *Progress = Request;\r
c8ad2d7a 91 if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gVlanConfigFormSetGuid, mVlanStorageName)) {\r
59aefb7e
LG
92 return EFI_NOT_FOUND;\r
93 }\r
94\r
95 ConfigRequestHdr = NULL;\r
96 ConfigRequest = NULL;\r
97 AllocatedRequest = FALSE;\r
98 Size = 0;\r
99\r
779ae357 100 //\r
101 // Retrieve the pointer to the UEFI HII Config Routing Protocol\r
102 //\r
103 if (mHiiConfigRouting == NULL) {\r
104 gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &mHiiConfigRouting);\r
105 }\r
106 ASSERT (mHiiConfigRouting != NULL);\r
107\r
108 //\r
109 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()\r
110 //\r
59aefb7e 111 PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);\r
779ae357 112 ZeroMem (&Configuration, sizeof (VLAN_CONFIGURATION));\r
5a157365 113 BufferSize = sizeof (Configuration);\r
59aefb7e
LG
114 ConfigRequest = Request;\r
115 if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {\r
116 //\r
117 // Request has no request element, construct full request string.\r
118 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template\r
119 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator\r
120 //\r
c8ad2d7a 121 ConfigRequestHdr = HiiConstructConfigHdr (&gVlanConfigFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);\r
59aefb7e
LG
122 Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);\r
123 ConfigRequest = AllocateZeroPool (Size);\r
124 ASSERT (ConfigRequest != NULL);\r
125 AllocatedRequest = TRUE;\r
126 UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);\r
127 FreePool (ConfigRequestHdr);\r
128 }\r
129\r
779ae357 130 Status = mHiiConfigRouting->BlockToConfig (\r
131 mHiiConfigRouting,\r
59aefb7e 132 ConfigRequest,\r
779ae357 133 (UINT8 *) &Configuration,\r
134 BufferSize,\r
135 Results,\r
136 Progress\r
137 );\r
59aefb7e
LG
138 //\r
139 // Free the allocated config request string.\r
140 //\r
141 if (AllocatedRequest) {\r
142 FreePool (ConfigRequest);\r
143 ConfigRequest = NULL;\r
144 }\r
145 //\r
146 // Set Progress string to the original request string.\r
147 //\r
148 if (Request == NULL) {\r
149 *Progress = NULL;\r
150 } else if (StrStr (Request, L"OFFSET") == NULL) {\r
151 *Progress = Request + StrLen (Request);\r
152 }\r
153\r
779ae357 154 return Status;\r
155}\r
156\r
157\r
158/**\r
159 This function processes the results of changes in configuration.\r
160\r
161 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
162 @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r
163 format.\r
164 @param[out] Progress A pointer to a string filled in with the offset of\r
165 the most recent '&' before the first failing\r
166 name/value pair (or the beginning of the string if\r
167 the failure is in the first name/value pair) or\r
168 the terminating NULL if all was successful.\r
169\r
170 @retval EFI_SUCCESS The Results is processed successfully.\r
171 @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
172 @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
173 driver.\r
174\r
175**/\r
176EFI_STATUS\r
177EFIAPI\r
178VlanRouteConfig (\r
179 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
180 IN CONST EFI_STRING Configuration,\r
181 OUT EFI_STRING *Progress\r
182 )\r
183{\r
184 if (Configuration == NULL || Progress == NULL) {\r
185 return EFI_INVALID_PARAMETER;\r
186 }\r
187\r
188 *Progress = Configuration;\r
c8ad2d7a 189 if (!HiiIsConfigHdrMatch (Configuration, &gVlanConfigFormSetGuid, mVlanStorageName)) {\r
779ae357 190 return EFI_NOT_FOUND;\r
191 }\r
192\r
193 *Progress = Configuration + StrLen (Configuration);\r
194 return EFI_SUCCESS;\r
195}\r
196\r
197/**\r
198 This function processes the results of changes in configuration.\r
199\r
200 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
201 @param[in] Action Specifies the type of action taken by the browser.\r
202 @param[in] QuestionId A unique value which is sent to the original\r
203 exporting driver so that it can identify the type\r
204 of data to expect.\r
205 @param[in] Type The type of value for the question.\r
206 @param[in] Value A pointer to the data being sent to the original\r
207 exporting driver.\r
208 @param[out] ActionRequest On return, points to the action requested by the\r
209 callback function.\r
210\r
211 @retval EFI_SUCCESS The callback successfully handled the action.\r
212 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
213 variable and its data.\r
214 @retval EFI_DEVICE_ERROR The variable could not be saved.\r
215 @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
216 callback.\r
217\r
218**/\r
219EFI_STATUS\r
220EFIAPI\r
221VlanCallback (\r
222 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
223 IN EFI_BROWSER_ACTION Action,\r
224 IN EFI_QUESTION_ID QuestionId,\r
225 IN UINT8 Type,\r
226 IN EFI_IFR_TYPE_VALUE *Value,\r
227 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
228 )\r
229{\r
230 VLAN_CONFIG_PRIVATE_DATA *PrivateData;\r
231 VLAN_CONFIGURATION *Configuration;\r
232 EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;\r
233 UINTN Index;\r
234 EFI_HANDLE VlanHandle;\r
235\r
236 PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);\r
237\r
9ea13d79 238 if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
779ae357 239 return EFI_SUCCESS;\r
240 }\r
241\r
083f7c69 242 if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
779ae357 243 //\r
083f7c69 244 // Get Browser data\r
779ae357 245 //\r
083f7c69
ED
246 Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));\r
247 ASSERT (Configuration != NULL);\r
c8ad2d7a 248 HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);\r
779ae357 249\r
083f7c69
ED
250 VlanConfig = PrivateData->VlanConfig;\r
251\r
252 switch (QuestionId) {\r
253 case VLAN_ADD_QUESTION_ID:\r
779ae357 254 //\r
083f7c69 255 // Add a VLAN\r
779ae357 256 //\r
083f7c69
ED
257 VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);\r
258 VlanUpdateForm (PrivateData);\r
779ae357 259\r
083f7c69
ED
260 //\r
261 // Connect the newly created VLAN device\r
262 //\r
263 VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);\r
264 if (VlanHandle == NULL) {\r
779ae357 265 //\r
083f7c69 266 // There may be no child handle created for VLAN ID 0, connect the parent handle\r
779ae357 267 //\r
083f7c69 268 VlanHandle = PrivateData->ControllerHandle;\r
779ae357 269 }\r
083f7c69 270 gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);\r
779ae357 271\r
779ae357 272 //\r
083f7c69 273 // Clear UI data\r
779ae357 274 //\r
cd3d9a85 275 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
083f7c69
ED
276 Configuration->VlanId = 0;\r
277 Configuration->Priority = 0;\r
278 break;\r
779ae357 279\r
083f7c69
ED
280 case VLAN_REMOVE_QUESTION_ID:\r
281 //\r
282 // Remove VLAN\r
283 //\r
284 ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);\r
285 for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {\r
286 if (Configuration->VlanList[Index] != 0) {\r
287 //\r
288 // Checkbox is selected, need remove this VLAN\r
289 //\r
290 VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);\r
291 }\r
292 }\r
779ae357 293\r
083f7c69
ED
294 VlanUpdateForm (PrivateData);\r
295 if (PrivateData->NumberOfVlan == 0) {\r
296 //\r
297 // No VLAN device now, connect the physical NIC handle.\r
298 // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()\r
299 //\r
300 gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);\r
301 }\r
302\r
cd3d9a85 303 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
083f7c69
ED
304 ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);\r
305 break;\r
306\r
9ea13d79 307 case VLAN_UPDATE_QUESTION_ID:\r
308 //\r
309 // Update current VLAN list into Form.\r
310 //\r
311 VlanUpdateForm (PrivateData);\r
312 break;\r
313\r
083f7c69
ED
314 default:\r
315 break;\r
316 }\r
317\r
c8ad2d7a 318 HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);\r
083f7c69
ED
319 FreePool (Configuration);\r
320 return EFI_SUCCESS;\r
779ae357 321 }\r
322\r
083f7c69
ED
323 //\r
324 // All other action return unsupported.\r
325 //\r
326 return EFI_UNSUPPORTED;\r
779ae357 327}\r
328\r
329\r
330/**\r
331 This function update VLAN list in the VLAN configuration Form.\r
332\r
333 @param[in, out] PrivateData Points to VLAN configuration private data.\r
334\r
335**/\r
336VOID\r
337VlanUpdateForm (\r
338 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
339 )\r
340{\r
341 EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;\r
342 UINT16 NumberOfVlan;\r
343 UINTN Index;\r
344 EFI_VLAN_FIND_DATA *VlanData;\r
345 VOID *StartOpCodeHandle;\r
346 EFI_IFR_GUID_LABEL *StartLabel;\r
347 VOID *EndOpCodeHandle;\r
348 EFI_IFR_GUID_LABEL *EndLabel;\r
349 CHAR16 *String;\r
350 CHAR16 VlanStr[30];\r
351 CHAR16 VlanIdStr[6];\r
352 UINTN DigitalCount;\r
353 EFI_STRING_ID StringId;\r
354\r
355 //\r
356 // Find current VLAN configuration\r
357 //\r
358 VlanData = NULL;\r
359 NumberOfVlan = 0;\r
360 VlanConfig = PrivateData->VlanConfig;\r
361 VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData);\r
362\r
363 //\r
364 // Update VLAN configuration in PrivateData\r
365 //\r
366 if (NumberOfVlan > MAX_VLAN_NUMBER) {\r
367 NumberOfVlan = MAX_VLAN_NUMBER;\r
368 }\r
369 PrivateData->NumberOfVlan = NumberOfVlan;\r
370\r
371 //\r
372 // Init OpCode Handle\r
373 //\r
374 StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
375 ASSERT (StartOpCodeHandle != NULL);\r
376\r
377 EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
378 ASSERT (EndOpCodeHandle != NULL);\r
379\r
380 //\r
381 // Create Hii Extend Label OpCode as the start opcode\r
382 //\r
383 StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (\r
384 StartOpCodeHandle,\r
385 &gEfiIfrTianoGuid,\r
386 NULL,\r
387 sizeof (EFI_IFR_GUID_LABEL)\r
388 );\r
389 StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
390 StartLabel->Number = LABEL_VLAN_LIST;\r
391\r
392 //\r
393 // Create Hii Extend Label OpCode as the end opcode\r
394 //\r
395 EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (\r
396 EndOpCodeHandle,\r
397 &gEfiIfrTianoGuid,\r
398 NULL,\r
399 sizeof (EFI_IFR_GUID_LABEL)\r
400 );\r
401 EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
402 EndLabel->Number = LABEL_END;\r
403\r
404 ZeroMem (PrivateData->VlanId, MAX_VLAN_NUMBER);\r
405 for (Index = 0; Index < NumberOfVlan; Index++) {\r
406 String = VlanStr;\r
407\r
408 StrCpy (String, L" VLAN ID:");\r
409 String += 10;\r
410 //\r
411 // Pad VlanId string up to 4 characters with space\r
412 //\r
413 DigitalCount = UnicodeValueToString (VlanIdStr, 0, VlanData[Index].VlanId, 5);\r
414 SetMem16 (String, (4 - DigitalCount) * sizeof (CHAR16), L' ');\r
415 StrCpy (String + 4 - DigitalCount, VlanIdStr);\r
416 String += 4;\r
417\r
418 StrCpy (String, L", Priority:");\r
419 String += 11;\r
420 String += UnicodeValueToString (String, 0, VlanData[Index].Priority, 4);\r
421 *String = 0;\r
422\r
423 StringId = HiiSetString (PrivateData->HiiHandle, 0, VlanStr, NULL);\r
424 ASSERT (StringId != 0);\r
425\r
426 HiiCreateCheckBoxOpCode (\r
427 StartOpCodeHandle,\r
428 (EFI_QUESTION_ID) (VLAN_LIST_VAR_OFFSET + Index),\r
429 VLAN_CONFIGURATION_VARSTORE_ID,\r
430 (UINT16) (VLAN_LIST_VAR_OFFSET + Index),\r
431 StringId,\r
432 STRING_TOKEN (STR_VLAN_VLAN_LIST_HELP),\r
433 0,\r
434 0,\r
435 NULL\r
436 );\r
437\r
438 //\r
439 // Save VLAN id to private data\r
440 //\r
441 PrivateData->VlanId[Index] = VlanData[Index].VlanId;\r
442 }\r
443\r
444 HiiUpdateForm (\r
445 PrivateData->HiiHandle, // HII handle\r
c8ad2d7a 446 &gVlanConfigFormSetGuid, // Formset GUID\r
779ae357 447 VLAN_CONFIGURATION_FORM_ID, // Form ID\r
448 StartOpCodeHandle, // Label for where to insert opcodes\r
449 EndOpCodeHandle // Replace data\r
450 );\r
451\r
452 HiiFreeOpCodeHandle (StartOpCodeHandle);\r
453 HiiFreeOpCodeHandle (EndOpCodeHandle);\r
454\r
455 if (VlanData != NULL) {\r
456 FreePool (VlanData);\r
457 }\r
458}\r
459\r
460\r
461/**\r
462 This function publish the VLAN configuration Form for a network device. The\r
463 HII Config Access protocol will be installed on a child handle of the network\r
464 device.\r
465\r
466 @param[in, out] PrivateData Points to VLAN configuration private data.\r
467\r
468 @retval EFI_SUCCESS HII Form is installed for this network device.\r
469 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r
470 @retval Others Other errors as indicated.\r
471\r
472**/\r
473EFI_STATUS\r
474InstallVlanConfigForm (\r
475 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
476 )\r
477{\r
478 EFI_STATUS Status;\r
479 EFI_HII_HANDLE HiiHandle;\r
480 EFI_HANDLE DriverHandle;\r
e2851998 481 CHAR16 Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];\r
779ae357 482 CHAR16 *MacString;\r
483 EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;\r
484 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
485\r
486 //\r
487 // Create child handle and install HII Config Access Protocol\r
488 //\r
489 ChildDevicePath = AppendDevicePathNode (\r
490 PrivateData->ParentDevicePath,\r
491 (CONST EFI_DEVICE_PATH_PROTOCOL *) &mHiiVendorDevicePathNode\r
492 );\r
493 if (ChildDevicePath == NULL) {\r
494 return EFI_OUT_OF_RESOURCES;\r
495 }\r
496 PrivateData->ChildDevicePath = ChildDevicePath;\r
497\r
498 DriverHandle = NULL;\r
499 ConfigAccess = &PrivateData->ConfigAccess;\r
500 Status = gBS->InstallMultipleProtocolInterfaces (\r
501 &DriverHandle,\r
502 &gEfiDevicePathProtocolGuid,\r
503 ChildDevicePath,\r
504 &gEfiHiiConfigAccessProtocolGuid,\r
505 ConfigAccess,\r
506 NULL\r
507 );\r
508 if (EFI_ERROR (Status)) {\r
509 return Status;\r
510 }\r
511 PrivateData->DriverHandle = DriverHandle;\r
512\r
513 //\r
514 // Publish the HII package list\r
515 //\r
516 HiiHandle = HiiAddPackages (\r
c8ad2d7a 517 &gVlanConfigFormSetGuid,\r
779ae357 518 DriverHandle,\r
519 VlanConfigDxeStrings,\r
520 VlanConfigBin,\r
521 NULL\r
522 );\r
523 if (HiiHandle == NULL) {\r
524 return EFI_OUT_OF_RESOURCES;\r
525 }\r
526 PrivateData->HiiHandle = HiiHandle;\r
527\r
528 //\r
3ddc4cf2 529 // Update formset title help string.\r
779ae357 530 //\r
531 MacString = NULL;\r
532 Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);\r
533 if (EFI_ERROR (Status)) {\r
534 return Status;\r
535 }\r
536 PrivateData->MacString = MacString;\r
537\r
538 StrCpy (Str, L"VLAN Configuration (MAC:");\r
1b2bf3ca 539 StrnCat (Str, MacString, sizeof (EFI_MAC_ADDRESS) * 2);\r
779ae357 540 StrCat (Str, L")");\r
541 HiiSetString (\r
542 HiiHandle,\r
c7f204db 543 STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),\r
779ae357 544 Str,\r
545 NULL\r
546 );\r
547\r
548 //\r
3ddc4cf2 549 // Update form title help string.\r
779ae357 550 //\r
551 HiiSetString (\r
552 HiiHandle,\r
c7f204db 553 STRING_TOKEN (STR_VLAN_FORM_HELP),\r
779ae357 554 Str,\r
555 NULL\r
556 );\r
557\r
558 return EFI_SUCCESS;\r
559}\r
560\r
561/**\r
562 This function remove the VLAN configuration Form for a network device. The\r
563 child handle for HII Config Access protocol will be destroyed.\r
564\r
565 @param[in, out] PrivateData Points to VLAN configuration private data.\r
566\r
567**/\r
568VOID\r
569UninstallVlanConfigForm (\r
570 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
571 )\r
572{\r
573 //\r
574 // Free MAC string\r
575 //\r
576 if (PrivateData->MacString != NULL) {\r
577 FreePool (PrivateData->MacString);\r
578 PrivateData->MacString = NULL;\r
579 }\r
580\r
581 //\r
582 // Uninstall HII package list\r
583 //\r
584 if (PrivateData->HiiHandle != NULL) {\r
585 HiiRemovePackages (PrivateData->HiiHandle);\r
586 PrivateData->HiiHandle = NULL;\r
587 }\r
588\r
589 //\r
590 // Uninstall HII Config Access Protocol\r
591 //\r
592 if (PrivateData->DriverHandle != NULL) {\r
593 gBS->UninstallMultipleProtocolInterfaces (\r
594 PrivateData->DriverHandle,\r
595 &gEfiDevicePathProtocolGuid,\r
596 PrivateData->ChildDevicePath,\r
597 &gEfiHiiConfigAccessProtocolGuid,\r
598 &PrivateData->ConfigAccess,\r
599 NULL\r
600 );\r
601 PrivateData->DriverHandle = NULL;\r
602\r
603 if (PrivateData->ChildDevicePath != NULL) {\r
604 FreePool (PrivateData->ChildDevicePath);\r
605 PrivateData->ChildDevicePath = NULL;\r
606 }\r
607 }\r
608}\r