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.

Update for MdeModulePkg.

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

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12865 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-12-15 02:54:49 +00:00
parent 3531262f5f
commit 3a4e7a3e73
9 changed files with 224 additions and 182 deletions

View File

@ -1667,6 +1667,48 @@ DriverCallback (
}
break;
case 0x2000:
//
// Only used to update the state.
//
if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
(PrivateData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
return EFI_INVALID_PARAMETER;
}
//
// When try to set a new password, user will be chanlleged with old password.
// The Callback is responsible for validating old password input by user,
// If Callback return EFI_SUCCESS, it indicates validation pass.
//
switch (PrivateData->PasswordState) {
case BROWSER_STATE_VALIDATE_PASSWORD:
Status = ValidatePassword (PrivateData, Value->string);
if (Status == EFI_SUCCESS) {
PrivateData->PasswordState = BROWSER_STATE_SET_PASSWORD;
}
break;
case BROWSER_STATE_SET_PASSWORD:
Status = SetPassword (PrivateData, Value->string);
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
break;
default:
break;
}
break;
default:
break;
}
}
break;
case EFI_BROWSER_ACTION_CHANGED:
switch (QuestionId) {
case 0x1237:
//
// User press "Exit now", request Browser to exit
@ -1711,44 +1753,9 @@ DriverCallback (
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
case 0x2000:
//
// Only used to update the state.
//
if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) &&
(PrivateData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
return EFI_INVALID_PARAMETER;
}
//
// When try to set a new password, user will be chanlleged with old password.
// The Callback is responsible for validating old password input by user,
// If Callback return EFI_SUCCESS, it indicates validation pass.
//
switch (PrivateData->PasswordState) {
case BROWSER_STATE_VALIDATE_PASSWORD:
Status = ValidatePassword (PrivateData, Value->string);
if (Status == EFI_SUCCESS) {
PrivateData->PasswordState = BROWSER_STATE_SET_PASSWORD;
}
break;
case BROWSER_STATE_SET_PASSWORD:
Status = SetPassword (PrivateData, Value->string);
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
break;
default:
break;
}
break;
default:
break;
}
}
break;
default:

View File

