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,50 +1667,6 @@ DriverCallback (
}
break;
case 0x1237:
//
// User press "Exit now", request Browser to exit
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case 0x1238:
//
// User press "Save now", request Browser to save the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
break;
case 0x1241:
case 0x1246:
//
// User press "Submit current form and Exit now", request Browser to submit current form and exit
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
break;
case 0x1242:
//
// User press "Discard current form now", request Browser to discard the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;
break;
case 0x1243:
//
// User press "Submit current form now", request Browser to save the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
case 0x1244:
case 0x1245:
//
// User press "Discard current form and Exit now", request Browser to discard the uncommitted data and exit.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
case 0x2000:
//
// Only used to update the state.
@ -1751,6 +1707,57 @@ DriverCallback (
}
break;
case EFI_BROWSER_ACTION_CHANGED:
switch (QuestionId) {
case 0x1237:
//
// User press "Exit now", request Browser to exit
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case 0x1238:
//
// User press "Save now", request Browser to save the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
break;
case 0x1241:
case 0x1246:
//
// User press "Submit current form and Exit now", request Browser to submit current form and exit
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
break;
case 0x1242:
//
// User press "Discard current form now", request Browser to discard the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;
break;
case 0x1243:
//
// User press "Submit current form now", request Browser to save the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
case 0x1244:
case 0x1245:
//
// User press "Discard current form and Exit now", request Browser to discard the uncommitted data and exit.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
default:
break;
}
break;
default:
Status = EFI_UNSUPPORTED;
break;

View File

