]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Sync EDKII BaseTools to BaseTools project r2065.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 11 Oct 2010 06:26:52 +0000 (06:26 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 11 Oct 2010 06:26:52 +0000 (06:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10915 6f19259b-4bc3-4df7-8a09-765794883524

52 files changed:
BaseTools/Bin/Win32/BPDG.exe
BaseTools/Bin/Win32/BootSectImage.exe
BaseTools/Bin/Win32/EfiLdrImage.exe
BaseTools/Bin/Win32/EfiRom.exe
BaseTools/Bin/Win32/Fpd2Dsc.exe
BaseTools/Bin/Win32/GenBootSector.exe
BaseTools/Bin/Win32/GenCrc32.exe
BaseTools/Bin/Win32/GenDepex.exe
BaseTools/Bin/Win32/GenFds.exe
BaseTools/Bin/Win32/GenFfs.exe
BaseTools/Bin/Win32/GenFv.exe
BaseTools/Bin/Win32/GenFw.exe
BaseTools/Bin/Win32/GenPage.exe
BaseTools/Bin/Win32/GenPatchPcdTable.exe
BaseTools/Bin/Win32/GenSec.exe
BaseTools/Bin/Win32/GenVtf.exe
BaseTools/Bin/Win32/LzmaCompress.exe
BaseTools/Bin/Win32/MigrationMsa2Inf.exe
BaseTools/Bin/Win32/PatchPcdValue.exe
BaseTools/Bin/Win32/Spd2Dec.exe
BaseTools/Bin/Win32/Split.exe
BaseTools/Bin/Win32/TargetTool.exe
BaseTools/Bin/Win32/TianoCompress.exe
BaseTools/Bin/Win32/Trim.exe
BaseTools/Bin/Win32/VfrCompile.exe
BaseTools/Bin/Win32/VolInfo.exe
BaseTools/Bin/Win32/build.exe
BaseTools/Conf/build_rule.template
BaseTools/Conf/target.template
BaseTools/Conf/tools_def.template
BaseTools/Source/C/Include/IndustryStandard/PeImage.h
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/AutoGen/UniClassObject.py
BaseTools/Source/Python/BPDG/BPDG.py
BaseTools/Source/Python/BPDG/GenVpd.py
BaseTools/Source/Python/BPDG/StringTable.py
BaseTools/Source/Python/Common/BuildToolError.py
BaseTools/Source/Python/Common/DataType.py
BaseTools/Source/Python/Common/Dictionary.py
BaseTools/Source/Python/Common/String.py
BaseTools/Source/Python/Common/TargetTxtClassObject.py
BaseTools/Source/Python/Common/ToolDefClassObject.py
BaseTools/Source/Python/Common/VpdInfoFile.py
BaseTools/Source/Python/CommonDataClass/CommonClass.py
BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py
BaseTools/Source/Python/PackagingTool/DependencyRules.py
BaseTools/Source/Python/TargetTool/TargetTool.py
BaseTools/Source/Python/Trim/Trim.py
BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
BaseTools/Source/Python/build/build.py

index d0b2c95c304c97e5fcdba30f66921b74823525c8..29888d56ad3c73466fe6e8234eadfec86ec1e752 100644 (file)
Binary files a/BaseTools/Bin/Win32/BPDG.exe and b/BaseTools/Bin/Win32/BPDG.exe differ
index 0e11dd8a5c5bb83c6a1bb0f44e16e08898e980e4..c628a946dd6d7a646e3b15a39245d7c60df0ab44 100755 (executable)
Binary files a/BaseTools/Bin/Win32/BootSectImage.exe and b/BaseTools/Bin/Win32/BootSectImage.exe differ
index d63752e1c1217cddd0e75074dc680ba2ec231b13..2d42e0fff48223ea5f53e5b3376c92ed3ca5a61e 100755 (executable)
Binary files a/BaseTools/Bin/Win32/EfiLdrImage.exe and b/BaseTools/Bin/Win32/EfiLdrImage.exe differ
index f92ae9bf303bfbcf7d1a9d7ddced06ece6774d6e..9a1db5f3d03e079b199e0d8e6877bb4c9ce7ecd5 100755 (executable)
Binary files a/BaseTools/Bin/Win32/EfiRom.exe and b/BaseTools/Bin/Win32/EfiRom.exe differ
index 688dd210e47455ebb5e70a7ce557c374096959a2..1eea8257450490460ec4f3ede78b422c9005fff6 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Fpd2Dsc.exe and b/BaseTools/Bin/Win32/Fpd2Dsc.exe differ
index bc2bdebd913e54cec9fc2f36d423d789a4b9db88..4e68e769670f44df79313d45971ae693e0f9755f 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenBootSector.exe and b/BaseTools/Bin/Win32/GenBootSector.exe differ
index 9e86442a73f678b20fbb92f9c0b80837d87a33c7..671e04ee6a112f41c18bf6ab3f7f0baf4e5d5bf4 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenCrc32.exe and b/BaseTools/Bin/Win32/GenCrc32.exe differ
index 698eebf30ca35ecdf796c93fd76414bc6dadb385..3e6685ce388069bb14a8f82447a90243d3a4467d 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenDepex.exe and b/BaseTools/Bin/Win32/GenDepex.exe differ
index adb7da94bcbfc1eb4aaa8e1a670f746184cd9c91..1df44e67143cec5e0c4d7abb12c2706e39e5c676 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFds.exe and b/BaseTools/Bin/Win32/GenFds.exe differ
index 2f51ce6825b9b935006efc22f8a1767e964c54e9..92a1c1540eeafe88de8e1a3a3a11882158945a78 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFfs.exe and b/BaseTools/Bin/Win32/GenFfs.exe differ
index 66c61fee763c3158f2114f4a44ce45f351f03239..882c2d1d096ea58e52e4e08ffa84bf71a0fcb337 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFv.exe and b/BaseTools/Bin/Win32/GenFv.exe differ
index 10cb4a33f713c48c91bdbb48e9965081ea671b7f..4db22ba547341008503e7b0588fdf3dc5d96f6d7 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFw.exe and b/BaseTools/Bin/Win32/GenFw.exe differ
index 9ce843fb87ad50b05833759b0dc11e175ab964d0..0d3e6615aa62b2298ef400d95e1b17075531ddb6 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenPage.exe and b/BaseTools/Bin/Win32/GenPage.exe differ
index 9306426f753e3c38a070caeee5468426af1de459..1262bf6f06cbdf8e4d00e6ef6830b1455b5de73f 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenPatchPcdTable.exe and b/BaseTools/Bin/Win32/GenPatchPcdTable.exe differ
index 7806717c8256f1efb7cf8c59829823e9c2a0a96b..74d3379adca5c52e1ce6bb08e889781c432f227e 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenSec.exe and b/BaseTools/Bin/Win32/GenSec.exe differ
index 9066545715b744586b257735275ec40773091a80..fc1f860fec7764dfdd4b9eb3c9ec5de9e4bf65fe 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenVtf.exe and b/BaseTools/Bin/Win32/GenVtf.exe differ
index f9108fa8f5d440b84d2b8309628d0bc2ba0aadbc..2f74e0f8a97a232a6b19562ad128dbb0d286f948 100755 (executable)
Binary files a/BaseTools/Bin/Win32/LzmaCompress.exe and b/BaseTools/Bin/Win32/LzmaCompress.exe differ
index 117cad3ddb4432c2604dbebfd136614a0783a8e5..3db093f735fc9b8f567d0319d8edb2a133c14e6e 100755 (executable)
Binary files a/BaseTools/Bin/Win32/MigrationMsa2Inf.exe and b/BaseTools/Bin/Win32/MigrationMsa2Inf.exe differ
index 5b19d89e1fd96f55242c93a43081f7d07da127f3..afcaccfc6615e513e8aa5e61c0ecf9c210492f0f 100755 (executable)
Binary files a/BaseTools/Bin/Win32/PatchPcdValue.exe and b/BaseTools/Bin/Win32/PatchPcdValue.exe differ
index 049766b682294b270320c30d1e315d920c429bf2..bc58b468facbcffb21bc71b6c5efe4c704263ea7 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Spd2Dec.exe and b/BaseTools/Bin/Win32/Spd2Dec.exe differ
index 561aa69bd11be95694118093ba4fbe258ded5783..097824af6670e571f070aba67e3e3fc118087f1d 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Split.exe and b/BaseTools/Bin/Win32/Split.exe differ
index bfe546188eeea2acde49c73f13b5debcd9a84b15..b2837875918af122fadce87a272bbfb418be4eb3 100755 (executable)
Binary files a/BaseTools/Bin/Win32/TargetTool.exe and b/BaseTools/Bin/Win32/TargetTool.exe differ
index 4c1d44ff5d2e6296be65748bdd5c0f3f3e806abd..8fe45a52d9399056549b568050473049b45a26e1 100755 (executable)
Binary files a/BaseTools/Bin/Win32/TianoCompress.exe and b/BaseTools/Bin/Win32/TianoCompress.exe differ
index 2c0b8738f74843f4459400d78677cba924228d4f..4c6993bf3ba5cc8e3b5542a50b116c2bff9df20d 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Trim.exe and b/BaseTools/Bin/Win32/Trim.exe differ
index da1b0a9a996f3d0474d0e56fe2eb7560b728e783..cf31c305a006843da2dad7c658edd48e784d0a08 100755 (executable)
Binary files a/BaseTools/Bin/Win32/VfrCompile.exe and b/BaseTools/Bin/Win32/VfrCompile.exe differ
index 2cf76569a4470e7a0e7db8aa302664e6ca18bc09..d7d30c45d6d3eaf0a42a7c369163f653d90a1c82 100755 (executable)
Binary files a/BaseTools/Bin/Win32/VolInfo.exe and b/BaseTools/Bin/Win32/VolInfo.exe differ
index 170a55cdbe2d754e8534643d1b9d227fd4a9525b..05ab7c1daf34d1ebc84d6e2e07e2675366a8aa2e 100755 (executable)
Binary files a/BaseTools/Bin/Win32/build.exe and b/BaseTools/Bin/Win32/build.exe differ
index d240e9694deca6cdf89095b1bcb698eff3c2e035..c29ed563ae63b56b6f7df2fb2eb7d934f2452960 100644 (file)
@@ -1,6 +1,6 @@
 #\r
 #  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
-#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+#  Portions copyright (c) 2008 - 2010, Apple Inc. 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
@@ -9,8 +9,6 @@
 #  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
-#  Filename: build_rule.template\r
-#\r
 \r
 ## Syntax\r
 #\r
         $(MAKE_FILE)\r
 \r
     <Command.MSFT, Command.INTEL>\r
-        Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i ${src}\r
+        Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}\r
         "$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii\r
-        "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii\r
+        Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii \r
+        "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii\r
 \r
     <Command.GCC>\r
-        Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i ${src}\r
+        Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}\r
         "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii\r
         "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii\r
 \r
     <InputFile>\r
         *.hpk\r
 \r
