]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: replace string constants used for module types
authorCarsey, Jaben <jaben.carsey@intel.com>
Thu, 26 Apr 2018 16:57:53 +0000 (00:57 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Wed, 2 May 2018 06:56:31 +0000 (14:56 +0800)
replace raw strings in the code (note: except UPT) with constants.
SUP_MODULE_BASE was 'BASE'
SUP_MODULE_SEC was 'SEC'
SUP_MODULE_PEI_CORE was 'PEI_CORE'
SUP_MODULE_PEIM was 'PEIM'
SUP_MODULE_DXE_CORE was 'DXE_CORE'
SUP_MODULE_DXE_DRIVER was 'DXE_DRIVER'
SUP_MODULE_DXE_RUNTIME_DRIVER was 'DXE_RUNTIME_DRIVER'
SUP_MODULE_DXE_SAL_DRIVER was 'DXE_SAL_DRIVER'
SUP_MODULE_DXE_SMM_DRIVER was 'DXE_SMM_DRIVER'
SUP_MODULE_UEFI_DRIVER was 'UEFI_DRIVER'
SUP_MODULE_UEFI_APPLICATION was 'UEFI_APPLICATION'
SUP_MODULE_USER_DEFINED was 'USER_DEFINED'
SUP_MODULE_SMM_CORE was 'SMM_CORE'
SUP_MODULE_MM_STANDALONE was 'MM_STANDALONE'
SUP_MODULE_MM_CORE_STANDALONE was 'MM_CORE_STANDALONE'

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
21 files changed:
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/BuildEngine.py
BaseTools/Source/Python/AutoGen/GenC.py
BaseTools/Source/Python/AutoGen/GenDepex.py
BaseTools/Source/Python/Common/DataType.py
BaseTools/Source/Python/Ecc/Check.py
BaseTools/Source/Python/GenFds/CompressSection.py
BaseTools/Source/Python/GenFds/DataSection.py
BaseTools/Source/Python/GenFds/DepexSection.py
BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/Ffs.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools/Source/Python/GenFds/FvImageSection.py
BaseTools/Source/Python/GenFds/GuidSection.py
BaseTools/Source/Python/GenFds/UiSection.py
BaseTools/Source/Python/GenFds/VerSection.py
BaseTools/Source/Python/Workspace/InfBuildData.py
BaseTools/Source/Python/Workspace/WorkspaceCommon.py
BaseTools/Source/Python/build/BuildReport.py
BaseTools/Source/Python/build/build.py

index dc82075c5876e63a89120b7595c397444ec160ea..2811952fe1d36bf814f0782ef9436dedfb425b9c 100644 (file)
@@ -1430,7 +1430,7 @@ class PlatformAutoGen(AutoGen):
                     # used by DXE module, it should be stored in DXE PCD database.\r
                     # The default Phase is DXE\r
                     #\r
-                    if M.ModuleType in ["PEIM", "PEI_CORE"]:\r
+                    if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:\r
                         PcdFromModule.Phase = "PEI"\r
                     if PcdFromModule not in self._DynaPcdList_:\r
                         self._DynaPcdList_.append(PcdFromModule)\r
@@ -1472,7 +1472,7 @@ class PlatformAutoGen(AutoGen):
                     # make sure that the "VOID*" kind of datum has MaxDatumSize set\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
+                    if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:\r
                         PcdFromModule.Phase = "PEI"\r
                     if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd:\r
                         self._DynaPcdList_.append(PcdFromModule)\r
@@ -2203,7 +2203,7 @@ class PlatformAutoGen(AutoGen):
                         LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))\r
                     elif LibraryModule.LibraryClass is None \\r
                          or len(LibraryModule.LibraryClass) == 0 \\r
-                         or (ModuleType != 'USER_DEFINED'\r
+                         or (ModuleType != SUP_MODULE_USER_DEFINED\r
                              and ModuleType not in LibraryModule.LibraryClass[0].SupModList):\r
                         # only USER_DEFINED can link against any library instance despite of its SupModList\r
                         EdkLogger.error("build", OPTION_MISSING,\r
@@ -3969,8 +3969,8 @@ class ModuleAutoGen(AutoGen):
                     break\r
 \r
         ModuleType = self.ModuleType\r
-        if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:\r
-            ModuleType = 'DXE_DRIVER'\r
+        if ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated:\r
+            ModuleType = SUP_MODULE_DXE_DRIVER\r
 \r
         DriverType = ''\r
         if self.PcdIsDriver != '':\r
@@ -4047,11 +4047,11 @@ class ModuleAutoGen(AutoGen):
                 AsBuiltInfDict['binary_item'] += ['BIN|' + File]\r
         if self.DepexGenerated:\r
             self.OutputFile.add(self.Name + '.depex')\r
-            if self.ModuleType in ['PEIM']:\r
+            if self.ModuleType in [SUP_MODULE_PEIM]:\r
                 AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + '.depex']\r
-            if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'UEFI_DRIVER']:\r
+            if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:\r
                 AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex']\r
-            if self.ModuleType in ['DXE_SMM_DRIVER']:\r
+            if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]:\r
                 AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']\r
 \r
         Bin = self._GenOffsetBin()\r
@@ -4377,8 +4377,8 @@ class ModuleAutoGen(AutoGen):
             return\r
 \r
         for ModuleType in self.DepexList:\r
-            # Ignore empty [depex] section or [depex] section for "USER_DEFINED" module\r
-            if len(self.DepexList[ModuleType]) == 0 or ModuleType == "USER_DEFINED":\r
+            # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module\r
+            if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED:\r
                 continue\r
 \r
             Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)\r
index bbd1a4d5b2573dfd1d13210e3cf272335ca2f7f7..a4f39b0b2925055db9f003feff4339caf83e4a6d 100644 (file)
@@ -612,11 +612,11 @@ if __name__ == '__main__':
     EdkLogger.Initialize()\r
     if len(sys.argv) > 1:\r
         Br = BuildRule(sys.argv[1])\r
-        print str(Br[".c", "DXE_DRIVER", "IA32", "MSFT"][1])\r
+        print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1])\r
         print\r
-        print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1])\r
+        print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1])\r
         print\r
-        print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1])\r
+        print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1])\r
         print\r
         print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])\r
         print\r
@@ -624,7 +624,7 @@ if __name__ == '__main__':
         print\r
         print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])\r
         print\r
-        print str(Br[".s", "SEC", "IPF", "COMMON"][1])\r
+        print str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1])\r
         print\r
-        print str(Br[".s", "SEC"][1])\r
+        print str(Br[".s", SUP_MODULE_SEC][1])\r
 \r
