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