-    <OutputFile>\r
+    <OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC>\r
         $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib\r
 \r
+    <OutputFile.XCODE, OutputFile.RVCT, OutputFile.ARMGCC>\r
+        $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc\r
+\r
     <Command.MSFT, Command.INTEL>\r
         "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)\r
         "$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc\r
     <Command.GCC>\r
         "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)\r
         "$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}\r
+        \r
+    <Command.XCODE, Command.RVCT, Command.ARMGCC>  \r
+        GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES)\r
+        \r
+        \r
index a05e7af3af3e7982a1694987a14e8fb423da6da8..3c4c50ff1ec4ef73bbf6e193d29c04d9c81a9ca7 100644 (file)
@@ -1,5 +1,5 @@
 #\r
-#  Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2010, 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
@@ -9,7 +9,6 @@
 #  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
-#  Filename: target.template\r
 #\r
 #  ALL Paths are Relative to WORKSPACE\r
 \r
index c873d93738a69bdb3cb46af1737be96dae905914..639e20a60e2eec80bdad24f52d927a3275644541 100644 (file)
@@ -18,22 +18,22 @@ DEFINE VS2003_BIN       = C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
 DEFINE VS2003_DLL       = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\r
 \r
 DEFINE VS2005_BIN       = C:\Program Files\Microsoft Visual Studio 8\Vc\bin\r
-DEFINE VS2005_DLL       = C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\r
+DEFINE VS2005_DLL       = C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;DEF(VS2005_BIN)\r
 DEFINE VS2005_BINX64    = C:\Program Files\Microsoft Visual Studio 8\Vc\bin\x86_amd64\r
 DEFINE VS2005_BIN64     = C:\Program Files\Microsoft Visual Studio 8\Vc\bin\x86_ia64\r
 \r
 DEFINE VS2005x86_BIN    = C:\Program Files (x86)\Microsoft Visual Studio 8\Vc\bin\r
-DEFINE VS2005x86_DLL    = C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\r
+DEFINE VS2005x86_DLL    = C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE;DEF(VS2005x86_BIN)\r
 DEFINE VS2005x86_BINX64 = DEF(VS2005x86_BIN)\x86_amd64\r
 DEFINE VS2005x86_BIN64  = DEF(VS2005x86_BIN)\x86_ia64\r
 \r
 DEFINE VS2008_BIN      = C:\Program Files\Microsoft Visual Studio 9.0\Vc\bin\r
-DEFINE VS2008_DLL      = C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\r
+DEFINE VS2008_DLL      = C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;DEF(VS2008_BIN)\r
 DEFINE VS2008_BINX64   = DEF(VS2008_BIN)\x86_amd64\r
 DEFINE VS2008_BIN64    = DEF(VS2008_BIN)\x86_ia64\r
 \r
 DEFINE VS2008x86_BIN    = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Vc\bin\r
-DEFINE VS2008x86_DLL    = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\r
+DEFINE VS2008x86_DLL    = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;DEF(VS2008x86_BIN)\r
 DEFINE VS2008x86_BINX64 = DEF(VS2008x86_BIN)\x86_amd64\r
 DEFINE VS2008x86_BIN64  = DEF(VS2008x86_BIN)\x86_ia64\r
 \r
@@ -149,11 +149,11 @@ DEFINE DEFAULT_WIN_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
 #DEFINE DEFAULT_WIN_ASL_FLAGS    = DEF(MS_ASL_FLAGS)\r
 #DEFINE DEFAULT_WIN_ASL_OUTFLAGS = DEF(MS_ASL_OUTFLAGS)\r
 \r
-DEFINE MSFT_ASLPP_FLAGS        = /nologo /EP /C\r
+DEFINE MSFT_ASLPP_FLAGS        = /nologo /E /C /FIAutoGen.h\r
 DEFINE MSFT_ASLCC_FLAGS        = /GL- /Y- /TC /Dmain=ReferenceAcpiTable\r
 DEFINE MSFT_ASLDLINK_FLAGS     = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE\r
 \r
-DEFINE ICC_WIN_ASLPP_FLAGS     = /nologo /EP /C\r
+DEFINE ICC_WIN_ASLPP_FLAGS     = /nologo /E /C /FIAutoGen.h\r
 DEFINE ICC_WIN_ASLCC_FLAGS     = /Y- /TC /WX- /Od /Dmain=ReferenceAcpiTable\r
 DEFINE ICC_WIN_ASLDLINK_FLAGS  = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libmmt /NODEFAULTLIB:libirc\r
 \r
index de0e90e223d112f6243bd7ddfd2af8e477d9ee72..f54ee63a83aef0b12d0108ca70f3fa8ec84e426a 100644 (file)
@@ -511,6 +511,8 @@ typedef struct {
 #define EFI_IMAGE_REL_BASED_HIGHLOW       3\r
 #define EFI_IMAGE_REL_BASED_HIGHADJ       4\r
 #define EFI_IMAGE_REL_BASED_MIPS_JMPADDR  5\r
+#define EFI_IMAGE_REL_BASED_ARM_MOV32A    5\r
+#define EFI_IMAGE_REL_BASED_ARM_MOV32T    7\r
 #define EFI_IMAGE_REL_BASED_IA64_IMM64    9\r
 #define EFI_IMAGE_REL_BASED_DIR64         10\r
 \r
index d95f40bf82ae52c4c5820617289fe8f956e134a2..aaba768b4a84867be9d545296f52a978855c7173 100644 (file)
@@ -162,6 +162,10 @@ class WorkspaceAutoGen(AutoGen):
 \r
         # parse FDF file to get PCDs in it, if any\r
         if self.FdfFile != None and self.FdfFile != '':\r
+            #\r
+            # Make global macros available when parsing FDF file\r
+            #\r
+            InputMacroDict.update(self.BuildDatabase.WorkspaceDb._GlobalMacros)\r
             Fdf = FdfParser(self.FdfFile.Path)\r
             Fdf.ParseFile()\r
             PcdSet = Fdf.Profile.PcdDict\r
@@ -544,9 +548,18 @@ class PlatformAutoGen(AutoGen):
                                     DecPcdEntry = eachDec.Pcds[DecPcd]\r
                                     if (DecPcdEntry.TokenSpaceGuidCName == DscPcdEntry.TokenSpaceGuidCName) and \\r
                                        (DecPcdEntry.TokenCName == DscPcdEntry.TokenCName):\r
+                                        # Print warning message to let the developer make a determine.\r
+                                        EdkLogger.warn("build", "Unreferenced vpd pcd used!",\r
+                                                        File=self.MetaFile, \\r
+                                                        ExtraData = "PCD: %s.%s used in the DSC file %s is unreferenced." \\r
+                                                        %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, self.Platform.MetaFile.Path))  \r
+                                                                              \r
                                         DscPcdEntry.DatumType    = DecPcdEntry.DatumType\r
                                         DscPcdEntry.DefaultValue = DecPcdEntry.DefaultValue\r
