]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
Clean up the private GUID definition in module Level.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
index e9e98fa225a8372e9407c4a660ddb5f7930b6619..ea70d5e28d0e0ba8fd65acf00c7bf942f5a4e4e2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "VlanConfigImpl.h"\r
 \r
-EFI_GUID                        mVlanFormSetGuid = VLAN_CONFIG_PRIVATE_GUID;\r
 CHAR16                          mVlanStorageName[] = L"VlanNvData";\r
 EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting = NULL;\r
 \r
@@ -37,7 +36,7 @@ VENDOR_DEVICE_PATH              mHiiVendorDevicePathNode = {
       (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
     }\r
   },\r
-  VLAN_CONFIG_PRIVATE_GUID\r
+  VLAN_CONFIG_FORM_SET_GUID\r
 };\r
 \r
 /**\r
@@ -89,7 +88,7 @@ VlanExtractConfig (
   }\r
 \r
   *Progress = Request;\r
-  if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mVlanFormSetGuid, mVlanStorageName)) {\r
+  if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gVlanConfigFormSetGuid, mVlanStorageName)) {\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
@@ -119,7 +118,7 @@ VlanExtractConfig (
     // Allocate and fill a buffer large enough to hold the <ConfigHdr> template\r
     // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator\r
     //\r
-    ConfigRequestHdr = HiiConstructConfigHdr (&mVlanFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);\r
+    ConfigRequestHdr = HiiConstructConfigHdr (&gVlanConfigFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);\r
     Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);\r
     ConfigRequest = AllocateZeroPool (Size);\r
     ASSERT (ConfigRequest != NULL);\r
@@ -187,7 +186,7 @@ VlanRouteConfig (
   }\r
 \r
   *Progress = Configuration;\r
-  if (!HiiIsConfigHdrMatch (Configuration, &mVlanFormSetGuid, mVlanStorageName)) {\r
+  if (!HiiIsConfigHdrMatch (Configuration, &gVlanConfigFormSetGuid, mVlanStorageName)) {\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
@@ -236,95 +235,95 @@ VlanCallback (
 \r
   PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);\r
 \r
-  if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r
-    if (QuestionId == VLAN_ADD_QUESTION_ID) {\r
-      //\r
-      // Update current VLAN list into Form when Form is opened.\r
-      // This will be done only in FORM_OPEN CallBack of question with VLAN_ADD_QUESTION_ID.\r
-      //\r
-      VlanUpdateForm (PrivateData);\r
-    }\r
+  if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
     return EFI_SUCCESS;\r
   }\r
 \r
-  if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {\r
+  if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
     //\r
-    // Do nothing for UEFI FORM_CLOSE action\r
+    // Get Browser data\r
     //\r
-    return EFI_SUCCESS;\r
-  }\r
+    Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));\r
+    ASSERT (Configuration != NULL);\r
+    HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);\r
 \r
-  //\r
-  // Get Browser data\r
-  //\r
-  Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));\r
-  ASSERT (Configuration != NULL);\r
-  HiiGetBrowserData (&mVlanFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);\r
+    VlanConfig = PrivateData->VlanConfig;\r
 \r
-  VlanConfig = PrivateData->VlanConfig;\r
+    switch (QuestionId) {\r
+    case VLAN_ADD_QUESTION_ID:\r
+      //\r
+      // Add a VLAN\r
+      //\r
+      VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);\r
+      VlanUpdateForm (PrivateData);\r
 \r
-  switch (QuestionId) {\r
-  case VLAN_ADD_QUESTION_ID:\r
-    //\r
-    // Add a VLAN\r
-    //\r
-    VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);\r
-    VlanUpdateForm (PrivateData);\r
+      //\r
+      // Connect the newly created VLAN device\r
+      //\r
+      VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);\r
+      if (VlanHandle == NULL) {\r
+        //\r
+        // There may be no child handle created for VLAN ID 0, connect the parent handle\r
+        //\r
+        VlanHandle = PrivateData->ControllerHandle;\r
+      }\r
+      gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);\r
 \r
-    //\r
-    // Connect the newly created VLAN device\r
-    //\r
-    VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);\r
-    if (VlanHandle == NULL) {\r
       //\r
-      // There may be no child handle created for VLAN ID 0, connect the parent handle\r
+      // Clear UI data\r
       //\r
-      VlanHandle = PrivateData->ControllerHandle;\r
-    }\r
-    gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
+      Configuration->VlanId = 0;\r
+      Configuration->Priority = 0;\r
+      break;\r
 \r
-    //\r
-    // Clear UI data\r
-    //\r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
-    Configuration->VlanId = 0;\r
-    Configuration->Priority = 0;\r
-    break;\r
+    case VLAN_REMOVE_QUESTION_ID:\r
+      //\r
+      // Remove VLAN\r
+      //\r
+      ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);\r
+      for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {\r
+        if (Configuration->VlanList[Index] != 0) {\r
+          //\r
+          // Checkbox is selected, need remove this VLAN\r
+          //\r
+          VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);\r
+        }\r
+      }\r
 \r
-  case VLAN_REMOVE_QUESTION_ID:\r
-    //\r
-    // Remove VLAN\r
-    //\r
-    ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);\r
-    for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {\r
-      if (Configuration->VlanList[Index] != 0) {\r
+      VlanUpdateForm (PrivateData);\r
+      if (PrivateData->NumberOfVlan == 0) {\r
         //\r
-        // Checkbox is selected, need remove this VLAN\r
+        // No VLAN device now, connect the physical NIC handle.\r
+        // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()\r
         //\r
-        VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);\r
+        gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);\r
       }\r
-    }\r
 \r
-    VlanUpdateForm (PrivateData);\r
-    if (PrivateData->NumberOfVlan == 0) {\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;\r
+      ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);\r
+      break;\r
+\r
+    case VLAN_UPDATE_QUESTION_ID:\r
       //\r
-      // No VLAN device now, connect the physical NIC handle.\r
-      // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()\r
+      // Update current VLAN list into Form.\r
       //\r
-      gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);\r
-    }\r
+      VlanUpdateForm (PrivateData);\r
+      break;\r
 \r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
-    ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);\r
-    break;\r
+    default:\r
+      break;\r
+    }\r
 \r
-  default:\r
-    break;\r
+    HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);\r
+    FreePool (Configuration);\r
+    return EFI_SUCCESS;\r
   }\r
 \r
-  HiiSetBrowserData (&mVlanFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);\r
-  FreePool (Configuration);\r
-  return EFI_SUCCESS;\r
+  //\r
+  // All other action return unsupported.\r
+  //\r
+  return EFI_UNSUPPORTED;\r
 }\r
 \r
 \r
@@ -444,7 +443,7 @@ VlanUpdateForm (
 \r
   HiiUpdateForm (\r
     PrivateData->HiiHandle,     // HII handle\r
-    &mVlanFormSetGuid,          // Formset GUID\r
+    &gVlanConfigFormSetGuid,    // Formset GUID\r
     VLAN_CONFIGURATION_FORM_ID, // Form ID\r
     StartOpCodeHandle,          // Label for where to insert opcodes\r
     EndOpCodeHandle             // Replace data\r
@@ -515,7 +514,7 @@ InstallVlanConfigForm (
   // Publish the HII package list\r
   //\r
   HiiHandle = HiiAddPackages (\r
-                &mVlanFormSetGuid,\r
+                &gVlanConfigFormSetGuid,\r
                 DriverHandle,\r
                 VlanConfigDxeStrings,\r
                 VlanConfigBin,\r
@@ -527,7 +526,7 @@ InstallVlanConfigForm (
   PrivateData->HiiHandle = HiiHandle;\r
 \r
   //\r
-  // Update formset title\r
+  // Update formset title help string.\r
   //\r
   MacString = NULL;\r
   Status = NetLibGetMacString (PrivateData->ControllerHandle, PrivateData->ImageHandle, &MacString);\r
@@ -547,7 +546,7 @@ InstallVlanConfigForm (
     );\r
 \r
   //\r
-  // Update form title\r
+  // Update form title help string.\r
   //\r
   HiiSetString (\r
     HiiHandle,\r