]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
Refine some call back function to return EFI_UNSUPPORTED for all unsupported call...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / VlanConfigDxe / VlanConfigImpl.c
index 871199e7b96ed22d1d6ef63a2f3866e779ddbe99..dfcf7a3d9c2c316834bf64d09cb7a231f2831aac 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
@@ -254,77 +254,84 @@ VlanCallback (
     return EFI_SUCCESS;\r
   }\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
-\r
-  VlanConfig = PrivateData->VlanConfig;\r
-\r
-  switch (QuestionId) {\r
-  case VLAN_ADD_QUESTION_ID:\r
+  if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
     //\r
-    // Add a VLAN\r
+    // Get Browser data\r
     //\r
-    VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);\r
-    VlanUpdateForm (PrivateData);\r
+    Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));\r
+    ASSERT (Configuration != NULL);\r
+    HiiGetBrowserData (&mVlanFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);\r
 \r
-    //\r
-    // Connect the newly created VLAN device\r
-    //\r
-    VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);\r
-    if (VlanHandle == NULL) {\r
+    VlanConfig = PrivateData->VlanConfig;\r
+\r
+    switch (QuestionId) {\r
+    case VLAN_ADD_QUESTION_ID:\r
       //\r
-      // There may be no child handle created for VLAN ID 0, connect the parent handle\r
+      // Add a VLAN\r
       //\r
-      VlanHandle = PrivateData->ControllerHandle;\r
-    }\r
-    gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);\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
+      VlanConfig->Set (VlanConfig, Configuration->VlanId, Configuration->Priority);\r
+      VlanUpdateForm (PrivateData);\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
+      //\r
+      // Connect the newly created VLAN device\r
+      //\r
+      VlanHandle = NetLibGetVlanHandle (PrivateData->ControllerHandle, Configuration->VlanId);\r
+      if (VlanHandle == NULL) {\r
         //\r
-        // Checkbox is selected, need remove this VLAN\r
+        // There may be no child handle created for VLAN ID 0, connect the parent handle\r
         //\r
-        VlanConfig->Remove (VlanConfig, PrivateData->VlanId[Index]);\r
+        VlanHandle = PrivateData->ControllerHandle;\r
       }\r
-    }\r
+      gBS->ConnectController (VlanHandle, NULL, NULL, TRUE);\r
 \r
-    VlanUpdateForm (PrivateData);\r
-    if (PrivateData->NumberOfVlan == 0) {\r
       //\r
-      // No VLAN device now, connect the physical NIC handle.\r
-      // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()\r
+      // Clear UI data\r
       //\r
-      gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);\r
-    }\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
+      Configuration->VlanId = 0;\r
+      Configuration->Priority = 0;\r
+      break;\r
 \r
-    *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
-    ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);\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
-  default:\r
-    break;\r
+      VlanUpdateForm (PrivateData);\r
+      if (PrivateData->NumberOfVlan == 0) {\r
+        //\r
+        // No VLAN device now, connect the physical NIC handle.\r
+        // Note: PrivateData->NumberOfVlan has been updated by VlanUpdateForm()\r
+        //\r
+        gBS->ConnectController (PrivateData->ControllerHandle, NULL, NULL, TRUE);\r
+      }\r
+\r
+      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;\r
+      ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);\r
+      break;\r
+\r
+    default:\r
+      break;\r
+    }\r
+\r
+    HiiSetBrowserData (&mVlanFormSetGuid, 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