]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Acquire & Release the lock from the high level variable service
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 29 Apr 2009 20:22:38 +0000 (20:22 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 29 Apr 2009 20:22:38 +0000 (20:22 +0000)
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

MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c

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