]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools: replace 'UINT8','UINT16','UINT32','UINT64','VOID*' with shared constants.
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / FfsInfStatement.py
index 887619694df3ce00a6aeb6cca9625ec0af37d0e6..3c5eef40222b25fb3117284c2c1e7c3a6156b98b 100644 (file)
@@ -47,14 +47,12 @@ import Common.GlobalData as GlobalData
 from DepexSection import DepexSection\r
 from Common.Misc import SaveFileOnChange\r
 from Common.Expression import *\r
-from Common.DataType import TAB_COMMON\r
+from Common.DataType import *\r
 \r
 ## generate FFS from INF\r
 #\r
 #\r
 class FfsInfStatement(FfsInfStatementClassObject):\r
-    ## The mapping dictionary from datum type to its maximum number.\r
-    _MAX_SIZE_TYPE = {"BOOLEAN":0x01, "UINT8":0xFF, "UINT16":0xFFFF, "UINT32":0xFFFFFFFF, "UINT64":0xFFFFFFFFFFFFFFFF}\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
@@ -298,7 +296,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue),File=self.InfFileName)\r
 \r
             # Check value, if value are equal, no need to patch\r
-            if Pcd.DatumType == "VOID*":\r
+            if Pcd.DatumType == TAB_VOID:\r
                 if Pcd.InfDefaultValue == DefaultValue or DefaultValue in [None, '']:\r
                     continue\r
                 # Get the string size from FDF or DSC\r
@@ -328,13 +326,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 except:\r
                     continue\r
             # Check the Pcd size and data type\r
-            if Pcd.DatumType == "VOID*":\r
+            if Pcd.DatumType == TAB_VOID:\r
                 if int(MaxDatumSize) > int(Pcd.MaxDatumSize):\r
                     EdkLogger.error("GenFds", GENFDS_ERROR, "The size of VOID* type PCD '%s.%s' exceeds its maximum size %d bytes." \\r
                                     % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, int(MaxDatumSize) - int(Pcd.MaxDatumSize)))\r
             else:\r
-                if PcdValueInDscOrFdf > FfsInfStatement._MAX_SIZE_TYPE[Pcd.DatumType] \\r
-                    or PcdValueInImg > FfsInfStatement._MAX_SIZE_TYPE[Pcd.DatumType]:\r
+                if PcdValueInDscOrFdf > MAX_VAL_TYPE[Pcd.DatumType] \\r
+                    or PcdValueInImg > MAX_VAL_TYPE[Pcd.DatumType]:\r
                     EdkLogger.error("GenFds", GENFDS_ERROR, "The size of %s type PCD '%s.%s' doesn't match its data type." \\r
                                     % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
             self.PatchPcds.append((Pcd, DefaultValue))\r