]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools: replace 'UINT8','UINT16','UINT32','UINT64','VOID*' with shared constants.
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / AutoGen.py
index 6152225943cf51a0f52b161ffd887a98237c1f1d..56b5d399727e4f68af31d654c4115047286267c6 100644 (file)
@@ -1394,7 +1394,7 @@ class PlatformAutoGen(AutoGen):
 \r
             for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:\r
                 # make sure that the "VOID*" kind of datum has MaxDatumSize set\r
-                if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:\r
+                if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:\r
                     NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))\r
 \r
                 # Check the PCD from Binary INF or Source INF\r
@@ -1471,7 +1471,7 @@ class PlatformAutoGen(AutoGen):
                                         ExtraData="\n\tExisted %s PCD %s in:\n\t\t%s\n"\r
                                         % (PcdFromModule.Type, PcdFromModule.TokenCName, InfName))\r
                     # make sure that the "VOID*" kind of datum has MaxDatumSize set\r
-                    if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:\r
+                    if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:\r
                         NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))\r
                     if M.ModuleType in ["PEIM", "PEI_CORE"]:\r
                         PcdFromModule.Phase = "PEI"\r
@@ -1536,7 +1536,7 @@ class PlatformAutoGen(AutoGen):
 \r
         for item in self._PlatformPcds:\r
             if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
-                self._PlatformPcds[item].DatumType = "VOID*"\r
+                self._PlatformPcds[item].DatumType = TAB_VOID\r
 \r
         if (self.Workspace.ArchList[-1] == self.Arch): \r
             for Pcd in self._DynamicPcdList:\r
@@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
                 Sku.VpdOffset = Sku.VpdOffset.strip()\r
 \r
                 if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
-                    Pcd.DatumType = "VOID*"\r
+                    Pcd.DatumType = TAB_VOID\r
 \r
                     # if found PCD which datum value is unicode string the insert to left size of UnicodeIndex\r
                     # if found HII type PCD then insert to right of UnicodeIndex\r
@@ -1697,7 +1697,7 @@ class PlatformAutoGen(AutoGen):
                                 SkuValueMap[PcdValue].append(Sku)\r
                                 if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":\r
                                     NeedProcessVpdMapFile = True \r
-                            if DscPcdEntry.DatumType == 'VOID*' and PcdValue.startswith("L"):\r
+                            if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):\r
                                 UnicodePcdArray.add(DscPcdEntry)\r
                             elif len(Sku.VariableName) > 0:\r
                                 HiiPcdArray.add(DscPcdEntry)\r
@@ -1744,10 +1744,10 @@ class PlatformAutoGen(AutoGen):
                 Sku.VpdOffset = Sku.VpdOffset.strip()\r
 \r
                 if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:\r
-                    Pcd.DatumType = "VOID*"\r
+                    Pcd.DatumType = TAB_VOID\r
 \r
                 PcdValue = Sku.DefaultValue\r
-                if Pcd.DatumType == 'VOID*' and PcdValue.startswith("L"):\r
+                if Pcd.DatumType == TAB_VOID and PcdValue.startswith("L"):\r
                     # if found PCD which datum value is unicode string the insert to left size of UnicodeIndex\r
                     UnicodePcdArray.add(Pcd)\r
                 elif len(Sku.VariableName) > 0:\r
@@ -2369,7 +2369,7 @@ class PlatformAutoGen(AutoGen):
             ToPcd.validlists = FromPcd.validlists\r
             ToPcd.expressions = FromPcd.expressions\r
 \r
-        if FromPcd is not None and ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:\r
+        if FromPcd is not None and ToPcd.DatumType == TAB_VOID and ToPcd.MaxDatumSize in ['', None]:\r
             EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \\r
                             % (ToPcd.TokenSpaceGuidCName, TokenCName))\r
             Value = ToPcd.DefaultValue\r
@@ -2445,7 +2445,7 @@ class PlatformAutoGen(AutoGen):
         # use PCD value to calculate the MaxDatumSize when it is not specified\r
         for Name, Guid in Pcds:\r
             Pcd = Pcds[Name, Guid]\r
-            if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:\r
+            if Pcd.DatumType == TAB_VOID and Pcd.MaxDatumSize in ['', None]:\r
                 Pcd.MaxSizeUserSet = None\r
                 Value = Pcd.DefaultValue\r
                 if Value in [None, '']:\r
@@ -4113,13 +4113,13 @@ class ModuleAutoGen(AutoGen):
                     elif BoolValue == 'FALSE':\r
                         Pcd.DefaultValue = '0'\r
 \r
-                if Pcd.DatumType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:\r
+                if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:\r
                     HexFormat = '0x%02x'\r
-                    if Pcd.DatumType == 'UINT16':\r
+                    if Pcd.DatumType == TAB_UINT16:\r
                         HexFormat = '0x%04x'\r
-                    elif Pcd.DatumType == 'UINT32':\r
+                    elif Pcd.DatumType == TAB_UINT32:\r
                         HexFormat = '0x%08x'\r
-                    elif Pcd.DatumType == 'UINT64':\r
+                    elif Pcd.DatumType == TAB_UINT64:\r
                         HexFormat = '0x%016x'\r
                     PcdValue = HexFormat % int(Pcd.DefaultValue, 0)\r
                 else:\r