mirror of https://github.com/acidanthera/audk.git
Fix a bug with changing the NVRAM properties of a Variable
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4030 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
bd55fe149f
commit
fd51bf702f
|
@ -1033,6 +1033,7 @@ RuntimeServiceSetVariable (
|
||||||
UINTN *VolatileOffset;
|
UINTN *VolatileOffset;
|
||||||
UINTN *NonVolatileOffset;
|
UINTN *NonVolatileOffset;
|
||||||
UINT32 Instance;
|
UINT32 Instance;
|
||||||
|
BOOLEAN Volatile;
|
||||||
|
|
||||||
Reclaimed = FALSE;
|
Reclaimed = FALSE;
|
||||||
VolatileOffset = &mVariableModuleGlobal->VolatileLastVariableOffset;
|
VolatileOffset = &mVariableModuleGlobal->VolatileLastVariableOffset;
|
||||||
|
@ -1076,11 +1077,11 @@ RuntimeServiceSetVariable (
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = FindVariable (VariableName, VendorGuid, &Variable, &mVariableModuleGlobal->VariableGlobal);
|
Status = FindVariable (VariableName, VendorGuid, &Variable, &mVariableModuleGlobal->VariableGlobal);
|
||||||
|
|
||||||
if (Status == EFI_SUCCESS && Variable.CurrPtr != NULL) {
|
if (Status == EFI_SUCCESS && Variable.CurrPtr != NULL) {
|
||||||
//
|
//
|
||||||
// Update/Delete existing variable
|
// Update/Delete existing variable
|
||||||
//
|
//
|
||||||
|
Volatile = Variable.Volatile;
|
||||||
|
|
||||||
if (EfiAtRuntime ()) {
|
if (EfiAtRuntime ()) {
|
||||||
//
|
//
|
||||||
|
@ -1118,7 +1119,7 @@ RuntimeServiceSetVariable (
|
||||||
&State
|
&State
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, FALSE, FALSE, TRUE, FALSE);
|
UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, FALSE, TRUE, FALSE);
|
||||||
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||||
}
|
}
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -1130,7 +1131,7 @@ RuntimeServiceSetVariable (
|
||||||
if (Variable.CurrPtr->DataSize == DataSize &&
|
if (Variable.CurrPtr->DataSize == DataSize &&
|
||||||
(CompareMem (Data, GetVariableDataPtr (Variable.CurrPtr), DataSize) == 0)) {
|
(CompareMem (Data, GetVariableDataPtr (Variable.CurrPtr), DataSize) == 0)) {
|
||||||
|
|
||||||
UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, FALSE, TRUE, FALSE, FALSE);
|
UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, TRUE, FALSE, FALSE);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
} else if ((Variable.CurrPtr->State == VAR_ADDED) ||
|
} else if ((Variable.CurrPtr->State == VAR_ADDED) ||
|
||||||
|
@ -1232,7 +1233,7 @@ RuntimeServiceSetVariable (
|
||||||
//
|
//
|
||||||
// Create a nonvolatile variable
|
// Create a nonvolatile variable
|
||||||
//
|
//
|
||||||
Variable.Volatile = FALSE;
|
Volatile = FALSE;
|
||||||
|
|
||||||
if ((UINT32) (VarSize +*NonVolatileOffset) >
|
if ((UINT32) (VarSize +*NonVolatileOffset) >
|
||||||
((VARIABLE_STORE_HEADER *) ((UINTN) (mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase)))->Size
|
((VARIABLE_STORE_HEADER *) ((UINTN) (mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase)))->Size
|
||||||
|
@ -1322,7 +1323,7 @@ RuntimeServiceSetVariable (
|
||||||
//
|
//
|
||||||
// Create a volatile variable
|
// Create a volatile variable
|
||||||
//
|
//
|
||||||
Variable.Volatile = TRUE;
|
Volatile = TRUE;
|
||||||
|
|
||||||
if ((UINT32) (VarSize +*VolatileOffset) >
|
if ((UINT32) (VarSize +*VolatileOffset) >
|
||||||
((VARIABLE_STORE_HEADER *) ((UINTN) (mVariableModuleGlobal->VariableGlobal.VolatileVariableBase)))->Size) {
|
((VARIABLE_STORE_HEADER *) ((UINTN) (mVariableModuleGlobal->VariableGlobal.VolatileVariableBase)))->Size) {
|
||||||
|
@ -1381,14 +1382,14 @@ RuntimeServiceSetVariable (
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, FALSE, TRUE, FALSE, FALSE);
|
UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, TRUE, FALSE, FALSE);
|
||||||
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||||
}
|
}
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, FALSE, TRUE, FALSE, FALSE);
|
UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, TRUE, FALSE, FALSE);
|
||||||
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
UpdateVariableCache (VariableName, VendorGuid, Attributes, DataSize, Data);
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
|
|
Loading…
Reference in New Issue