]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Move Varialbe common definitions (GET_PAD_SIZE and HEADER_ALIGN macro) into MdeModule...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 9 Jan 2009 06:31:30 +0000 (06:31 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 9 Jan 2009 06:31:30 +0000 (06:31 +0000)
And Use PCD to replace macros in source code to reduce confusion.(FixedPcdGet32(PcdMaxVariableSize) replaces MAX_VARIABLE_SIZE, and FixedPcdGet32(PcdMaxHardwareErrorVariableSize) replaces MAX_HARDWARE_ERROR_VARIABLE_SIZE.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7230 6f19259b-4bc3-4df7-8a09-765794883524

DuetPkg/FSVariable/FSVariable.c
DuetPkg/FSVariable/FSVariable.h

index 3a5fcc4e5f9d9f06c3b50cb1395b0e25290f0c05..18b93c08cc0854703c170d8ef781b4e0fe372c75 100644 (file)
@@ -70,7 +70,7 @@ Returns:
 {\r
   if (Variable == NULL ||\r
       Variable->StartId != VARIABLE_DATA ||\r
-      (sizeof (VARIABLE_HEADER) + Variable->NameSize + Variable->DataSize) > MAX_VARIABLE_SIZE\r
+      (sizeof (VARIABLE_HEADER) + Variable->NameSize + Variable->DataSize) > FixedPcdGet32(PcdMaxVariableSize)\r
       ) {\r
     return FALSE;\r
   }\r
@@ -734,17 +734,17 @@ Returns:
   \r
   //\r
   //  The size of the VariableName, including the Unicode Null in bytes plus\r
-  //  the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K)\r
-  //  bytes for HwErrRec, and MAX_VARIABLE_SIZE (1024) bytes for the others.\r
+  //  the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)\r
+  //  bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.\r
   //\r
   if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
-    if ((DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE) ||                                                       \r
-        (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE)) {\r
+    if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) ||                                                       \r
+        (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {\r
       return EFI_INVALID_PARAMETER;\r
     }    \r
   } else {\r
-    if ((DataSize > MAX_VARIABLE_SIZE) ||\r
-        (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {\r
+    if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||\r
+        (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {\r
       return EFI_INVALID_PARAMETER;\r
     }  \r
   }  \r
@@ -1035,15 +1035,15 @@ Returns:
   *RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
 \r
   //\r
-  // Let *MaximumVariableSize be MAX_VARIABLE_SIZE with the exception of the variable header size.\r
+  // Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.\r
   //\r
-  *MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);\r
+  *MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);\r
 \r
   //\r
   // Harware error record variable needs larger size.\r
   //\r
   if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
-    *MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);\r
+    *MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);\r
   }\r
   \r
   //\r
index c046fe91ea3a75a7324227310cb82c05afa7fa6d..9fdd0a77fdb889414d85b98c4b3250ff70f82c3a 100644 (file)
@@ -53,15 +53,6 @@ Abstract:
 #define VARIABLE_SCRATCH_SIZE         (4 * 1024)\r
 #define VARIABLE_RECLAIM_THRESHOLD    (1024)\r
 \r
-//\r
-// Define GET_PAD_SIZE to optimize compiler\r
-//\r
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
-#define GET_PAD_SIZE(a) (0)\r
-#else\r
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
-#endif\r
-\r
 #define GET_VARIABLE_NAME_PTR(a)  (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
 \r
 typedef enum {\r