]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fixed one bug in EmuVariable module: The macro (GET_PAD_SIZE) is different with GetPa...
authorzliu3 <zliu3@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 6 Dec 2006 08:16:31 +0000 (08:16 +0000)
committerzliu3 <zliu3@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 6 Dec 2006 08:16:31 +0000 (08:16 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2059 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c

index fe1ac92b63589a92b7725545962dc9db785b6c80..bfb499ab653277f574c00936f9dcfc675e7db3bb 100644 (file)
@@ -1,16 +1,16 @@
 /*++\r
 \r
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
 Module Name:\r
-  \r
+\r
     EmuVariable.c\r
 \r
 Abstract:\r
     EmuVariable.c\r
 \r
 Abstract:\r
@@ -62,37 +62,6 @@ Returns:
   return (Count * 2) + 2;\r
 }\r
 \r
   return (Count * 2) + 2;\r
 }\r
 \r
-UINTN\r
-EFIAPI\r
-GetPadSize (\r
-  IN UINTN Value\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function return the pad size for alignment\r
-\r
-Arguments:\r
-\r
-  Value  The value need to align\r
-\r
-Returns:\r
-\r
-  Pad size for value\r
-\r
---*/\r
-{\r
-  //\r
-  // If alignment is 0 or 1, means no alignment required\r
-  //\r
-  if (ALIGNMENT == 0 || ALIGNMENT == 1) {\r
-    return 0;\r
-  }\r
-\r
-  return ALIGNMENT - (Value % ALIGNMENT);\r
-}\r
-\r
 VARIABLE_STORE_STATUS\r
 EFIAPI\r
 GetVariableStoreStatus (\r
 VARIABLE_STORE_STATUS\r
 EFIAPI\r
 GetVariableStoreStatus (\r
@@ -161,7 +130,7 @@ Returns:
   //\r
   // Be careful about pad size for alignment\r
   //\r
   //\r
   // Be careful about pad size for alignment\r
   //\r
-  return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GetPadSize (Variable->NameSize));\r
+  return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GET_PAD_SIZE (Variable->NameSize));\r
 }\r
 \r
 VARIABLE_HEADER *\r
 }\r
 \r
 VARIABLE_HEADER *\r
@@ -413,7 +382,7 @@ Returns:
   UINTN                   VarNameSize;\r
   EFI_STATUS              Status;\r
 \r
   UINTN                   VarNameSize;\r
   EFI_STATUS              Status;\r
 \r
-  if (VariableNameSize == NULL || VariableName == NULL || VendorGuid == NULL) {\r
+  if (VariableNameSize == NULL || VendorGuid == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -593,8 +562,8 @@ Returns:
     //\r
     VarNameOffset = sizeof (VARIABLE_HEADER);\r
     VarNameSize   = ArrayLength (VariableName);\r
     //\r
     VarNameOffset = sizeof (VARIABLE_HEADER);\r
     VarNameSize   = ArrayLength (VariableName);\r
-    VarDataOffset = VarNameOffset + VarNameSize + GetPadSize (VarNameSize);\r
-    VarSize       = VarDataOffset + DataSize + GetPadSize (DataSize);\r
+    VarDataOffset = VarNameOffset + VarNameSize + GET_PAD_SIZE (VarNameSize);\r
+    VarSize       = VarDataOffset + DataSize + GET_PAD_SIZE (DataSize);\r
 \r
     if (Attributes & EFI_VARIABLE_NON_VOLATILE) {\r
       if ((UINT32) (VarSize +*NonVolatileOffset) >\r
 \r
     if (Attributes & EFI_VARIABLE_NON_VOLATILE) {\r
       if ((UINT32) (VarSize +*NonVolatileOffset) >\r
@@ -675,11 +644,11 @@ Routine Description:
 \r
 Arguments:\r
 \r
 \r
 Arguments:\r
 \r
-  Attributes                      Attributes bitmask to specify the type of variables \r
+  Attributes                      Attributes bitmask to specify the type of variables\r
                                   on which to return information.\r
   MaximumVariableStorageSize      Pointer to the maximum size of the storage space available\r
                                   for the EFI variables associated with the attributes specified.\r
                                   on which to return information.\r
   MaximumVariableStorageSize      Pointer to the maximum size of the storage space available\r
                                   for the EFI variables associated with the attributes specified.\r
-  RemainingVariableStorageSize    Pointer to the remaining size of the storage space available \r
+  RemainingVariableStorageSize    Pointer to the remaining size of the storage space available\r
                                   for the EFI variables associated with the attributes specified.\r
   MaximumVariableSize             Pointer to the maximum size of the individual EFI variables\r
                                   associated with the attributes specified.\r
                                   for the EFI variables associated with the attributes specified.\r
   MaximumVariableSize             Pointer to the maximum size of the individual EFI variables\r
                                   associated with the attributes specified.\r
@@ -699,7 +668,7 @@ Returns:
   VARIABLE_HEADER        *NextVariable;\r
   UINT64                 VariableSize;\r
   VARIABLE_STORE_HEADER  *VariableStoreHeader;\r
   VARIABLE_HEADER        *NextVariable;\r
   UINT64                 VariableSize;\r
   VARIABLE_STORE_HEADER  *VariableStoreHeader;\r
-  \r
+\r
   if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -725,7 +694,7 @@ Returns:
     //\r
     // Query is Volatile related.\r
     //\r
     //\r
     // Query is Volatile related.\r
     //\r
-    VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);    \r
+    VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);\r
   } else {\r
     //\r
     // Query is Non-Volatile related.\r
   } else {\r
     //\r
     // Query is Non-Volatile related.\r
@@ -734,14 +703,14 @@ Returns:
   }\r
 \r
   //\r
   }\r
 \r
   //\r
-  // Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize \r
+  // Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize\r
   // with the storage size (excluding the storage header size)\r
   //\r
   *MaximumVariableStorageSize   = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
   *RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
 \r
   //\r
   // with the storage size (excluding the storage header size)\r
   //\r
   *MaximumVariableStorageSize   = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
   *RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
 \r
   //\r
-  // Let *MaximumVariableSize be MAX_VARIABLE_SIZE \r
+  // Let *MaximumVariableSize be MAX_VARIABLE_SIZE\r
   //\r
   *MaximumVariableSize = MAX_VARIABLE_SIZE;\r
 \r
   //\r
   *MaximumVariableSize = MAX_VARIABLE_SIZE;\r
 \r
@@ -846,7 +815,7 @@ Returns:
   //\r
   mVariableModuleGlobal = (ESAL_VARIABLE_GLOBAL *) AllocateRuntimePool (\r
                                                     sizeof (ESAL_VARIABLE_GLOBAL)\r
   //\r
   mVariableModuleGlobal = (ESAL_VARIABLE_GLOBAL *) AllocateRuntimePool (\r
                                                     sizeof (ESAL_VARIABLE_GLOBAL)\r
-                                                    );\r
+                                                   );\r
   if (NULL == mVariableModuleGlobal) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   if (NULL == mVariableModuleGlobal) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r