index 73d7699ad01bfe60d68545f672399a1a43bd1754..26f6aca0e63ffbc5fc5eb94f1d9f2d5a1f7064a1 100644 (file)
@@ -649,7 +649,7 @@ ${END}
 ]\r
 \r
 gLibraryStructorPrototype = {\r
-'BASE'  : TemplateString("""${BEGIN}\r
+SUP_MODULE_BASE  : TemplateString("""${BEGIN}\r
 RETURN_STATUS\r
 EFIAPI\r
 ${Function} (\r
@@ -686,7 +686,7 @@ ${Function} (
 }\r
 \r
 gLibraryStructorCall = {\r
-'BASE'  : TemplateString("""${BEGIN}\r
+SUP_MODULE_BASE  : TemplateString("""${BEGIN}\r
   Status = ${Function} ();\r
   ASSERT_EFI_ERROR (Status);${END}\r
 """),\r
@@ -709,7 +709,7 @@ gLibraryStructorCall = {
 \r
 ## Library Constructor and Destructor Templates\r
 gLibraryString = {\r
-'BASE'  :   TemplateString("""\r
+SUP_MODULE_BASE  :   TemplateString("""\r
 ${BEGIN}${FunctionPrototype}${END}\r
 \r
 VOID\r
@@ -772,21 +772,21 @@ ${FunctionCall}${END}
 gBasicHeaderFile = "Base.h"\r
 \r
 gModuleTypeHeaderFile = {\r
-    "BASE"              :   [gBasicHeaderFile],\r
-    "SEC"               :   ["PiPei.h", "Library/DebugLib.h"],\r
-    "PEI_CORE"          :   ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"],\r
-    "PEIM"              :   ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],\r
-    "DXE_CORE"          :   ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],\r
-    "DXE_DRIVER"        :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
-    "DXE_SMM_DRIVER"    :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
-    "DXE_RUNTIME_DRIVER":   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
-    "DXE_SAL_DRIVER"    :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
-    "UEFI_DRIVER"       :   ["Uefi.h",  "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
-    "UEFI_APPLICATION"  :   ["Uefi.h",  "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],\r
-    "SMM_CORE"          :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],\r
-    "MM_STANDALONE"     :   ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"],\r
-    "MM_CORE_STANDALONE" :  ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"],\r
-    "USER_DEFINED"      :   [gBasicHeaderFile]\r
+    SUP_MODULE_BASE              :   [gBasicHeaderFile],\r
+    SUP_MODULE_SEC               :   ["PiPei.h", "Library/DebugLib.h"],\r
+    SUP_MODULE_PEI_CORE          :   ["PiPei.h", "Library/DebugLib.h", "Library/PeiCoreEntryPoint.h"],\r
+    SUP_MODULE_PEIM              :   ["PiPei.h", "Library/DebugLib.h", "Library/PeimEntryPoint.h"],\r
+    SUP_MODULE_DXE_CORE          :   ["PiDxe.h", "Library/DebugLib.h", "Library/DxeCoreEntryPoint.h"],\r
+    SUP_MODULE_DXE_DRIVER        :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
+    SUP_MODULE_DXE_SMM_DRIVER    :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
+    SUP_MODULE_DXE_RUNTIME_DRIVER:   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
+    SUP_MODULE_DXE_SAL_DRIVER    :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
+    SUP_MODULE_UEFI_DRIVER       :   ["Uefi.h",  "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],\r
+    SUP_MODULE_UEFI_APPLICATION  :   ["Uefi.h",  "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],\r
+    SUP_MODULE_SMM_CORE          :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],\r
+    SUP_MODULE_MM_STANDALONE     :   ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"],\r
+    SUP_MODULE_MM_CORE_STANDALONE :  ["PiSmm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"],\r
+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile]\r
 }\r
 \r
 ## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName \r
@@ -1406,17 +1406,17 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
         if len(Lib.ConstructorList) <= 0:\r
             continue\r
         Dict = {'Function':Lib.ConstructorList}\r
-        if Lib.ModuleType in ['BASE', 'SEC']:\r
-            ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))\r
-            ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict))\r
-        elif Lib.ModuleType in ['PEI_CORE','PEIM']:\r
+        if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:\r
+            ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))\r
+            ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))\r
+        elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:\r
             ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))\r
             ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))\r
-        elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',\r
-                                'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:\r
+        elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,\r
+                                SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:\r
             ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))\r
             ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))\r
-        elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:\r
+        elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:\r
             ConstructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))\r
             ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))\r
 \r
@@ -1437,14 +1437,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary:\r
         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)\r
     else:\r
-        if Info.ModuleType in ['BASE', 'SEC']:\r
-            AutoGenC.Append(gLibraryString['BASE'].Replace(Dict))\r
-        elif Info.ModuleType in ['PEI_CORE','PEIM']:\r
+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:\r
+            AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))\r
+        elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:\r
             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))\r
-        elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',\r
-                                 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:\r
+        elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,\r
+                                 SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:\r
             AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))\r
-        elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:\r
+        elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:\r
             AutoGenC.Append(gLibraryString['MM'].Replace(Dict))\r
 \r
 ## Create code for library destructor\r
@@ -1468,17 +1468,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
         if len(Lib.DestructorList) <= 0:\r
             continue\r
         Dict = {'Function':Lib.DestructorList}\r
-        if Lib.ModuleType in ['BASE', 'SEC']:\r
-            DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))\r
-            DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict))\r
-        elif Lib.ModuleType in ['PEI_CORE','PEIM']:\r
+        if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:\r
+            DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))\r
+            DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))\r
+        elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:\r
             DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))\r
             DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))\r
-        elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',\r
-                                'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_CORE']:\r
+        elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,\r
+                                SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]:\r
             DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))\r
             DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))\r
-        elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:\r
+        elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:\r
             DestructorPrototypeString.Append(gLibraryStructorPrototype['MM'].Replace(Dict))\r
             DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict))\r
 \r
@@ -1499,14 +1499,14 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary:\r
         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)\r
     else:\r
-        if Info.ModuleType in ['BASE', 'SEC']:\r
-            AutoGenC.Append(gLibraryString['BASE'].Replace(Dict))\r
-        elif Info.ModuleType in ['PEI_CORE','PEIM']:\r
+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:\r
+            AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))\r
+        elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:\r
             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))\r
-        elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',\r
-                                 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:\r
+        elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,\r
+                                 SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:\r
             AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))\r
-        elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']:\r
+        elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CORE_STANDALONE]:\r
             AutoGenC.Append(gLibraryString['MM'].Replace(Dict))\r
 \r
 \r
@@ -1517,7 +1517,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):\r
-    if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']:\r
+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:\r
         return\r
     #\r
     # Module Entry Points\r
@@ -1537,7 +1537,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
         'UefiSpecVersion':   UefiSpecVersion + 'U'\r
     }\r
 \r
-    if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_STANDALONE']:\r
+    if Info.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE]:\r
         if Info.SourceFileList:\r
           if NumEntryPoints != 1:\r
               EdkLogger.error(\r
@@ -1547,43 +1547,43 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
                   File=str(Info),\r
                   ExtraData= ", ".join(Info.Module.ModuleEntryPointList)\r
                   )\r
-    if Info.ModuleType == 'PEI_CORE':\r
+    if Info.ModuleType == SUP_MODULE_PEI_CORE:\r
         AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))\r
         AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'DXE_CORE':\r
+    elif Info.ModuleType == SUP_MODULE_DXE_CORE:\r
         AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict))\r
         AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'SMM_CORE':\r
+    elif Info.ModuleType == SUP_MODULE_SMM_CORE:\r
         AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))\r
         AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'MM_CORE_STANDALONE':\r
+    elif Info.ModuleType == SUP_MODULE_MM_CORE_STANDALONE:\r
         AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict))\r
         AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'PEIM':\r
+    elif Info.ModuleType == SUP_MODULE_PEIM:\r
         if NumEntryPoints < 2:\r
             AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict))\r
         else:\r
             AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict))\r
         AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']:\r
+    elif Info.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER]:\r
         if NumEntryPoints < 2:\r
             AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))\r
         else:\r
             AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))\r
         AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'DXE_SMM_DRIVER':\r
+    elif Info.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:\r
         if NumEntryPoints == 0:\r
             AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))\r
         else:\r
             AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))\r
         AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'MM_STANDALONE':\r
+    elif Info.ModuleType == SUP_MODULE_MM_STANDALONE:\r
         if NumEntryPoints < 2:\r
             AutoGenC.Append(gMmStandaloneEntryPointString[NumEntryPoints].Replace(Dict))\r
         else:\r
             AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dict))\r
         AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict))\r
-    elif Info.ModuleType == 'UEFI_APPLICATION':\r
+    elif Info.ModuleType == SUP_MODULE_UEFI_APPLICATION:\r
         if NumEntryPoints < 2:\r
             AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))\r
         else:\r
@@ -1597,7 +1597,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):\r
-    if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']:\r
+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:\r
         return\r
     #\r
     # Unload Image Handlers\r
@@ -1617,7 +1617,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):\r
-    if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:\r
         GuidType = "GUID"\r
     else:\r
         GuidType = "EFI_GUID"\r
@@ -1641,7 +1641,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):\r
-    if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:\r
         GuidType = "GUID"\r
     else:\r
         GuidType = "EFI_GUID"\r
@@ -1665,7 +1665,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file\r
 #\r
 def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):\r
-    if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:\r
         GuidType = "GUID"\r
     else:\r
         GuidType = "EFI_GUID"\r
@@ -1702,7 +1702,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
     # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found\r
     if TokenSpaceList:\r
         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")\r
-        if Info.ModuleType in ["USER_DEFINED", "BASE"]:\r
+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:\r
             GuidType = "GUID"\r
         else:\r
             GuidType = "EFI_GUID"              \r
index 9acea8f6bfed17d02246f5179f07c1419acd52c1..100f1250b31f918ffd071b695d61132a191ce5ad 100644 (file)
@@ -24,26 +24,27 @@ from Common.Misc import SaveFileOnChange
 from Common.Misc import GuidStructureStringToGuidString\r
 from Common import EdkLogger as EdkLogger\r
 from Common.BuildVersion import gBUILD_VERSION\r
+from Common.DataType import *\r
 \r
 ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END"\r
 gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S)\r
 \r
 ## Mapping between module type and EFI phase\r
 gType2Phase = {\r
-    "BASE"              :   None,\r
-    "SEC"               :   "PEI",\r
-    "PEI_CORE"          :   "PEI",\r
-    "PEIM"              :   "PEI",\r
-    "DXE_CORE"          :   "DXE",\r
-    "DXE_DRIVER"        :   "DXE",\r
-    "DXE_SMM_DRIVER"    :   "DXE",\r
-    "DXE_RUNTIME_DRIVER":   "DXE",\r
-    "DXE_SAL_DRIVER"    :   "DXE",\r
-    "UEFI_DRIVER"       :   "DXE",\r
-    "UEFI_APPLICATION"  :   "DXE",\r
-    "SMM_CORE"          :   "DXE",\r
-    "MM_STANDALONE"     :   "MM",\r
-    "MM_CORE_STANDALONE" :  "MM",\r
+    SUP_MODULE_BASE              :   None,\r
+    SUP_MODULE_SEC               :   "PEI",\r
+    SUP_MODULE_PEI_CORE          :   "PEI",\r
+    SUP_MODULE_PEIM              :   "PEI",\r
+    SUP_MODULE_DXE_CORE          :   "DXE",\r
+    SUP_MODULE_DXE_DRIVER        :   "DXE",\r
+    SUP_MODULE_DXE_SMM_DRIVER    :   "DXE",\r
+    SUP_MODULE_DXE_RUNTIME_DRIVER:   "DXE",\r
+    SUP_MODULE_DXE_SAL_DRIVER    :   "DXE",\r
+    SUP_MODULE_UEFI_DRIVER       :   "DXE",\r
+    SUP_MODULE_UEFI_APPLICATION  :   "DXE",\r
+    SUP_MODULE_SMM_CORE          :   "DXE",\r
+    SUP_MODULE_MM_STANDALONE     :   "MM",\r
+    SUP_MODULE_MM_CORE_STANDALONE :  "MM",\r
 }\r
 \r
 ## Convert dependency expression string into EFI internal representation\r
@@ -299,12 +300,12 @@ class DependencyExpression:
             NewOperand.append(Token)\r
 \r
         # don't generate depex if only TRUE operand left\r
-        if self.ModuleType == 'PEIM' and len(NewOperand) == 1 and NewOperand[0] == 'TRUE':\r
+        if self.ModuleType == SUP_MODULE_PEIM and len(NewOperand) == 1 and NewOperand[0] == 'TRUE':\r
             self.PostfixNotation = []\r
             return\r
 \r
         # don't generate depex if all operands are architecture protocols\r
-        if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \\r
+        if self.ModuleType in [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE] and \\r
            Op == 'AND' and \\r
            self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]):\r
             self.PostfixNotation = []\r
index 20f31ce4b72f93968db085242eaf36d739e38122..ea2eafb94477b670a6e4859041e1af67bc341f6e 100644 (file)
@@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
 \r
 EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'\r
 EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'\r
-EDK_COMPONENT_TYPE_PEI_CORE = 'PEI_CORE'\r
+EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE\r
 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'\r
 EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'\r
 EDK_COMPONENT_TYPE_RELOCATABLE_PEIM = 'RELOCATABLE_PEIM'\r
index 27783e617b9219bae0f796087f1cc4bac0f1ead3..089d42a6d181989a2d781fa42da22bd591416c26 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to define checkpoints used by ECC tool\r
 #\r
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # 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
@@ -744,7 +744,7 @@ class Check(object):
                         if Item not in LibraryClasses[List[0]]:\r
                             LibraryClasses[List[0]].append(Item)\r
 \r
-                if Record[2] != 'BASE' and Record[2] not in SupModType:\r
+                if Record[2] != DT.SUP_MODULE_BASE and Record[2] not in SupModType:\r
                     EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])\r
 \r
             SqlCommand = """select A.ID, A.Value1, B.Value3 from Inf as A left join Inf as B\r
@@ -763,7 +763,7 @@ class Check(object):
 \r
             for Record in RecordSet:\r
                 if Record[1] in LibraryClasses:\r
-                    if Record[2] not in LibraryClasses[Record[1]] and 'BASE' not in RecordDict[Record[1]]:\r
+                    if Record[2] not in LibraryClasses[Record[1]] and DT.SUP_MODULE_BASE not in RecordDict[Record[1]]:\r
                         if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]):\r
                             EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg="The type of Library Class [%s] defined in Inf file does not match the type of the module" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])\r
                 else:\r
index 08ab48669f4546ee0a9c07eaf5ba1936f42eddbd..4ae14f27b3e132581349015e70bdf02dd183c7b2 100644 (file)
@@ -21,6 +21,7 @@ import subprocess
 import Common.LongFilePathOs as os\r
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import CompressSectionClassObject\r
+from Common.DataType import *\r
 \r
 ## generate compress section\r
 #\r
@@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) :
         OutputFile = OutputPath + \\r
                      os.sep     + \\r
                      ModuleName + \\r
-                     'SEC'      + \\r
+                     SUP_MODULE_SEC      + \\r
                      SecNum     + \\r
                      Ffs.SectionSuffix['COMPRESS']\r
         OutputFile = os.path.normpath(OutputFile)\r
index 40e345eee77e92267015b2f0e467ddac22e46110..99d7392aaab3de984d803b62a8c656aa1544f418 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process data section generation\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -23,6 +23,7 @@ import Common.LongFilePathOs as os
 from CommonDataClass.FdfClass import DataSectionClassObject\r
 from Common.Misc import PeImageClass\r
 from Common.LongFilePathSupport import CopyLongFilePath\r
+from Common.DataType import *\r
 \r
 ## generate data section\r
 #\r
@@ -119,7 +120,7 @@ class DataSection (DataSectionClassObject):
                 )\r
             self.SectFileName = TeFile\r
 \r
