mirror of https://github.com/acidanthera/audk.git
Fix a bug that when user can't presses F9 to restore the NV Map data into default values.
Setup Browser implementation has a bug to only restore the NV Map data for the first varstore ID. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3622 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
62271ed6b8
commit
c3e02ca573
|
@ -1441,6 +1441,7 @@ Returns:
|
||||||
MENU_REFRESH_ENTRY *OldMenuRefreshEntry;
|
MENU_REFRESH_ENTRY *OldMenuRefreshEntry;
|
||||||
UI_SCREEN_OPERATION ScreenOperation;
|
UI_SCREEN_OPERATION ScreenOperation;
|
||||||
EFI_VARIABLE_DEFINITION *VariableDefinition;
|
EFI_VARIABLE_DEFINITION *VariableDefinition;
|
||||||
|
EFI_VARIABLE_DEFINITION *UiDefaultVarDef; // Only used in CfUiDefault State
|
||||||
EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
|
EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
|
||||||
EFI_HII_VARIABLE_PACK_LIST *NvMapListHead;
|
EFI_HII_VARIABLE_PACK_LIST *NvMapListHead;
|
||||||
EFI_HII_VARIABLE_PACK_LIST *NvMapListNode;
|
EFI_HII_VARIABLE_PACK_LIST *NvMapListNode;
|
||||||
|
@ -2977,34 +2978,40 @@ Returns:
|
||||||
NvMapListNode = NvMapListHead;
|
NvMapListNode = NvMapListHead;
|
||||||
|
|
||||||
while (NULL != NvMapListNode) {
|
while (NULL != NvMapListNode) {
|
||||||
if (FileFormTags->VariableDefinitions->VariableId == NvMapListNode->VariablePack->VariableId) {
|
|
||||||
|
for (UiDefaultVarDef = FileFormTags->VariableDefinitions;
|
||||||
|
UiDefaultVarDef != NULL;
|
||||||
|
UiDefaultVarDef = UiDefaultVarDef->Next ) {
|
||||||
|
|
||||||
|
if (UiDefaultVarDef->VariableId == NvMapListNode->VariablePack->VariableId) {
|
||||||
NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);
|
NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);
|
||||||
NvMapSize = NvMapListNode->VariablePack->Header.Length - sizeof (EFI_HII_VARIABLE_PACK) - NvMapListNode->VariablePack->VariableNameLength;
|
NvMapSize = NvMapListNode->VariablePack->Header.Length - sizeof (EFI_HII_VARIABLE_PACK) - NvMapListNode->VariablePack->VariableNameLength;
|
||||||
break;
|
|
||||||
}
|
|
||||||
NvMapListNode = NvMapListNode->NextVariablePack;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free the buffer that was allocated.
|
// Free the buffer that was allocated.
|
||||||
//
|
//
|
||||||
FreePool (FileFormTags->VariableDefinitions->NvRamMap);
|
FreePool (UiDefaultVarDef->NvRamMap);
|
||||||
FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);
|
FreePool (UiDefaultVarDef->FakeNvRamMap);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate, copy the NvRamMap.
|
// Allocate, copy the NvRamMap.
|
||||||
//
|
//
|
||||||
FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize - FileFormTags->VariableDefinitions->VariableSize);
|
UiDefaultVarDef->VariableFakeSize = (UINT16) (UiDefaultVarDef->VariableFakeSize - UiDefaultVarDef->VariableSize);
|
||||||
FileFormTags->VariableDefinitions->VariableSize = (UINT16) NvMapSize;
|
UiDefaultVarDef->VariableSize = (UINT16) NvMapSize;
|
||||||
FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize);
|
UiDefaultVarDef->VariableFakeSize = (UINT16) (UiDefaultVarDef->VariableFakeSize + UiDefaultVarDef->VariableSize);
|
||||||
|
|
||||||
FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);
|
UiDefaultVarDef->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);
|
||||||
ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL);
|
ASSERT (UiDefaultVarDef->NvRamMap != NULL);
|
||||||
|
|
||||||
FileFormTags->VariableDefinitions->FakeNvRamMap = AllocateZeroPool (NvMapSize + FileFormTags->VariableDefinitions->VariableFakeSize);
|
UiDefaultVarDef->FakeNvRamMap = AllocateZeroPool (NvMapSize + UiDefaultVarDef->VariableFakeSize);
|
||||||
ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL);
|
ASSERT (UiDefaultVarDef->FakeNvRamMap != NULL);
|
||||||
|
|
||||||
|
CopyMem (UiDefaultVarDef->NvRamMap, NvMap, NvMapSize);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NvMapListNode = NvMapListNode->NextVariablePack;
|
||||||
|
}
|
||||||
|
|
||||||
CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize);
|
|
||||||
FreePool (NvMapListHead);
|
FreePool (NvMapListHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue