]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
Change the TPL lock level to EFI_TPL_NOTIFY. Variable Service is called in ResetSyste...
[mirror_edk2.git] / EdkModulePkg / Universal / Variable / RuntimeDxe / Variable.c
index 46ffc7ddbb0f8f9ba9650afb327389eb4c138783..a9dff65494720ad418d134e2a735df49ffe22174 100644 (file)
@@ -32,6 +32,7 @@ ESAL_VARIABLE_GLOBAL  *mVariableModuleGlobal;
 // when EfiAcquireLock in UefiLib can handle the\r
 // the call in UEFI Runtimer driver in RT phase.\r
 //\r
+STATIC\r
 VOID\r
 AcquireLockOnlyAtBootTime (\r
   IN EFI_LOCK  *Lock\r
@@ -47,6 +48,7 @@ AcquireLockOnlyAtBootTime (
 // when EfiAcquireLock in UefiLib can handle the\r
 // the call in UEFI Runtimer driver in RT phase.\r
 //\r
+STATIC\r
 VOID\r
 ReleaseLockOnlyAtBootTime (\r
   IN EFI_LOCK  *Lock\r
@@ -57,43 +59,6 @@ ReleaseLockOnlyAtBootTime (
   }\r
 }\r
 \r
-STATIC\r
-UINT32\r
-EFIAPI\r
-ArrayLength (\r
-  IN CHAR16 *String\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Determine the length of null terminated char16 array.\r
-\r
-Arguments:\r
-\r
-  String    Null-terminated CHAR16 array pointer.\r
-\r
-Returns:\r
-\r
-  UINT32    Number of bytes in the string, including the double NULL at the end;\r
-\r
---*/\r
-{\r
-  UINT32  Count;\r
-\r
-  if (NULL == String) {\r
-    return 0;\r
-  }\r
-\r
-  Count = 0;\r
-\r
-  while (0 != String[Count]) {\r
-    Count++;\r
-  }\r
-\r
-  return (Count * 2) + 2;\r
-}\r
-\r
 STATIC\r
 BOOLEAN\r
 EFIAPI\r
@@ -598,7 +563,7 @@ Returns:
             return EFI_SUCCESS;\r
           } else {\r
             if (CompareGuid (VendorGuid, &Variable[Index]->VendorGuid)) {\r
-              if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), ArrayLength (VariableName))) {\r
+              if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), Variable[Index]->NameSize)) {\r
                 PtrTrack->CurrPtr   = Variable[Index];\r
                 PtrTrack->Volatile  = (BOOLEAN) Index;\r
                 return EFI_SUCCESS;\r
@@ -874,7 +839,7 @@ Returns:
     //\r
     Status = EFI_WRITE_PROTECTED;\r
     goto Done;\r
-  } else if (sizeof (VARIABLE_HEADER) + ArrayLength (VariableName) + DataSize > MAX_VARIABLE_SIZE) {\r
+  } else if (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE) {\r
     //\r
     //  The size of the VariableName, including the Unicode Null in bytes plus\r
     //  the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
@@ -983,7 +948,7 @@ Returns:
     //\r
     NextVariable->Reserved  = 0;\r
     VarNameOffset           = sizeof (VARIABLE_HEADER);\r
-    VarNameSize             = ArrayLength (VariableName);\r
+    VarNameSize             = StrSize (VariableName);\r
     CopyMem (\r
       (UINT8 *) ((UINTN) NextVariable + VarNameOffset),\r
       VariableName,\r
@@ -1355,7 +1320,7 @@ Returns:
     return Status;\r
   }\r
 \r
-  EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, EFI_TPL_CALLBACK);\r
+  EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, EFI_TPL_NOTIFY);\r
   \r
   //\r
   // Allocate memory for volatile variable store\r