-        OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))\r
+        OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType))\r
         OutputFile = os.path.normpath(OutputFile)\r
         GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile)\r
         FileList = [OutputFile]\r
index 4ed1aa77929207e294ca7d7d809f38df7c3da5ce..d04160e890f17781c0e2596e1f53c1fcaa434e61 100644 (file)
@@ -25,6 +25,7 @@ from AutoGen.GenDepex import DependencyExpression
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 from Common.Misc import PathClass\r
+from Common.DataType import *\r
 \r
 ## generate data section\r
 #\r
@@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject):
             self.ExpressionProcessed = True\r
 \r
         if self.DepexType == 'PEI_DEPEX_EXP':\r
-            ModuleType = 'PEIM'\r
+            ModuleType = SUP_MODULE_PEIM\r
             SecType    = 'PEI_DEPEX'\r
         elif self.DepexType == 'DXE_DEPEX_EXP':\r
-            ModuleType = 'DXE_DRIVER'\r
+            ModuleType = SUP_MODULE_DXE_DRIVER\r
             SecType    = 'DXE_DEPEX'\r
         elif self.DepexType == 'SMM_DEPEX_EXP':\r
-            ModuleType = 'DXE_SMM_DRIVER'\r
+            ModuleType = SUP_MODULE_DXE_SMM_DRIVER\r
             SecType    = 'SMM_DEPEX'\r
         else:\r
             EdkLogger.error("GenFds", FORMAT_INVALID,\r
                             "Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))\r
 \r
-        InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')\r
+        InputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.depex')\r
         InputFile = os.path.normpath(InputFile)\r
         Depex = DependencyExpression(self.Expression, ModuleType)\r
         Depex.Generate(InputFile)\r
 \r
-        OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')\r
+        OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.dpx')\r
         OutputFile = os.path.normpath(OutputFile)\r
 \r
         GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)\r