@ -676,7 +676,10 @@ IScsiFormCallback (
EFI_STATUS Status;
EFI_INPUT_KEY Key;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
return EFI_UNSUPPORTED;
}
Private = ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
//
// Retrive uncommitted data from Browser
@ -689,6 +692,23 @@ IScsiFormCallback (
}
Status = EFI_SUCCESS;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if ((QuestionId >= KEY_DEVICE_ENTRY_BASE) && (QuestionId < (mNumberOfIScsiDevices + KEY_DEVICE_ENTRY_BASE))) {
//
// In case goto the device configuration form, update the device form title.
//
ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));
ASSERT (ConfigFormEntry != NULL);
UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);
DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;
HiiSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString, NULL);
IScsiConvertDeviceConfigDataToIfrNvData (ConfigFormEntry, IfrNvData);
Private->Current = ConfigFormEntry;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case KEY_INITIATOR_NAME:
IScsiUnicodeStrToAsciiStr (IfrNvData->InitiatorName, IScsiName);
@ -889,24 +909,9 @@ IScsiFormCallback (
break;
default:
if ((QuestionId >= KEY_DEVICE_ENTRY_BASE) && (QuestionId < (mNumberOfIScsiDevices + KEY_DEVICE_ENTRY_BASE))) {
//
// In case goto the device configuration form, update the device form title.
//
ConfigFormEntry = IScsiGetConfigFormEntryByIndex ((UINT32) (QuestionId - KEY_DEVICE_ENTRY_BASE));
ASSERT (ConfigFormEntry != NULL);
UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", ConfigFormEntry->MacString);
DeviceFormTitleToken = (EFI_STRING_ID) STR_ISCSI_DEVICE_FORM_TITLE;
HiiSetString (Private->RegisteredHandle, DeviceFormTitleToken, PortString, NULL);
IScsiConvertDeviceConfigDataToIfrNvData (ConfigFormEntry, IfrNvData);
Private->Current = ConfigFormEntry;
}
break;
}
}
if (!EFI_ERROR (Status)) {
//
@ -920,12 +925,6 @@ IScsiFormCallback (
return Status;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
/**
Updates the iSCSI configuration form to add/delete an entry for the iSCSI
device specified by the Controller.

View File

@ -204,9 +204,10 @@ formset
subtitle text = STRING_TOKEN(STR_NULL);
goto FORMID_DEVICE_FORM,
prompt = STRING_TOKEN (STR_SAVE_CHANGES),
text
help = STRING_TOKEN (STR_SAVE_CHANGES),
text = STRING_TOKEN (STR_SAVE_CHANGES),
text = STRING_TOKEN (STR_SAVE_CHANGES),
flags = INTERACTIVE,
key = KEY_SAVE_CHANGES;

View File

@ -79,9 +79,10 @@ formset
subtitle text = STRING_TOKEN(STR_NULL);
goto FORMID_DEVICE_FORM,
prompt = STRING_TOKEN (STR_SAVE_CHANGES),
text
help = STRING_TOKEN(STR_SAVE_CHANGES),
text = STRING_TOKEN(STR_SAVE_CHANGES),
text = STRING_TOKEN(STR_SAVE_CHANGES),
flags = INTERACTIVE,
key = KEY_SAVE_CHANGES;

View File

@ -689,7 +689,7 @@ Ip4FormCallback (
EFI_STATUS Status;
EFI_INPUT_KEY Key;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Action == EFI_BROWSER_ACTION_CHANGED) {
Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS (This);
IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG_IFR_NVDATA));

View File

@ -239,7 +239,13 @@ VlanCallback (
return EFI_SUCCESS;
}
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if ((Action != EFI_BROWSER_ACTION_CHANGED) && (Action != EFI_BROWSER_ACTION_CHANGING)) {
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
//
// Get Browser data
//
@ -249,6 +255,7 @@ VlanCallback (
VlanConfig = PrivateData->VlanConfig;
if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case VLAN_ADD_QUESTION_ID:
//
@ -304,6 +311,11 @@ VlanCallback (
ZeroMem (Configuration->VlanList, MAX_VLAN_NUMBER);
break;
default:
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
case VLAN_UPDATE_QUESTION_ID:
//
// Update current VLAN list into Form.
@ -314,18 +326,13 @@ VlanCallback (
default:
break;
}
}
HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);
FreePool (Configuration);
return EFI_SUCCESS;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
/**
This function update VLAN list in the VLAN configuration Form.

View File

@ -1334,17 +1334,25 @@ PlatOverMngrCallback (
EFI_INPUT_KEY Key;
PLAT_OVER_MNGR_DATA *FakeNvData;
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;
}
Private = EFI_CALLBACK_INFO_FROM_THIS (This);
FakeNvData = &Private->FakeNvData;
if (!HiiGetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData)) {
return EFI_NOT_FOUND;
}
if (KeyValue == KEY_VALUE_DEVICE_REFRESH ||
KeyValue == KEY_VALUE_DEVICE_FILTER ||
KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS
) {
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (Value == NULL) {
return EFI_INVALID_PARAMETER;
}
if (KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS) {
UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);
//
// Update page title string
@ -1380,15 +1388,6 @@ PlatOverMngrCallback (
}
}
if (KeyValue == KEY_VALUE_ORDER_SAVE_AND_EXIT) {
Status = CommintChanges (Private, KeyValue, FakeNvData);
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
if (EFI_ERROR (Status)) {
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Single Override Info too large, Saving Error!", NULL);
return EFI_DEVICE_ERROR;
}
}
if (KeyValue == KEY_VALUE_DEVICE_CLEAR) {
//
// Deletes all environment variable(s) that contain the override mappings info
@ -1397,6 +1396,34 @@ PlatOverMngrCallback (
Status = SaveOverridesMapping (&mMappingDataBase);
UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (KeyValue) {
case KEY_VALUE_DEVICE_REFRESH:
case KEY_VALUE_DEVICE_FILTER:
UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);
//
// Update page title string
//
NewStringToken = STRING_TOKEN (STR_TITLE);
if (HiiSetString (Private->RegisteredHandle, NewStringToken, L"First, Select the controller by device path", NULL) == 0) {
ASSERT (FALSE);
}
break;
case KEY_VALUE_ORDER_SAVE_AND_EXIT:
Status = CommintChanges (Private, KeyValue, FakeNvData);
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
if (EFI_ERROR (Status)) {
CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Single Override Info too large, Saving Error!", NULL);
return EFI_DEVICE_ERROR;
}
break;
default:
break;
}
}
//
// Pass changed uncommitted data back to Form Browser
//
@ -1405,12 +1432,6 @@ PlatOverMngrCallback (
return EFI_SUCCESS;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
/**
Retrieves the image handle of the platform override driver for a controller in the system.

View File

@ -99,9 +99,10 @@ formset
subtitle text = STRING_TOKEN(STR_NULL_STRING);
goto FORM_ID_ORDER,
prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
text
help = STRING_TOKEN (STR_NULL_STRING),
text = STRING_TOKEN (STR_SAVE_AND_EXIT),
text = STRING_TOKEN (STR_SAVE_AND_EXIT),
flags = INTERACTIVE | RESET_REQUIRED,
key = KEY_VALUE_ORDER_SAVE_AND_EXIT;
endform;

View File

@ -1248,6 +1248,10 @@ ProcessCallBackFunction (
&ActionRequest
);
if (!EFI_ERROR (Status)) {
//
// Only for EFI_BROWSER_ACTION_CHANGED need to handle this ActionRequest.
//
if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (ActionRequest) {
case EFI_BROWSER_ACTION_REQUEST_RESET:
gResetRequired = TRUE;
@ -1288,6 +1292,7 @@ ProcessCallBackFunction (
default:
break;
}
}
//
// According the spec, return value from call back of "changing" and
@ -1555,7 +1560,7 @@ SetupBrowser (
}
}
if ((Status == EFI_SUCCESS) && (Statement->Operand != EFI_IFR_REF_OP)) {
if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) {
ProcessCallBackFunction(Selection, Statement, EFI_BROWSER_ACTION_CHANGED, FALSE);
}
}