-                                        Sku.DefaultValue         = DecPcdEntry.DefaultValue                                                                    \r
+                                        # Only fix the value while no value provided in DSC file.\r
+                                        if (Sku.DefaultValue == "" or Sku.DefaultValue==None):\r
+                                            DscPcdEntry.SkuInfoList[DscPcdEntry.SkuInfoList.keys()[0]].DefaultValue = DecPcdEntry.DefaultValue\r
+                                                                                                                \r
                                                        \r
                             VpdFile.Add(DscPcdEntry, Sku.VpdOffset)\r
                             # if the offset of a VPD is *, then it need to be fixed up by third party tool.\r
@@ -569,11 +582,9 @@ class PlatformAutoGen(AutoGen):
                     except:\r
                         EdkLogger.error("build", FILE_WRITE_FAILURE, "Fail to create FV folder under %s" % self.BuildDir)\r
                         \r
-                VpdFileName = self.Platform.VpdFileName           \r
-                if VpdFileName == None or VpdFileName == "" :\r
-                    VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid)\r
-                else :\r
-                    VpdFilePath = os.path.join(FvPath, "%s.txt" % VpdFileName)  \r
+        \r
+                VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid)\r
+\r
                 \r
                 if not os.path.exists(VpdFilePath) or os.path.getmtime(VpdFilePath) < DscTimeStamp:\r
                     VpdFile.Write(VpdFilePath)\r
@@ -588,16 +599,13 @@ class PlatformAutoGen(AutoGen):
                             break\r
                     # Call third party GUID BPDG tool.\r
                     if BPDGToolName != None:\r
-                        VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath, VpdFileName)\r
+                        VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath)\r
                     else:\r
                         EdkLogger.error("Build", FILE_NOT_FOUND, "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")\r
                         \r
                 # Process VPD map file generated by third party BPDG tool\r
                 if NeedProcessVpdMapFile:\r
-                    if VpdFileName == None or VpdFileName == "" :\r
-                        VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)\r
-                    else :\r
-                        VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % VpdFileName)\r
+                    VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)\r
                     if os.path.exists(VpdMapFilePath):\r
                         VpdFile.Read(VpdMapFilePath)\r
                 \r
@@ -1709,12 +1717,12 @@ class ModuleAutoGen(AutoGen):
             self._SourceFileList = []\r
             for F in self.Module.Sources:\r
                 # match tool chain\r
-                if F.TagName != "" and F.TagName != self.ToolChain:\r
+                if F.TagName not in ("", "*", self.ToolChain):\r
                     EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for processing file [%s] is found, "\r
                                     "but [%s] is needed" % (F.TagName, str(F), self.ToolChain))\r
                     continue\r
                 # match tool chain family\r
-                if F.ToolChainFamily != "" and F.ToolChainFamily != self.ToolChainFamily:\r
+                if F.ToolChainFamily not in ("", "*", self.ToolChainFamily):\r
                     EdkLogger.debug(\r
                                 EdkLogger.DEBUG_0,\r
                                 "The file [%s] must be built by tools of [%s], " \\r
@@ -2128,14 +2136,6 @@ class ModuleAutoGen(AutoGen):
                         self._ApplyBuildRule(Lib.Target, TAB_UNKNOWN_FILE)\r
         return self._LibraryAutoGenList\r
 \r
-    ## Return build command string\r
-    #\r
-    #   @retval     string  Build command string\r
-    #\r
-    def _GetBuildCommand(self):\r
-        return self.PlatformInfo.BuildCommand\r
-\r
-\r
     Module          = property(_GetModule)\r
     Name            = property(_GetBaseName)\r
     Guid            = property(_GetGuid)\r
index 2e18f6771c79e699e7fc8369073b02886f59e6c7..b1e438547fb67f4dcfcb9a379ba3b6babf0444cc 100644 (file)
@@ -26,7 +26,7 @@ from BuildEngine import *
 import Common.GlobalData as GlobalData
 
 ## Regular expression for finding header file inclusions
-gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:[\"<]?[ \t]*)([\w.\\/() \t]+)(?:[ \t]*[\">]?)", re.MULTILINE|re.UNICODE|re.IGNORECASE)
+gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE|re.UNICODE|re.IGNORECASE)
 
 ## Regular expression for matching macro used in header file inclusion
 gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE)
@@ -769,7 +769,7 @@ cleanlib:
                     Inc = os.path.normpath(Inc)
                     for SearchPath in [CurrentFilePath] + SearchPathList:
                         FilePath = os.path.join(SearchPath, Inc)
-                        if not os.path.exists(FilePath) or FilePath in CurrentFileDependencyList:
+                        if not os.path.isfile(FilePath) or FilePath in CurrentFileDependencyList:
                             continue
                         FilePath = PathClass(FilePath)
                         CurrentFileDependencyList.append(FilePath)
index 76a0549a751c8d574d297ae54637895c0571a406..1eb65c1e9a4bd6bf9db105c2ad9411ab19cac233 100644 (file)
@@ -444,6 +444,13 @@ class UniFileClassObject(object):
     # Add a string to list\r
     #\r
     def AddStringToList(self, Name, Language, Value, Token = None, Referenced = False, UseOtherLangDef = '', Index = -1):\r
+        for LangNameItem in self.LanguageDef:\r
+            if Language == LangNameItem[0]:\r
+                break\r
+        else:\r
+            EdkLogger.error('Unicode File Parser', FORMAT_NOT_SUPPORTED, "The language '%s' for %s is not defined in Unicode file %s." \\r
+                            % (Language, Name, self.File))\r
+            \r
         if Language not in self.OrderedStringList:\r
             self.OrderedStringList[Language] = []\r
 \r
index 10692c48340eabdf04f0f0fbedaf1a8ac5967fe6..f50e6f7d2299dea3f60465255907dd135594e9f9 100644 (file)
@@ -25,7 +25,6 @@ import sys
 import encodings.ascii\r
 \r
 from optparse import OptionParser\r
-from encodings import gbk\r
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 \r
@@ -49,13 +48,11 @@ def main():
     \r
     # Initialize log system\r
     EdkLogger.Initialize()          \r
-    Options, Args = myOptionParser()\r
+    Options, Args = MyOptionParser()\r
     \r
     ReturnCode = 0\r
     \r
-    if Options.opt_slient:\r
-        EdkLogger.SetLevel(EdkLogger.ERROR)\r
-    elif Options.opt_verbose:\r
+    if Options.opt_verbose:\r
         EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
     elif Options.opt_quiet:\r
         EdkLogger.SetLevel(EdkLogger.QUIET)\r
@@ -64,7 +61,7 @@ def main():
     else:\r
         EdkLogger.SetLevel(EdkLogger.INFO)\r
                   \r
-    if Options.vpd_filename == None:\r
+    if Options.bin_filename == None:\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -o option to specify the file name for the VPD binary file")  \r
     if Options.filename == None:\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -m option to specify the file name for the mapping file")  \r
@@ -74,14 +71,22 @@ def main():
         Force = True\r
 \r
     if (Args[0] != None) :\r
-        startBPDG(Args[0], Options.filename, Options.vpd_filename, Force)\r
+        StartBpdg(Args[0], Options.filename, Options.bin_filename, Force)\r
     else :\r
         EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please specify the file which contain the VPD pcd info.",\r
                         None)         \r
     \r
     return ReturnCode\r
-            \r
-def myOptionParser():   \r
+\r
+\r
+## Parse command line options\r
+#\r
+# Using standard Python module optparse to parse command line option of this tool.\r
+#\r
+#   @retval options   A optparse.Values object containing the parsed options\r
+#   @retval args      Target of BPDG command\r
+#            \r
+def MyOptionParser():   \r
     #\r
     # Process command line firstly.\r
     #\r
@@ -94,11 +99,9 @@ def myOptionParser():
                       help=st.MSG_OPTION_DEBUG_LEVEL)\r
     parser.add_option('-v', '--verbose', action='store_true', dest='opt_verbose',\r
                       help=st.MSG_OPTION_VERBOSE)\r
-    parser.add_option('-s', '--silent', action='store_true', dest='opt_slient', default=False,\r
-                      help=st.MSG_OPTION_SILENT)\r
     parser.add_option('-q', '--quiet', action='store_true', dest='opt_quiet', default=False,\r
                       help=st.MSG_OPTION_QUIET)\r