index 5bb1ae6f664c8649fbbb75e8befac7a70899d3ce..1be23b4bf7fd85e52f48354875dd00801275b8bf 100644 (file)
@@ -27,6 +27,7 @@ from Common.BuildToolError import *
 from Common.Misc import PeImageClass\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 from Common.LongFilePathSupport import CopyLongFilePath\r
+from Common.DataType import *\r
 \r
 ## generate rule section\r
 #\r
@@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject):
             StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')\r
             NoStrip = True\r
-            if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and SectionType in ('TE', 'PE32'):\r
+            if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'):\r
                 if FfsInf.KeepReloc is not None:\r
                     NoStrip = FfsInf.KeepReloc\r
                 elif FfsInf.KeepRelocFromRule is not None:\r
@@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject):
                     BuildNumTuple = tuple()\r
 \r
                 Num = SecNum\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',\r
                                                     #Ui=StringData,\r
                                                     Ver=BuildNum,\r
@@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject):
                 for File in FileList:\r
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
-                    OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))\r
                     f = open(File, 'r')\r
                     VerString = f.read()\r
                     f.close()\r
@@ -162,7 +163,7 @@ class EfiSection (EfiSectionClassObject):
                     else:\r
                         EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName)\r
                 Num = SecNum\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION',\r
                                                     #Ui=VerString,\r
                                                     Ver=BuildNum,\r
@@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject):
                 Num = SecNum\r
                 if IsMakefile and StringData == ModuleNameStr:\r
                     StringData = "$(MODULE_NAME)"\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
@@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject):
                 for File in FileList:\r
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
-                    OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))\r
                     f = open(File, 'r')\r
                     UiString = f.read()\r
                     f.close()\r
@@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject):
                 Num = SecNum\r
                 if IsMakefile and StringData == ModuleNameStr:\r
                     StringData = "$(MODULE_NAME)"\r
-                OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
+                OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE',\r
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
@@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject):
                     """ Copy Map file to FFS output path """\r
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
-                    OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType))\r
                     File = GenFdsGlobalVariable.MacroExtend(File, Dict)\r
                     \r
                     #Get PE Section alignment when align is set to AUTO\r
index 25755a9778f241a771cb242b597d5072bf9889e8..db8947e4b453daacd24502a7ba3563845faf6761 100644 (file)
@@ -2626,7 +2626,7 @@ class FdfParser:
     #\r
     @staticmethod\r
     def __FileCouldHaveRelocFlag (FileType):\r
-        if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'):\r
+        if FileType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'PEI_DXE_COMBO'):\r
             return True\r
         else:\r
             return False\r
@@ -3626,12 +3626,12 @@ class FdfParser:
 \r
         if not self.__GetNextWord():\r
             raise Warning("expected Module type", self.FileName, self.CurrentLineNumber)\r
-        if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CORE", \\r
-                             "DXE_DRIVER", "DXE_SAL_DRIVER", \\r
-                             "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \\r
-                             "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \\r
+        if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \\r
+                             SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \\r
+                             SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \\r
+                             SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \\r
                              "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \\r
-                                        "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):\r
+                                        "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):\r
             raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
         return self.__Token\r
 \r
@@ -3673,8 +3673,8 @@ class FdfParser:
             raise Warning("expected FFS type", self.FileName, self.CurrentLineNumber)\r
 \r
         Type = self.__Token.strip().upper()\r
-        if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\\r
-                             "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALONE"):\r
+        if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\\r
+                             "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):\r
             raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
 \r
         if not self.__IsToken("="):\r
index a4178121118b57eb18b0631fbc3f048811ea70b1..fc760ae8bedac75728b038ed545f38281d045841 100644 (file)
@@ -16,6 +16,7 @@
 # Import Modules\r
 #\r
 from CommonDataClass.FdfClass import FDClassObject\r
+from Common.DataType import *\r
 \r
 ## generate FFS\r
 #\r
@@ -24,27 +25,27 @@ class Ffs(FDClassObject):
     \r
     # mapping between MODULE type in FDF (from INF) and file type for GenFfs\r
     ModuleTypeToFileType = {\r
-        'SEC'               : 'EFI_FV_FILETYPE_SECURITY_CORE',\r
-        'PEI_CORE'          : 'EFI_FV_FILETYPE_PEI_CORE',\r
-        'PEIM'              : 'EFI_FV_FILETYPE_PEIM',\r
-        'DXE_CORE'          : 'EFI_FV_FILETYPE_DXE_CORE',\r
-        'DXE_DRIVER'        : 'EFI_FV_FILETYPE_DRIVER',\r
-        'DXE_SAL_DRIVER'    : 'EFI_FV_FILETYPE_DRIVER',\r
-        'DXE_SMM_DRIVER'    : 'EFI_FV_FILETYPE_DRIVER',\r
-        'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER',\r
-        'UEFI_DRIVER'       : 'EFI_FV_FILETYPE_DRIVER',\r
-        'UEFI_APPLICATION'  : 'EFI_FV_FILETYPE_APPLICATION',\r
-        'SMM_CORE'          : 'EFI_FV_FILETYPE_SMM_CORE',\r
-        'MM_STANDALONE'     : 'EFI_FV_FILETYPE_MM_STANDALONE',\r
-        'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'\r
+        SUP_MODULE_SEC               : 'EFI_FV_FILETYPE_SECURITY_CORE',\r
+        SUP_MODULE_PEI_CORE          : 'EFI_FV_FILETYPE_PEI_CORE',\r
+        SUP_MODULE_PEIM              : 'EFI_FV_FILETYPE_PEIM',\r
+        SUP_MODULE_DXE_CORE          : 'EFI_FV_FILETYPE_DXE_CORE',\r
+        SUP_MODULE_DXE_DRIVER        : 'EFI_FV_FILETYPE_DRIVER',\r
+        SUP_MODULE_DXE_SAL_DRIVER    : 'EFI_FV_FILETYPE_DRIVER',\r
+        SUP_MODULE_DXE_SMM_DRIVER    : 'EFI_FV_FILETYPE_DRIVER',\r
+        SUP_MODULE_DXE_RUNTIME_DRIVER: 'EFI_FV_FILETYPE_DRIVER',\r
+        SUP_MODULE_UEFI_DRIVER       : 'EFI_FV_FILETYPE_DRIVER',\r
+        SUP_MODULE_UEFI_APPLICATION  : 'EFI_FV_FILETYPE_APPLICATION',\r
+        SUP_MODULE_SMM_CORE          : 'EFI_FV_FILETYPE_SMM_CORE',\r
+        SUP_MODULE_MM_STANDALONE     : 'EFI_FV_FILETYPE_MM_STANDALONE',\r
+        SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'\r
     }\r
     \r
     # mapping between FILE type in FDF and file type for GenFfs\r
     FdfFvFileTypeToFileType = {\r
-        'SEC'               : 'EFI_FV_FILETYPE_SECURITY_CORE',\r
-        'PEI_CORE'          : 'EFI_FV_FILETYPE_PEI_CORE',\r
-        'PEIM'              : 'EFI_FV_FILETYPE_PEIM',\r
-        'DXE_CORE'          : 'EFI_FV_FILETYPE_DXE_CORE',\r
+        SUP_MODULE_SEC               : 'EFI_FV_FILETYPE_SECURITY_CORE',\r
+        SUP_MODULE_PEI_CORE          : 'EFI_FV_FILETYPE_PEI_CORE',\r
+        SUP_MODULE_PEIM              : 'EFI_FV_FILETYPE_PEIM',\r
+        SUP_MODULE_DXE_CORE          : 'EFI_FV_FILETYPE_DXE_CORE',\r
         'FREEFORM'          : 'EFI_FV_FILETYPE_FREEFORM',\r
         'DRIVER'            : 'EFI_FV_FILETYPE_DRIVER',\r
         'APPLICATION'       : 'EFI_FV_FILETYPE_APPLICATION',\r
@@ -52,9 +53,9 @@ class Ffs(FDClassObject):
         'RAW'               : 'EFI_FV_FILETYPE_RAW',\r
         'PEI_DXE_COMBO'     : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',\r
         'SMM'               : 'EFI_FV_FILETYPE_SMM',\r
-        'SMM_CORE'          : 'EFI_FV_FILETYPE_SMM_CORE',\r
-        'MM_STANDALONE'     : 'EFI_FV_FILETYPE_MM_STANDALONE',\r
-        'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'\r
+        SUP_MODULE_SMM_CORE          : 'EFI_FV_FILETYPE_SMM_CORE',\r
+        SUP_MODULE_MM_STANDALONE     : 'EFI_FV_FILETYPE_MM_STANDALONE',\r
+        SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE'\r
     }\r
     \r
     # mapping between section type in FDF and file suffix\r
index 3c5eef40222b25fb3117284c2c1e7c3a6156b98b..f973cf2f0b76671ce1cc0c7e2e3ff3a4f4be3f38 100644 (file)
@@ -88,7 +88,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)\r
 \r
             # Check if current INF module has DEPEX\r
-            if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != "USER_DEFINED" \\r
+            if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \\r
                 and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:\r
                 ModuleType = self.InfModule.ModuleType\r
                 PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
@@ -224,10 +224,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if len(self.SourceFileList) != 0 and not self.InDsc:\r
             EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))\r
 \r
-        if self.ModuleType == 'SMM_CORE' and int(self.PiSpecVersion, 16) < 0x0001000A:\r
+        if self.ModuleType == SUP_MODULE_SMM_CORE and int(self.PiSpecVersion, 16) < 0x0001000A:\r
             EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)      \r
 \r
