Update to NOT to use EFI_BROWSER_ACTION_FORM_OPEN in Callback function thus able to function properly in UEFI2.1 platform.

Signed-off-by: tye1
Reviewed-by: lgao4
Reviewed-by: xdu2

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12198 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
tye1 2011-08-24 10:55:55 +00:00
parent 9ea13d7900
commit e0afa48970
4 changed files with 170 additions and 150 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
VFR file used by the IP6 configuration component. VFR file used by the IP6 configuration component.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -28,6 +28,17 @@ formset
name = IP6_CONFIG_IFR_NVDATA, name = IP6_CONFIG_IFR_NVDATA,
guid = IP6_CONFIG_NVDATA_GUID; guid = IP6_CONFIG_NVDATA_GUID;
form formid = FORMID_HEAD_FORM,
title = STRING_TOKEN(STR_IP6_DEVICE_FORM_TITLE);
goto FORMID_MAIN_FORM,
prompt = STRING_TOKEN (STR_GET_CURRENT_SETTING),
help = STRING_TOKEN (STR_GET_CURRENT_SETTING_HELP),
flags = INTERACTIVE,
key = KEY_GET_CURRENT_SETTING;
endform;
form formid = FORMID_MAIN_FORM, form formid = FORMID_MAIN_FORM,
title = STRING_TOKEN(STR_IP6_DEVICE_FORM_TITLE); title = STRING_TOKEN(STR_IP6_DEVICE_FORM_TITLE);

View File

@ -1649,133 +1649,14 @@ Ip6FormCallback (
Instance = IP6_CONFIG_INSTANCE_FROM_FORM_CALLBACK (Private); Instance = IP6_CONFIG_INSTANCE_FROM_FORM_CALLBACK (Private);
Ip6NvData = &Instance->Ip6NvData; Ip6NvData = &Instance->Ip6NvData;
if (Action == EFI_BROWSER_ACTION_FORM_OPEN) { if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)){
//
// Update main Form when main Form is opened.
// This will be done only in FORM_OPEN CallBack of question with KEY_INTERFACE_ID from main Form.
//
if (QuestionId != KEY_INTERFACE_ID) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
Ip6Config = &Instance->Ip6Config; if (Action != EFI_BROWSER_ACTION_CHANGING) {
HiiHandle = Instance->CallbackInfo.RegisteredHandle; return EFI_UNSUPPORTED;
//
// Get the current interface info.
//
Status = Ip6ConfigNvGetData (
Ip6Config,
Ip6ConfigDataTypeInterfaceInfo,
&DataSize,
(VOID **) &Data
);
if (EFI_ERROR (Status)) {
goto Exit;
} }
//
// Generate the 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)) {
goto Exit;
}
//
// Generate the dynamic text opcode for route table and draw it.
//
Status = Ip6ConvertAddressListToString (
PortString,
HiiHandle,
Ip6ConfigNvRouteTable,
IfInfo->RouteTable,
IfInfo->RouteCount
);
if (EFI_ERROR (Status)) {
goto Exit;
}
//
// Get DNS server list.
//
DataSize = 0;
Status = Ip6ConfigNvGetData (
Ip6Config,
Ip6ConfigDataTypeDnsServer,
&DataSize,
(VOID **) &Data
);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
goto Exit;
}
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)) {
goto Exit;
}
}
//
// Get gateway adderss list.
//
DataSize = 0;
Status = Ip6ConfigNvGetData (
Ip6Config,
Ip6ConfigDataTypeGateway,
&DataSize,
(VOID **) &Data
);
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
goto Exit;
}
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)) {
goto Exit;
}
}
Exit:
FreePool (Data);
return Status;
}
if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
//
// Do nothing for UEFI FORM_CLOSE action
//
return EFI_SUCCESS;
}
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if ((Value == NULL) || (ActionRequest == NULL)) { if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1882,6 +1763,138 @@ Exit:
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break; 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;
}
//
// 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: default:
break; break;
} }
@ -1896,12 +1909,6 @@ Exit:
FreePool (IfrNvData); FreePool (IfrNvData);
return Status; return Status;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
} }
/** /**

Binary file not shown.

View File

@ -1,7 +1,7 @@
/** @file /** @file
NVData structure used by the IP6 configuration component. NVData structure used by the IP6 configuration component.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -23,6 +23,7 @@
#define FORMID_MAIN_FORM 1 #define FORMID_MAIN_FORM 1
#define FORMID_MANUAL_CONFIG_FORM 2 #define FORMID_MANUAL_CONFIG_FORM 2
#define FORMID_HEAD_FORM 3
#define IP6_POLICY_AUTO 0 #define IP6_POLICY_AUTO 0
#define IP6_POLICY_MANUAL 1 #define IP6_POLICY_MANUAL 1
@ -35,6 +36,7 @@
#define KEY_SAVE_CHANGES 0x105 #define KEY_SAVE_CHANGES 0x105
#define KEY_SAVE_CONFIG_CHANGES 0x106 #define KEY_SAVE_CONFIG_CHANGES 0x106
#define KEY_IGNORE_CONFIG_CHANGES 0x107 #define KEY_IGNORE_CONFIG_CHANGES 0x107
#define KEY_GET_CURRENT_SETTING 0x108
#define HOST_ADDRESS_LABEL 0x9000 #define HOST_ADDRESS_LABEL 0x9000
#define ROUTE_TABLE_LABEL 0xa000 #define ROUTE_TABLE_LABEL 0xa000