@ -676,20 +676,40 @@ IScsiFormCallback (
EFI_STATUS Status;
EFI_INPUT_KEY Key;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
Private = ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
//
// Retrive uncommitted data from Browser
//
IfrNvData = AllocateZeroPool (sizeof (ISCSI_CONFIG_IFR_NVDATA));
ASSERT (IfrNvData != NULL);
if (!HiiGetBrowserData (&gIp4IScsiConfigGuid, mVendorStorageName, sizeof (ISCSI_CONFIG_IFR_NVDATA), (UINT8 *) IfrNvData)) {
FreePool (IfrNvData);
return EFI_NOT_FOUND;
}
Status = EFI_SUCCESS;
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
return EFI_UNSUPPORTED;
}
switch (QuestionId) {
Private = ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
//
// Retrive uncommitted data from Browser
//
IfrNvData = AllocateZeroPool (sizeof (ISCSI_CONFIG_IFR_NVDATA));
ASSERT (IfrNvData != NULL);
if (!HiiGetBrowserData (&gIp4IScsiConfigGuid, mVendorStorageName, sizeof (ISCSI_CONFIG_IFR_NVDATA), (UINT8 *) IfrNvData)) {
FreePool (IfrNvData);
return EFI_NOT_FOUND;
}
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);
BufferSize = AsciiStrSize (IScsiName);
@ -889,41 +909,20 @@ 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)) {
//
// Pass changed uncommitted data back to Form Browser
//
HiiSetBrowserData (&gIp4IScsiConfigGuid, mVendorStorageName, sizeof (ISCSI_CONFIG_IFR_NVDATA), (UINT8 *) IfrNvData, NULL);
}
FreePool (IfrNvData);
return Status;
}
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
if (!EFI_ERROR (Status)) {
//
// Pass changed uncommitted data back to Form Browser
//
HiiSetBrowserData (&gIp4IScsiConfigGuid, mVendorStorageName, sizeof (ISCSI_CONFIG_IFR_NVDATA), (UINT8 *) IfrNvData, NULL);
}
FreePool (IfrNvData);
return Status;
}
/**

View File

@ -204,12 +204,13 @@ formset
subtitle text = STRING_TOKEN(STR_NULL);
goto FORMID_DEVICE_FORM,
prompt = STRING_TOKEN (STR_SAVE_CHANGES),
help = STRING_TOKEN (STR_SAVE_CHANGES),
flags = INTERACTIVE,
key = KEY_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;
goto FORMID_MAIN_FORM,
prompt = STRING_TOKEN (STR_RETURN_MAIN_FORM),
help = STRING_TOKEN (STR_RETURN_MAIN_FORM),

View File

@ -78,13 +78,14 @@ formset
endif;
subtitle text = STRING_TOKEN(STR_NULL);
goto FORMID_DEVICE_FORM,
prompt = STRING_TOKEN (STR_SAVE_CHANGES),
help = STRING_TOKEN (STR_SAVE_CHANGES),
flags = INTERACTIVE,
key = KEY_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;
endform;
endformset;

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,16 +239,23 @@ VlanCallback (
return EFI_SUCCESS;
}
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if ((Action != EFI_BROWSER_ACTION_CHANGED) && (Action != EFI_BROWSER_ACTION_CHANGING)) {
//
// Get Browser data
// All other action return unsupported.
//
Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));
ASSERT (Configuration != NULL);
HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);
return EFI_UNSUPPORTED;
}
VlanConfig = PrivateData->VlanConfig;
//
// Get Browser data
//
Configuration = AllocateZeroPool (sizeof (VLAN_CONFIGURATION));
ASSERT (Configuration != NULL);
HiiGetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration);
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,16 +326,11 @@ 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;
HiiSetBrowserData (&gVlanConfigFormSetGuid, mVlanStorageName, sizeof (VLAN_CONFIGURATION), (UINT8 *) Configuration, NULL);
FreePool (Configuration);
return EFI_SUCCESS;
}

View File

@ -1334,17 +1334,25 @@ PlatOverMngrCallback (
EFI_INPUT_KEY Key;
PLAT_OVER_MNGR_DATA *FakeNvData;
if (Action == EFI_BROWSER_ACTION_CHANGING) {
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 ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED)) {
//
// All other action return unsupported.
//
return EFI_UNSUPPORTED;
}
if (KeyValue == KEY_VALUE_DEVICE_REFRESH ||
KeyValue == KEY_VALUE_DEVICE_FILTER ||
KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS
) {
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 (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,18 +1396,40 @@ PlatOverMngrCallback (
Status = SaveOverridesMapping (&mMappingDataBase);
UpdateDeviceSelectPage (Private, KeyValue, FakeNvData);
}
//
// Pass changed uncommitted data back to Form Browser
//
HiiSetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData, NULL);
} 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;
return EFI_SUCCESS;
}
default:
break;
}
}
//
// All other action return unsupported.
// Pass changed uncommitted data back to Form Browser
//
return EFI_UNSUPPORTED;
HiiSetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData, NULL);
return EFI_SUCCESS;
}
/**

View File

@ -99,11 +99,12 @@ formset
subtitle text = STRING_TOKEN(STR_NULL_STRING);
goto FORM_ID_ORDER,
prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
help = STRING_TOKEN(STR_NULL_STRING),
flags = INTERACTIVE | RESET_REQUIRED,
key = KEY_VALUE_ORDER_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;
endformset;

View File

@ -1248,45 +1248,50 @@ ProcessCallBackFunction (
&ActionRequest
);
if (!EFI_ERROR (Status)) {
switch (ActionRequest) {
case EFI_BROWSER_ACTION_REQUEST_RESET:
gResetRequired = TRUE;
Selection->Action = UI_ACTION_EXIT;
break;
//
// 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;
Selection->Action = UI_ACTION_EXIT;
break;
case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
SubmitFormIsRequired = TRUE;
Selection->Action = UI_ACTION_EXIT;
break;
case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
SubmitFormIsRequired = TRUE;
Selection->Action = UI_ACTION_EXIT;
break;
case EFI_BROWSER_ACTION_REQUEST_EXIT:
Selection->Action = UI_ACTION_EXIT;
break;
case EFI_BROWSER_ACTION_REQUEST_EXIT:
Selection->Action = UI_ACTION_EXIT;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT:
SubmitFormIsRequired = TRUE;
SettingLevel = FormLevel;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT:
SubmitFormIsRequired = TRUE;
SettingLevel = FormLevel;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
NeedExit = TRUE;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_APPLY:
SubmitFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_APPLY:
SubmitFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
default:
break;
default:
break;
}
}
//
@ -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);
}
}