summaryrefslogtreecommitdiff
path: root/NetworkPkg/IScsiDxe/IScsiConfig.c
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-12-15 02:57:46 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-12-15 02:57:46 +0000
commit639a76d1912f8eb07e26b1a8f2393b682be65f2c (patch)
treeb67f5a0096541a50a24db231ca786fc0a343c140 /NetworkPkg/IScsiDxe/IScsiConfig.c
parent847240774030f9da79140a9d515a64ec817eb6eb (diff)
downloadedk2-platforms-639a76d1912f8eb07e26b1a8f2393b682be65f2c.tar.xz
Update for NetworkPkg.
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@12867 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/IScsiDxe/IScsiConfig.c')
-rw-r--r--NetworkPkg/IScsiDxe/IScsiConfig.c228
1 files changed, 117 insertions, 111 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index d347d8dc70..eea73a8ff1 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -1606,14 +1606,6 @@ IScsiConfigProcessDefault (
UINTN Index;
//
- // Free any attempt that is previously created but not saved to system.
- //
- if (mPrivate->NewAttempt != NULL) {
- FreePool (mPrivate->NewAttempt);
- mPrivate->NewAttempt = NULL;
- }
-
- //
// Is User creating a new attempt?
//
NewAttempt = FALSE;
@@ -1637,6 +1629,14 @@ IScsiConfigProcessDefault (
//
return EFI_SUCCESS;
}
+
+ //
+ // Free any attempt that is previously created but not saved to system.
+ //
+ if (mPrivate->NewAttempt != NULL) {
+ FreePool (mPrivate->NewAttempt);
+ mPrivate->NewAttempt = NULL;
+ }
if (NewAttempt) {
//
@@ -2103,37 +2103,75 @@ IScsiFormCallback (
return EFI_SUCCESS;
}
- if (Action == EFI_BROWSER_ACTION_CHANGING) {
- if (This == NULL || Value == NULL || ActionRequest == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
-
+ if ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED)) {
//
- // Retrieve uncommitted data from Browser
+ // All other type return unsupported.
//
+ return EFI_UNSUPPORTED;
+ }
- BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA);
- IfrNvData = AllocateZeroPool (BufferSize);
- if (IfrNvData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- IScsiName = (CHAR8 *) AllocateZeroPool (ISCSI_NAME_MAX_SIZE);
- if (IScsiName == NULL) {
- FreePool (IfrNvData);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = EFI_SUCCESS;
+ if ((Value == NULL) || (ActionRequest == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
- ZeroMem (&OldIfrNvData, BufferSize);
+ Private = ISCSI_FORM_CALLBACK_INFO_FROM_FORM_CALLBACK (This);
+
+ //
+ // Retrieve uncommitted data from Browser
+ //
+
+ BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA);
+ IfrNvData = AllocateZeroPool (BufferSize);
+ if (IfrNvData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ IScsiName = (CHAR8 *) AllocateZeroPool (ISCSI_NAME_MAX_SIZE);
+ if (IScsiName == NULL) {
+ FreePool (IfrNvData);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Status = EFI_SUCCESS;
+
+ ZeroMem (&OldIfrNvData, BufferSize);
+
+ HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData);
+
+ CopyMem (&OldIfrNvData, IfrNvData, BufferSize);
- HiiGetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData);
+ if (Action == EFI_BROWSER_ACTION_CHANGING) {
+ switch (QuestionId) {
+ case KEY_ADD_ATTEMPT:
+ Status = IScsiConfigAddAttempt ();
+ break;
- CopyMem (&OldIfrNvData, IfrNvData, BufferSize);
+ case KEY_DELETE_ATTEMPT:
+ CopyMem (
+ OldIfrNvData.DeleteAttemptList,
+ IfrNvData->DeleteAttemptList,
+ sizeof (IfrNvData->DeleteAttemptList)
+ );
+ Status = IScsiConfigDisplayDeleteAttempts (IfrNvData);
+ break;
+ case KEY_ORDER_ATTEMPT_CONFIG:
+ //
+ // Order the attempt according to user input.
+ //
+ CopyMem (
+ OldIfrNvData.DynamicOrderedList,
+ IfrNvData->DynamicOrderedList,
+ sizeof (IfrNvData->DynamicOrderedList)
+ );
+ IScsiConfigDisplayOrderAttempts ();
+ break;
+
+ default:
+ Status = IScsiConfigProcessDefault (QuestionId, IfrNvData);
+ break;
+ }
+ } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case KEY_INITIATOR_NAME:
UnicodeStrToAsciiStr (IfrNvData->InitiatorName, IScsiName);
@@ -2151,54 +2189,34 @@ IScsiFormCallback (
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
+ case KEY_ATTEMPT_NAME:
+ if (StrLen (IfrNvData->AttemptName) > ATTEMPT_NAME_SIZE) {
+ CopyMem (AttemptName, IfrNvData->AttemptName, ATTEMPT_NAME_SIZE * sizeof (CHAR16));
+ CopyMem (&AttemptName[ATTEMPT_NAME_SIZE], L"...", 4 * sizeof (CHAR16));
+ } else {
+ CopyMem (
+ AttemptName,
+ IfrNvData->AttemptName,
+ (StrLen (IfrNvData->AttemptName) + 1) * sizeof (CHAR16)
+ );
+ }
- case KEY_ADD_ATTEMPT:
- Status = IScsiConfigAddAttempt ();
- break;
+ UnicodeStrToAsciiStr (IfrNvData->AttemptName, Private->Current->AttemptName);
- case KEY_DELETE_ATTEMPT:
- CopyMem (
- OldIfrNvData.DeleteAttemptList,
- IfrNvData->DeleteAttemptList,
- sizeof (IfrNvData->DeleteAttemptList)
- );
- Status = IScsiConfigDisplayDeleteAttempts (IfrNvData);
- break;
+ IScsiConfigUpdateAttempt ();
- case KEY_SAVE_DELETE_ATTEMPT:
- //
- // Delete the Attempt Order from NVR
- //
- Status = IScsiConfigDeleteAttempts (IfrNvData);
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
+ break;
+
+ case KEY_SAVE_ATTEMPT_CONFIG:
+ Status = IScsiConvertIfrNvDataToAttemptConfigData (IfrNvData, Private->Current);
if (EFI_ERROR (Status)) {
break;
}
- IScsiConfigUpdateAttempt ();
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
- case KEY_IGNORE_DELETE_ATTEMPT:
- CopyMem (
- IfrNvData->DeleteAttemptList,
- OldIfrNvData.DeleteAttemptList,
- sizeof (IfrNvData->DeleteAttemptList)
- );
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;
- break;
-
- case KEY_ORDER_ATTEMPT_CONFIG:
- //
- // Order the attempt according to user input.
- //
- CopyMem (
- OldIfrNvData.DynamicOrderedList,
- IfrNvData->DynamicOrderedList,
- sizeof (IfrNvData->DynamicOrderedList)
- );
- IScsiConfigDisplayOrderAttempts ();
- break;
-
case KEY_SAVE_ORDER_CHANGES:
//
// Sync the Attempt Order to NVR.
@@ -2209,7 +2227,7 @@ IScsiFormCallback (
}
IScsiConfigUpdateAttempt ();
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
break;
case KEY_IGNORE_ORDER_CHANGES:
@@ -2218,26 +2236,29 @@ IScsiFormCallback (
OldIfrNvData.DynamicOrderedList,
sizeof (IfrNvData->DynamicOrderedList)
);
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
- case KEY_ATTEMPT_NAME:
- if (StrLen (IfrNvData->AttemptName) > ATTEMPT_NAME_SIZE) {
- CopyMem (AttemptName, IfrNvData->AttemptName, ATTEMPT_NAME_SIZE * sizeof (CHAR16));
- CopyMem (&AttemptName[ATTEMPT_NAME_SIZE], L"...", 4 * sizeof (CHAR16));
- } else {
- CopyMem (
- AttemptName,
- IfrNvData->AttemptName,
- (StrLen (IfrNvData->AttemptName) + 1) * sizeof (CHAR16)
- );
+ case KEY_SAVE_DELETE_ATTEMPT:
+ //
+ // Delete the Attempt Order from NVR
+ //
+ Status = IScsiConfigDeleteAttempts (IfrNvData);
+ if (EFI_ERROR (Status)) {
+ break;
}
- UnicodeStrToAsciiStr (IfrNvData->AttemptName, Private->Current->AttemptName);
-
IScsiConfigUpdateAttempt ();
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
+ break;
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
+ case KEY_IGNORE_DELETE_ATTEMPT:
+ CopyMem (
+ IfrNvData->DeleteAttemptList,
+ OldIfrNvData.DeleteAttemptList,
+ sizeof (IfrNvData->DeleteAttemptList)
+ );
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
case KEY_IP_MODE:
@@ -2409,38 +2430,23 @@ IScsiFormCallback (
break;
- case KEY_SAVE_ATTEMPT_CONFIG:
- Status = IScsiConvertIfrNvDataToAttemptConfigData (IfrNvData, Private->Current);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
- break;
-
default:
- Status = IScsiConfigProcessDefault (QuestionId, IfrNvData);
break;
}
+ }
- if (!EFI_ERROR (Status)) {
- //
- // Pass changed uncommitted data back to Form Browser.
- //
- BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA);
- HiiSetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData, NULL);
- }
-
- FreePool (IfrNvData);
- FreePool (IScsiName);
-
- return Status;
+ if (!EFI_ERROR (Status)) {
+ //
+ // Pass changed uncommitted data back to Form Browser.
+ //
+ BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA);
+ HiiSetBrowserData (NULL, NULL, BufferSize, (UINT8 *) IfrNvData, NULL);
}
- //
- // All other action return unsupported.
- //
- return EFI_UNSUPPORTED;
+ FreePool (IfrNvData);
+ FreePool (IScsiName);
+
+ return Status;
}