Update for IntelFrameworkModulePkg.

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@12866 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-12-15 02:56:46 +00:00
parent 3a4e7a3e73
commit 8472407740
10 changed files with 152 additions and 158 deletions

View File

@ -55,7 +55,7 @@ formset
subtitle text = STRING_TOKEN(STR_NULL_STRING);
goto FORM_CON_MAIN_ID,
goto FORM_BOOT_FROM_FILE_ID,
prompt = STRING_TOKEN(STR_BOOT_FROM_FILE),
help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
flags = INTERACTIVE,
@ -154,13 +154,6 @@ formset
key = FORM_DRV_CHG_ID;
endform;
form formid = FORM_BOOT_ADD_ID,
title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
label FORM_BOOT_ADD_ID;
label LABEL_END;
endform;
form formid = FORM_BOOT_DEL_ID,
title = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE);
@ -298,13 +291,6 @@ formset
label LABEL_END;
endform;
form formid = FORM_DRV_ADD_FILE_ID,
title = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE);
label FORM_DRV_ADD_FILE_ID;
label LABEL_END;
endform;
form formid = FORM_DRV_ADD_HANDLE_ID,
title = STRING_TOKEN(STR_FORM_DRV_ADD_HANDLE_TITLE);

View File

@ -286,31 +286,36 @@ BootMaintCallback (
UINT8 *NewLegacyDev;
UINT8 *DisMap;
EFI_FORM_ID FormId;
Status = EFI_SUCCESS;
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
Status = EFI_SUCCESS;
OldValue = 0;
NewValue = 0;
Number = 0;
OldLegacyDev = NULL;
NewLegacyDev = NULL;
NewValuePos = 0;
DisMap = NULL;
Private = BMM_CALLBACK_DATA_FROM_THIS (This);
//
// Retrive uncommitted data from Form Browser
//
CurrentFakeNVMap = &Private->BmmFakeNvData;
HiiGetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if ((Value == NULL) || (ActionRequest == NULL)) {
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
OldValue = 0;
NewValue = 0;
Number = 0;
OldLegacyDev = NULL;
NewLegacyDev = NULL;
NewValuePos = 0;
DisMap = NULL;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Private = BMM_CALLBACK_DATA_FROM_THIS (This);
UpdatePageId (Private, QuestionId);
//
// Retrive uncommitted data from Form Browser
//
CurrentFakeNVMap = &Private->BmmFakeNvData;
HiiGetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
//
// need to be subtituded.
//
@ -488,29 +493,14 @@ BootMaintCallback (
switch (QuestionId) {
case KEY_VALUE_BOOT_FROM_FILE:
Private->FeCurrentState = FileExplorerStateBootFromFile;
//
// Exit Bmm main formset to send File Explorer formset.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case FORM_BOOT_ADD_ID:
Private->FeCurrentState = FileExplorerStateAddBootOption;
//
// Exit Bmm main formset to send File Explorer formset.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case FORM_DRV_ADD_FILE_ID:
Private->FeCurrentState = FileExplorerStateAddDriverOptionState;
//
// Exit Bmm main formset to send File Explorer formset.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case FORM_DRV_ADD_HANDLE_ID:
@ -543,10 +533,6 @@ BootMaintCallback (
UpdateTimeOutPage (Private);
break;
case FORM_RESET:
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
return EFI_UNSUPPORTED;
case FORM_CON_IN_ID:
case FORM_CON_OUT_ID:
case FORM_CON_ERR_ID:
@ -572,25 +558,6 @@ BootMaintCallback (
UpdateSetLegacyDeviceOrderPage (QuestionId, Private);
break;
case KEY_VALUE_SAVE_AND_EXIT:
case KEY_VALUE_NO_SAVE_AND_EXIT:
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) {
Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId);
if (EFI_ERROR (Status)) {
return Status;
}
} else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) {
DiscardChangeHandler (Private, CurrentFakeNVMap);
}
//
// Tell browser not to ask for confirmation of changes,
// since we have already applied or discarded.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
default:
break;
}
@ -616,18 +583,44 @@ BootMaintCallback (
UpdateDriverAddHandleDescPage (Private);
}
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}
switch (QuestionId) {
case KEY_VALUE_SAVE_AND_EXIT:
case KEY_VALUE_NO_SAVE_AND_EXIT:
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) {
Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId);
if (EFI_ERROR (Status)) {
return Status;
}
} else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) {
DiscardChangeHandler (Private, CurrentFakeNVMap);
}
//
// Pass changed uncommitted data back to Form Browser
//
Status = HiiSetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
return Status;
//
// Tell browser not to ask for confirmation of changes,
// since we have already applied or discarded.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
break;
case FORM_RESET:
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
return EFI_UNSUPPORTED;
default:
break;
}
}
//
// All other action return unsupported.
// Pass changed uncommitted data back to Form Browser
//
return EFI_UNSUPPORTED;
HiiSetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
return EFI_SUCCESS;
}
/**

View File

@ -253,21 +253,27 @@ FileExplorerCallback (
FILE_EXPLORER_NV_DATA *NvRamMap;
EFI_STATUS Status;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
Status = EFI_SUCCESS;
Private = FE_CALLBACK_DATA_FROM_THIS (This);
//
// Retrieve uncommitted data from Form Browser
//
NvRamMap = &Private->FeFakeNvData;
HiiGetBrowserData (&gFileExploreFormSetGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap);
if (Action == EFI_BROWSER_ACTION_CHANGED) {
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = EFI_SUCCESS;
Private = FE_CALLBACK_DATA_FROM_THIS (This);
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
//
// Retrieve uncommitted data from Form Browser
//
NvRamMap = &Private->FeFakeNvData;
HiiGetBrowserData (&gFileExploreFormSetGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap);
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) {
//
// Apply changes and exit formset
@ -309,16 +315,16 @@ FileExplorerCallback (
// Exit File Explorer formset
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
} else {
if (UpdateFileExplorer (Private, QuestionId)) {
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
}
}
return Status;
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
if (QuestionId >= FILE_OPTION_OFFSET) {
UpdateFileExplorer (Private, QuestionId);
}
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
return Status;
}

View File

@ -49,6 +49,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define FORM_BOOT_ADD_DESCRIPTION_ID 0x101F
#define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID 0x1020
#define FORM_CON_MODE_ID 0x1021
#define FORM_BOOT_FROM_FILE_ID 0x1022
#define MAXIMUM_FORM_ID 0x10FF

View File

@ -99,26 +99,26 @@ UpdatePageEnd (
0
);
HiiCreateGotoOpCode (
HiiCreateActionOpCode (
mStartOpCodeHandle,
FORM_MAIN_ID,
KEY_VALUE_SAVE_AND_EXIT,
STRING_TOKEN (STR_SAVE_AND_EXIT),
STRING_TOKEN (STR_NULL_STRING),
EFI_IFR_FLAG_CALLBACK,
KEY_VALUE_SAVE_AND_EXIT
0
);
}
//
// Ensure user can return to the main page.
//
HiiCreateGotoOpCode (
HiiCreateActionOpCode (
mStartOpCodeHandle,
FORM_MAIN_ID,
KEY_VALUE_NO_SAVE_AND_EXIT,
STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
STRING_TOKEN (STR_NULL_STRING),
EFI_IFR_FLAG_CALLBACK,
KEY_VALUE_NO_SAVE_AND_EXIT
0
);
HiiUpdateForm (

View File

@ -673,14 +673,13 @@ Var_UpdateDriverOption (
&gEfiGlobalVariableGuid,
&DriverOrderListSize
);
ASSERT (DriverOrderList != NULL);
NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
ASSERT (NewDriverOrderList != NULL);
CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
if (DriverOrderList != NULL) {
CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
}
NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
Status = gRT->SetVariable (
L"DriverOrder",

View File

@ -95,7 +95,7 @@ BootManagerCallback (
LIST_ENTRY *Link;
UINT16 KeyCount;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Action == EFI_BROWSER_ACTION_CHANGED) {
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}

View File

@ -133,35 +133,30 @@ DeviceManagerCallback (
{
UINTN CurIndex;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}
gCallbackKey = QuestionId;
if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
//
// If user select the mac address, need to record mac address string to support next form show.
//
for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) {
if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {
mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL);
}
}
}
if (Action != EFI_BROWSER_ACTION_CHANGING) {
//
// Request to exit SendForm(), so as to switch to selected form
// All other action return unsupported.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
return EFI_SUCCESS;
return EFI_UNSUPPORTED;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
gCallbackKey = QuestionId;
if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) {
//
// If user select the mac address, need to record mac address string to support next form show.
//
for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) {
if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) {
mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL);
}
}
}
return EFI_SUCCESS;
}
/**
@ -873,7 +868,7 @@ CallDeviceManager (
AddNetworkMenu = TRUE;
HiiCreateGotoOpCode (
StartOpCodeHandle,
DEVICE_MANAGER_FORM_ID,
INVALID_FORM_ID,
STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE),
STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP),
EFI_IFR_FLAG_CALLBACK,
@ -887,7 +882,7 @@ CallDeviceManager (
while (AddItemCount > 0) {
HiiCreateGotoOpCode (
StartOpCodeHandle,
NETWORK_DEVICE_LIST_FORM_ID,
INVALID_FORM_ID,
mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId,
STRING_TOKEN (STR_NETWORK_DEVICE_HELP),
EFI_IFR_FLAG_CALLBACK,
@ -901,7 +896,7 @@ CallDeviceManager (
//
HiiCreateGotoOpCode (
StartOpCodeHandle,
NETWORK_DEVICE_FORM_ID,
INVALID_FORM_ID,
Token,
TokenHelp,
EFI_IFR_FLAG_CALLBACK,
@ -916,7 +911,7 @@ CallDeviceManager (
if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) {
HiiCreateGotoOpCode (
StartOpCodeHandle,
DEVICE_MANAGER_FORM_ID,
INVALID_FORM_ID,
Token,
TokenHelp,
EFI_IFR_FLAG_CALLBACK,
@ -1097,7 +1092,7 @@ DriverHealthCallback (
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Action == EFI_BROWSER_ACTION_CHANGED) {
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}

View File

@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define LABEL_VBIOS 0x0040
#define INVALID_FORM_ID 0x0FFF
#define DEVICE_MANAGER_FORM_ID 0x1000
#define NETWORK_DEVICE_LIST_FORM_ID 0x1001
#define NETWORK_DEVICE_FORM_ID 0x1002

View File

@ -175,23 +175,26 @@ FrontPageCallback (
CHAR8 *PlatformSupportedLanguages;
CHAR8 *BestLanguage;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
gCallbackKey = QuestionId;
if (Action == EFI_BROWSER_ACTION_CHANGED) {
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}
gCallbackKey = QuestionId;
//
// The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
// describe to their customers in documentation how to find their setup information (namely
// under the device manager and specific buckets)
//
switch (QuestionId) {
case FRONT_PAGE_KEY_CONTINUE:
//
// This is the continue - clear the screen and return an error to get out of FrontPage loop
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case FRONT_PAGE_KEY_LANGUAGE:
@ -250,11 +253,27 @@ FrontPageCallback (
ASSERT (FALSE);
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
FreePool (PlatformSupportedLanguages);
FreePool (Lang);
FreePool (LanguageString);
break;
default:
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
// describe to their customers in documentation how to find their setup information (namely
// under the device manager and specific buckets)
//
switch (QuestionId) {
case FRONT_PAGE_KEY_BOOT_MANAGER:
//
// Boot Manager
@ -277,16 +296,9 @@ FrontPageCallback (
gCallbackKey = 0;
break;
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
return EFI_SUCCESS;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
return EFI_SUCCESS;
}
/**
@ -1181,6 +1193,7 @@ PlatformBdsEnterFrontPage (
BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
}
Status = EFI_SUCCESS;
do {
//
// Set proper video resolution and text mode for setup
@ -1195,7 +1208,7 @@ PlatformBdsEnterFrontPage (
UpdateFrontPageStrings ();
gCallbackKey = 0;
Status = CallFrontPage ();
CallFrontPage ();
//
// If gCallbackKey is greater than 1 and less or equal to 5,