From 639a76d1912f8eb07e26b1a8f2393b682be65f2c Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 15 Dec 2011 02:57:46 +0000 Subject: Update for NetworkPkg. Per UEFI spec, on CallBack action EFI_BROWSER_ACTION_CHANGING, the return value of ActionRequest will be ignored, but on CallBack action EFI_BROWSER_ACTION_CHANGED, the return value of ActionRequest will be used. But, EDKII browser still processes the got ActionRequest. And, all HII drivers in EDKII project also returns their expected ActionRequest value on action EFI_BROWSER_ACTION_CHANGING. Now update the browser to follow the spec, and update all core Hii drivers to keep old working modal. Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12867 6f19259b-4bc3-4df7-8a09-765794883524 --- NetworkPkg/Ip6Dxe/Ip6Config.vfr | 22 +-- NetworkPkg/Ip6Dxe/Ip6ConfigNv.c | 384 ++++++++++++++++++++-------------------- 2 files changed, 207 insertions(+), 199 deletions(-) (limited to 'NetworkPkg/Ip6Dxe') diff --git a/NetworkPkg/Ip6Dxe/Ip6Config.vfr b/NetworkPkg/Ip6Dxe/Ip6Config.vfr index 7639f5a..de63f4d 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Config.vfr +++ b/NetworkPkg/Ip6Dxe/Ip6Config.vfr @@ -163,17 +163,19 @@ formset maxsize = ADDRESS_STR_MAX_SIZE, endstring; - goto FORMID_MAIN_FORM, - prompt = STRING_TOKEN (STR_SAVE_AND_EXIT), - help = STRING_TOKEN (STR_SAVE_AND_EXIT), - flags = INTERACTIVE, - key = KEY_SAVE_CONFIG_CHANGES; + text + help = STRING_TOKEN (STR_SAVE_AND_EXIT), + text = STRING_TOKEN (STR_SAVE_AND_EXIT), + text = STRING_TOKEN (STR_SAVE_AND_EXIT), + flags = INTERACTIVE, + key = KEY_SAVE_CONFIG_CHANGES; - goto FORMID_MAIN_FORM, - prompt = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), - help = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), - flags = INTERACTIVE, - key = KEY_IGNORE_CONFIG_CHANGES; + text + help = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), + text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), + text = STRING_TOKEN (STR_NO_SAVE_AND_EXIT), + flags = INTERACTIVE, + key = KEY_IGNORE_CONFIG_CHANGES; endform; diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c index b383488..db2155e 100644 --- a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c +++ b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c @@ -1651,7 +1651,7 @@ Ip6FormCallback ( return EFI_SUCCESS; } - if (Action != EFI_BROWSER_ACTION_CHANGING) { + if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) { return EFI_UNSUPPORTED; } @@ -1677,224 +1677,230 @@ Ip6FormCallback ( CopyMem (&OldIfrNvData, IfrNvData, BufferSize); - switch (QuestionId) { - case KEY_INTERFACE_ID: - Status = Ip6ParseInterfaceIdFromString (IfrNvData->InterfaceId, &Ip6NvData->InterfaceId); - if (EFI_ERROR (Status)) { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"Invalid Interface ID!", - NULL - ); - } - - break; - - case KEY_MANUAL_ADDRESS: - Status = Ip6ParseAddressListFromString ( - IfrNvData->ManualAddress, - &Ip6NvData->ManualAddress, - &Ip6NvData->ManualAddressCount - ); - if (EFI_ERROR (Status)) { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"Invalid Host Addresses!", - NULL - ); - } - - break; - - case KEY_GATEWAY_ADDRESS: - Status = Ip6ParseAddressListFromString ( - IfrNvData->GatewayAddress, - &Ip6NvData->GatewayAddress, - &Ip6NvData->GatewayAddressCount - ); - if (EFI_ERROR (Status)) { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"Invalid Gateway Addresses!", - NULL - ); - } - - break; - - case KEY_DNS_ADDRESS: - Status = Ip6ParseAddressListFromString ( - IfrNvData->DnsAddress, - &Ip6NvData->DnsAddress, - &Ip6NvData->DnsAddressCount - ); - if (EFI_ERROR (Status)) { - CreatePopUp ( - EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, - &Key, - L"Invalid DNS Addresses!", - NULL - ); - } - - break; - - case KEY_SAVE_CONFIG_CHANGES: - CopyMem (&OldIfrNvData, IfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY; - break; - - case KEY_IGNORE_CONFIG_CHANGES: - CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD; - break; - - case KEY_SAVE_CHANGES: - Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance); - if (EFI_ERROR (Status)) { - break; - } - - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; - break; - - case KEY_GET_CURRENT_SETTING: - Ip6Config = &Instance->Ip6Config; - HiiHandle = Instance->CallbackInfo.RegisteredHandle; - Data = NULL; - - // - // Get current interface info. - // - Status = Ip6ConfigNvGetData ( - Ip6Config, - Ip6ConfigDataTypeInterfaceInfo, - &DataSize, - (VOID **) &Data - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Generate dynamic text opcode for host address and draw it. - // - IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data; - Status = Ip6ConvertAddressListToString ( - PortString, - HiiHandle, - Ip6ConfigNvHostAddress, - IfInfo->AddressInfo, - IfInfo->AddressInfoCount - ); - if (EFI_ERROR (Status)) { - FreePool (Data); - return Status; - } - - // - // Generate the dynamic text opcode for route table and draw it. - // - Status = Ip6ConvertAddressListToString ( - PortString, - HiiHandle, - Ip6ConfigNvRouteTable, - IfInfo->RouteTable, - IfInfo->RouteCount - ); - if (EFI_ERROR (Status)) { - FreePool (Data); - return Status; - } + if (Action == EFI_BROWSER_ACTION_CHANGING) { + switch (QuestionId) { + case KEY_GET_CURRENT_SETTING: + Ip6Config = &Instance->Ip6Config; + HiiHandle = Instance->CallbackInfo.RegisteredHandle; + Data = NULL; - // - // Get DNS server list. - // - FreePool (Data); - DataSize = 0; - Data = NULL; - Status = Ip6ConfigNvGetData ( - Ip6Config, - Ip6ConfigDataTypeDnsServer, - &DataSize, - (VOID **) &Data - ); - if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { - if (Data != NULL) { - FreePool (Data); + // + // Get current interface info. + // + Status = Ip6ConfigNvGetData ( + Ip6Config, + Ip6ConfigDataTypeInterfaceInfo, + &DataSize, + (VOID **) &Data + ); + if (EFI_ERROR (Status)) { + return Status; } - return Status; - } - if (DataSize > 0) { // - // Generate the dynamic text opcode for DNS server and draw it. + // Generate dynamic text opcode for host address and draw it. // + IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data; Status = Ip6ConvertAddressListToString ( PortString, HiiHandle, - Ip6ConfigNvDnsAddress, - Data, - DataSize / sizeof (EFI_IPv6_ADDRESS) + Ip6ConfigNvHostAddress, + IfInfo->AddressInfo, + IfInfo->AddressInfoCount ); if (EFI_ERROR (Status)) { FreePool (Data); return Status; } - } - - // - // Get gateway adderss list. - // - if (Data != NULL) { - FreePool (Data); - } - - DataSize = 0; - Data = NULL; - Status = Ip6ConfigNvGetData ( - Ip6Config, - Ip6ConfigDataTypeGateway, - &DataSize, - (VOID **) &Data - ); - if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { - if (Data != NULL) { - FreePool (Data); - } - return Status; - } - if (DataSize > 0) { // - // Generate the dynamic text opcode for gateway and draw it. + // Generate the dynamic text opcode for route table and draw it. // Status = Ip6ConvertAddressListToString ( PortString, HiiHandle, - Ip6ConfigNvGatewayAddress, - Data, - DataSize / sizeof (EFI_IPv6_ADDRESS) + Ip6ConfigNvRouteTable, + IfInfo->RouteTable, + IfInfo->RouteCount ); if (EFI_ERROR (Status)) { FreePool (Data); return Status; } - } - if (Data != NULL) { + // + // Get DNS server list. + // FreePool (Data); + DataSize = 0; + Data = NULL; + Status = Ip6ConfigNvGetData ( + Ip6Config, + Ip6ConfigDataTypeDnsServer, + &DataSize, + (VOID **) &Data + ); + if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { + if (Data != NULL) { + FreePool (Data); + } + return Status; + } + + if (DataSize > 0) { + // + // Generate the dynamic text opcode for DNS server and draw it. + // + Status = Ip6ConvertAddressListToString ( + PortString, + HiiHandle, + Ip6ConfigNvDnsAddress, + Data, + DataSize / sizeof (EFI_IPv6_ADDRESS) + ); + if (EFI_ERROR (Status)) { + FreePool (Data); + return Status; + } + } + + // + // Get gateway adderss list. + // + if (Data != NULL) { + FreePool (Data); + } + + DataSize = 0; + Data = NULL; + Status = Ip6ConfigNvGetData ( + Ip6Config, + Ip6ConfigDataTypeGateway, + &DataSize, + (VOID **) &Data + ); + if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { + if (Data != NULL) { + FreePool (Data); + } + return Status; + } + + if (DataSize > 0) { + // + // Generate the dynamic text opcode for gateway and draw it. + // + Status = Ip6ConvertAddressListToString ( + PortString, + HiiHandle, + Ip6ConfigNvGatewayAddress, + Data, + DataSize / sizeof (EFI_IPv6_ADDRESS) + ); + if (EFI_ERROR (Status)) { + FreePool (Data); + return Status; + } + } + + if (Data != NULL) { + FreePool (Data); + } + + Status = EFI_SUCCESS; + + break; + + default: + break; } + } else if (Action == EFI_BROWSER_ACTION_CHANGED) { + switch (QuestionId) { + case KEY_SAVE_CONFIG_CHANGES: + CopyMem (&OldIfrNvData, IfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; + break; - Status = EFI_SUCCESS; + case KEY_IGNORE_CONFIG_CHANGES: + CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; + break; - break; + case KEY_SAVE_CHANGES: + Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance); + if (EFI_ERROR (Status)) { + break; + } + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; + break; + + case KEY_INTERFACE_ID: + Status = Ip6ParseInterfaceIdFromString (IfrNvData->InterfaceId, &Ip6NvData->InterfaceId); + if (EFI_ERROR (Status)) { + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Invalid Interface ID!", + NULL + ); + } + + break; + + case KEY_MANUAL_ADDRESS: + Status = Ip6ParseAddressListFromString ( + IfrNvData->ManualAddress, + &Ip6NvData->ManualAddress, + &Ip6NvData->ManualAddressCount + ); + if (EFI_ERROR (Status)) { + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Invalid Host Addresses!", + NULL + ); + } + + break; + + case KEY_GATEWAY_ADDRESS: + Status = Ip6ParseAddressListFromString ( + IfrNvData->GatewayAddress, + &Ip6NvData->GatewayAddress, + &Ip6NvData->GatewayAddressCount + ); + if (EFI_ERROR (Status)) { + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Invalid Gateway Addresses!", + NULL + ); + } + + break; + + case KEY_DNS_ADDRESS: + Status = Ip6ParseAddressListFromString ( + IfrNvData->DnsAddress, + &Ip6NvData->DnsAddress, + &Ip6NvData->DnsAddressCount + ); + if (EFI_ERROR (Status)) { + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Invalid DNS Addresses!", + NULL + ); + } + + break; - default: - break; + default: + break; + } } if (!EFI_ERROR (Status)) { -- cgit v1.1