From 51967a53143ff87800afe37b3c72292a7ae5f938 Mon Sep 17 00:00:00 2001 From: jljusten Date: Wed, 29 Apr 2009 20:22:38 +0000 Subject: 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 --- .../Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c index 9f372c1437..6925f3c6eb 100644 --- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c +++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c @@ -811,13 +811,6 @@ FindVariable ( VARIABLE_STORE_HEADER *VariableStoreHeader[2]; 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 // @@ -906,6 +899,9 @@ EmuGetVariable ( if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) { return EFI_INVALID_PARAMETER; } + + AcquireLockOnlyAtBootTime(&Global->VariableServicesLock); + // // Find existing variable // @@ -979,6 +975,8 @@ EmuGetNextVariableName ( return EFI_INVALID_PARAMETER; } + AcquireLockOnlyAtBootTime(&Global->VariableServicesLock); + Status = FindVariable (VariableName, VendorGuid, &Variable, Global); if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) { @@ -1129,6 +1127,8 @@ EmuSetVariable ( } } + AcquireLockOnlyAtBootTime(&Global->VariableServicesLock); + // // Check whether the input variable is already existed // -- cgit v1.2.3