-        if self.ModuleType == 'MM_CORE_STANDALONE' and int(self.PiSpecVersion, 16) < 0x00010032:\r
+        if self.ModuleType == SUP_MODULE_MM_CORE_STANDALONE and int(self.PiSpecVersion, 16) < 0x00010032:\r
             EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.InfFileName)\r
 \r
         if Inf._Defs is not None and len(Inf._Defs) > 0:\r
@@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED\r
         #  \r
-        if FileType != 'PE32' and self.ModuleType != "USER_DEFINED":\r
+        if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:\r
             return EfiFile\r
 \r
         #\r
@@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         # Convert Fv File Type for PI1.1 SMM driver.\r
         #\r
-        if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
+        if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
             if Rule.FvFileType == 'DRIVER':\r
                 Rule.FvFileType = 'SMM'\r
         #\r
         # Framework SMM Driver has no SMM FV file type\r
         #\r
-        if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:\r
-            if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':\r
+        if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:\r
+            if Rule.FvFileType == 'SMM' or Rule.FvFileType == SUP_MODULE_SMM_CORE:\r
                 EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)\r
         #\r
         # For the rule only has simpleFile\r
@@ -738,17 +738,17 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         # Convert Fv Section Type for PI1.1 SMM driver.\r
         #\r
-        if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
+        if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
             if SectionType == 'DXE_DEPEX':\r
                 SectionType = 'SMM_DEPEX'\r
         #\r
         # Framework SMM Driver has no SMM_DEPEX section type\r
         #\r
-        if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:\r
+        if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:\r
             if SectionType == 'SMM_DEPEX':\r
                 EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
         NoStrip = True\r
-        if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
+        if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):\r
             if self.KeepReloc is not None:\r
                 NoStrip = self.KeepReloc\r
             elif Rule.KeepReloc is not None:\r
@@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
 \r
                 SecNum = '%d' %Index\r
                 GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
-                              Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum\r
+                              Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum\r
                 Index = Index + 1\r
                 OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
                 File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)\r
@@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         else:\r
             SecNum = '%d' %Index\r
             GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
-                              Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum\r
+                              Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum\r
             OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
             GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)\r
 \r
@@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @retval string       File name of the generated section file\r
     #\r
     def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):\r
-        if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
+        if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):\r
             if Rule.KeepReloc is not None:\r
                 self.KeepRelocFromRule = Rule.KeepReloc\r
         SectFiles = []\r
@@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
             #\r
             # Convert Fv Section Type for PI1.1 SMM driver.\r
             #\r
-            if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
+            if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
                 if Sect.SectionType == 'DXE_DEPEX':\r
                     Sect.SectionType = 'SMM_DEPEX'\r
             #\r
             # Framework SMM Driver has no SMM_DEPEX section type\r
             #\r
-            if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:\r
+            if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:\r
                 if Sect.SectionType == 'SMM_DEPEX':\r
                     EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
             #\r
index 5026a3ffca2f2bedd0ebce3497b250c35d4ed638..eb84b44bbec49316e1a6d0c3258ef230529f2207 100644 (file)
@@ -24,6 +24,7 @@ import Common.LongFilePathOs as os
 from CommonDataClass.FdfClass import FvImageSectionClassObject\r
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
+from Common.DataType import *\r
 \r
 ## generate FV image section\r
 #\r
@@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject):
                 if FvAlignmentValue > MaxFvAlignment:\r
                     MaxFvAlignment = FvAlignmentValue\r
 \r
-                OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))\r
+                OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE"))\r
                 GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
 \r
@@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject):
             #\r
             # Prepare the parameter of GenSection\r
             #\r
-            OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
+            OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
             GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)\r
             OutputFileList.append(OutputFile)\r
 \r
index 08665a3d4d491a25b95d012fbe234d8d07cc57d0..1105689e0d79968c7de0303aec49ef986c7dc124 100644 (file)
@@ -28,6 +28,7 @@ from Common.BuildToolError import *
 from FvImageSection import FvImageSection\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
 from GenFds import FindExtendTool\r
+from Common.DataType import *\r
 \r
 ## generate GUIDed section\r
 #\r
@@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) :
         OutputFile = OutputPath + \\r
                      os.sep + \\r
                      ModuleName + \\r
-                     'SEC' + \\r
+                     SUP_MODULE_SEC + \\r
                      SecNum + \\r
                      Ffs.SectionSuffix['GUIDED']\r
         OutputFile = os.path.normpath(OutputFile)\r
@@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) :
             TempFile = OutputPath + \\r
                        os.sep + \\r
                        ModuleName + \\r
-                       'SEC' + \\r
+                       SUP_MODULE_SEC + \\r
                        SecNum + \\r
                        '.tmp'\r
             TempFile = os.path.normpath(TempFile)\r
index 6340520602eed09e7034ca1f69a12ef5e2666640..084f761e1285e8ea3d316233613faab8379e7a5f 100644 (file)
@@ -22,6 +22,7 @@ import Common.LongFilePathOs as os
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import UiSectionClassObject\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.DataType import SUP_MODULE_SEC\r
 \r
 ## generate UI section\r
 #\r
@@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject):
             self.StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r
 \r
-        OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('UI'))\r
+        OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('UI'))\r
 \r
         if self.StringData is not None :\r
             NameString = self.StringData\r
index 11e974b9936e8435005d18841ba51cee480709e8..456a430079bb2159b7269743c911c6c5b7e6108e 100644 (file)
@@ -22,6 +22,7 @@ import subprocess
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import VerSectionClassObject\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.DataType import SUP_MODULE_SEC\r
 \r
 ## generate version section\r
 #\r
@@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject):
             self.FileName = FfsInf.__ExtendMacro__(self.FileName)\r
 \r
         OutputFile = os.path.join(OutputPath,\r
-                                  ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get('VERSION'))\r
+                                  ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION'))\r
         OutputFile = os.path.normpath(OutputFile)\r
 \r
         # Get String Data\r
index a725a2a2a7720c089cb65d7e3ee87f2b8526ef9d..f2d36d0ee0d45215188a3b21e0764e5d44afd3e3 100644 (file)
@@ -68,22 +68,22 @@ class InfBuildData(ModuleBuildClassObject):
 \r
     # dict used to convert Component type to Module type\r
     _MODULE_TYPE_ = {\r
-        "LIBRARY"               :   "BASE",\r
-        "SECURITY_CORE"         :   "SEC",\r
-        "PEI_CORE"              :   "PEI_CORE",\r
-        "COMBINED_PEIM_DRIVER"  :   "PEIM",\r
-        "PIC_PEIM"              :   "PEIM",\r
-        "RELOCATABLE_PEIM"      :   "PEIM",\r
-        "PE32_PEIM"             :   "PEIM",\r
-        "BS_DRIVER"             :   "DXE_DRIVER",\r
-        "RT_DRIVER"             :   "DXE_RUNTIME_DRIVER",\r
-        "SAL_RT_DRIVER"         :   "DXE_SAL_DRIVER",\r
-        "DXE_SMM_DRIVER"        :   "DXE_SMM_DRIVER",\r
-    #    "SMM_DRIVER"            :   "DXE_SMM_DRIVER",\r
-    #    "BS_DRIVER"             :   "DXE_SMM_DRIVER",\r
-    #    "BS_DRIVER"             :   "UEFI_DRIVER",\r
-        "APPLICATION"           :   "UEFI_APPLICATION",\r
-        "LOGO"                  :   "BASE",\r
+        "LIBRARY"               :   SUP_MODULE_BASE,\r
+        "SECURITY_CORE"         :   SUP_MODULE_SEC,\r
+        SUP_MODULE_PEI_CORE              :   SUP_MODULE_PEI_CORE,\r
+        "COMBINED_PEIM_DRIVER"  :   SUP_MODULE_PEIM,\r
+        "PIC_PEIM"              :   SUP_MODULE_PEIM,\r
+        "RELOCATABLE_PEIM"      :   SUP_MODULE_PEIM,\r
+        "PE32_PEIM"             :   SUP_MODULE_PEIM,\r
+        "BS_DRIVER"             :   SUP_MODULE_DXE_DRIVER,\r
+        "RT_DRIVER"             :   SUP_MODULE_DXE_RUNTIME_DRIVER,\r
+        "SAL_RT_DRIVER"         :   SUP_MODULE_DXE_SAL_DRIVER,\r
+        SUP_MODULE_DXE_SMM_DRIVER        :   SUP_MODULE_DXE_SMM_DRIVER,\r
+    #    "SMM_DRIVER"            :   SUP_MODULE_DXE_SMM_DRIVER,\r
+    #    "BS_DRIVER"             :   SUP_MODULE_DXE_SMM_DRIVER,\r
+    #    "BS_DRIVER"             :   SUP_MODULE_UEFI_DRIVER,\r
+        "APPLICATION"           :   SUP_MODULE_UEFI_APPLICATION,\r
+        "LOGO"                  :   SUP_MODULE_BASE,\r
     }\r
 \r
     # regular expression for converting XXX_FLAGS in [nmake] section to new type\r
@@ -461,9 +461,9 @@ class InfBuildData(ModuleBuildClassObject):
             if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
             if self._ModuleType is None:\r
-                self._ModuleType = 'BASE'\r
+                self._ModuleType = SUP_MODULE_BASE\r
             if self._ModuleType not in SUP_MODULE_LIST:\r
-                self._ModuleType = "USER_DEFINED"\r
+                self._ModuleType = SUP_MODULE_USER_DEFINED\r
         return self._ModuleType\r
 \r
     ## Retrieve COMPONENT_TYPE\r
@@ -472,7 +472,7 @@ class InfBuildData(ModuleBuildClassObject):
             if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
             if self._ComponentType is None:\r
-                self._ComponentType = 'USER_DEFINED'\r
+                self._ComponentType = SUP_MODULE_USER_DEFINED\r
         return self._ComponentType\r
 \r
     ## Retrieve "BUILD_TYPE"\r
@@ -481,7 +481,7 @@ class InfBuildData(ModuleBuildClassObject):
             if self._Header_ is None:\r
                 self._GetHeaderInfo()\r
             if not self._BuildType:\r
-                self._BuildType = "BASE"\r
+                self._BuildType = SUP_MODULE_BASE\r
         return self._BuildType\r
 \r
     ## Retrieve file guid\r
@@ -899,14 +899,14 @@ class InfBuildData(ModuleBuildClassObject):
 \r
             # PEIM and DXE drivers must have a valid [Depex] section\r
             if len(self.LibraryClass) == 0 and len(RecordList) == 0:\r
-                if self.ModuleType == 'DXE_DRIVER' or self.ModuleType == 'PEIM' or self.ModuleType == 'DXE_SMM_DRIVER' or \\r
-                    self.ModuleType == 'DXE_SAL_DRIVER' or self.ModuleType == 'DXE_RUNTIME_DRIVER':\r
+                if self.ModuleType == SUP_MODULE_DXE_DRIVER or self.ModuleType == SUP_MODULE_PEIM or self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER or \\r
+                    self.ModuleType == SUP_MODULE_DXE_SAL_DRIVER or self.ModuleType == SUP_MODULE_DXE_RUNTIME_DRIVER:\r
                     EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \\r
                                     % self.ModuleType, File=self.MetaFile)\r
 \r
-            if len(RecordList) != 0 and self.ModuleType == 'USER_DEFINED':\r
+            if len(RecordList) != 0 and self.ModuleType == SUP_MODULE_USER_DEFINED:\r
                 for Record in RecordList:\r
-                    if Record[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DRIVER']:\r
+                    if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER]:\r
                         EdkLogger.error('build', FORMAT_INVALID,\r
                                         "'%s' module must specify the type of [Depex] section" % self.ModuleType,\r
                                         File=self.MetaFile)\r
index 736ef62534533ae2837e0f361bef9980978799de..573100081815af4bdd966762ba665a47400c370b 100644 (file)
@@ -134,7 +134,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildDatabase, Arch, Target, To
                     LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))\r
                 elif LibraryModule.LibraryClass is None \\r
                      or len(LibraryModule.LibraryClass) == 0 \\r
-                     or (ModuleType != 'USER_DEFINED'\r
+                     or (ModuleType != SUP_MODULE_USER_DEFINED\r
                          and ModuleType not in LibraryModule.LibraryClass[0].SupModList):\r
                     # only USER_DEFINED can link against any library instance despite of its SupModList\r
                     return []\r
index c4647d068a6b91ed336cb9d078b3599e657f7706..b2e5fd6fbf384dc049e7ef543368f32abfa4cb6c 100644 (file)
@@ -48,18 +48,18 @@ import collections
 from Common.Expression import *\r
 \r
 gComponentType2ModuleType = {\r
-    "LIBRARY"               :   "BASE",\r
-    "SECURITY_CORE"         :   "SEC",\r
-    "PEI_CORE"              :   "PEI_CORE",\r
-    "COMBINED_PEIM_DRIVER"  :   "PEIM",\r
-    "PIC_PEIM"              :   "PEIM",\r
-    "RELOCATABLE_PEIM"      :   "PEIM",\r
-    "PE32_PEIM"             :   "PEIM",\r
-    "BS_DRIVER"             :   "DXE_DRIVER",\r
-    "RT_DRIVER"             :   "DXE_RUNTIME_DRIVER",\r
-    "SAL_RT_DRIVER"         :   "DXE_SAL_DRIVER",\r
-    "APPLICATION"           :   "UEFI_APPLICATION",\r
-    "LOGO"                  :   "BASE",\r
+    "LIBRARY"               :   SUP_MODULE_BASE,\r
+    "SECURITY_CORE"         :   SUP_MODULE_SEC,\r
+    SUP_MODULE_PEI_CORE     :   SUP_MODULE_PEI_CORE,\r
+    "COMBINED_PEIM_DRIVER"  :   SUP_MODULE_PEIM,\r
+    "PIC_PEIM"              :   SUP_MODULE_PEIM,\r
+    "RELOCATABLE_PEIM"      :   SUP_MODULE_PEIM,\r
+    "PE32_PEIM"             :   SUP_MODULE_PEIM,\r
+    "BS_DRIVER"             :   SUP_MODULE_DXE_DRIVER,\r
+    "RT_DRIVER"             :   SUP_MODULE_DXE_RUNTIME_DRIVER,\r
+    "SAL_RT_DRIVER"         :   SUP_MODULE_DXE_SAL_DRIVER,\r
+    "APPLICATION"           :   SUP_MODULE_UEFI_APPLICATION,\r
+    "LOGO"                  :   SUP_MODULE_BASE,\r
 }\r
 \r
 ## Pattern to extract contents in EDK DXS files\r
@@ -122,20 +122,20 @@ gPcdTypeMap = {
 \r
 ## The look up table to map module type to driver type\r
 gDriverTypeMap = {\r
-  'SEC'               : '0x3 (SECURITY_CORE)',\r
-  'PEI_CORE'          : '0x4 (PEI_CORE)',\r
-  'PEIM'              : '0x6 (PEIM)',\r
-  'DXE_CORE'          : '0x5 (DXE_CORE)',\r
-  'DXE_DRIVER'        : '0x7 (DRIVER)',\r
-  'DXE_SAL_DRIVER'    : '0x7 (DRIVER)',\r
-  'DXE_SMM_DRIVER'    : '0x7 (DRIVER)',\r
-  'DXE_RUNTIME_DRIVER': '0x7 (DRIVER)',\r
-  'UEFI_DRIVER'       : '0x7 (DRIVER)',\r
-  'UEFI_APPLICATION'  : '0x9 (APPLICATION)',\r
-  'SMM_CORE'          : '0xD (SMM_CORE)',\r
+  SUP_MODULE_SEC               : '0x3 (SECURITY_CORE)',\r
+  SUP_MODULE_PEI_CORE          : '0x4 (PEI_CORE)',\r
+  SUP_MODULE_PEIM              : '0x6 (PEIM)',\r
+  SUP_MODULE_DXE_CORE          : '0x5 (DXE_CORE)',\r
+  SUP_MODULE_DXE_DRIVER        : '0x7 (DRIVER)',\r
+  SUP_MODULE_DXE_SAL_DRIVER    : '0x7 (DRIVER)',\r
+  SUP_MODULE_DXE_SMM_DRIVER    : '0x7 (DRIVER)',\r
+  SUP_MODULE_DXE_RUNTIME_DRIVER: '0x7 (DRIVER)',\r
+  SUP_MODULE_UEFI_DRIVER       : '0x7 (DRIVER)',\r
+  SUP_MODULE_UEFI_APPLICATION  : '0x9 (APPLICATION)',\r
+  SUP_MODULE_SMM_CORE          : '0xD (SMM_CORE)',\r
   'SMM_DRIVER'        : '0xA (SMM)', # Extension of module type to support PI 1.1 SMM drivers\r
-  'MM_STANDALONE'     : '0xE (MM_STANDALONE)',\r
-  'MM_CORE_STANDALONE' : '0xF (MM_CORE_STANDALONE)'\r
+  SUP_MODULE_MM_STANDALONE     : '0xE (MM_STANDALONE)',\r
+  SUP_MODULE_MM_CORE_STANDALONE : '0xF (MM_CORE_STANDALONE)'\r
   }\r
 \r
 ## The look up table of the supported opcode in the dependency expression binaries\r
@@ -424,7 +424,7 @@ class DepexReport(object):
         if not ModuleType:\r
             ModuleType = gComponentType2ModuleType.get(M.ComponentType, "")\r
 \r
-        if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "MM_CORE_STANDALONE", "UEFI_APPLICATION"]:\r
+        if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UEFI_APPLICATION]:\r
             return\r
       \r
         for Source in M.SourceFileList:\r
@@ -591,7 +591,7 @@ class ModuleReport(object):
             #\r
             # If a module complies to PI 1.1, promote Module type to "SMM_DRIVER"\r
             #\r
-            if ModuleType == "DXE_SMM_DRIVER":\r
+            if ModuleType == SUP_MODULE_DXE_SMM_DRIVER:\r
                 PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")\r
                 if int(PiSpec, 0) >= 0x0001000A:\r
                     ModuleType = "SMM_DRIVER"\r
@@ -1382,7 +1382,7 @@ class PredictionReport(object):
                 # their source code to find PPI/Protocol produce or consume\r
                 # information.\r
                 #\r
-                if Module.ModuleType == "BASE":\r
+                if Module.ModuleType == SUP_MODULE_BASE:\r
                     continue\r
                 #\r
                 # Add module referenced source files\r
index 36bb1fecf7e570143d11e0ac9f9c6568e13ba9b3..81d59dd3eedf9a6837885de8a092c809c5a382ea 100644 (file)
@@ -1587,22 +1587,22 @@ class Build():
                     if not ImageClass.IsValid:\r
                         EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo)\r
                     ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass)\r
-                    if Module.ModuleType in ['PEI_CORE', 'PEIM', 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', 'DXE_CORE']:\r
+                    if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]:\r
                         PeiModuleList[Module.MetaFile] = ImageInfo\r
                         PeiSize += ImageInfo.Image.Size\r
-                    elif Module.ModuleType in ['BS_DRIVER', 'DXE_DRIVER', 'UEFI_DRIVER']:\r
+                    elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]:\r
                         BtModuleList[Module.MetaFile] = ImageInfo\r
                         BtSize += ImageInfo.Image.Size\r
-                    elif Module.ModuleType in ['DXE_RUNTIME_DRIVER', 'RT_DRIVER', 'DXE_SAL_DRIVER', 'SAL_RT_DRIVER']:\r
+                    elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']:\r
                         RtModuleList[Module.MetaFile] = ImageInfo\r
                         #IPF runtime driver needs to be at 2 page alignment.\r
                         if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0:\r
                             ImageInfo.Image.Size = (ImageInfo.Image.Size / 0x2000 + 1) * 0x2000\r
                         RtSize += ImageInfo.Image.Size\r
-                    elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER', 'MM_STANDALONE', 'MM_CORE_STANDALONE']:\r
+                    elif Module.ModuleType in [SUP_MODULE_SMM_CORE, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]:\r
                         SmmModuleList[Module.MetaFile] = ImageInfo\r
                         SmmSize += ImageInfo.Image.Size\r
-                        if Module.ModuleType == 'DXE_SMM_DRIVER':\r
+                        if Module.ModuleType == SUP_MODULE_DXE_SMM_DRIVER:\r
                             PiSpecVersion = Module.Module.Specification.get('PI_SPECIFICATION_VERSION', '0x00000000')\r
                             # for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver.\r
                             if int(PiSpecVersion, 16) < 0x0001000A:\r