mirror of https://github.com/acidanthera/audk.git
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:
parent
9ea13d7900
commit
e0afa48970
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -1649,20 +1649,127 @@ 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)){
|
||||||
//
|
return EFI_SUCCESS;
|
||||||
// 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 (Action != EFI_BROWSER_ACTION_CHANGING) {
|
||||||
if (QuestionId != KEY_INTERFACE_ID) {
|
return EFI_UNSUPPORTED;
|
||||||
return EFI_SUCCESS;
|
}
|
||||||
|
|
||||||
|
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve uncommitted data from Browser
|
||||||
|
//
|
||||||
|
|
||||||
|
BufferSize = sizeof (IP6_CONFIG_IFR_NVDATA);
|
||||||
|
IfrNvData = AllocateZeroPool (BufferSize);
|
||||||
|
if (IfrNvData == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
ZeroMem (&OldIfrNvData, BufferSize);
|
||||||
|
|
||||||
|
HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData);
|
||||||
|
|
||||||
|
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_SUBMIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_IGNORE_CONFIG_CHANGES:
|
||||||
|
CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));
|
||||||
|
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_SAVE_CHANGES:
|
||||||
|
Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_GET_CURRENT_SETTING:
|
||||||
Ip6Config = &Instance->Ip6Config;
|
Ip6Config = &Instance->Ip6Config;
|
||||||
HiiHandle = Instance->CallbackInfo.RegisteredHandle;
|
HiiHandle = Instance->CallbackInfo.RegisteredHandle;
|
||||||
|
Data = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the current interface info.
|
// Get current interface info.
|
||||||
//
|
//
|
||||||
Status = Ip6ConfigNvGetData (
|
Status = Ip6ConfigNvGetData (
|
||||||
Ip6Config,
|
Ip6Config,
|
||||||
|
@ -1671,11 +1778,11 @@ Ip6FormCallback (
|
||||||
(VOID **) &Data
|
(VOID **) &Data
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Generate the dynamic text opcode for host address and draw it.
|
// Generate dynamic text opcode for host address and draw it.
|
||||||
//
|
//
|
||||||
IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data;
|
IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data;
|
||||||
Status = Ip6ConvertAddressListToString (
|
Status = Ip6ConvertAddressListToString (
|
||||||
|
@ -1686,7 +1793,8 @@ Ip6FormCallback (
|
||||||
IfInfo->AddressInfoCount
|
IfInfo->AddressInfoCount
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
FreePool (Data);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1700,13 +1808,16 @@ Ip6FormCallback (
|
||||||
IfInfo->RouteCount
|
IfInfo->RouteCount
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
FreePool (Data);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get DNS server list.
|
// Get DNS server list.
|
||||||
//
|
//
|
||||||
|
FreePool (Data);
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
|
Data = NULL;
|
||||||
Status = Ip6ConfigNvGetData (
|
Status = Ip6ConfigNvGetData (
|
||||||
Ip6Config,
|
Ip6Config,
|
||||||
Ip6ConfigDataTypeDnsServer,
|
Ip6ConfigDataTypeDnsServer,
|
||||||
|
@ -1714,7 +1825,10 @@ Ip6FormCallback (
|
||||||
(VOID **) &Data
|
(VOID **) &Data
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
||||||
goto Exit;
|
if (Data != NULL) {
|
||||||
|
FreePool (Data);
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataSize > 0) {
|
if (DataSize > 0) {
|
||||||
|
@ -1729,14 +1843,20 @@ Ip6FormCallback (
|
||||||
DataSize / sizeof (EFI_IPv6_ADDRESS)
|
DataSize / sizeof (EFI_IPv6_ADDRESS)
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
FreePool (Data);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get gateway adderss list.
|
// Get gateway adderss list.
|
||||||
//
|
//
|
||||||
|
if (Data != NULL) {
|
||||||
|
FreePool (Data);
|
||||||
|
}
|
||||||
|
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
|
Data = NULL;
|
||||||
Status = Ip6ConfigNvGetData (
|
Status = Ip6ConfigNvGetData (
|
||||||
Ip6Config,
|
Ip6Config,
|
||||||
Ip6ConfigDataTypeGateway,
|
Ip6ConfigDataTypeGateway,
|
||||||
|
@ -1744,7 +1864,10 @@ Ip6FormCallback (
|
||||||
(VOID **) &Data
|
(VOID **) &Data
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
|
||||||
goto Exit;
|
if (Data != NULL) {
|
||||||
|
FreePool (Data);
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataSize > 0) {
|
if (DataSize > 0) {
|
||||||
|
@ -1759,149 +1882,33 @@ Ip6FormCallback (
|
||||||
DataSize / sizeof (EFI_IPv6_ADDRESS)
|
DataSize / sizeof (EFI_IPv6_ADDRESS)
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Exit;
|
FreePool (Data);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
if (Data != NULL) {
|
||||||
FreePool (Data);
|
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)) {
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieve uncommitted data from Browser
|
|
||||||
//
|
|
||||||
|
|
||||||
BufferSize = sizeof (IP6_CONFIG_IFR_NVDATA);
|
|
||||||
IfrNvData = AllocateZeroPool (BufferSize);
|
|
||||||
if (IfrNvData == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
ZeroMem (&OldIfrNvData, BufferSize);
|
break;
|
||||||
|
|
||||||
HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData);
|
default:
|
||||||
|
break;
|
||||||
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_SUBMIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEY_IGNORE_CONFIG_CHANGES:
|
|
||||||
CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));
|
|
||||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEY_SAVE_CHANGES:
|
|
||||||
Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// Pass changed uncommitted data back to Form Browser.
|
|
||||||
//
|
|
||||||
BufferSize = sizeof (IP6_CONFIG_IFR_NVDATA);
|
|
||||||
HiiSetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreePool (IfrNvData);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
if (!EFI_ERROR (Status)) {
|
||||||
// All other action return unsupported.
|
//
|
||||||
//
|
// Pass changed uncommitted data back to Form Browser.
|
||||||
return EFI_UNSUPPORTED;
|
//
|
||||||
|
BufferSize = sizeof (IP6_CONFIG_IFR_NVDATA);
|
||||||
|
HiiSetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (IfrNvData);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Binary file not shown.
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue