]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
1. Add EFI_COMPONENT_NAME2_PROTOCOL support for UNDI driver.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
... / ...
CommitLineData
1/** @file\r
2 HII Config Access protocol implementation of VLAN configuration module.\r
3\r
4Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
5This 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#include "VlanConfigImpl.h"\r
17\r
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
39 VLAN_CONFIG_FORM_SET_GUID\r
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
63 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
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
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
87 return EFI_INVALID_PARAMETER;\r
88 }\r
89\r
90 *Progress = Request;\r
91 if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gVlanConfigFormSetGuid, mVlanStorageName)) {\r
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
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
111 PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);\r
112 ZeroMem (&Configuration, sizeof (VLAN_CONFIGURATION));\r
113 BufferSize = sizeof (Configuration);\r
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
121 ConfigRequestHdr = HiiConstructConfigHdr (&gVlanConfigFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);\r
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
130 Status = mHiiConfigRouting->BlockToConfig (\r
131 mHiiConfigRouting,\r
132 ConfigRequest,\r
133 (UINT8 *) &Configuration,\r
134 BufferSize,\r
135 Results,\r
136 Progress\r
137 );\r
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
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
189 if (!HiiIsConfigHdrMatch (Configuration, &gVlanConfigFormSetGuid, mVlanStorageName)) {\r
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
238 if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
239 return EFI_SUCCESS;\r
240 }\r
241\r
242 if ((Action != EFI_BROWSER_ACTION_CHANGED) && (Action != EFI_BROWSER_ACTION_CHANGING)) {\r
243 //\r
244 // All other action return unsupported.\r
245 //\r
246 return EFI_UNSUPPORTED;\r
247 }\r
248\r
249 //\r
250 // Get Browser data\r
251 //\r
252 Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));\r
253 ASSERT (Configuration != NULL);\r
254 HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);\r
255\r
256 VlanConfig = PrivateData->VlanConfig;\r
257\r
258 if (Action == EFI_BROWSER_ACTION_CHANGED) {\r
259 switch (QuestionId) {\r
260 case VLAN_ADD_QUESTION_ID:\r
261 //\r
262 // Add a VLAN\r
263 //\r
264 VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);\r
265 VlanUpdateForm (PrivateData);\r
266\r
267 //\r
268 // Connect the newly created VLAN device\r
269 //\r
270 VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);\r
271 if (VlanHandle == NULL) {\r
272 //\r
273 // There may be no child handle created for VLAN ID 0, connect the parent handle\r
274 //\r
275 VlanHandle = PrivateData->ControllerHandle;\r
276 }\r
277 gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);\r
278\r
279 //\r
280 // Clear UI data\r
281 //\r
282 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
283 Configuration->VlanId = 0;\r
284 Configuration->Priority = 0;\r
285 break;\r
286\r
287 case VLAN_REMOVE_QUESTION_ID:\r
288 //\r
289 // Remove VLAN\r
290 //\r
291 ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);\r
292 for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {\r
293 if (Configuration->VlanList[Index] != 0) {\r
294 //\r
295 // Checkbox is selected, need remove this VLAN\r
296 //\r
297 VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);\r
298 }\r
299 }\r
300\r
301 VlanUpdateForm (PrivateData);\r
302 if (PrivateData->NumberOfVlan == 0) {\r
303 //\r
304 // No VLAN device now, connect the physical NIC handle.\r
305 // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()\r
306 //\r
307 gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);\r
308 }\r
309\r
310 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
311 ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);\r
312 break;\r
313\r
314 default:\r
315 break;\r
316 }\r
317 } else if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
318 switch (QuestionId) {\r
319 case VLAN_UPDATE_QUESTION_ID:\r
320 //\r
321 // Update current VLAN list into Form.\r
322 //\r
323 VlanUpdateForm (PrivateData);\r
324 break;\r
325\r
326 default:\r
327 break;\r
328 }\r
329 }\r
330 \r
331 HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);\r
332 FreePool (Configuration);\r
333 return EFI_SUCCESS;\r
334}\r
335\r
336\r
337/**\r
338 This function update VLAN list in the VLAN configuration Form.\r
339\r
340 @param[in, out] PrivateData Points to VLAN configuration private data.\r
341\r
342**/\r
343VOID\r
344VlanUpdateForm (\r
345 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
346 )\r
347{\r
348 EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;\r
349 UINT16 NumberOfVlan;\r
350 UINTN Index;\r
351 EFI_VLAN_FIND_DATA *VlanData;\r
352 VOID *StartOpCodeHandle;\r
353 EFI_IFR_GUID_LABEL *StartLabel;\r
354 VOID *EndOpCodeHandle;\r
355 EFI_IFR_GUID_LABEL *EndLabel;\r
356 CHAR16 *String;\r
357 CHAR16 VlanStr[30];\r
358 CHAR16 VlanIdStr[6];\r
359 UINTN DigitalCount;\r
360 EFI_STRING_ID StringId;\r
361\r
362 //\r
363 // Find current VLAN configuration\r
364 //\r
365 VlanData = NULL;\r
366 NumberOfVlan = 0;\r
367 VlanConfig = PrivateData->VlanConfig;\r
368 VlanConfig->Find (VlanConfig, NULL, &NumberOfVlan, &VlanData);\r
369\r
370 //\r
371 // Update VLAN configuration in PrivateData\r
372 //\r
373 if (NumberOfVlan > MAX_VLAN_NUMBER) {\r
374 NumberOfVlan = MAX_VLAN_NUMBER;\r
375 }\r
376 PrivateData->NumberOfVlan = NumberOfVlan;\r
377\r
378 //\r
379 // Init OpCode Handle\r
380 //\r
381 StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
382 ASSERT (StartOpCodeHandle != NULL);\r
383\r
384 EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
385 ASSERT (EndOpCodeHandle != NULL);\r
386\r
387 //\r
388 // Create Hii Extend Label OpCode as the start opcode\r
389 //\r
390 StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (\r
391 StartOpCodeHandle,\r
392 &gEfiIfrTianoGuid,\r
393 NULL,\r
394 sizeof (EFI_IFR_GUID_LABEL)\r
395 );\r
396 StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
397 StartLabel->Number = LABEL_VLAN_LIST;\r
398\r
399 //\r
400 // Create Hii Extend Label OpCode as the end opcode\r
401 //\r
402 EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (\r
403 EndOpCodeHandle,\r
404 &gEfiIfrTianoGuid,\r
405 NULL,\r
406 sizeof (EFI_IFR_GUID_LABEL)\r
407 );\r
408 EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
409 EndLabel->Number = LABEL_END;\r
410\r
411 ZeroMem (PrivateData->VlanId, MAX_VLAN_NUMBER);\r
412 for (Index = 0; Index < NumberOfVlan; Index++) {\r
413 String = VlanStr;\r
414\r
415 StrCpy (String, L" VLAN ID:");\r
416 String += 10;\r
417 //\r
418 // Pad VlanId string up to 4 characters with space\r
419 //\r
420 DigitalCount = UnicodeValueToString (VlanIdStr, 0, VlanData[Index].VlanId, 5);\r
421 SetMem16 (String, (4 - DigitalCount) * sizeof (CHAR16), L' ');\r
422 StrCpy (String + 4 - DigitalCount, VlanIdStr);\r
423 String += 4;\r
424\r
425 StrCpy (String, L", Priority:");\r
426 String += 11;\r
427 String += UnicodeValueToString (String, 0, VlanData[Index].Priority, 4);\r
428 *String = 0;\r
429\r
430 StringId = HiiSetString (PrivateData->HiiHandle, 0, VlanStr, NULL);\r
431 ASSERT (StringId != 0);\r
432\r
433 HiiCreateCheckBoxOpCode (\r
434 StartOpCodeHandle,\r
435 (EFI_QUESTION_ID) (VLAN_LIST_VAR_OFFSET + Index),\r
436 VLAN_CONFIGURATION_VARSTORE_ID,\r
437 (UINT16) (VLAN_LIST_VAR_OFFSET + Index),\r
438 StringId,\r
439 STRING_TOKEN (STR_VLAN_VLAN_LIST_HELP),\r
440 0,\r
441 0,\r
442 NULL\r
443 );\r
444\r
445 //\r
446 // Save VLAN id to private data\r
447 //\r
448 PrivateData->VlanId[Index] = VlanData[Index].VlanId;\r
449 }\r
450\r
451 HiiUpdateForm (\r
452 PrivateData->HiiHandle, // HII handle\r
453 &gVlanConfigFormSetGuid, // Formset GUID\r
454 VLAN_CONFIGURATION_FORM_ID, // Form ID\r
455 StartOpCodeHandle, // Label for where to insert opcodes\r
456 EndOpCodeHandle // Replace data\r
457 );\r
458\r
459 HiiFreeOpCodeHandle (StartOpCodeHandle);\r
460 HiiFreeOpCodeHandle (EndOpCodeHandle);\r
461\r
462 if (VlanData != NULL) {\r
463 FreePool (VlanData);\r
464 }\r
465}\r
466\r
467\r
468/**\r
469 This function publish the VLAN configuration Form for a network device. The\r
470 HII Config Access protocol will be installed on a child handle of the network\r
471 device.\r
472\r
473 @param[in, out] PrivateData Points to VLAN configuration private data.\r
474\r
475 @retval EFI_SUCCESS HII Form is installed for this network device.\r
476 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r
477 @retval Others Other errors as indicated.\r
478\r
479**/\r
480EFI_STATUS\r
481InstallVlanConfigForm (\r
482 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
483 )\r
484{\r
485 EFI_STATUS Status;\r
486 EFI_HII_HANDLE HiiHandle;\r
487 EFI_HANDLE DriverHandle;\r
488 CHAR16 Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];\r
489 CHAR16 *MacString;\r
490 EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;\r
491 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
492\r
493 //\r
494 // Create child handle and install HII Config Access Protocol\r
495 //\r
496 ChildDevicePath = AppendDevicePathNode (\r
497 PrivateData->ParentDevicePath,\r
498 (CONST EFI_DEVICE_PATH_PROTOCOL *) &mHiiVendorDevicePathNode\r
499 );\r
500 if (ChildDevicePath == NULL) {\r
501 return EFI_OUT_OF_RESOURCES;\r
502 }\r
503 PrivateData->ChildDevicePath = ChildDevicePath;\r
504\r
505 DriverHandle = NULL;\r
506 ConfigAccess = &PrivateData->ConfigAccess;\r
507 Status = gBS->InstallMultipleProtocolInterfaces (\r
508 &DriverHandle,\r
509 &gEfiDevicePathProtocolGuid,\r
510 ChildDevicePath,\r
511 &gEfiHiiConfigAccessProtocolGuid,\r
512 ConfigAccess,\r
513 NULL\r
514 );\r
515 if (EFI_ERROR (Status)) {\r
516 return Status;\r
517 }\r
518 PrivateData->DriverHandle = DriverHandle;\r
519\r
520 //\r
521 // Publish the HII package list\r
522 //\r
523 HiiHandle = HiiAddPackages (\r
524 &gVlanConfigFormSetGuid,\r
525 DriverHandle,\r
526 VlanConfigDxeStrings,\r
527 VlanConfigBin,\r
528 NULL\r
529 );\r
530 if (HiiHandle == NULL) {\r
531 return EFI_OUT_OF_RESOURCES;\r
532 }\r
533 PrivateData->HiiHandle = HiiHandle;\r
534\r
535 //\r
536 // Update formset title help string.\r
537 //\r
538 MacString = NULL;\r
539 Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);\r
540 if (EFI_ERROR (Status)) {\r
541 return Status;\r
542 }\r
543 PrivateData->MacString = MacString;\r
544\r
545 StrCpy (Str, L"VLAN Configuration (MAC:");\r
546 StrnCat (Str, MacString, sizeof (EFI_MAC_ADDRESS) * 2);\r
547 StrCat (Str, L")");\r
548 HiiSetString (\r
549 HiiHandle,\r
550 STRING_TOKEN (STR_VLAN_FORM_SET_TITLE_HELP),\r
551 Str,\r
552 NULL\r
553 );\r
554\r
555 //\r
556 // Update form title help string.\r
557 //\r
558 HiiSetString (\r
559 HiiHandle,\r
560 STRING_TOKEN (STR_VLAN_FORM_HELP),\r
561 Str,\r
562 NULL\r
563 );\r
564\r
565 return EFI_SUCCESS;\r
566}\r
567\r
568/**\r
569 This function remove the VLAN configuration Form for a network device. The\r
570 child handle for HII Config Access protocol will be destroyed.\r
571\r
572 @param[in, out] PrivateData Points to VLAN configuration private data.\r
573\r
574**/\r
575VOID\r
576UninstallVlanConfigForm (\r
577 IN OUT VLAN_CONFIG_PRIVATE_DATA *PrivateData\r
578 )\r
579{\r
580 //\r
581 // Free MAC string\r
582 //\r
583 if (PrivateData->MacString != NULL) {\r
584 FreePool (PrivateData->MacString);\r
585 PrivateData->MacString = NULL;\r
586 }\r
587\r
588 //\r
589 // Uninstall HII package list\r
590 //\r
591 if (PrivateData->HiiHandle != NULL) {\r
592 HiiRemovePackages (PrivateData->HiiHandle);\r
593 PrivateData->HiiHandle = NULL;\r
594 }\r
595\r
596 //\r
597 // Uninstall HII Config Access Protocol\r
598 //\r
599 if (PrivateData->DriverHandle != NULL) {\r
600 gBS->UninstallMultipleProtocolInterfaces (\r
601 PrivateData->DriverHandle,\r
602 &gEfiDevicePathProtocolGuid,\r
603 PrivateData->ChildDevicePath,\r
604 &gEfiHiiConfigAccessProtocolGuid,\r
605 &PrivateData->ConfigAccess,\r
606 NULL\r
607 );\r
608 PrivateData->DriverHandle = NULL;\r
609\r
610 if (PrivateData->ChildDevicePath != NULL) {\r
611 FreePool (PrivateData->ChildDevicePath);\r
612 PrivateData->ChildDevicePath = NULL;\r
613 }\r
614 }\r
615}\r