Refine all R9 call back function to return EFI_UNSUPPORTED for all unsupported call back type.

Signed-off-by:  ydong10
Reviewed-by: lgao4


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11682 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-05-20 01:58:48 +00:00
parent d88f86f154
commit 2d4df3393f
1 changed files with 110 additions and 103 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Helper functions for configuring or obtaining the parameters relating to IP6. Helper functions for configuring or obtaining the parameters relating to IP6.
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
@ -1775,126 +1775,133 @@ Exit:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
if ((Value == NULL) || (ActionRequest == NULL)) { if (Action == EFI_BROWSER_ACTION_CHANGING) {
return EFI_INVALID_PARAMETER; 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; //
// Retrieve uncommitted data from Browser
//
case KEY_MANUAL_ADDRESS: BufferSize = sizeof (IP6_CONFIG_IFR_NVDATA);
Status = Ip6ParseAddressListFromString ( IfrNvData = AllocateZeroPool (BufferSize);
IfrNvData->ManualAddress, if (IfrNvData == NULL) {
&Ip6NvData->ManualAddress, return EFI_OUT_OF_RESOURCES;
&Ip6NvData->ManualAddressCount
);
if (EFI_ERROR (Status)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
L"Invalid Host Addresses!",
NULL
);
} }
break; Status = EFI_SUCCESS;
case KEY_GATEWAY_ADDRESS: ZeroMem (&OldIfrNvData, BufferSize);
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; HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData);
case KEY_DNS_ADDRESS: CopyMem (&OldIfrNvData, IfrNvData, BufferSize);
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; 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
);
}
case KEY_SAVE_CONFIG_CHANGES: break;
CopyMem (&OldIfrNvData, IfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA));
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
break;
case KEY_IGNORE_CONFIG_CHANGES: case KEY_MANUAL_ADDRESS:
CopyMem (IfrNvData, &OldIfrNvData, sizeof (IP6_CONFIG_IFR_NVDATA)); Status = Ip6ParseAddressListFromString (
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; IfrNvData->ManualAddress,
break; &Ip6NvData->ManualAddress,
&Ip6NvData->ManualAddressCount
);
if (EFI_ERROR (Status)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
&Key,
L"Invalid Host Addresses!",
NULL
);
}
case KEY_SAVE_CHANGES: break;
Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);
if (EFI_ERROR (Status)) { 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; break;
} }
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; if (!EFI_ERROR (Status)) {
break; //
// Pass changed uncommitted data back to Form Browser.
//
BufferSize = sizeof (IP6_CONFIG_IFR_NVDATA);
HiiSetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData, NULL);
}
default: FreePool (IfrNvData);
break; 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;
} }
/** /**