-    parser.add_option('-o', '--vpd-filename', action='store', dest='vpd_filename',\r
+    parser.add_option('-o', '--vpd-filename', action='store', dest='bin_filename',\r
                       help=st.MSG_OPTION_VPD_FILENAME)\r
     parser.add_option('-m', '--map-filename', action='store', dest='filename',\r
                       help=st.MSG_OPTION_MAP_FILENAME)   \r
@@ -111,8 +114,22 @@ def myOptionParser():
         EdkLogger.info(parser.usage)\r
         sys.exit(1)\r
     return options, args\r
-    \r
-def startBPDG(InputFileName, MapFileName, VpdFileName, Force):\r
+\r
+\r
+## Start BPDG and call the main functions \r
+#\r
+# This method mainly focus on call GenVPD class member functions to complete\r
+# BPDG's target. It will process VpdFile override, and provide the interface file\r
+# information.\r
+#\r
+#   @Param      InputFileName   The filename include the vpd type pcd information\r
+#   @param      MapFileName     The filename of map file that stores vpd type pcd information.\r
+#                               This file will be generated by the BPDG tool after fix the offset\r
+#                               and adjust the offset to make the pcd data aligned.\r
+#   @param      VpdFileName     The filename of Vpd file that hold vpd pcd information.\r
+#   @param      Force           Override the exist Vpdfile or not.\r
+#\r
+def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):\r
     if os.path.exists(VpdFileName) and not Force:\r
         print "\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName\r
         choice = sys.stdin.readline()\r
index 05f5b6cf9506284dcf9210a4aff4a88fb410a014..f0196e061a64bfad17c3f5d5038688ba302eea80 100644 (file)
@@ -28,6 +28,10 @@ _FORMAT_CHAR = {1: 'B',
                 8: 'Q'\r
                 }\r
 \r
+## The VPD PCD data structure for store and process each VPD PCD entry.\r
+#\r
+#  This class contain method to format and pack pcd's value.          \r
+#\r
 class PcdEntry:\r
     def __init__(self, PcdCName, PcdOffset, PcdSize, PcdValue, Lineno=None, FileName=None, PcdUnpackValue=None, \r
                  PcdBinOffset=None, PcdBinSize=None):\r
@@ -54,12 +58,29 @@ class PcdEntry:
                             "Invalid PCD format(Name: %s File: %s Line: %s), no PcdSize specified!" %(self.PcdCName, self.FileName, self.Lineno))  \r
                    \r
         self._GenOffsetValue ()\r
+    \r
+    ## Analyze the string value to judge the PCD's datum type euqal to Boolean or not.\r
+    # \r
+    #  @param   ValueString      PCD's value\r
+    #  @param   Size             PCD's size\r
+    #  \r
+    #  @retval  True   PCD's datum type is Boolean\r
+    #  @retval  False  PCD's datum type is not Boolean.              \r
+    #    \r
+    def _IsBoolean(self, ValueString, Size):\r
+        if (Size == "1"):\r
+            if ValueString.upper() in ["TRUE", "FALSE"]:\r
+                return True\r
+            elif ValueString in ["0", "1", "0x0", "0x1", "0x00", "0x01"]:\r
+                return True \r
         \r
-    def _IsBoolean(self, ValueString):\r
-        if ValueString.upper() in ["TRUE", "FALSE"]:\r
-            return True\r
         return False\r
     \r
+    ## Convert the PCD's value from string to integer.\r
+    #              \r
+    #  This function will try to convert the Offset value form string to integer\r
+    #  for both hexadecimal and decimal.\r
+    #    \r
     def _GenOffsetValue(self):\r
         if self.PcdOffset != "*" :\r
             try:\r
@@ -70,9 +91,14 @@ class PcdEntry:
                 except:\r
                     EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
                                     "Invalid offset value %s for PCD %s (File: %s Line: %s)" % (self.PcdOffset, self.PcdCName, self.FileName, self.Lineno))                                  \r
-        \r
+    \r
+    ## Pack Boolean type VPD PCD's value form string to binary type.\r
+    # \r
+    #  @param ValueString     The boolean type string for pack.\r
+    # \r
+    # \r
     def _PackBooleanValue(self, ValueString):\r
-        if ValueString.upper() == "TRUE":\r
+        if ValueString.upper() == "TRUE" or ValueString in ["1", "0x1", "0x01"]:\r
             try:    \r
                 self.PcdValue =  pack(_FORMAT_CHAR[1], 1)\r
             except:\r
@@ -83,18 +109,65 @@ class PcdEntry:
                 self.PcdValue =  pack(_FORMAT_CHAR[1], 0)\r
             except:\r
                 EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
-                                "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))      \r
-                               \r
+                                "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno)) \r
+                     \r
+    ## Pack Integer type VPD PCD's value form string to binary type.\r
+    # \r
+    #  @param ValueString     The Integer type string for pack.\r
+    # \r
+    #                                \r
     def _PackIntValue(self, IntValue, Size):\r
         if Size not in _FORMAT_CHAR.keys():\r
             EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
                             "Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))        \r
+        \r
+        if Size == 1:            \r
+            if IntValue < 0:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "PCD can't be set to negative value %d for PCD %s in UINT8 datum type(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))\r
+            elif IntValue >= 0x100:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "Too large PCD value %d for datum type UINT8 for PCD %s(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))                             \r
+        elif Size == 2:\r
+            if IntValue < 0:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "PCD can't be set to negative value %d for PCD %s in UINT16 datum type(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))\r
+            elif IntValue >= 0x10000:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "Too large PCD value %d for datum type UINT16 for PCD %s(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno)) \r
+        elif Size == 4:\r
+            if IntValue < 0:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "PCD can't be set to negative value %d for PCD %s in UINT32 datum type(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))\r
+            elif IntValue >= 0x100000000:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "Too large PCD value %d for datum type UINT32 for PCD %s(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))\r
+        elif Size == 8:\r
+            if IntValue < 0:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "PCD can't be set to negative value %d for PCD %s in UINT32 datum type(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))\r
+            elif IntValue >= 0x10000000000000000:\r
+                EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                                "Too large PCD value %d for datum type UINT32 for PCD %s(File: %s Line: %s)." % (IntValue, self.PcdCName, self.FileName, self.Lineno))\r
+        else:\r
+            EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
+                            "Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))              \r
+        \r
         try:\r
             self.PcdValue =  pack(_FORMAT_CHAR[Size], IntValue)\r
         except:\r
             EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
                             "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))                \r
-        \r
+\r
+    ## Pack VOID* type VPD PCD's value form string to binary type.\r
+    #\r
+    #  The VOID* type of string divided into 3 sub-type:\r
+    #    1:    L"String", Unicode type string.\r
+    #    2:    "String",  Ascii type string.\r
+    #    3:    {bytearray}, only support byte-array.\r
+    #\r
+    #  @param ValueString     The Integer type string for pack.\r
+    #       \r
     def _PackPtrValue(self, ValueString, Size):\r
         if ValueString.startswith('L"'):\r
             self._PackUnicode(ValueString, Size)\r
@@ -105,7 +178,11 @@ class PcdEntry:
         else:\r
             EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
                             "Invalid VOID* type PCD %s value %s (File: %s Line: %s)" % (self.PcdCName, ValueString, self.FileName, self.Lineno)) \r
-                   \r
+            \r
+    ## Pack an Ascii PCD value.\r
+    #  \r
+    #  An Ascii string for a PCD should be in format as  "".\r
+    #                   \r
     def _PackString(self, ValueString, Size):\r
         if (Size < 0):\r
             EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
@@ -123,8 +200,12 @@ class PcdEntry:
             self.PcdValue=  pack('%ds' % Size, ValueString)\r
         except:\r
             EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, \r
-                            "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))                  \r
-        \r
+                            "Invalid size or value for PCD %s to pack(File: %s Line: %s)." % (self.PcdCName, self.FileName, self.Lineno))   \r
+                           \r
+    ## Pack a byte-array PCD value.\r
+    #  \r
+    #  A byte-array for a PCD should be in format as  {0x01, 0x02, ...}.\r
+    #         \r
     def _PackByteArray(self, ValueString, Size):\r
         if (Size < 0):        \r
             EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid parameter Size %s of PCD %s!(File: %s Line: %s)" % (self.PcdBinSize, self.PcdCName, self.FileName, self.Lineno))\r
@@ -206,9 +287,18 @@ class PcdEntry:
             ReturnArray.append(0)\r
             \r
         self.PcdValue =  ReturnArray.tolist()    \r
-        \r
-class GenVPD :\r
-    \r
+\r
+\r
+\r
+## The class implementing the BPDG VPD PCD offset fix process\r
+#\r
+#   The VPD PCD offset fix process includes:\r
+#       1. Parse the input guided.txt file and store it in the data structure;\r
+#       2. Format the input file data to remove unused lines;\r
+#       3. Fixed offset if needed;\r
+#       4. Generate output file, including guided.map and guided.bin file;\r
+#        \r
+class GenVPD :    \r
     ## Constructor of DscBuildData\r
     #\r
     #  Initialize object of GenVPD\r
@@ -310,7 +400,7 @@ class GenVPD :
                     except:\r
                         EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "Invalid PCD size value %s at file: %s line: %s" % (PCD.PcdSize, self.InputFileName, PCD.Lineno))\r
                     \r
-                if PCD._IsBoolean(PCD.PcdValue):\r
+                if PCD._IsBoolean(PCD.PcdValue, PCD.PcdSize):\r
                     PCD._PackBooleanValue(PCD.PcdValue)\r
                     self.FileLinesList[count] = PCD\r
                     count += 1\r
index 0db282a143cbdaec821c613c5462d2cc26bb21f2..a661da0f9476fbddef0453ca5fbd81a29670994e 100644 (file)
@@ -55,7 +55,7 @@ Intel(r) Binary Product Data Generation Tool (Intel(r) BPDG)
 Copyright (c) 2010 Intel Corporation All Rights Reserved.\r
 \r
 Required Flags:\r
-  -o VPD_FILENAME, --vpd-filename=VPD_FILENAME\r
+  -o BIN_FILENAME, --vpd-filename=BIN_FILENAME\r
             Specify the file name for the VPD binary file\r
   -m FILENAME, --map-filename=FILENAME\r
             Generate file name for consumption during the build that contains \r
@@ -67,11 +67,10 @@ Required Flags:
 MSG_OPTION_HELP             = ("Show this help message and exit.")\r
 MSG_OPTION_DEBUG_LEVEL      = ("Print DEBUG statements, where DEBUG_LEVEL is 0-9.")\r
 MSG_OPTION_VERBOSE          = ("Print informational statements.")\r
-MSG_OPTION_SILENT           = ("Only the exit code will be returned, all informational and error messages will not be displayed.")\r
 MSG_OPTION_QUIET            = ("Returns the exit code and will display only error messages.")\r
 MSG_OPTION_VPD_FILENAME     = ("Specify the file name for the VPD binary file.")\r
 MSG_OPTION_MAP_FILENAME     = ("Generate file name for consumption during the build that contains the mapping of Pcd name, offset, datum size and value derived from the input file and any automatic calculations.")\r
-MSG_OPTION_FORCE            = ("Disable prompting the user for overwriting files as well as for missing input content.")\r
+MSG_OPTION_FORCE            = ("Will force overwriting existing output files rather than returning an error message.")\r
 \r
 ERR_INVALID_DEBUG_LEVEL     = ("Invalid level for debug message. Only "\r
                                 "'DEBUG', 'INFO', 'WARNING', 'ERROR', "\r
index 9986ba2b0d0c8308bc1f4b641151a42c76f6001d..b5dc3712e0a40b7137a5d932608f0074bfca39e6 100644 (file)
@@ -1,7 +1,7 @@
 ## @file
 # Standardized Error Hanlding infrastructures.
 #
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
 # which accompanies this distribution.  The full text of the license may be found at
@@ -125,7 +125,7 @@ gErrorMessage = {
     RESOURCE_FULL           :   "Full",
     RESOURCE_OVERFLOW       :   "Overflow",
     RESOURCE_UNDERRUN       :   "Underrun",
-    RESOURCE_UNKNOWN_ERROR  :   "Unkown error",
+    RESOURCE_UNKNOWN_ERROR  :   "Unknown error",
 
     ATTRIBUTE_NOT_AVAILABLE :   "Not available",
     ATTRIBUTE_GET_FAILURE   :   "Failed to retrieve",
index 62a23ea77323049758627da8aa453b58e08adaec..d9d1774e2722243457b66adeb5e2c19a9e18a0ba 100644 (file)
@@ -355,7 +355,6 @@ TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress'
 TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'\r
 TAB_DSC_DEFINES_DEFINE = 'DEFINE'\r
 TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'\r
-TAB_DSC_DEFINES_VPD_FILENAME = 'VPD_FILENAME'\r
 TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'\r
 \r
 #\r
@@ -364,7 +363,6 @@ TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
 TAB_TAT_DEFINES_ACTIVE_PLATFORM = 'ACTIVE_PLATFORM'\r
 TAB_TAT_DEFINES_ACTIVE_MODULE = 'ACTIVE_MODULE'\r
 TAB_TAT_DEFINES_TOOL_CHAIN_CONF = 'TOOL_CHAIN_CONF'\r
-TAB_TAT_DEFINES_MULTIPLE_THREAD = 'MULTIPLE_THREAD'\r
 TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER = 'MAX_CONCURRENT_THREAD_NUMBER'\r
 TAB_TAT_DEFINES_TARGET = 'TARGET'\r
 TAB_TAT_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'\r
index e3460e9891d4f995ef22caa1f283bc1200759263..de3556b8929a7c94322478c711d70d240596a27f 100644 (file)
@@ -25,26 +25,26 @@ from DataType import *
 # @retval 1  Open file failed\r
 #\r
 def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):\r
-  try:\r
-      F = open(FileName,'r')\r
-      Keys = []\r
-      for Line in F:\r
-        if Line.startswith(CommentCharacter):\r
-          continue\r
-        LineList = Line.split(KeySplitCharacter,1)\r
-        if len(LineList) >= 2:\r
-          Key = LineList[0].split()\r
-          if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:\r
-            if ValueSplitFlag:\r
-              Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)\r
-            else:\r
-              Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')\r
-            Keys += [Key[0]]\r
-      F.close()\r
-      return 0\r
-  except:\r
-      EdkLogger.info('Open file failed')\r
-      return 1\r
+    try:\r
+        F = open(FileName,'r')\r
+        Keys = []\r
+        for Line in F:\r
+            if Line.startswith(CommentCharacter):\r
+                continue\r
+            LineList = Line.split(KeySplitCharacter,1)\r
+            if len(LineList) >= 2:\r
+                Key = LineList[0].split()\r
+            if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:\r
+                if ValueSplitFlag:\r
+                    Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)\r
+                else:\r
+                    Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')\r
+                Keys += [Key[0]]\r
+        F.close()\r
+        return 0\r
+    except:\r
+        EdkLogger.info('Open file failed')\r
+        return 1\r
 \r
 ## Print the dictionary\r
 #\r
@@ -53,11 +53,11 @@ def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplit
 # @param Dict:  The dictionary to be printed\r
 #\r
 def printDict(Dict):\r
-  if Dict != None:\r
-    KeyList = Dict.keys()\r
-    for Key in KeyList:\r
-      if Dict[Key] != '':\r
-        print Key + ' = ' + str(Dict[Key])\r
+    if Dict != None:\r
+        KeyList = Dict.keys()\r
+        for Key in KeyList:\r
+            if Dict[Key] != '':\r
+                print Key + ' = ' + str(Dict[Key])\r
 \r
 ## Print the dictionary\r
 #\r
@@ -67,9 +67,9 @@ def printDict(Dict):
 # @param key:   The key of the item to be printed\r
 #\r
 def printList(Key, List):\r
-  if type(List) == type([]):\r
-      if len(List) > 0:\r
-        if key.find(TAB_SPLIT) != -1:\r
-          print "\n" + Key\r
-          for Item in List:\r
-            print Item\r
+    if type(List) == type([]):\r
+        if len(List) > 0:\r
+            if Key.find(TAB_SPLIT) != -1:\r
+                print "\n" + Key\r
+                for Item in List:\r
+                    print Item\r
index 283e913b3b0a0a87917a093a621c5d57c8837a8a..195fa5c6cacc0c9d82f483ace03316d04ae67ac2 100644 (file)
@@ -23,6 +23,9 @@ import EdkLogger as EdkLogger
 from GlobalData import *\r
 from BuildToolError import *\r
 \r
+gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE)\r
+gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')\r
+\r
 ## GetSplitValueList\r
 #\r
 # Get a value list from a string with multiple values splited with SplitTag\r
@@ -377,6 +380,34 @@ def GetDefineValue(String, Key, CommentCharacter):
     String = CleanString(String)\r
     return String[String.find(Key + ' ') + len(Key + ' ') : ]\r
 \r
+## GetHexVerValue\r
+#\r
+# Get a Hex Version Value\r
+#\r
+# @param VerString:         The version string to be parsed\r
+#\r
+#\r
+# @retval:      If VerString is incorrectly formatted, return "None" which will break the build.\r
+#               If VerString is correctly formatted, return a Hex value of the Version Number (0xmmmmnnnn)\r
+#                   where mmmm is the major number and nnnn is the adjusted minor number.\r
+#\r
+def GetHexVerValue(VerString):\r
+    VerString = CleanString(VerString)\r
+\r
+    if gHumanReadableVerPatt.match(VerString):\r
+        ValueList = VerString.split('.')\r
+        Major = ValueList[0]\r
+        Minor = ValueList[1]\r
+        if len(Minor) == 1:\r
+            Minor += '0'\r
+        DeciValue = (int(Major) << 16) + int(Minor);\r
+        return "0x%08x"%DeciValue\r
+    elif gHexVerPatt.match(VerString):\r
+        return VerString\r
+    else:\r
+        return None\r
+\r
+\r
 ## GetSingleValueOfKeyFromLines\r
 #\r
 # Parse multiple strings as below to get value of each definition line\r
index fc5d589a5966bf27a7a2281a0283bb377c26f58a..a7dec65a2530dc66a2942dd4af34b9db17907781 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to define each component of Target.txt file\r
 #\r
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2010, 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
@@ -37,7 +37,6 @@ class TargetTxtClassObject(object):
             DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM                            : '',\r
             DataType.TAB_TAT_DEFINES_ACTIVE_MODULE                              : '',\r
             DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF                            : '',\r
-            DataType.TAB_TAT_DEFINES_MULTIPLE_THREAD                            : '',\r
             DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER               : '',\r
             DataType.TAB_TAT_DEFINES_TARGET                                     : [],\r
             DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG                             : [],\r
@@ -102,12 +101,6 @@ class TargetTxtClassObject(object):
             elif Key in [DataType.TAB_TAT_DEFINES_TARGET, DataType.TAB_TAT_DEFINES_TARGET_ARCH, \\r
                          DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]:\r
                 self.TargetTxtDictionary[Key] = Value.split()\r
-            elif Key == DataType.TAB_TAT_DEFINES_MULTIPLE_THREAD:\r
-                if Value not in ["Enable", "Disable"]:\r
-                    EdkLogger.error("build", FORMAT_INVALID, "Invalid setting of [%s]: %s." % (Key, Value),\r
-                                    ExtraData="\tSetting must be one of [Enable, Disable]",\r
-                                    File=FileName)\r
-                self.TargetTxtDictionary[Key] = Value\r
             elif Key == DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER:\r
                 try:\r
                     V = int(Value, 0)\r
index 549f76cee98ca7741cca1e2f49a392914952ba31..b5cd5ee435ef153c14e4495359ea01c9169506d2 100644 (file)
@@ -23,7 +23,7 @@ from BuildToolError import *
 from TargetTxtClassObject import *\r
 \r
 ##\r
-# Static vailabes used for pattern\r
+# Static variables used for pattern\r
 #\r
 gMacroRefPattern = re.compile('(DEF\([^\(\)]+\))')\r
 gEnvRefPattern = re.compile('(ENV\([^\(\)]+\))')\r
index 0111744cc045cc6c1a344f24ac28d82494315348..5f92fa5cdda6f6b970b183f0605a75c0d898691a 100644 (file)
@@ -219,28 +219,23 @@ class VpdInfoFile:
 #  @param ToolPath      The string path name for BPDG tool\r
 #  @param VpdFileName   The string path name for VPD information guid.txt\r
 # \r
-def CallExtenalBPDGTool(ToolPath, VpdFilePath, VpdFileName):\r
+def CallExtenalBPDGTool(ToolPath, VpdFileName):\r
     assert ToolPath != None, "Invalid parameter ToolPath"\r
-    assert VpdFilePath != None and os.path.exists(VpdFilePath), "Invalid parameter VpdFileName"\r
+    assert VpdFileName != None and os.path.exists(VpdFileName), "Invalid parameter VpdFileName"\r
     \r
-    OutputDir = os.path.dirname(VpdFilePath)\r
-    if (VpdFileName == None or VpdFileName == "") :\r
-        FileName = os.path.basename(VpdFilePath)\r
-        BaseName, ext = os.path.splitext(FileName)\r
-        OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)\r
-        OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)\r
-    else :\r
-        OutputMapFileName = os.path.join(OutputDir, "%s.map" % VpdFileName)\r
-        OutputBinFileName = os.path.join(OutputDir, "%s.bin" % VpdFileName)\r
+    OutputDir = os.path.dirname(VpdFileName)\r
+    FileName = os.path.basename(VpdFileName)\r
+    BaseName, ext = os.path.splitext(FileName)\r
+    OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)\r
+    OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)\r
           \r
     try:\r
         PopenObject = subprocess.Popen([ToolPath,\r
                                         '-o', OutputBinFileName, \r
                                         '-m', OutputMapFileName,\r
-                                        '-s',\r
+                                        '-q',\r
                                         '-f',\r
-                                        '-v',\r
-                                        VpdFilePath],\r
+                                        VpdFileName],\r
                                         stdout=subprocess.PIPE, \r
                                         stderr= subprocess.PIPE)\r
     except Exception, X:\r
index 509601007c1b32c4f4ac3743741028a54ffb8093..7a0123b1d90f1890527ef08f1a951464266efbae 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to define common items of class object\r
 #\r
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2010, 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
@@ -53,7 +53,7 @@ class CommonClass(object):
         self.HelpText = HelpText\r
         self.HelpTextList = []\r
 \r
-## CommonClass\r
+## CommonHeaderClass\r
 #\r
 # This class defined common items used in Module/Platform/Package files\r
 # \r
@@ -301,7 +301,7 @@ class SkuInfoClass(object):
     #  @retval Rtn Formatted String\r
     #\r
     def __str__(self):\r
-        Rtn = Rtn = 'SkuId = ' + str(self.SkuId) + "," + \\r
+        Rtn = 'SkuId = ' + str(self.SkuId) + "," + \\r
                     'SkuIdName = ' + str(self.SkuIdName) + "," + \\r
                     'VariableName = ' + str(self.VariableName) + "," + \\r
                     'VariableGuid = ' + str(self.VariableGuid) + "," + \\r
index b43329945223e400e36c8c6d6a0a84d02fc0c367..8f12026887fb3fe206a123c991229b01a036ad74 100644 (file)
@@ -150,7 +150,6 @@ class DistributionPackageClass(object):
 # script.\r
 #\r
 if __name__ == '__main__':\r
-    pass\r
     D = DistributionPackageClass()\r
     D.GetDistributionPackage(os.getenv('WORKSPACE'), ['MdePkg/MdePkg.dec', 'TianoModulePkg/TianoModulePkg.dec'], ['MdeModulePkg/Application/HelloWorld/HelloWorld.inf'])\r
     Xml = DistributionPackageXml()\r
index 7956c8a2aeba66a77caac89e232759e463ee9ae8..741736e39d8572efc9c1e1d0c597ba53507c545c 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is for installed package information database operations\r
 #\r
-# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2010, 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
@@ -25,7 +25,7 @@ DEPEX_CHECK_PACKAGE_NOT_FOUND, DEPEX_CHECK_DP_NOT_FOUND) = (0, 1, 2, 3)
 \r
 ## IpiDb\r
 #\r
-# This class represents the installed package information databse\r
+# This class represents the installed package information database\r
 # Add/Remove/Get installed distribution package information here.\r
 # \r
 # \r
@@ -57,7 +57,7 @@ class DependencyRules(object):
             return False\r
         \r
 \r
-    ## Check whether a module depex satified by current workspace.\r
+    ## Check whether a module depex satisfied by current workspace.\r
     #\r
     # @param ModuleObj:  \r
     # @param DpObj:\r
@@ -103,7 +103,7 @@ class DependencyRules(object):
         \r
         EdkLogger.verbose("Check package exists in workspace ... DONE!")\r
         \r
-    ## Check whether a package depex satified by current workspace.\r
+    ## Check whether a package depex satisfied by current workspace.\r
     #\r
     # @param ModuleObj:  \r
     # @param DpObj:\r
@@ -135,7 +135,7 @@ class DependencyRules(object):
         \r
         EdkLogger.verbose("Check DP exists in workspace ... DONE!")\r
         \r
-    ## Check whether a DP depex satified by current workspace.\r
+    ## Check whether a DP depex satisfied by current workspace.\r
     #\r
     # @param ModuleObj:  \r
     # @param DpObj:\r
@@ -158,7 +158,7 @@ class DependencyRules(object):
         \r
         return True\r
     \r
-    ## Check whether a DP depex satified by current workspace.\r
+    ## Check whether a DP depex satisfied by current workspace.\r
     #\r
     # @param ModuleObj:  \r
     # @param DpObj:\r
index 68c55718bcc718d91b066f2ad0e69e4dec94765c..7993023150c4e57ea31a51e76bf09b3c6cbb28d9 100644 (file)
@@ -33,7 +33,6 @@ class TargetTool():
         self.TargetTxtDictionary = {\r
             TAB_TAT_DEFINES_ACTIVE_PLATFORM                            : None,\r
             TAB_TAT_DEFINES_TOOL_CHAIN_CONF                            : None,\r
-            TAB_TAT_DEFINES_MULTIPLE_THREAD                            : None,\r
             TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER               : None,\r
             TAB_TAT_DEFINES_TARGET                                     : None,\r
             TAB_TAT_DEFINES_TOOL_CHAIN_TAG                             : None,\r
@@ -44,7 +43,7 @@ class TargetTool():
 \r
     def LoadTargetTxtFile(self, filename):\r
         if os.path.exists(filename) and os.path.isfile(filename):\r
-             return self.ConvertTextFileToDict(filename, '#', '=')\r
+            return self.ConvertTextFileToDict(filename, '#', '=')\r
         else:\r
             raise ParseError('LoadTargetTxtFile() : No Target.txt file exists.')\r
             return 1\r
@@ -64,7 +63,7 @@ class TargetTool():
                     Key = LineList[0].strip()\r
                     if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary.keys():\r
                         if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM or Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF \\r
-                          or Key == TAB_TAT_DEFINES_MULTIPLE_THREAD or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \\r
+                          or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \\r
                           or Key == TAB_TAT_DEFINES_ACTIVE_MODULE:\r
                             self.TargetTxtDictionary[Key] = LineList[1].replace('\\', '/').strip()\r
                         elif Key == TAB_TAT_DEFINES_TARGET or Key == TAB_TAT_DEFINES_TARGET_ARCH \\r
@@ -149,15 +148,13 @@ def GetConfigureKeyValue(self, Key):
         else:\r
             EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND, \r
                             "Tooldef file %s does not exist!" % self.Opt.TOOL_DEFINITION_FILE, RaiseError=False)\r
-    elif Key == TAB_TAT_DEFINES_MULTIPLE_THREAD and self.Opt.NUM != None:\r
-        if self.Opt.NUM >= 2:\r
-            Line = "%-30s = %s\n" % (Key, 'Enable')\r
-        else:\r
-            Line = "%-30s = %s\n" % (Key, 'Disable')\r
+\r
+    elif self.Opt.NUM >= 2:\r
+        Line = "%-30s = %s\n" % (Key, 'Enable')\r
+    elif self.Opt.NUM <= 1:\r
+        Line = "%-30s = %s\n" % (Key, 'Disable')        \r
     elif Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER and self.Opt.NUM != None:\r
         Line = "%-30s = %s\n" % (Key, str(self.Opt.NUM))\r
-    elif Key == TAB_TAT_DEFINES_MULTIPLE_THREAD and self.Opt.ENABLE_MULTI_THREAD != None:\r
-        Line = "%-30s = %s\n" % (Key, self.Opt.ENABLE_MULTI_THREAD)\r
     elif Key == TAB_TAT_DEFINES_TARGET and self.Opt.TARGET != None:\r
         Line = "%-30s = %s\n" % (Key, ''.join(elem + ' ' for elem in self.Opt.TARGET))\r
     elif Key == TAB_TAT_DEFINES_TARGET_ARCH and self.Opt.TARGET_ARCH != None:\r
@@ -216,8 +213,6 @@ def MyOptionParser():
         help="Specify the build rule configure file, which replaces target.txt's BUILD_RULE_CONF definition. If not specified, the default value Conf/build_rule.txt will be set.")\r
     parser.add_option("-m", "--multithreadnum", action="callback", type="int", dest="NUM", callback=RangeCheckCallback,\r
         help="Specify the multi-thread number which replace target.txt's MAX_CONCURRENT_THREAD_NUMBER. If the value is less than 2, MULTIPLE_THREAD will be disabled. If the value is larger than 1, MULTIPLE_THREAD will be enabled.")\r
-    parser.add_option("-e", "--enablemultithread", action="store", type="choice", choices=['Enable', 'Disable'], dest="ENABLE_MULTI_THREAD", \r
-        help="Specify whether enable multi-thread! If Enable, multi-thread is enabled; If Disable, mutli-thread is disable")\r
     (opt, args)=parser.parse_args()\r
     return (opt, args)\r
 \r
index 75c08bbabffd182aca30a70b7dfd723cb58531f2..b3ad16715ae03cbf9185e5996e3ea1f070a97360 100644 (file)
@@ -40,6 +40,10 @@ gPragmaPattern = re.compile("^\s*#pragma\s+pack", re.MULTILINE)
 gHexNumberPattern = re.compile("0[xX]([0-9a-fA-F]+)")
 ## Regular expression for matching "Include ()" in asl file
 gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)", re.MULTILINE)
+## Regular expression for matching C style #include "XXX.asl" in asl file
+gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-\\/\w.]+)\s*[>"]', re.MULTILINE)
+## Regular expression for matching constant with 'ULL' and 'UL', 'LL', 'L' postfix
+gLongNumberPattern = re.compile("(0[xX][0-9a-fA-F]+|[0-9]+)U?LL", re.MULTILINE)
 ## Patterns used to convert EDK conventions to EDK2 ECP conventions
 gImportCodePatterns = [
     [
@@ -118,7 +122,7 @@ gIncludedAslFile = []
 # @param  Target    File to store the trimmed content
 # @param  Convert   If True, convert standard HEX format to MASM format
 #
-def TrimPreprocessedFile(Source, Target, Convert):
+def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
     CreateDirectory(os.path.dirname(Target))
     try:
         f = open (Source, 'r')
@@ -164,8 +168,10 @@ def TrimPreprocessedFile(Source, Target, Convert):
                               % (LineIndexOfOriginalFile + 1))
 
         # convert HEX number format if indicated
-        if Convert:
+        if ConvertHex:
             Line = gHexNumberPattern.sub(r"0\1h", Line)
+        if TrimLong:
+            Line = gLongNumberPattern.sub(r"\1", Line)
 
         if LineNumber != None:
             EdkLogger.verbose("Got line directive: line=%d" % LineNumber)
@@ -264,31 +270,43 @@ def TrimPreprocessedVfr(Source, Target):
 
 ## Read the content  ASL file, including ASL included, recursively
 #
-# @param  Source    File to be read
-# @param  Indent    Spaces before the Include() statement
+# @param  Source            File to be read
+# @param  Indent            Spaces before the Include() statement
+# @param  IncludePathList   The list of external include file
 #
-def DoInclude(Source, Indent=''):
+def DoInclude(Source, Indent='', IncludePathList=[]):
     NewFileContent = []
-    # avoid A "include" B and B "include" A
-    if Source in gIncludedAslFile:
-        EdkLogger.warn("Trim", "Circular include",
-                       ExtraData= "%s -> %s" % (" -> ".join(gIncludedAslFile), Source))
-        return []
-    gIncludedAslFile.append(Source)
 
     try:
-        F = open(Source,'r')
+        for IncludePath in IncludePathList:
+            IncludeFile = os.path.join(IncludePath, Source)
+            if os.path.isfile(IncludeFile):
+                F = open(IncludeFile, "r")
+                break
+        else:
+            EdkLogger.error("Trim", "Failed to find include file %s" % Source)
     except:
         EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
 
+    
+    # avoid A "include" B and B "include" A
+    IncludeFile = os.path.abspath(os.path.normpath(IncludeFile))
+    if IncludeFile in gIncludedAslFile:
+        EdkLogger.warn("Trim", "Circular include",
+                       ExtraData= "%s -> %s" % (" -> ".join(gIncludedAslFile), IncludeFile))
+        return []
+    gIncludedAslFile.append(IncludeFile)
+    
     for Line in F:
         Result = gAslIncludePattern.findall(Line)
         if len(Result) == 0:
-            NewFileContent.append("%s%s" % (Indent, Line))
-            continue
+            Result = gAslCIncludePattern.findall(Line)
+            if len(Result) == 0 or os.path.splitext(Result[0][1])[1].lower() not in [".asl", ".asi"]:
+                NewFileContent.append("%s%s" % (Indent, Line))
+                continue
         CurrentIndent = Indent + Result[0][0]
         IncludedFile = Result[0][1]
-        NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent))
+        NewFileContent.extend(DoInclude(IncludedFile, CurrentIndent, IncludePathList))
         NewFileContent.append("\n")
 
     gIncludedAslFile.pop()
@@ -301,19 +319,44 @@ def DoInclude(Source, Indent=''):
 #
 # Replace ASL include statement with the content the included file
 #
-# @param  Source    File to be trimmed
-# @param  Target    File to store the trimmed content
+# @param  Source          File to be trimmed
+# @param  Target          File to store the trimmed content
+# @param  IncludePathFile The file to log the external include path 
 #
-def TrimAslFile(Source, Target):
+def TrimAslFile(Source, Target, IncludePathFile):
     CreateDirectory(os.path.dirname(Target))
     
-    Cwd = os.getcwd()
     SourceDir = os.path.dirname(Source)
     if SourceDir == '':
         SourceDir = '.'
-    os.chdir(SourceDir)
-    Lines = DoInclude(Source)
-    os.chdir(Cwd)
+    
+    #
+    # Add source directory as the first search directory
+    #
+    IncludePathList = [SourceDir]
+    
+    #
+    # If additional include path file is specified, append them all
+    # to the search directory list.
+    #
+    if IncludePathFile:
+        try:
+            LineNum = 0
+            for Line in open(IncludePathFile,'r'):
+                LineNum += 1
+                if Line.startswith("/I") or Line.startswith ("-I"):
+                    IncludePathList.append(Line[2:].strip())
+                else:
+                    EdkLogger.warn("Trim", "Invalid include line in include list file.", IncludePathFile, LineNum)
+        except:
+            EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=IncludePathFile)
+
+    Lines = DoInclude(Source, '', IncludePathList)
+
+    #
+    # Undef MIN and MAX to avoid collision in ASL source code
+    #
+    Lines.insert(0, "#undef MIN\n#undef MAX\n")
 
     # save all lines trimmed
     try:
