Acquire & Release the lock from the high level variable service

routines similar to MdeModulePkg/Universal/Variable/RuntimeDxe.
When the Acquire was in the FindVariable routine, is was
being called by both EmuSetVariable and again in
AutoUpdateLangVariable, which caused an ASSERT to fail.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8205 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten 2009-04-29 20:22:38 +00:00
parent 6198c34621
commit 51967a5314
1 changed files with 7 additions and 7 deletions

View File

@ -811,13 +811,6 @@ FindVariable (
VARIABLE_STORE_HEADER *VariableStoreHeader[2]; VARIABLE_STORE_HEADER *VariableStoreHeader[2];
UINTN Index; UINTN Index;
//
// We aquire the lock at the entry of FindVariable as GetVariable, GetNextVariableName
// SetVariable all call FindVariable at entry point. Please move "Aquire Lock" to
// the correct places if this assumption does not hold TRUE anymore.
//
AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
// //
// 0: Non-Volatile, 1: Volatile // 0: Non-Volatile, 1: Volatile
// //
@ -906,6 +899,9 @@ EmuGetVariable (
if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) { if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
// //
// Find existing variable // Find existing variable
// //
@ -979,6 +975,8 @@ EmuGetNextVariableName (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
Status = FindVariable (VariableName, VendorGuid, &Variable, Global); Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) { if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
@ -1129,6 +1127,8 @@ EmuSetVariable (
} }
} }
AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
// //
// Check whether the input variable is already existed // Check whether the input variable is already existed
// //