@@ -437,6 +480,10 @@ def Options():
         make_option("-c", "--convert-hex", dest="ConvertHex", action="store_true",
                           help="Convert standard hex format (0xabcd) to MASM format (abcdh)"),
 
+        make_option("-l", "--trim-long", dest="TrimLong", action="store_true",
+                          help="Remove postfix of long number"),
+        make_option("-i", "--include-path-file", dest="IncludePathFile",
+                          help="The input file is include path list to search for ASL include file"),
         make_option("-o", "--output", dest="OutputFile",
                           help="File to store the trimmed content"),
         make_option("-v", "--verbose", dest="LogLevel", action="store_const", const=EdkLogger.VERBOSE,
@@ -449,7 +496,7 @@ def Options():
     ]
 
     # use clearer usage to override default usage message
-    UsageString = "%prog [-s|-r|-a] [-c] [-v|-d <debug_level>|-q] [-o <output_file>] <input_file>"
+    UsageString = "%prog [-s|-r|-a] [-c] [-v|-d <debug_level>|-q] [-i <include_path_file>] [-o <output_file>] <input_file>"
 
     Parser = OptionParser(description=__copyright__, version=__version__, option_list=OptionList, usage=UsageString)
     Parser.set_defaults(FileType="Vfr")
@@ -495,13 +542,13 @@ def Main():
         elif CommandOptions.FileType == "Asl":
             if CommandOptions.OutputFile == None:
                 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
-            TrimAslFile(InputFile, CommandOptions.OutputFile)
+            TrimAslFile(InputFile, CommandOptions.OutputFile, CommandOptions.IncludePathFile)
         elif CommandOptions.FileType == "R8SourceCode":
             TrimR8Sources(InputFile, CommandOptions.OutputFile)
         else :
             if CommandOptions.OutputFile == None:
                 CommandOptions.OutputFile = os.path.splitext(InputFile)[0] + '.iii'
-            TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex)
+            TrimPreprocessedFile(InputFile, CommandOptions.OutputFile, CommandOptions.ConvertHex, CommandOptions.TrimLong)
     except FatalError, X:
         import platform
         import traceback
index fb66e41fb5ce169e50c362abc6ecb9bbc78a4c52..3c7d7fdf6ad4ef7138e5e93ef454d4524f0d1a9c 100644 (file)
@@ -474,11 +474,11 @@ class InfParser(MetaFileParser):
     def _DefineParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
         self._ValueList[0:len(TokenList)] = TokenList
-        self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
         if self._ValueList[1] == '':
             EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-
+        self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
+        
     ## [nmake] section parser (R8.x style only)
     def _NmakeParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
@@ -655,6 +655,11 @@ class DscParser(MetaFileParser):
                 continue
             # file private macros
             elif Line.upper().startswith('DEFINE '):
+                if self._Enabled < 0:
+                    # Do not parse the macro and add it to self._Macros dictionary if directives
+                    # statement is evaluated to false.
+                    continue
+                
                 (Name, Value) = self._MacroParser()
                 # Make the defined macro in DSC [Defines] section also
                 # available for FDF file.
@@ -676,6 +681,11 @@ class DscParser(MetaFileParser):
                     )
                 continue
             elif Line.upper().startswith('EDK_GLOBAL '):
+                if self._Enabled < 0:
+                    # Do not parse the macro and add it to self._Macros dictionary
+                    # if previous directives statement is evaluated to false.
+                    continue
+                
                 (Name, Value) = self._MacroParser()
                 for Arch, ModuleType in self._Scope:
                     self._LastItem = self._Store(
@@ -802,8 +812,8 @@ class DscParser(MetaFileParser):
             if not self._SectionName in self._IncludeAllowedSection:
                 EdkLogger.error("Parser", FORMAT_INVALID, File=self.MetaFile, Line=self._LineIndex+1,
                                 ExtraData="'!include' is not allowed under section [%s]" % self._SectionName)
-            # the included file must be relative to the parsing file
-            IncludedFile = os.path.join(self._FileDir, NormPath(self._ValueList[1], self._Macros))
+            # the included file must be relative to workspace
+            IncludedFile = os.path.join(os.environ["WORKSPACE"], NormPath(self._ValueList[1], self._Macros))
             Parser = DscParser(IncludedFile, self._FileType, self._Table, self._Macros, From=self._LastItem)
             # set the parser status with current status
             Parser._SectionName = self._SectionName
index dad6ecd49a071fb0f81cc6012441698cb22c8bfd..9d53fa8e689fff55f6dea41e89ed136dad37bda4 100644 (file)
@@ -141,7 +141,6 @@ class DscBuildData(PlatformBuildClassObject):
         self._BuildOptions      = None\r
         self._LoadFixAddress    = None\r
         self._VpdToolGuid       = None\r
-        self._VpdFileName       = None\r
 \r
     ## Get architecture\r
     def _GetArch(self):\r
@@ -204,9 +203,7 @@ class DscBuildData(PlatformBuildClassObject):
                     uuid.UUID(Record[1])\r
                 except:\r
                     EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)\r
-                self._VpdToolGuid = Record[1]               \r
-            elif Name == TAB_DSC_DEFINES_VPD_FILENAME:\r
-                self._VpdFileName = Record[1]       \r
+                self._VpdToolGuid = Record[1]                   \r
         # set _Header to non-None in order to avoid database re-querying\r
         self._Header = 'DUMMY'\r
 \r
@@ -350,16 +347,7 @@ class DscBuildData(PlatformBuildClassObject):
             if self._VpdToolGuid == None:\r
                 self._VpdToolGuid = ''\r
         return self._VpdToolGuid\r
-  \r
-    ## Retrieve the VPD file Name, this is optional in DSC file\r
-    def _GetVpdFileName(self):\r
-        if self._VpdFileName == None:\r
-            if self._Header == None:\r
-                self._GetHeaderInfo()\r
-            if self._VpdFileName == None:\r
-                self._VpdFileName = ''\r
-        return self._VpdFileName  \r
-    \r
+      \r
     ## Retrieve [SkuIds] section information\r
     def _GetSkuIds(self):\r
         if self._SkuIds == None:\r
@@ -802,8 +790,7 @@ class DscBuildData(PlatformBuildClassObject):
     BsBaseAddress       = property(_GetBsBaseAddress)\r
     RtBaseAddress       = property(_GetRtBaseAddress)\r
     LoadFixAddress      = property(_GetLoadFixAddress)\r
-    VpdToolGuid         = property(_GetVpdToolGuid)\r
-    VpdFileName         = property(_GetVpdFileName)    \r
+    VpdToolGuid         = property(_GetVpdToolGuid)   \r
     SkuIds              = property(_GetSkuIds)\r
     Modules             = property(_GetModules)\r
     LibraryInstances    = property(_GetLibraryInstances)\r
@@ -1330,18 +1317,16 @@ class InfBuildData(ModuleBuildClassObject):
             if Name in self:\r
                 self[Name] = Record[1]\r
             # some special items in [Defines] section need special treatment\r
-            elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):\r
-                if self._Specification == None:\r
-                    self._Specification = sdict()\r
-                self._Specification['UEFI_SPECIFICATION_VERSION'] = Record[1]\r
-            elif Name == 'EDK_RELEASE_VERSION':\r
+            elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):\r
+                if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):\r
+                    Name = 'UEFI_SPECIFICATION_VERSION'\r
                 if self._Specification == None:\r
                     self._Specification = sdict()\r
-                self._Specification[Name] = Record[1]\r
-            elif Name == 'PI_SPECIFICATION_VERSION':\r
-                if self._Specification == None:\r
-                    self._Specification = sdict()\r
-                self._Specification[Name] = Record[1]\r
+                self._Specification[Name] = GetHexVerValue(Record[1])\r
+                if self._Specification[Name] == None:\r
+                    EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
+                                    "'%s' format is not supported for %s" % (Record[1], Name),\r
+                                    File=self.MetaFile, Line=Record[-1])\r
             elif Name == 'LIBRARY_CLASS':\r
                 if self._LibraryClass == None:\r
                     self._LibraryClass = []\r
index af9d3d5f5a8742fc423ea752fe0e2e27cf6680ba..54265952d03ba034d540168a6429e66603005161 100644 (file)
@@ -305,7 +305,7 @@ class BuildUnit:
 \r
     ## str() method\r
     #\r
-    #   It just returns the string representaion of self.BuildObject\r
+    #   It just returns the string representation of self.BuildObject\r
     #\r
     #   @param  self        The object pointer\r
     #\r
@@ -943,7 +943,7 @@ class Build():
 \r
     ## Build a module or platform\r
     #\r
-    # Create autogen code and makfile for a module or platform, and the launch\r
+    # Create autogen code and makefile for a module or platform, and the launch\r
     # "make" command to build it\r
     #\r
     #   @param  Target                      The target of build command\r