]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Sync basetools' source and binary files with r1707 of the basetools project.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Sep 2009 03:14:43 +0000 (03:14 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Sep 2009 03:14:43 +0000 (03:14 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9257 6f19259b-4bc3-4df7-8a09-765794883524

91 files changed:
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/GenSec.exe
BaseTools/Bin/Win32/GenVtf.exe
BaseTools/Bin/Win32/LzmaCompress.exe
BaseTools/Bin/Win32/MigrationMsa2Inf.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/tools_def.template
BaseTools/ReadMe.txt
BaseTools/Source/C/BootSectImage/bootsectimage.c
BaseTools/Source/C/Common/BasePeCoff.c
BaseTools/Source/C/Common/CommonLib.c
BaseTools/Source/C/Common/EfiUtilityMsgs.c
BaseTools/Source/C/Common/EfiUtilityMsgs.h
BaseTools/Source/C/Common/MyAlloc.c
BaseTools/Source/C/Common/ParseGuidedSectionTools.c
BaseTools/Source/C/Common/ParseInf.c
BaseTools/Source/C/Common/SimpleFileParsing.c
BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
BaseTools/Source/C/EfiRom/EfiRom.c
BaseTools/Source/C/GenBootSector/GenBootSector.c
BaseTools/Source/C/GenCrc32/GenCrc32.c
BaseTools/Source/C/GenFfs/GenFfs.c
BaseTools/Source/C/GenFv/GenFv.c
BaseTools/Source/C/GenFv/GenFvInternalLib.c
BaseTools/Source/C/GenFw/GenFw.c
BaseTools/Source/C/GenFw/elf_generic.h [deleted file]
BaseTools/Source/C/GenPage/GenPage.c
BaseTools/Source/C/GenSec/GenSec.c
BaseTools/Source/C/GenVtf/GenVtf.c
BaseTools/Source/C/GenVtf/GenVtf.h
BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
BaseTools/Source/C/Include/Common/BaseTypes.h
BaseTools/Source/C/Include/Common/PiFirmwareFile.h
BaseTools/Source/C/Include/Common/UefiCapsule.h
BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
BaseTools/Source/C/Include/Ia32/ProcessorBind.h
BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
BaseTools/Source/C/LzmaCompress/LzmaCompress.c
BaseTools/Source/C/Makefiles/header.makefile
BaseTools/Source/C/Makefiles/ms.common
BaseTools/Source/C/Split/Split.c
BaseTools/Source/C/TianoCompress/TianoCompress.c
BaseTools/Source/C/VfrCompile/VfrError.cpp
BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
BaseTools/Source/C/VfrCompile/VfrFormPkg.h
BaseTools/Source/C/VfrCompile/VfrSyntax.g
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
BaseTools/Source/C/VolInfo/VolInfo.c
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/AutoGen/StrGather.py
BaseTools/Source/Python/Common/DscClassObject.py
BaseTools/Source/Python/Common/FdfParserLite.py
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Ecc/Ecc.py
BaseTools/Source/Python/GenFds/Capsule.py
BaseTools/Source/Python/GenFds/CapsuleData.py
BaseTools/Source/Python/GenFds/Fd.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/FfsFileStatement.py
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/GenFds/GenFds.py
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
BaseTools/Source/Python/GenFds/OptRomInfStatement.py
BaseTools/Source/Python/GenFds/OptionRom.py
BaseTools/Source/Python/GenFds/Region.py
BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
BaseTools/Source/Python/build/build.py
BaseTools/Tests/CheckPythonSyntax.py
BaseTools/toolsetup.bat

index 966832de3206f6855500b5e5f9f472a62a635ad0..b019e9e816469a1ac4e99cda2fadd991c723a6b2 100755 (executable)
Binary files a/BaseTools/Bin/Win32/BootSectImage.exe and b/BaseTools/Bin/Win32/BootSectImage.exe differ
index 89c655d3dcf9035f1a0d7237367ecd6887b72a91..bb4f216d00fe775f1706c6d93424b88fd7028e14 100755 (executable)
Binary files a/BaseTools/Bin/Win32/EfiLdrImage.exe and b/BaseTools/Bin/Win32/EfiLdrImage.exe differ
index 643162e87b761d39cb7511e5e0057b7a31f45da3..e733065ad57f26c911cbbb3ae4a4209fc3e361a5 100755 (executable)
Binary files a/BaseTools/Bin/Win32/EfiRom.exe and b/BaseTools/Bin/Win32/EfiRom.exe differ
index a1fbc59d9114a29daf498a5d6a0586e686a67b14..3596a11e7004616f1e5909a5aca661f39f1df586 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Fpd2Dsc.exe and b/BaseTools/Bin/Win32/Fpd2Dsc.exe differ
index 48a17af7e6280c0a1c0bef08fc3f2faefe73abc3..2de33515c5a8c897e5d8915544851185ea6f4153 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenBootSector.exe and b/BaseTools/Bin/Win32/GenBootSector.exe differ
index 01234aff5f61ba0c1c8eab9a7a8d3d7651827953..13a9f95431c1cdd8c6718d837d2173cd07ac1c63 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenCrc32.exe and b/BaseTools/Bin/Win32/GenCrc32.exe differ
index ba2f00a56f7f8e3832b5422782ac59a7538f5588..bf95890df041931dcf313ee5759b66ef323d7b2f 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenDepex.exe and b/BaseTools/Bin/Win32/GenDepex.exe differ
index c9c35caccf7adb7d7e6f54ac175121719089ac1e..35a9cdca6bb52dfc5f1f424b2520ec68d5a99c46 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFds.exe and b/BaseTools/Bin/Win32/GenFds.exe differ
index 3ee7925217bdb84b443fb3f3471eca1d28ca45d5..b4ae6158900698f7f03804f0b362ccaeb5248398 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFfs.exe and b/BaseTools/Bin/Win32/GenFfs.exe differ
index 6011dd317693b049c4f7a981957913c61c6bc3d2..5496946bd7891e8ddad1bfd5e7c95ea13b093b52 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFv.exe and b/BaseTools/Bin/Win32/GenFv.exe differ
index f2b04ed3695fa6c4e11e6d62d24c4a4367b2ea0b..9b54f6a9bd606870c700d5ad48eb562a685b9565 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFw.exe and b/BaseTools/Bin/Win32/GenFw.exe differ
index 41ac4348e1bc0ec4e0a3c313592f8e8336337abb..0de67229b0690b5ae763e3a47e11652bac4209ec 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenPage.exe and b/BaseTools/Bin/Win32/GenPage.exe differ
index 0c828b89191cde669e6efb765917c631f7707df7..c928617651c5f110c0410a0722e58ce6f54c864e 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenSec.exe and b/BaseTools/Bin/Win32/GenSec.exe differ
index 32eb2c1c48a416ad4b79c75681a73a2400c1e938..f0acfc357c7ceabe48a2fb7bfdecf0660a2a0665 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenVtf.exe and b/BaseTools/Bin/Win32/GenVtf.exe differ
index 8ca0bbc214e8b421b4ac79938329116c04a3c01e..c4e15ef7e3d7a1b1c23375e4828434dcd3044573 100644 (file)
Binary files a/BaseTools/Bin/Win32/LzmaCompress.exe and b/BaseTools/Bin/Win32/LzmaCompress.exe differ
index c45663f20f9e30937930ab9c9ab59c45f4c3959f..f2d4b18e87d5bacf07418a3f03fea5477b5600e5 100755 (executable)
Binary files a/BaseTools/Bin/Win32/MigrationMsa2Inf.exe and b/BaseTools/Bin/Win32/MigrationMsa2Inf.exe differ
index 26a173da06b5550c64790babc3bfbd5fe9591a8e..7fdad3e50e30f0c5f42e9505be5d308c549418a8 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Spd2Dec.exe and b/BaseTools/Bin/Win32/Spd2Dec.exe differ
index 4b01ebab3f3f607e778bd9686de5a3df61d2dbbf..305c068b5775702ee03463bf460891657bba9ed2 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Split.exe and b/BaseTools/Bin/Win32/Split.exe differ
index 8e13c992b82af7540d1ccd2e034645f3e731b21d..1e250c8b9b6d39667ec55fda14fb913b8ad4d7b2 100755 (executable)
Binary files a/BaseTools/Bin/Win32/TargetTool.exe and b/BaseTools/Bin/Win32/TargetTool.exe differ
index b95b67f7cb77eb936acd417ac0a8dff04bbb9547..8ba3c2fd107b64c18a055efb5a26c11400b73fd0 100755 (executable)
Binary files a/BaseTools/Bin/Win32/TianoCompress.exe and b/BaseTools/Bin/Win32/TianoCompress.exe differ
index 2dd6c4d5ca7bfb9cfe7a76ff0205df6b9ea68459..3fd05d5dcc35b90293a3cc95d05a9d80c1cd9e2a 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Trim.exe and b/BaseTools/Bin/Win32/Trim.exe differ
index e9b9977627d92faaf29e3a4d20eae5483eef3afa..d1d0e29ce91f76c3c1f7089e838f9feecfcfc6ff 100755 (executable)
Binary files a/BaseTools/Bin/Win32/VfrCompile.exe and b/BaseTools/Bin/Win32/VfrCompile.exe differ
index ebbe39809fca19de60dc3e9e37e1f26a3238f111..7cff9e93d3d2c2019e36c114c8a8ec0949becf8c 100755 (executable)
Binary files a/BaseTools/Bin/Win32/VolInfo.exe and b/BaseTools/Bin/Win32/VolInfo.exe differ
index ac127742c076528fbcf0214cb34981e917e589e8..56245f547b33b97dd481985787704017d03e27bf 100755 (executable)
Binary files a/BaseTools/Bin/Win32/build.exe and b/BaseTools/Bin/Win32/build.exe differ
index e961674d34b1f5b20b467bba182bdf949359273d..f036fb375fa9c612d3da89a22cf72c0342ef8392 100644 (file)
@@ -1,6 +1,6 @@
 #\r
 #  Copyright (c) 2007-2009, Intel Corporation\r
-#\r
+#  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.\r
 #  All rights reserved. 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
     <Command.MSFT, Command.INTEL>\r
         "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}\r
 \r
-    <Command.GCC>\r
-        "$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src}\r
+    <Command.GCC, Command.RVCT>\r
+        # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues\r
+        "$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}\r
         "$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}\r
 \r
 [C-Header-File]\r
 \r
 \r
 [Assembly-Code-File.COMMON.COMMON]\r
-    <InputFile.MSFT, InputFile.INTEL>\r
+    <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>\r
         ?.asm, ?.Asm, ?.ASM\r
 \r
     <InputFile.GCC>\r
         Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i\r
         "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii\r
 \r
-    <Command.GCC>\r
+    <Command.GCC, Command.RVCT>\r
         "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i\r
         Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i\r
-        "$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii\r
+        # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues\r
+        "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii\r
 \r
 [Assembly-Code-File.COMMON.IPF]\r
     <InputFile>\r
     <Command.MSFT, Command.INTEL>\r
         "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i\r
         Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i\r
-        "$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii\r
+        # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues\r
+        "$(ASM)" $(ASM_FLAGS) -o ${dst} ${d_path}(+)${s_base}.iii\r
 \r
 [Visual-Form-Representation-File]\r
     <InputFile>\r
     <Command>\r
         -$(MD) $(OUTPUT_DIR)(+)${s_dir} > NUL 2>&1\r
         "$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i\r
-        Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i\r
         -$(MD) ${d_path} > NUL 2>&1\r
-        "$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii\r
+        "$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i\r
 \r
 [Object-File]\r
     <InputFile>\r
 \r
     <Command.GCC>\r
         "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @"$(OBJECT_FILES_LIST)"\r
+    \r
+    <Command.RVCT>\r
+        "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)\r
+    \r
+    <Command.RVCTCYGWIN>\r
+        # $(OBJECT_FILES_LIST) has wrong paths for cygwin\r
+        "$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)\r
+\r
+    <Command.XCODE>\r
+        "$(SLINK)" $(SLINK_FLAGS) ${dst} -filelist $(OBJECT_FILES_LIST)\r
 \r
 [Static-Library-File]\r
     <InputFile>\r
         "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @"$(STATIC_LIBRARY_FILES_LIST)" -\) $(DLINK2_FLAGS)\r
         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}\r
 \r
+    <Command.RVCT>\r
+        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)\r
+\r
+    <Command.RVCTCYGWIN>\r
+        #$(STATIC_LIBRARY_FILES_LIST) has wrong paths for cygwin\r
+        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)\r
+\r
+    <Command.XCODE>\r
+        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)\r
+    \r
+    \r
 [Static-Library-File.USER_DEFINED]\r
     <InputFile>\r
         *.lib\r
     <Command.GCC>\r
         "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)\r
 \r
+    <Command.RVCT>\r
+        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)\r
+\r
+    <Command.RVCTCYGWIN>\r
+        #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin\r
+        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)\r
+\r
+    <Command.XCODE>\r
+        "$(DLINK)" -o ${dst} $(DLINK_FLAGS)  $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)\r
+      \r
+      \r
 [Dynamic-Library-File]\r
     <InputFile>\r
         ?.dll\r
     <OutputFile>\r
         $(DEBUG_DIR)(+)$(MODULE_NAME).efi\r
 \r
-    <Command>\r
+    <Command.MSFT, Command.INTEL, Command.GCC, Command.RVCT>      \r
         GenFw -e $(MODULE_TYPE) -o ${dst} ${src}\r
         $(CP) ${dst} $(OUTPUT_DIR)\r
         $(CP) ${dst} $(BIN_DIR)\r
         -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
+        \r
+    <Command.XCODE>\r
+        # tool to convert Mach-O to PE/COFF\r
+        "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff\r
+        # create symbol file for GDB debug\r
+        -$(DSYMUTIL) ${src}\r
+        GenFw -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff \r
+        $(CP) ${dst} $(OUTPUT_DIR)\r
+        $(CP) ${dst} $(BIN_DIR)\r
+        -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
 \r
 [Dependency-Expression-File]\r
     <InputFile>\r
         "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}\r
         "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj\r
         GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll\r
-\r
+        \r
+    <Command.XCODE>        \r
+        "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj  $(ASLCC_FLAGS) $(INC) ${src}\r
+        "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj\r
+        "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.efi\r
+        GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.efi\r
+      \r
+      \r
 [Masm16-Code-File]\r
     <InputFile>\r
         ?.asm16, ?.Asm16, ?.ASM16\r
         "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}\r
         "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,\r
 \r
+    <Command.GCC>\r
+      "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i\r
+      Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i\r
+      "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii\r
+      "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj -)\r
+     \r
+    <Command.XCODE>\r
+      "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i\r
+      Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i\r
+      "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii\r
+      "$(SLINK)" $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj\r
+      otool -t $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib | hex2bin.py ${dst}\r
+      \r
+\r
 [Microcode-File]\r
     <InputFile>\r
         ?.txt, ?.TXT, ?.Txt, ?.mut\r
index bd8b03ef3d8397aa82337ba216d8fd6777a46729..b3132a08fe501baafb04649465b55f42ccd26762 100644 (file)
@@ -1,5 +1,6 @@
 #\r
 #  Copyright (c) 2006-2009, Intel Corporation\r
+#  Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -100,6 +101,12 @@ DEFINE ICC_WIN_ASLPP_FLAGS     = /nologo /EP /C
 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
+DEFINE IPHONE_TOOLS            = /Developer/Platforms/iPhoneOS.platform/Developer\r
+DEFINE RVCT31_TOOLS_PATH       = c:/Program Files/ARM/RVCT/Programs/3.1/761/win_32-pentium\r
+DEFINE RVCT31CYGWIN_TOOLS_PATH = /cygdrive/c/Program\ Files/ARM/RVCT/Programs/3.1/761/win_32-pentium\r
+\r
+# Update to the location of the gcc executables\r
+DEFINE ARMGCC_BIN              = /\r
 \r
 ####################################################################################\r
 #\r
@@ -2040,6 +2047,267 @@ RELEASE_MYTOOLS_IPF_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
 *_MYTOOLS_EBC_SLINK_FLAGS                = /lib /NOLOGO /MACHINE:EBC\r
 *_MYTOOLS_EBC_DLINK_FLAGS                = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP\r
 \r
+\r
+####################################################################################\r
+#\r
+# Xcode Support for building on Mac OS X (Snow Leopard)\r
+#\r
+####################################################################################\r
+#   XCODE32         - Xcode 3.2 Tools (Snow Leopard)\r
+*_XCODE32_*_*_FAMILY            = GCC\r
+*_XCODE32_*_*_BUILDRULEFAMILY   = XCODE\r
+\r
+\r
+*_XCODE32_*_ASL_PATH          = /usr/bin/iasl\r
+\r
+*_XCODE32_*_MAKE_PATH        = make\r
+\r
+# This tool needs to be installed seperatly from Xcode 3.2\r
+*_XCODE32_*_MTOC_PATH        = /Developer/usr/bin/mtoc\r
+*_XCODE32_*_DSYMUTIL_PATH    = /usr/bin/dsymutil\r
+\r
+  DEBUG_XCODE32_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll\r
+RELEASE_XCODE32_*_MTOC_FLAGS = -align 0x20 \r
+\r
+##################\r
+# IA32 definitions\r
+##################\r
+*_XCODE32_IA32_CC_PATH      = gcc\r
+*_XCODE32_IA32_SLINK_PATH   = libtool\r
+*_XCODE32_IA32_DLINK_PATH   = ld\r
+*_XCODE32_IA32_ASM_PATH     = as\r
+*_XCODE32_IA32_PP_PATH      = gcc\r
+*_XCODE32_IA32_VFRPP_PATH   = gcc\r
+*_XCODE32_IA32_ASL_PATH     = iasl\r
+*_XCODE32_IA32_ASLCC_PATH   = gcc\r
+*_XCODE32_IA32_ASLPP_PATH   = gcc\r
+*_XCODE32_IA32_ASLDLINK_PATH  = ld\r
+\r
+  DEBUG_XCODE32_IA32_DLINK_FLAGS      = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
+RELEASE_XCODE32_IA32_DLINK_FLAGS      = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
+*_XCODE32_IA32_SLINK_FLAGS      = -static -o\r
+  DEBUG_XCODE32_IA32_ASM_FLAGS  = -arch i386 -g\r
+RELEASE_XCODE32_IA32_ASM_FLAGS  = -arch i386 \r
+*_XCODE32_IA32_PP_FLAGS         = -arch i386 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
+*_XCODE32_IA32_VFRPP_FLAGS      = -arch i386 -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+  DEBUG_XCODE32_IA32_CC_FLAGS   = -arch i386 -save-temps -g -O0 -combine -mms-bitfields  -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces  -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector\r
+RELEASE_XCODE32_IA32_CC_FLAGS   = -arch i386 -Oz -combine -mms-bitfields  -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector\r
+\r
+*_XCODE32_IA32_ASLCC_FLAGS      = -arch i386 -x c -save-temps -g -O0 -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h -mdynamic-no-pic\r
+*_XCODE32_IA32_ASLDLINK_FLAGS   = -arch i386 -e _main -preload -segalign 0x20 -slow_stubs -pie -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
+*_XCODE32_IA32_ASLPP_FLAGS      = -arch i386 -x c -E \r
+*_XCODE32_IA32_ASL_FLAGS        =\r
+\r
+##################\r
+# X64 definitions - still a work in progress. This tool chain does not produce \r
+# the correct ABI, it is just used to compile the code....\r
+##################\r
+*_XCODE32_X64_CC_PATH       = gcc-4.2\r
+*_XCODE32_X64_SLINK_PATH    = libtool\r
+*_XCODE32_X64_DLINK_PATH    = ld\r
+*_XCODE32_X64_ASM_PATH      = as\r
+*_XCODE32_X64_PP_PATH       = gcc-4.2\r
+*_XCODE32_X64_VFRPP_PATH    = gcc-4.2\r
+*_XCODE32_X64_ASL_PATH     = iasl\r
+*_XCODE32_X64_ASLCC_PATH   = gcc\r
+*_XCODE32_X64_ASLPP_PATH   = gcc\r
+*_XCODE32_X64_ASLDLINK_PATH  = ld\r
+\r
+*_XCODE32_X64_DLINK_FLAGS      = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
+*_XCODE32_X64_SLINK_FLAGS      = -static -o\r
+\r
+  DEBUG_XCODE32_X64_ASM_FLAGS  = -arch x86_64 -g\r
+RELEASE_XCODE32_X64_ASM_FLAGS  = -arch x86_64 \r
+*_XCODE32_X64_PP_FLAGS         = -arch x86_64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
+*_XCODE32_X64_VFRPP_FLAGS      = -arch x86_64 -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+\r
+  DEBUG_XCODE32_X64_CC_FLAGS   = -arch x86_64 -save-temps -g -O0 -combine -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address  -fomit-frame-pointer -static  -c -include AutoGen.h -fno-stack-protector\r
+RELEASE_XCODE32_X64_CC_FLAGS   = -arch x86_64 -Oz -combine -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address  -fomit-frame-pointer -static  -c -include AutoGen.h -fno-stack-protector\r
+\r
+##################\r
+# ARM definitions - still a work in progress (Assumes iPhone SDK installed)\r
+##################\r
+\r
+*_XCODE32_ARM_ARCHCC_FLAGS    = -arch armv6 -march=armv6 -mthumb\r
+*_XCODE32_ARM_ARCHASM_FLAGS   = -arch armv6 \r
+*_XCODE32_ARM_ARCHDLINK_FLAGS = -arch armv6 \r
+*_XCODE32_ARM_PLATFORM_FLAGS  =\r
+*_XCODE32_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib\r
+\r
+*_XCODE32_ARM_CC_PATH       = DEF(IPHONE_TOOLS)/usr/bin/gcc\r
+*_XCODE32_ARM_SLINK_PATH    = DEF(IPHONE_TOOLS)/usr/bin/libtool\r
+*_XCODE32_ARM_DLINK_PATH    = DEF(IPHONE_TOOLS)/usr/bin/ld\r
+*_XCODE32_ARM_ASM_PATH      = DEF(IPHONE_TOOLS)/usr/bin/as\r
+*_XCODE32_ARM_PP_PATH       = DEF(IPHONE_TOOLS)/usr/bin/gcc\r
+*_XCODE32_ARM_VFRPP_PATH    = DEF(IPHONE_TOOLS)/usr/bin/gcc\r
+\r
+  DEBUG_XCODE32_ARM_DLINK_FLAGS      = $(ARCHDLINK_FLAGS) -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Darwin-i386/ARM/DEBUG_XCODE32/$(INTRINSIC_FLAGS)\r
+RELEASE_XCODE32_ARM_DLINK_FLAGS      = $(ARCHDLINK_FLAGS) -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Darwin-i386/ARM/RELEASE_XCODE32/$(INTRINSIC_FLAGS)\r
+\r
+*_XCODE32_ARM_SLINK_FLAGS      = -static -o\r
+\r
+  DEBUG_XCODE32_ARM_ASM_FLAGS  = $(ARCHASM_FLAGS) -g\r
+RELEASE_XCODE32_ARM_ASM_FLAGS  = $(ARCHASM_FLAGS) \r
+*_XCODE32_ARM_PP_FLAGS         = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
+*_XCODE32_ARM_VFRPP_FLAGS      = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+\r
+  DEBUG_XCODE32_ARM_CC_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-interwork -g -Oz -mabi=aapcs -mapcs -fno-short-enums  -save-temps -combine  -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector\r
+RELEASE_XCODE32_ARM_CC_FLAGS   = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-interwork -Oz    -mabi=aapcs -mapcs -fno-short-enums  -save-temps -combine -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector\r
+\r
+\r
+####################################################################################\r
+#\r
+# ARM Tools\r
+#\r
+####################################################################################\r
+#   RVCT31         - Tools from ARM\r
+\r
+*_RVCT31_*_*_FAMILY          = RVCT\r
+\r
+#\r
+# Use default values, or override in DSC file\r
+#\r
+*_RVCT31_ARM_ARCHCC_FLAGS    = --thumb --cpu ARM1176JZF-S\r
+*_RVCT31_ARM_ARCHASM_FLAGS   = --cpu ARM1176JZF-S\r
+*_RVCT31_ARM_ARCHDLINK_FLAGS = \r
+*_RVCT31_ARM_PLATFORM_FLAGS  =\r
+*_RVCT31_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib\r
+\r
+  DEBUG_RVCT31_ARM_DLINK_FLAGS     = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT)  --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Win32/ARM/DEBUG_RVCT31/$(INTRINSIC_FLAGS)\r
+RELEASE_RVCT31_ARM_DLINK_FLAGS     = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT)  --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Win32/ARM/RELEASE_RVCT31/$(INTRINSIC_FLAGS)\r
+\r
+\r
+*_RVCT31_ARM_ASM_FLAGS       = $(ARCHASM_FLAGS) --apcs /interwork\r
+*_RVCT31_ARM_PP_FLAGS        = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E\r
+*_RVCT31_ARM_VFRPP_FLAGS     = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E  -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+*_RVCT31_ARM_MAKE_PATH       = nmake\r
+*_RVCT31_ARM_SLINK_FLAGS     = --partial -o\r
+  DEBUG_RVCT31_ARM_CC_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167\r
+RELEASE_RVCT31_ARM_CC_FLAGS  = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167\r
+\r
+##################\r
+# ARM definitions\r
+##################\r
+*_RVCT31_ARM_CC_PATH         = DEF(RVCT31_TOOLS_PATH)/armcc\r
+*_RVCT31_ARM_SLINK_PATH      = DEF(RVCT31_TOOLS_PATH)/armlink\r
+*_RVCT31_ARM_DLINK_PATH      = DEF(RVCT31_TOOLS_PATH)/armlink\r
+*_RVCT31_ARM_ASM_PATH        = DEF(RVCT31_TOOLS_PATH)/armasm\r
+*_RVCT31_ARM_PP_PATH         = DEF(RVCT31_TOOLS_PATH)/armcc\r
+*_RVCT31_ARM_VFRPP_PATH      = DEF(RVCT31_TOOLS_PATH)/armcc\r
+*_RVCT31_ARM_FROMELF_PATH    = DEF(RVCT31_TOOLS_PATH)/fromelf\r
+\r
+####################################################################################\r
+#\r
+# ARM Tools & Cygwin\r
+#\r
+####################################################################################\r
+#   ARMCYGWIN         - Tools from ARM in a Cygwin environment\r
+\r
+*_RVCT31CYGWIN_*_*_FAMILY               = RVCT\r
+*_RVCT31CYGWIN_*_*_BUILDRULEFAMILY      = RVCTCYGWIN\r
+\r
+*_RVCT31CYGWIN_ARM_CCPATH_FLAG         = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc\r
+*_RVCT31CYGWIN_ARM_SLINKPATH_FLAG      = DEF(RVCT31CYGWIN_TOOLS_PATH)/armlink\r
+*_RVCT31CYGWIN_ARM_DLINKPATH_FLAG      = DEF(RVCT31CYGWIN_TOOLS_PATH)/armlink\r
+*_RVCT31CYGWIN_ARM_ASMPATH_FLAG        = DEF(RVCT31CYGWIN_TOOLS_PATH)/armasm\r
+*_RVCT31CYGWIN_ARM_PPPATH_FLAG         = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc\r
+*_RVCT31CYGWIN_ARM_VFRPPPATH_FLAG      = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc\r
+*_RVCT31CYGWIN_ARM_FROMELFPATH_FLAG    = DEF(RVCT31CYGWIN_TOOLS_PATH)/fromelf\r
+\r
+\r
+#\r
+# Use default values, or override in DSC file\r
+#\r
+*_RVCT31CYGWIN_ARM_ARCHCC_FLAGS    = --thumb --cpu ARM1176JZF-S\r
+*_RVCT31CYGWIN_ARM_ARCHASM_FLAGS   = --cpu ARM1176JZF-S\r
+*_RVCT31CYGWIN_ARM_ARCHDLINK_FLAGS = \r
+*_RVCT31CYGWIN_ARM_PLATFORM_FLAGS  =\r
+*_RVCT31CYGWIN_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib\r
+\r
+  DEBUG_RVCT31CYGWIN_ARM_DLINK_FLAGS     = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT)  --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` ENV(EDK_TOOLS_PATH)/Bin/CYGWIN_NT-5.1-i686/ARM/DEBUG_RVCT31CYGWIN/$(INTRINSIC_FLAGS)\r
+RELEASE_RVCT31CYGWIN_ARM_DLINK_FLAGS     = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT)  --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` ENV(EDK_TOOLS_PATH)/Bin/CYGWIN_NT-5.1-i686/ARM/DEBUG_RVCT31CYGWIN/$(INTRINSIC_FLAGS)\r
+\r
+*_RVCT31CYGWIN_ARM_ASM_FLAGS       = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) --apcs /interwork\r
+*_RVCT31CYGWIN_ARM_PP_FLAGS        = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E\r
+*_RVCT31CYGWIN_ARM_VFRPP_FLAGS     = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E  -DVFRCOMPILE --preinclude `cygpath -m $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h`\r
+*_RVCT31CYGWIN_ARM_MAKE_PATH       = make\r
+*_RVCT31CYGWIN_ARM_SLINK_FLAGS     = "$(SLINKPATH_FLAG)" --partial -o\r
+  DEBUG_RVCT31CYGWIN_ARM_CC_FLAGS  = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167\r
+RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS  = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167\r
+\r
+##################\r
+# ARM definitions\r
+##################\r
+*_RVCT31CYGWIN_ARM_CC_PATH         = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+*_RVCT31CYGWIN_ARM_SLINK_PATH      = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+*_RVCT31CYGWIN_ARM_DLINK_PATH      = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+*_RVCT31CYGWIN_ARM_ASM_PATH        = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+*_RVCT31CYGWIN_ARM_PP_PATH         = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+*_RVCT31CYGWIN_ARM_VFRPP_PATH      = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+*_RVCT31CYGWIN_ARM_FROMELF_PATH    = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py\r
+\r
+####################################################################################\r
+#\r
+# ARM GCC (GCC 4.1.1, etc.)\r
+#\r
+####################################################################################\r
+#  ARMGCC         - ARM version of the GCC cross compiler\r
+\r
+*_ARMGCC_*_*_FAMILY          = GCC\r
+*_ARMGCC_*_MAKE_PATH         = make\r
+\r
+##################\r
+# ASL definitions\r
+##################\r
+*_ARMGCC_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)\r
+*_ARMGCCC_*_ASL_FLAGS                    = \r
+*_ARMGCC_*_ASL_OUTFLAGS                 = DEF(IASL_OUTFLAGS)\r
+*_ARMGCC_*_ASLPP_FLAGS                  = -x c -E -P\r
+*_ARMGCC_*_ASLCC_FLAGS                  = -x c\r
+*_ARMGCC_*_ASLDLINK_FLAGS               = DEF(UNIXGCC_DLINK_FLAGS_COMMON) --entry _ReferenceAcpiTable\r
+\r
+##################\r
+# ARM definitions\r
+##################\r
+\r
+*_ARMGCC_ARM_ASLCC_PATH      = DEF(ARMGCC_BIN)/arm-elf-gcc\r
+*_ARMGCC_ARM_ASLDLINK_PATH   = DEF(ARMGCC_BIN)/arm-elf-ld\r
+*_ARMGCC_ARM_ASLPP_PATH      = DEF(ARMGCC_BIN)/arm-elf-gcc\r
+\r
+*_ARMGCC_ARM_CC_PATH         = DEF(ARMGCC_BIN)/arm-elf-gcc\r
+*_ARMGCC_ARM_SLINK_PATH      = DEF(ARMGCC_BIN)/arm-elf-ar\r
+*_ARMGCC_ARM_DLINK_PATH      = DEF(ARMGCC_BIN)/arm-elf-ld\r
+*_ARMGCC_ARM_ASM_PATH        = DEF(ARMGCC_BIN)/arm-elf-as\r
+*_ARMGCC_ARM_PP_PATH         = DEF(ARMGCC_BIN)/arm-elf-gcc\r
+*_ARMGCC_ARM_VFRPP_PATH      = DEF(ARMGCC_BIN)/arm-elf-gcc\r
+\r
+#\r
+# Use default values, or override in DSC file\r
+#\r
+*_ARMGCC_ARM_ARCHCC_FLAGS    = \r
+*_ARMGCC_ARM_ARCHASM_FLAGS   = \r
+*_ARMGCC_ARM_ARCHDLINK_FLAGS = \r
+*_ARMGCC_ARM_PLATFORM_FLAGS  =\r
+*_ARMGCC_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib\r
+\r
+  DEBUG_ARMGCC_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) -mlittle-endian -g\r
+RELEASE_ARMGCC_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) -mlittle-endian\r
+\r
+*_ARMGCC_ARM_PP_FLAGS    = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)  -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
+*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)  -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+\r
+*_ARMGCC_ARM_MAKE_PATH   = make\r
+\r
+*_ARMGCC_ARM_SLINK_FLAGS = -r\r
+*_ARMGCC_ARM_DLINK_FLAGS =  $(ARCHDLINK_FLAGS) --emit-relocs --oformat=elf32-littlearm -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
+# --gc-sections\r
+\r
+  DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -g -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h\r
+RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian    -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h\r
+\r
+\r
+\r
+\r
 ##################\r
 # VfrCompiler definitions\r
 ##################\r
index a37501e8daf37a2bdcc9a548b30b52e5b145ead0..82b3d5883f72cdeb9f9e362a6a7791851a871b89 100644 (file)
@@ -66,7 +66,7 @@ Notes:
         or modules because the AutoGen.* files have been be removed. The "makefile" itself\r
         cannot generate AutoGen.* files. Only "build" command can.\r
 3) All .exe binary file including C and python tools are generated from:\r
-    r1655 <buildtools_project>\BaseTools\Source\ + r1662 VfrCompiler tool update\r
+    r1707 <buildtools_project>\BaseTools\Source\ + r1707 VfrCompiler tool update\r
 \r
 Brief usage for Migration Tool MigrationMsa2Inf.exe:\r
 1. Command line format:\r
@@ -190,4 +190,4 @@ Brief usage for Migration Tool Fpd2Dsc.exe:
 7. Pyton Source\r
    r767 <buildtools_project>\BaseTools\Source\Python\Fpd2Dsc\r
 \r
-17-July-2009\r
+10-Sep-2009\r
index 10a545292b46b56550d3117cc338b0ed9f9c7d38..d8dc8907a5efb7f700c76281c4f87239bd5a81f3 100644 (file)
@@ -371,13 +371,13 @@ Return:
   if ((FatType == FatTypeFat32) &&\r
       (FatBpb->Fat12_16.BPB_TotSec32 == 0)) {\r
     DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_TotSec32 - %04x, expected: Non-Zero",\r
-        FatBpb->Fat12_16.BPB_TotSec32);\r
+        (unsigned) FatBpb->Fat12_16.BPB_TotSec32);\r
     return FatTypeUnknown;\r
   }\r
   if ((FatType == FatTypeFat32) &&\r
       (FatBpb->Fat32.BPB_FATSz32 == 0)) {\r
     DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_FATSz32 - %08x, expected: Non-Zero",\r
-        FatBpb->Fat32.BPB_FATSz32);\r
+        (unsigned) FatBpb->Fat32.BPB_FATSz32);\r
     return FatTypeUnknown;\r
   }\r
   if ((FatType == FatTypeFat32) &&\r
@@ -388,7 +388,7 @@ Return:
   if ((FatType == FatTypeFat32) &&\r
       (FatBpb->Fat32.BPB_RootClus != 2)) {\r
     DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT32 - BPB_RootClus - %08x, expected: %04x",\r
-        FatBpb->Fat32.BPB_RootClus, 2);\r
+        (unsigned) FatBpb->Fat32.BPB_RootClus, 2);\r
   }\r
   if ((FatType == FatTypeFat32) &&\r
       (FatBpb->Fat32.BPB_FSInfo != 1)) {\r
@@ -523,14 +523,14 @@ ParseBootSector (
   printf ("  16     Sectors per FAT (small vol.) %04x\n", FatBpb.Fat12_16.BPB_FATSz16);\r
   printf ("  18     Sectors per track            %04x\n", FatBpb.Fat12_16.BPB_SecPerTrk);\r
   printf ("  1A     Heads                        %04x\n", FatBpb.Fat12_16.BPB_NumHeads);\r
-  printf ("  1C     Hidden sectors               %08x\n", FatBpb.Fat12_16.BPB_HiddSec);\r
-  printf ("  20     Sectors (over 32MB)          %08x\n", FatBpb.Fat12_16.BPB_TotSec32);\r
+  printf ("  1C     Hidden sectors               %08x\n", (unsigned) FatBpb.Fat12_16.BPB_HiddSec);\r
+  printf ("  20     Sectors (over 32MB)          %08x\n", (unsigned) FatBpb.Fat12_16.BPB_TotSec32);\r
   printf ("\n");\r
   if (FatType != FatTypeFat32) {\r
     printf ("  24     BIOS drive                   %02x\n", FatBpb.Fat12_16.BS_DrvNum);\r
     printf ("  25     (Unused)                     %02x\n", FatBpb.Fat12_16.BS_Reserved1);\r
     printf ("  26     Ext. boot signature          %02x\n", FatBpb.Fat12_16.BS_BootSig);\r
-    printf ("  27     Volume serial number         %08x\n", FatBpb.Fat12_16.BS_VolID);\r
+    printf ("  27     Volume serial number         %08x\n", (unsigned) FatBpb.Fat12_16.BS_VolID);\r
     printf ("  2B     Volume lable                 %c%c%c%c%c%c%c%c%c%c%c\n",\r
                                                    FatBpb.Fat12_16.BS_VolLab[0],\r
                                                    FatBpb.Fat12_16.BS_VolLab[1],\r
@@ -555,10 +555,10 @@ ParseBootSector (
     printf ("\n");\r
   } else {\r
     printf ("FAT32 Section\n");\r
-    printf ("  24     Sectors per FAT (large vol.) %08x\n", FatBpb.Fat32.BPB_FATSz32);\r
+    printf ("  24     Sectors per FAT (large vol.) %08x\n", (unsigned) FatBpb.Fat32.BPB_FATSz32);\r
     printf ("  28     Flags                        %04x\n", FatBpb.Fat32.BPB_ExtFlags);\r
     printf ("  2A     Version                      %04x\n", FatBpb.Fat32.BPB_FSVer);\r
-    printf ("  2C     Root dir 1st cluster         %08x\n", FatBpb.Fat32.BPB_RootClus);\r
+    printf ("  2C     Root dir 1st cluster         %08x\n", (unsigned) FatBpb.Fat32.BPB_RootClus);\r
     printf ("  30     FSInfo sector                %04x\n", FatBpb.Fat32.BPB_FSInfo);\r
     printf ("  32     Backup boot sector           %04x\n", FatBpb.Fat32.BPB_BkBootSec);\r
     printf ("  34     (Reserved)                   %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",\r
@@ -578,7 +578,7 @@ ParseBootSector (
     printf ("  40     BIOS drive                   %02x\n", FatBpb.Fat32.BS_DrvNum);\r
     printf ("  41     (Unused)                     %02x\n", FatBpb.Fat32.BS_Reserved1);\r
     printf ("  42     Ext. boot signature          %02x\n", FatBpb.Fat32.BS_BootSig);\r
-    printf ("  43     Volume serial number         %08x\n", FatBpb.Fat32.BS_VolID);\r
+    printf ("  43     Volume serial number         %08x\n", (unsigned) FatBpb.Fat32.BS_VolID);\r
     printf ("  47     Volume lable                 %c%c%c%c%c%c%c%c%c%c%c\n",\r
                                                    FatBpb.Fat32.BS_VolLab[0],\r
                                                    FatBpb.Fat32.BS_VolLab[1],\r
@@ -738,7 +738,7 @@ ParseMbr (
   printf ("  Offset Title                        Value\n");\r
   printf ("==================================================================\n");\r
   printf ("  0      Master bootstrap loader code (not list)\n");\r
-  printf ("  1B8    Windows disk signature       %08x\n", Mbr.UniqueMbrSignature);\r
+  printf ("  1B8    Windows disk signature       %08x\n", (unsigned) Mbr.UniqueMbrSignature);\r
   printf ("\n");\r
   printf ("Partition Table Entry #1\n");\r
   printf ("  1BE    80 = active partition        %02x\n", Mbr.PartitionRecord[0].BootIndicator);\r
@@ -749,8 +749,8 @@ ParseMbr (
   printf ("  1C3    End head                     %02x\n", Mbr.PartitionRecord[0].EndHead);\r
   printf ("  1C4    End sector                   %02x\n", Mbr.PartitionRecord[0].EndSector);\r
   printf ("  1C5    End cylinder                 %02x\n", Mbr.PartitionRecord[0].EndTrack);\r
-  printf ("  1C6    Sectors preceding partition  %08x\n", Mbr.PartitionRecord[0].StartingLBA);\r
-  printf ("  1CA    Sectors in partition         %08x\n", Mbr.PartitionRecord[0].SizeInLBA);\r
+  printf ("  1C6    Sectors preceding partition  %08x\n", (unsigned) Mbr.PartitionRecord[0].StartingLBA);\r
+  printf ("  1CA    Sectors in partition         %08x\n", (unsigned) Mbr.PartitionRecord[0].SizeInLBA);\r
   printf ("\n");\r
   printf ("Partition Table Entry #2\n");\r
   printf ("  1CE    80 = active partition        %02x\n", Mbr.PartitionRecord[1].BootIndicator);\r
@@ -761,8 +761,8 @@ ParseMbr (
   printf ("  1D3    End head                     %02x\n", Mbr.PartitionRecord[1].EndHead);\r
   printf ("  1D4    End sector                   %02x\n", Mbr.PartitionRecord[1].EndSector);\r
   printf ("  1D5    End cylinder                 %02x\n", Mbr.PartitionRecord[1].EndTrack);\r
-  printf ("  1D6    Sectors preceding partition  %08x\n", Mbr.PartitionRecord[1].StartingLBA);\r
-  printf ("  1DA    Sectors in partition         %08x\n", Mbr.PartitionRecord[1].SizeInLBA);\r
+  printf ("  1D6    Sectors preceding partition  %08x\n", (unsigned) Mbr.PartitionRecord[1].StartingLBA);\r
+  printf ("  1DA    Sectors in partition         %08x\n", (unsigned) Mbr.PartitionRecord[1].SizeInLBA);\r
   printf ("\n");\r
   printf ("Partition Table Entry #3\n");\r
   printf ("  1DE    80 = active partition        %02x\n", Mbr.PartitionRecord[2].BootIndicator);\r
@@ -773,8 +773,8 @@ ParseMbr (
   printf ("  1E3    End head                     %02x\n", Mbr.PartitionRecord[2].EndHead);\r
   printf ("  1E4    End sector                   %02x\n", Mbr.PartitionRecord[2].EndSector);\r
   printf ("  1E5    End cylinder                 %02x\n", Mbr.PartitionRecord[2].EndTrack);\r
-  printf ("  1E6    Sectors preceding partition  %08x\n", Mbr.PartitionRecord[2].StartingLBA);\r
-  printf ("  1EA    Sectors in partition         %08x\n", Mbr.PartitionRecord[2].SizeInLBA);\r
+  printf ("  1E6    Sectors preceding partition  %08x\n", (unsigned) Mbr.PartitionRecord[2].StartingLBA);\r
+  printf ("  1EA    Sectors in partition         %08x\n", (unsigned) Mbr.PartitionRecord[2].SizeInLBA);\r
   printf ("\n");\r
   printf ("Partition Table Entry #4\n");\r
   printf ("  1EE    80 = active partition        %02x\n", Mbr.PartitionRecord[3].BootIndicator);\r
@@ -785,8 +785,8 @@ ParseMbr (
   printf ("  1F3    End head                     %02x\n", Mbr.PartitionRecord[3].EndHead);\r
   printf ("  1F4    End sector                   %02x\n", Mbr.PartitionRecord[3].EndSector);\r
   printf ("  1F5    End cylinder                 %02x\n", Mbr.PartitionRecord[3].EndTrack);\r
-  printf ("  1F6    Sectors preceding partition  %08x\n", Mbr.PartitionRecord[3].StartingLBA);\r
-  printf ("  1FA    Sectors in partition         %08x\n", Mbr.PartitionRecord[3].SizeInLBA);\r
+  printf ("  1F6    Sectors preceding partition  %08x\n", (unsigned) Mbr.PartitionRecord[3].StartingLBA);\r
+  printf ("  1FA    Sectors in partition         %08x\n", (unsigned) Mbr.PartitionRecord[3].SizeInLBA);\r
   printf ("\n");\r
   printf ("  1FE    Signature                    %04x\n", Mbr.Signature);\r
   printf ("\n");\r
index 72b6a52f890c162744b9f4bbbaf527598774c083..0166c22460fbc3ca5a05c9bc7f826d55e725e505 100644 (file)
@@ -856,6 +856,7 @@ Returns:
 \r
   PeHdr = NULL;\r
   TeHdr = NULL;\r
+  OptionHeader.Header = NULL;\r
   //\r
   // Assume success\r
   //\r
@@ -1252,11 +1253,11 @@ PeCoffLoaderGetPdbPointer (
       //\r
       // Get the DebugEntry offset in the raw data image.\r
       //\r
-           SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);\r
-           Index = Hdr.Te->NumberOfSections;\r
+      SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);\r
+      Index = Hdr.Te->NumberOfSections;\r
       for (Index1 = 0; Index1 < Index; Index1 ++) {\r
-       if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
-                (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
+           (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
           DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +\r
                         DirectoryEntry->VirtualAddress - \r
                         SectionHeader [Index1].VirtualAddress + \r
@@ -1324,8 +1325,8 @@ PeCoffLoaderGetPdbPointer (
       // Get the DebugEntry offset in the raw data image.\r
       //\r
       for (Index1 = 0; Index1 < Index; Index1 ++) {\r
-       if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
-                (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && \r
+           (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
           DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (\r
                        (UINTN) Pe32Data + \r
                        DirectoryEntry->VirtualAddress - \r
@@ -1349,27 +1350,28 @@ PeCoffLoaderGetPdbPointer (
   for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {\r
     if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {\r
       if (DebugEntry->SizeOfData > 0) {\r
-             //\r
-             // Get the DebugEntry offset in the raw data image.\r
-             //\r
-             for (Index1 = 0; Index1 < Index; Index1 ++) {\r
-               if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && \r
-                        (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
-                 CodeViewEntryPointer = (VOID *) (\r
-                                        ((UINTN)Pe32Data) + \r
-                                        (UINTN) DebugEntry->RVA - \r
-                                        SectionHeader[Index1].VirtualAddress + \r
-                                        SectionHeader[Index1].PointerToRawData + \r
-                                        (UINTN)TEImageAdjust);\r
-                 break;\r
-               }\r
-             }\r
-             if (Index1 >= Index) {\r
-               //\r
-               // Can't find CodeViewEntryPointer in raw PE/COFF image.\r
-               //\r
-               continue;\r
-             }\r
+        //\r
+        // Get the DebugEntry offset in the raw data image.\r
+        //\r
+        CodeViewEntryPointer = NULL;\r
+        for (Index1 = 0; Index1 < Index; Index1 ++) {\r
+          if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && \r
+             (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {\r
+            CodeViewEntryPointer = (VOID *) (\r
+                                   ((UINTN)Pe32Data) + \r
+                                   (UINTN) DebugEntry->RVA - \r
+                                   SectionHeader[Index1].VirtualAddress + \r
+                                   SectionHeader[Index1].PointerToRawData + \r
+                                   (UINTN)TEImageAdjust);\r
+            break;\r
+          }\r
+        }\r
+        if (Index1 >= Index) {\r
+          //\r
+          // Can't find CodeViewEntryPointer in raw PE/COFF image.\r
+          //\r
+          continue;\r
+        }\r
         switch (* (UINT32 *) CodeViewEntryPointer) {\r
         case CODEVIEW_SIGNATURE_NB10:\r
           return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));\r
index 970b2af27b367d3b77b14af6a6c3ba9a5cd4f891..a0c6603a85ae2bb002f2a72aa241d4081970246c 100644 (file)
@@ -472,7 +472,7 @@ Returns:
 \r
   printf (\r
     "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",\r
-    Guid->Data1,\r
+    (unsigned) Guid->Data1,\r
     Guid->Data2,\r
     Guid->Data3,\r
     Guid->Data4[0],\r
@@ -529,7 +529,7 @@ Returns:
     sprintf (\r
       (CHAR8 *)Buffer,\r
       "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",\r
-      Guid->Data1,\r
+      (unsigned) Guid->Data1,\r
       Guid->Data2,\r
       Guid->Data3,\r
       Guid->Data4[0],\r
@@ -545,7 +545,7 @@ Returns:
     sprintf (\r
       (CHAR8 *)Buffer,\r
       "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",\r
-      Guid->Data1,\r
+      (unsigned) Guid->Data1,\r
       Guid->Data2,\r
       Guid->Data3,\r
       Guid->Data4[0],\r
index 9d697da82d802303b8a30805159ee2708bd771ce..68cf02469e18a4de9ab9d6f4c4bb037a4f7254f5 100644 (file)
@@ -34,7 +34,7 @@ Abstract:
 //\r
 STATIC STATUS mStatus                 = STATUS_SUCCESS;\r
 STATIC CHAR8  mUtilityName[50]        = { 0 };\r
-STATIC UINT32 mPrintLogLevel          = INFO_LOG_LEVEL;\r
+STATIC UINT64 mPrintLogLevel          = INFO_LOG_LEVEL;\r
 STATIC CHAR8  *mSourceFileName        = NULL;\r
 STATIC UINT32 mSourceFileLineNum      = 0;\r
 STATIC UINT32 mErrorCount             = 0;\r
@@ -355,7 +355,7 @@ VOID
 DebugMsg (\r
   CHAR8   *FileName,\r
   UINT32  LineNumber,\r
-  UINT32  MsgLevel,\r
+  UINT64  MsgLevel,\r
   CHAR8   *Text,\r
   CHAR8   *MsgFmt,\r
   ...\r
@@ -495,7 +495,7 @@ Notes:
     if (Cptr != NULL) {\r
       sprintf (Line, ": %s", Cptr);\r
       if (LineNumber != 0) {\r
-        sprintf (Line2, "(%d)", LineNumber);\r
+        sprintf (Line2, "(%u)", (unsigned) LineNumber);\r
         strcat (Line, Line2);\r
       }\r
     }\r
@@ -509,7 +509,7 @@ Notes:
       }\r
       sprintf (Line, "%s", Cptr);\r
       if (LineNumber != 0) {\r
-        sprintf (Line2, "(%d)", LineNumber);\r
+        sprintf (Line2, "(%u)", (unsigned) LineNumber);\r
         strcat (Line, Line2);\r
       }\r
     } else {\r
@@ -524,7 +524,7 @@ Notes:
   // message for you. It has to be decimal digits too.\r
   //\r
   if (MessageCode != 0) {\r
-    sprintf (Line2, ": %s %04d", Type, MessageCode);\r
+    sprintf (Line2, ": %s %04u", Type, (unsigned) MessageCode);\r
   } else {\r
     sprintf (Line2, ": %s", Type);\r
   }\r
@@ -665,7 +665,7 @@ Returns:
 \r
 VOID\r
 SetPrintLevel (\r
-  UINT32  LogLevel\r
+  UINT64  LogLevel\r
   )\r
 /*++\r
 \r
@@ -843,7 +843,7 @@ TestUtilityMessages (
   )\r
 {\r
   CHAR8 *ArgStr = "ArgString";\r
-  INTN  ArgInt;\r
+  int   ArgInt;\r
 \r
   ArgInt  = 0x12345678;\r
   //\r
index 6c2f9d2989a527115ab8d2aac468b31b4376cb8e..40e6e170ae06496012c10389b60cf4ef8eefc2e9 100644 (file)
@@ -96,7 +96,7 @@ VOID
 DebugMsg (\r
   CHAR8   *FileName,\r
   UINT32  LineNumber,\r
-  UINT32  MsgLevel,\r
+  UINT64  MsgLevel,\r
   CHAR8   *OffendingText,\r
   CHAR8   *MsgFmt,\r
   ...\r
@@ -123,7 +123,7 @@ KeyMsg (
 \r
 VOID\r
 SetPrintLevel (\r
-  UINT32  LogLevel\r
+  UINT64  LogLevel\r
   );\r
 \r
 VOID\r
index b53713941cdbc1f8e57dca0a8d205468c89caf7a..64c5ff783e4e8af2c2c5790721725d197f0519ef 100644 (file)
@@ -86,7 +86,7 @@ MyCheck (
       "Invalid parameter(s).\n",\r
       Final,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -98,7 +98,7 @@ MyCheck (
       "Invalid parameter.\n",\r
       Final,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -121,12 +121,12 @@ MyCheck (
       "\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",\r
       Final,\r
       File,\r
-      (UINT32)Line,\r
+      (unsigned)Line,\r
       Tmp->File,\r
-      (UINT32)Tmp->Line,\r
-      (UINT32)Tmp->Size,\r
-      *(UINT32 *) (Tmp->Buffer),\r
-      *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
+      (unsigned) Tmp->Line,\r
+      (unsigned) Tmp->Size,\r
+      (unsigned) *(UINT32 *) (Tmp->Buffer),\r
+      (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
       );\r
 \r
     exit (1);\r
@@ -141,17 +141,17 @@ MyCheck (
         "\nSome allocated items have not been freed.\n",\r
         Final,\r
         File,\r
-        (UINT32)Line\r
+        (unsigned)Line\r
         );\r
 \r
       for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {\r
         printf (\r
           "File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",\r
           Tmp->File,\r
-          (UINT32)Tmp->Line,\r
-          (UINT32)Tmp->Size,\r
-          *(UINT32 *) (Tmp->Buffer),\r
-          *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
+          (unsigned) Tmp->Line,\r
+          (unsigned) Tmp->Size,\r
+          (unsigned) *(UINT32 *) (Tmp->Buffer),\r
+          (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
           );\r
       }\r
     }\r
@@ -201,9 +201,9 @@ MyAlloc (
     printf (\r
       "\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
       "\nInvalid parameter(s).\n",\r
-      (UINT32)Size,\r
+      (unsigned)Size,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -214,9 +214,9 @@ MyAlloc (
     printf (\r
       "\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
       "\nInvalid parameter.\n",\r
-      (UINT32)Size,\r
+      (unsigned)Size,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -238,9 +238,9 @@ MyAlloc (
     printf (\r
       "\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
       "\nOut of memory.\n",\r
-      (UINT32)Size,\r
+      (unsigned)Size,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -315,9 +315,9 @@ MyRealloc (
       "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
       "\nInvalid parameter(s).\n",\r
       Ptr,\r
-      (UINT32)Size,\r
+      (unsigned)Size,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -328,9 +328,9 @@ MyRealloc (
       "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
       "\nInvalid parameter.\n",\r
       Ptr,\r
-      (UINT32)Size,\r
+      (unsigned)Size,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -349,9 +349,9 @@ MyRealloc (
           "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
           "\nCould not find buffer.\n",\r
           Ptr,\r
-          (UINT32)Size,\r
+          (unsigned)Size,\r
           File,\r
-          (UINT32)Line\r
+          (unsigned)Line\r
           );\r
 \r
         exit (1);\r
@@ -421,7 +421,7 @@ MyFree (
       "\nInvalid parameter(s).\n",\r
       Ptr,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -433,7 +433,7 @@ MyFree (
       "\nInvalid parameter.\n",\r
       Ptr,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -453,7 +453,7 @@ MyFree (
       "\nCalled before memory allocated.\n",\r
       Ptr,\r
       File,\r
-      (UINT32)Line\r
+      (unsigned)Line\r
       );\r
 \r
     exit (1);\r
@@ -486,7 +486,7 @@ MyFree (
           "\nNot found.\n",\r
           Ptr,\r
           File,\r
-          (UINT32)Line\r
+          (unsigned)Line\r
           );\r
 \r
         exit (1);\r
index 02d0b11f0d9e5416bedc53c26689916b13b4a1ce..b643cdeb4fef2d32c5d17dd1b741cabdbe3d6072 100644 (file)
@@ -122,6 +122,7 @@ Returns:
   GUID_SEC_TOOL_ENTRY *NewGuidTool;\r
 \r
   FirstGuidTool = NULL;\r
+  LastGuidTool  = NULL;\r
 \r
   while (TRUE) {\r
     NextLine = ReadMemoryFileLine (InputFile);\r
index 8305f14aef3081502e9cd937dd2a8fe84f665e63..b39c5bde4022527333b78ce2914b0e1952cb8452 100644 (file)
@@ -379,10 +379,10 @@ Returns:
 --*/\r
 {\r
   INT32 Index;\r
-  UINT32 Data1;\r
-  UINT32 Data2;\r
-  UINT32 Data3;\r
-  UINT16 Data4[8];\r
+  unsigned Data1;\r
+  unsigned Data2;\r
+  unsigned Data3;\r
+  unsigned Data4[8];\r
 \r
   if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -416,7 +416,7 @@ Returns:
   //\r
   Index = sscanf (\r
             AsciiGuidBuffer,\r
-            "%08x-%04x-%04x-%02hx%02hx-%02hx%02hx%02hx%02hx%02hx%02hx",\r
+            "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",\r
             &Data1,\r
             &Data2,\r
             &Data3,\r
index 52ec1291933c4cedc39adaf84cbe567893ec5f4d..5a7111c8ebbd1d6b023a63015498b51f7d0ef5e7 100644 (file)
@@ -536,7 +536,7 @@ Returns:
 \r
 --*/\r
 {\r
-  UINT32 Val;\r
+  unsigned Val;\r
 \r
   SkipWhiteSpace (&mGlobals.SourceFile);\r
   if (EndOfFile (&mGlobals.SourceFile)) {\r
@@ -554,7 +554,7 @@ Returns:
 \r
       mGlobals.SourceFile.FileBufferPtr += 2;\r
       sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);\r
-      *Value = Val;\r
+      *Value = (UINT32) Val;\r
       while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {\r
         mGlobals.SourceFile.FileBufferPtr++;\r
       }\r
@@ -634,7 +634,7 @@ Returns:
   // depth.\r
   //\r
   if (mGlobals.VerboseFile) {\r
-    fprintf (stdout, "%*cProcessing file '%s'\n", (INT32)NestDepth * 2, ' ', SourceFile->FileName);\r
+    fprintf (stdout, "%*cProcessing file '%s'\n", (int)NestDepth * 2, ' ', SourceFile->FileName);\r
     fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName);\r
   }\r
 \r
@@ -642,7 +642,7 @@ Returns:
   // Make sure we didn't exceed our maximum nesting depth\r
   //\r
   if (NestDepth > MAX_NEST_DEPTH) {\r
-    Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%d)", SourceFile->FileName, NestDepth);\r
+    Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);\r
     Status = STATUS_ERROR;\r
     goto Finish;\r
   }\r
@@ -698,7 +698,7 @@ Returns:
   fseek (SourceFile->Fptr, 0, SEEK_END);\r
   SourceFile->FileSize = ftell (SourceFile->Fptr);\r
   if (mGlobals.VerboseFile) {\r
-    printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);\r
+    printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);\r
   }\r
 \r
   fseek (SourceFile->Fptr, 0, SEEK_SET);\r
@@ -819,7 +819,7 @@ Returns:
     }\r
 \r
     printf ("'\n");\r
-    printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);\r
+    printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);\r
     RewindFile (SourceFile);\r
   }\r
 }\r
@@ -1282,7 +1282,7 @@ Returns:
 \r
 --*/\r
 {\r
-  UINT32        Value32;\r
+  unsigned      Value32;\r
   UINT32        Index;\r
   FILE_POSITION FPos;\r
   CHAR8         TempString[20];\r
index 3591a4d71b970ea757d3fc1fe80c9ec60cbabecf..c2c8111d31be31c35c5e3cdbe012b4e956c312a0 100644 (file)
@@ -131,7 +131,7 @@ Return:
   UINT64 : file size of input file\r
 --*/\r
 {\r
-  UINT64           filesize, offset, length;\r
+  UINT32          filesize, offset, length;\r
   CHAR8           Buffer[8*1024];\r
 \r
   fseek (in, 0, SEEK_END);\r
@@ -252,7 +252,7 @@ Returns:
       continue; \r
     }\r
     //\r
-    // Don't recognize the paramter, should be regarded as the input file name.\r
+    // Don't recognize the parameter, should be regarded as the input file name.\r
     //\r
     InputFileNames[InputFileCount] = argv[0];\r
     InputFileCount++;\r
@@ -309,9 +309,9 @@ Returns:
     //  And in the same time update the EfiLdrHeader and EfiLdrImage array\r
     //\r
     EfiLdrImage[i].Offset = EfiLdrHeader.FileLength;\r
-    EfiLdrImage[i].Length = filesize;\r
+    EfiLdrImage[i].Length = (UINT32) filesize;\r
     strncpy ((CHAR8*) EfiLdrImage[i].FileName, InputFileNames[i], sizeof (EfiLdrImage[i].FileName) - 1);\r
-    EfiLdrHeader.FileLength += filesize;\r
+    EfiLdrHeader.FileLength += (UINT32) filesize;\r
     EfiLdrHeader.NumberOfImages++;\r
   }\r
 \r
index d9c2e7c1c145618e39e0881b7ac4a348375ffca4..d43520ae47dc5e5e62ad275a50ab69a79e77aee7 100644 (file)
@@ -88,8 +88,8 @@ Returns:
   // If dumping an image, then do that and quit\r
   //\r
   if (mOptions.DumpOption == 1) {\r
-    for (FList = mOptions.FileList; FList != NULL; FList = FList->Next) {\r
-      if ((Ptr0 = strstr ((CONST CHAR8 *)FList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {\r
+    if (mOptions.FileList != NULL) {\r
+      if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {\r
         DumpImage (mOptions.FileList);\r
         goto BailOut;\r
       } else {\r
@@ -163,7 +163,7 @@ Returns:
     }\r
 \r
     if (mOptions.Verbose) {\r
-      VerboseMsg("  Output size = 0x%X\n", Size);\r
+      VerboseMsg("  Output size = 0x%X\n", (unsigned) Size);\r
     }\r
 \r
     if (Status != STATUS_SUCCESS) {\r
@@ -238,7 +238,8 @@ Returns:
   UINT32                    Index;\r
   UINT8                     ByteCheckSum;\r
  \r
-\r
+  PciDs23 = NULL;\r
+  PciDs30 = NULL;\r
   Status = STATUS_SUCCESS;\r
 \r
   //\r
@@ -255,7 +256,7 @@ Returns:
   fseek (InFptr, 0, SEEK_END);\r
   FileSize = ftell (InFptr);\r
   if (mOptions.Verbose) {\r
-    VerboseMsg("  File size   = 0x%X\n", FileSize);\r
+    VerboseMsg("  File size   = 0x%X\n", (unsigned) FileSize);\r
   }\r
 \r
   fseek (InFptr, 0, SEEK_SET);\r
@@ -365,7 +366,7 @@ Returns:
 \r
   Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);\r
   if (mOptions.Verbose) {\r
-    VerboseMsg("  Checksum = %02x\n\n", (UINT32) Buffer[FileSize - 1]);\r
+    VerboseMsg("  Checksum = %02x\n\n", Buffer[FileSize - 1]);\r
   }\r
 \r
   //\r
@@ -495,7 +496,7 @@ Returns:
   }\r
 \r
   if (mOptions.Verbose) {\r
-    VerboseMsg("  File size   = 0x%X\n", FileSize);\r
+    VerboseMsg("  File size   = 0x%X\n", (unsigned) FileSize);\r
   }\r
   //\r
   // Allocate memory for the entire file (in case we have to compress), then\r
@@ -540,7 +541,7 @@ Returns:
     // Now compute the size, then swap buffer pointers.\r
     //\r
     if (mOptions.Verbose) {\r
-      VerboseMsg("  Comp size   = 0x%X\n", CompressedFileSize);\r
+      VerboseMsg("  Comp size   = 0x%X\n", (unsigned) CompressedFileSize);\r
     }\r
 \r
     TotalSize         = CompressedFileSize + HeaderSize;\r
@@ -820,7 +821,7 @@ Returns:
   }\r
 \r
   if (mOptions.Verbose) {\r
-    VerboseMsg("  Got subsystem = 0x%X from image\n", (int) *SubSystem);\r
+    VerboseMsg("  Got subsystem = 0x%X from image\n", *SubSystem);\r
   }\r
 \r
   //\r
@@ -999,7 +1000,7 @@ Returns:
           return 1;\r
         }\r
         if (DebugLevel > 9)  {\r
-          Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", Argv[1]);\r
+          Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, current input level is %d", Argv[1]);\r
           return 1;\r
         }\r
         if (DebugLevel>=5 && DebugLevel<=9) {\r
@@ -1301,10 +1302,10 @@ Returns:
     //\r
     // Dump the contents of the header\r
     //\r
-    fprintf (stdout, "Image %d -- Offset 0x%X\n", ImageCount, ImageStart);\r
+    fprintf (stdout, "Image %u -- Offset 0x%X\n", (unsigned) ImageCount, (unsigned) ImageStart);\r
     fprintf (stdout, "  ROM header contents\n");\r
-    fprintf (stdout, "    Signature              0x%04X\n", (UINT32) PciRomHdr.Signature);\r
-    fprintf (stdout, "    PCIR offset            0x%04X\n", (UINT32) PciRomHdr.PcirOffset);\r
+    fprintf (stdout, "    Signature              0x%04X\n", PciRomHdr.Signature);\r
+    fprintf (stdout, "    PCIR offset            0x%04X\n", PciRomHdr.PcirOffset);\r
     //\r
     // Find PCI data structure\r
     //\r
@@ -1349,11 +1350,11 @@ Returns:
     fprintf (\r
       stdout,\r
       "    Class Code             0x%06X\n",\r
-      (UINT32) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16))\r
+      (unsigned) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16))\r
       );\r
-    fprintf (stdout, "    Image size             0x%X\n", PciDs23.ImageLength * 512);\r
+    fprintf (stdout, "    Image size             0x%X\n", (unsigned) PciDs23.ImageLength * 512);\r
     fprintf (stdout, "    Code revision:         0x%04X\n", PciDs23.CodeRevision);\r
-    fprintf (stdout, "    Indicator              0x%02X", (UINT32) PciDs23.Indicator);\r
+    fprintf (stdout, "    Indicator              0x%02X", PciDs23.Indicator);\r
     } else {\r
     fprintf (\r
       stdout,\r
@@ -1367,18 +1368,18 @@ Returns:
     fprintf (stdout, "    Device ID               0x%04X\n", PciDs30.DeviceId);\r
     fprintf (stdout, "    Length                  0x%04X\n", PciDs30.Length);\r
     fprintf (stdout, "    Revision                0x%04X\n", PciDs30.Revision);\r
-    fprintf (stdout, "    DeviceListOffset        0x%02X\n", (UINT32) PciDs30.DeviceListOffset);    \r
+    fprintf (stdout, "    DeviceListOffset        0x%02X\n", PciDs30.DeviceListOffset);    \r
     fprintf (\r
       stdout,\r
       "    Class Code              0x%06X\n",\r
-      (UINT32) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16))\r
+      (unsigned) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16))\r
       );\r
-    fprintf (stdout, "    Image size              0x%X\n", PciDs30.ImageLength * 512);\r
+    fprintf (stdout, "    Image size              0x%X\n", (unsigned) PciDs30.ImageLength * 512);\r
     fprintf (stdout, "    Code revision:          0x%04X\n", PciDs30.CodeRevision);\r
-    fprintf (stdout, "    MaxRuntimeImageLength   0x%02X\n", (UINT32) PciDs30.MaxRuntimeImageLength);\r
-    fprintf (stdout, "    ConfigUtilityCodeHeaderOffset 0x%02X\n", (UINT32) PciDs30.ConfigUtilityCodeHeaderOffset);\r
-    fprintf (stdout, "    DMTFCLPEntryPointOffset 0x%02X\n", (UINT32) PciDs30.DMTFCLPEntryPointOffset);   \r
-    fprintf (stdout, "    Indicator               0x%02X", (UINT32) PciDs30.Indicator);    \r
+    fprintf (stdout, "    MaxRuntimeImageLength   0x%02X\n", PciDs30.MaxRuntimeImageLength);\r
+    fprintf (stdout, "    ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);\r
+    fprintf (stdout, "    DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);   \r
+    fprintf (stdout, "    Indicator               0x%02X", PciDs30.Indicator);    \r
     }\r
     //\r
     // Print the indicator, used to flag the last image\r
@@ -1392,9 +1393,9 @@ Returns:
     // Print the code type. If EFI code, then we can provide more info.\r
     //\r
     if (mOptions.Pci23 == 1) {\r
-      fprintf (stdout, "    Code type              0x%02X", (UINT32) PciDs23.CodeType);\r
+      fprintf (stdout, "    Code type              0x%02X", PciDs23.CodeType);\r
     } else {\r
-      fprintf (stdout, "    Code type               0x%02X", (UINT32) PciDs30.CodeType); \r
+      fprintf (stdout, "    Code type               0x%02X", PciDs30.CodeType); \r
     }\r
     if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {\r
       fprintf (stdout, "   (EFI image)\n");\r
@@ -1414,11 +1415,11 @@ Returns:
       //\r
       // Now dump more info\r
       //\r
-      fprintf (stdout, "    EFI Signature          0x%04X\n", EfiRomHdr.EfiSignature);\r
+      fprintf (stdout, "    EFI Signature          0x%04X\n", (unsigned) EfiRomHdr.EfiSignature);\r
       fprintf (\r
         stdout,\r
         "    Compression Type       0x%04X ",\r
-        (UINT32) EfiRomHdr.CompressionType\r
+        EfiRomHdr.CompressionType\r
         );\r
       if (EfiRomHdr.CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {\r
         fprintf (stdout, "(compressed)\n");\r
@@ -1441,8 +1442,8 @@ Returns:
       fprintf (\r
         stdout,\r
         "    EFI image offset       0x%04X (@0x%X)\n",\r
-        (UINT32) EfiRomHdr.EfiImageHeaderOffset,\r
-        (UINT32) (EfiRomHdr.EfiImageHeaderOffset + ImageStart)\r
+        EfiRomHdr.EfiImageHeaderOffset,\r
+        EfiRomHdr.EfiImageHeaderOffset + (unsigned) ImageStart\r
         );\r
 \r
     } else {\r
index 47b5c5c67a040e48069f14286dae95659a013beb..05839bb736e356095d49f108232a15136fcd3494 100644 (file)
@@ -26,6 +26,9 @@ Abstract:
 #include <string.h>\r
 #include <Common/UefiBaseTypes.h>\r
 \r
+#include "ParseInf.h"\r
+#include "EfiUtilityMsgs.h"\r
+\r
 //\r
 // Utility Name\r
 //\r
@@ -259,9 +262,9 @@ Routine Description:
         } else {\r
           fprintf (\r
             stdout,\r
-            "%c: - DiskNum: %d, Type: %s\n", \r
+            "%c: - DiskNum: %u, Type: %s\n", \r
             DriveInfo.VolumeLetter,\r
-            DriveInfo.DiskNumber, \r
+            (unsigned) DriveInfo.DiskNumber, \r
             DriveInfo.DriveType->Description\r
             );\r
         }\r
@@ -438,11 +441,9 @@ ProcessBsOrMbr (
   BYTE              DiskPartition[0x200] = {0};\r
   BYTE              DiskPartitionBackup[0x200] = {0};\r
   DWORD             BytesReturn;\r
-  DWORD             DbrOffset;\r
   INT               DrvNumOffset;\r
   HANDLE            InputHandle;\r
   HANDLE            OutputHandle;\r
-  BOOL              WriteToDisk;\r
   ERROR_STATUS      Status;\r
   DWORD             InputDbrOffset;\r
   DWORD             OutputDbrOffset;\r
@@ -731,7 +732,7 @@ main (
         return 1;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);\r
         return 1;\r
       }\r
       SetPrintLevel (LogLevel);\r
index 63900b64611489a08a2cad74031df653f71163a0..a94f9202fef831b846a9a148e5b3afd6a081eb3d 100644 (file)
@@ -22,6 +22,7 @@ Abstract:
 #include <stdlib.h>\r
 #include <string.h>\r
 \r
+#include "ParseInf.h"\r
 #include "EfiUtilityMsgs.h"\r
 #include "CommonLib.h"\r
 #include "Crc32.h"\r
@@ -104,7 +105,7 @@ Returns:
 \r
 int\r
 main (\r
-  INT32 argc,\r
+  int   argc,\r
   CHAR8 *argv[]\r
   )\r
 /*++\r
@@ -222,7 +223,7 @@ Returns:
         goto Finish;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);\r
         goto Finish;\r
       }\r
       SetPrintLevel (LogLevel);\r
@@ -294,7 +295,7 @@ Returns:
   \r
   fread (FileBuffer, 1, FileSize, InFile);\r
   fclose (InFile);\r
-  VerboseMsg ("the size of the input file is %d bytes", FileSize);\r
+  VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);\r
   \r
   //\r
   // Open output file\r
@@ -318,9 +319,9 @@ Returns:
     // Done, write output file.\r
     //\r
     fwrite (&Crc32Value, 1, sizeof (Crc32Value), OutFile);\r
-    VerboseMsg ("The calculated CRC32 value is 0x%08x", Crc32Value);\r
+    VerboseMsg ("The calculated CRC32 value is 0x%08x", (unsigned) Crc32Value);\r
     fwrite (FileBuffer, 1, FileSize, OutFile);\r
-    VerboseMsg ("the size of the encoded file is %d bytes", FileSize + sizeof (UINT32));\r
+    VerboseMsg ("the size of the encoded file is %u bytes", (unsigned) FileSize + sizeof (UINT32));\r
   } else {\r
     //\r
     // Verify Crc32 Value\r
@@ -330,7 +331,7 @@ Returns:
       Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");\r
       goto Finish;\r
     }\r
-    VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", Crc32Value, *(UINT32 *)FileBuffer);\r
+    VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", (unsigned) Crc32Value, (unsigned) (*(UINT32 *)FileBuffer));\r
     if (Crc32Value != *(UINT32 *)FileBuffer) {\r
       Error (NULL, 0, 3000, "Invalid", "CRC32 value of input file is not correct!");\r
       Status = STATUS_ERROR;\r
@@ -340,7 +341,7 @@ Returns:
     // Done, write output file.\r
     //\r
     fwrite (FileBuffer + sizeof (UINT32), 1, FileSize - sizeof (UINT32), OutFile);\r
-    VerboseMsg ("the size of the decoded file is %d bytes", FileSize - sizeof (UINT32));\r
+    VerboseMsg ("the size of the decoded file is %u bytes", (unsigned) FileSize - sizeof (UINT32));\r
   }\r
 \r
 Finish:\r
index e8cd09e947600a8a7c08b0246e7f1ad5267df1e5..12a3b2f18cb2eeb7f5b4856832346b64f33333a6 100644 (file)
@@ -322,7 +322,7 @@ Returns:
     FileSize = ftell (InFile);\r
     fseek (InFile, 0, SEEK_SET);\r
     DebugMsg (NULL, 0, 9, "Input section files", \r
-              "the input section name is %s and the size is %d bytes", InputFileName[Index], FileSize); \r
+              "the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize); \r
 \r
     //\r
     // Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.\r
@@ -374,7 +374,7 @@ Returns:
         SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);\r
       }\r
       DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment", \r
-                "Pad Raw section size is %d", Offset);\r
+                "Pad Raw section size is %u", (unsigned) Offset);\r
 \r
       Size = Size + Offset;\r
     }\r
@@ -409,7 +409,7 @@ Returns:
 \r
 int\r
 main (\r
-  INT32 argc,\r
+  int   argc,\r
   CHAR8 *argv[]\r
   )\r
 /*++\r
@@ -679,7 +679,7 @@ Returns:
         goto Finish;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);\r
         goto Finish;\r
       }\r
       SetPrintLevel (LogLevel);\r
@@ -719,7 +719,7 @@ Returns:
   VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);\r
   VerboseMsg ("Output file name is %s", OutputFileName);\r
   VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
-                FileGuid.Data1,\r
+                (unsigned) FileGuid.Data1,\r
                 FileGuid.Data2,\r
                 FileGuid.Data3,\r
                 FileGuid.Data4[0],\r
@@ -744,7 +744,7 @@ Returns:
       //\r
       InputFileAlign[Index] = 1;\r
     }\r
-    VerboseMsg ("the %dth input section name is %s and section alignment is %d", Index, InputFileName[Index], InputFileAlign[Index]);\r
+    VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);\r
   }\r
   \r
   //\r
@@ -763,7 +763,7 @@ Returns:
   if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE || \r
       FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||\r
       FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {\r
-    Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %d Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);\r
+    Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);\r
     goto Finish;\r
   }\r
   \r
@@ -810,7 +810,7 @@ Returns:
   //\r
   // Update FFS Alignment based on the max alignment required by input section files \r
   //\r
-  VerboseMsg ("the max alignment of all input sections is %d", MaxAlignment); \r
+  VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment); \r
   for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {\r
     if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {\r
       break;\r
@@ -819,14 +819,14 @@ Returns:
   if (FfsAlign < Index) {\r
     FfsAlign = Index;\r
   }\r
-  VerboseMsg ("the alignment of the genreated FFS file is %d", mFfsValidAlign [FfsAlign + 1]);  \r
-  FfsFileHeader.Attributes = FfsAttrib | (FfsAlign << 3);\r
+  VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);  \r
+  FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));\r
   \r
   //\r
   // Now FileSize includes the EFI_FFS_FILE_HEADER\r
   //\r
   FileSize += sizeof (EFI_FFS_FILE_HEADER);\r
-  VerboseMsg ("the size of the genreated FFS file is %d bytes", FileSize);\r
+  VerboseMsg ("the size of the generated FFS file is %u bytes", (unsigned) FileSize);\r
   FfsFileHeader.Size[0]  = (UINT8) (FileSize & 0xFF);\r
   FfsFileHeader.Size[1]  = (UINT8) ((FileSize & 0xFF00) >> 8);\r
   FfsFileHeader.Size[2]  = (UINT8) ((FileSize & 0xFF0000) >> 16);\r
index e080422e5488134eec0066fd28c7f4f579b1d1c9..f2ff2d29cd00ce503342653e976c16f1dfcfb43c 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2007 - 2008, Intel Corporation                                                         \r
+Copyright (c) 2007 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -141,7 +141,7 @@ Returns:
   fprintf (stdout, "  --FvNameGuid          GuidValue is the Fv Name Guid value.\n\\r
                         Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");\r
   fprintf (stdout, "  --capflag CapFlag     Capsule Reset Flag can be PersistAcrossReset,\n\\r
-                        or PopulateSystemTable or not set.\n");\r
+                        or PopulateSystemTable or InitiateReset or not set\n");\r
   fprintf (stdout, "  --capheadsize HeadSize\n\\r
                         HeadSize is one HEX or DEC format value\n\\r
                         HeadSize is required by Capsule Image.\n");                        \r
@@ -218,6 +218,7 @@ Returns:
   Index         = 0;\r
   mFvTotalSize  = 0;\r
   mFvTakenSize  = 0;\r
+  Status        = EFI_SUCCESS;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
   \r
@@ -232,10 +233,10 @@ Returns:
   //\r
   memset (&mFvDataInfo, 0, sizeof (FV_INFO));\r
   memset (&mCapDataInfo, 0, sizeof (CAP_INFO)); \r
-       //\r
-       // Set the default FvGuid\r
-       //\r
-       memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));\r
+  //\r
+  // Set the default FvGuid\r
+  //\r
+  memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));\r
    \r
   //\r
   // Parse command line\r
@@ -312,7 +313,7 @@ Returns:
         return STATUS_ERROR;        \r
       }\r
       mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;\r
-      DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%x", EFI_BLOCK_SIZE_STRING, TempNumber);\r
+      DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);\r
       argc -= 2;\r
       argv += 2;\r
       continue; \r
@@ -329,7 +330,7 @@ Returns:
         return STATUS_ERROR;        \r
       }\r
       mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;\r
-      DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%x", EFI_NUM_BLOCKS_STRING, TempNumber);\r
+      DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);\r
       argc -= 2;\r
       argv += 2;\r
       continue; \r
@@ -341,7 +342,7 @@ Returns:
         return STATUS_ERROR;\r
       }\r
       strcpy (mFvDataInfo.FvFiles[Index], argv[1]);\r
-      DebugMsg (NULL, 0, 9, "FV component file", "the %dth name is %s", Index + 1, argv[1]);\r
+      DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index + 1, argv[1]);\r
       argc -= 2;\r
       argv += 2;\r
 \r
@@ -356,8 +357,8 @@ Returns:
                        Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
                        return STATUS_ERROR;        \r
                      }\r
-                     mFvDataInfo.SizeofFvFiles[Index] = TempNumber;\r
-               DebugMsg (NULL, 0, 9, "FV component file size", "the %dth size is %s", Index + 1, argv[1]);\r
+                     mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;\r
+               DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);\r
                argc -= 2;\r
                argv += 2;\r
         }\r
@@ -388,7 +389,7 @@ Returns:
         return STATUS_ERROR;        \r
       }\r
       mCapDataInfo.HeaderSize = (UINT32) TempNumber;\r
-      DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%x", EFI_CAPSULE_HEADER_SIZE_STRING, TempNumber);\r
+      DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);\r
       argc -= 2;\r
       argv += 2;\r
       continue; \r
@@ -406,6 +407,8 @@ Returns:
         mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;\r
       } else if (strcmp (argv[1], "PersistAcrossReset") == 0) {\r
         mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;\r
+      } else if (strcmp (argv[1], "InitiateReset") == 0) {\r
+        mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET;\r
       } else {\r
         Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
         return STATUS_ERROR;\r
@@ -506,7 +509,7 @@ Returns:
         return STATUS_ERROR;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);\r
         return STATUS_ERROR;\r
       }\r
       SetPrintLevel (LogLevel);\r
@@ -625,20 +628,20 @@ Returns:
     }\r
     fprintf (FpFile, "Capsule %s Image Header Information\n", InfFileName);\r
     fprintf (FpFile, "  GUID                  %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n", \r
-                    CapsuleHeader->CapsuleGuid.Data1,\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data2,\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data3,\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[0],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[1],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[2],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[3],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[4],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[5],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[6],\r
-                    (UINT32) CapsuleHeader->CapsuleGuid.Data4[7]);\r
-    fprintf (FpFile, "  Header size           0x%08X\n", CapsuleHeader->HeaderSize);\r
-    fprintf (FpFile, "  Flags                 0x%08X\n", CapsuleHeader->Flags);\r
-    fprintf (FpFile, "  Capsule image size    0x%08X\n", CapsuleHeader->CapsuleImageSize);\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data1,\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data2,\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data3,\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[0],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[1],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[2],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[3],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[4],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[5],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[6],\r
+                    (unsigned) CapsuleHeader->CapsuleGuid.Data4[7]);\r
+    fprintf (FpFile, "  Header size           0x%08X\n", (unsigned) CapsuleHeader->HeaderSize);\r
+    fprintf (FpFile, "  Flags                 0x%08X\n", (unsigned) CapsuleHeader->Flags);\r
+    fprintf (FpFile, "  Capsule image size    0x%08X\n", (unsigned) CapsuleHeader->CapsuleImageSize);\r
     fclose (FpFile);\r
   } else if (CapsuleFlag) {\r
     VerboseMsg ("Create capsule image");\r
@@ -657,7 +660,7 @@ Returns:
   } else {\r
     VerboseMsg ("Create Fv image and its map file");\r
     if (mFvDataInfo.BaseAddress != 0) {\r
-      VerboseMsg ("FvImage Rebase Address is 0x%X", mFvDataInfo.BaseAddress);\r
+      VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);\r
     }\r
     //\r
     // Call the GenerateFvImage to generate Fv Image\r
@@ -690,21 +693,29 @@ Returns:
     fprintf (FpFile, "\n");\r
     if (mFvDataInfo.BootBaseAddress != 0) {\r
       fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING);\r
-      fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.BootBaseAddress);\r
-      DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.BootBaseAddress);\r
+      fprintf (\r
+        FpFile,\r
+        " = 0x%llx\n",\r
+        (unsigned long long)mFvDataInfo.BootBaseAddress\r
+        );\r
+      DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.BootBaseAddress);\r
     }\r
     if (mFvDataInfo.RuntimeBaseAddress != 0) {\r
       fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING);\r
-      fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.RuntimeBaseAddress);\r
-      DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.RuntimeBaseAddress);\r
+      fprintf (\r
+        FpFile,\r
+        " = 0x%llx\n",\r
+        (unsigned long long)mFvDataInfo.RuntimeBaseAddress\r
+        );\r
+      DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.RuntimeBaseAddress);\r
     }\r
     fclose (FpFile);\r
   }\r
   \r
   if (Status == EFI_SUCCESS) {\r
-    DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, mFvTotalSize);\r
-    DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, mFvTakenSize);\r
-    DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, mFvTotalSize - mFvTakenSize);\r
+    DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);\r
+    DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);\r
+    DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, (unsigned) (mFvTotalSize - mFvTakenSize));\r
   }\r
 \r
   VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());\r
index ad3e7a6e080ccf2022f6be12f7d2e09fcc0b44e8..917baa11e83d775d115c96235e869a8f34939166 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation                                                         \r
+Copyright (c) 2004 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -184,7 +184,8 @@ Returns:
 {\r
   CHAR8       Value[_MAX_PATH];\r
   UINT64      Value64;\r
-  UINTN       Index, Number, Index1;\r
+  UINTN       Index;\r
+  UINTN       Number;\r
   EFI_STATUS  Status;\r
   EFI_GUID    GuidValue;\r
 \r
@@ -371,7 +372,7 @@ Returns:
       // Add the file\r
       //\r
       strcpy (FvInfo->FvFiles[Number + Index], Value);\r
-      DebugMsg (NULL, 0, 9, "FV component file", "the %dth name is %s", Index, Value);\r
+      DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index, Value);\r
     } else {\r
       break;\r
     }\r
@@ -514,6 +515,7 @@ EFI_STATUS
 AddPadFile (\r
   IN OUT MEMORY_FILE  *FvImage,\r
   IN UINT32           DataAlignment,\r
+  IN VOID             *FvEnd,\r
   IN EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHeader\r
   )\r
 /*++\r
@@ -525,9 +527,10 @@ Routine Description:
 \r
 Arguments:\r
 \r
-  FvImage         The memory image of the FV to add it to.  The current offset\r
-                  must be valid.\r
+  FvImage         The memory image of the FV to add it to.\r
+                  The current offset must be valid.\r
   DataAlignment   The data alignment of the next FFS file.\r
+  FvEnd           End of the empty data in FvImage.\r
   ExtHeader       PI FvExtHeader Optional \r
 \r
 Returns:\r
@@ -556,30 +559,6 @@ Returns:
     return EFI_SUCCESS;\r
   }\r
 \r
-  //\r
-  // Write pad file header\r
-  //\r
-  PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;\r
-\r
-  //\r
-  // Verify that we have enough space for the file header\r
-  //\r
-  if (ExtHeader != NULL) {\r
-    if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER) + ExtHeader->ExtHeaderSize) >= (UINTN) FvImage->Eof) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }    \r
-  } else {\r
-    if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER)) >= (UINTN) FvImage->Eof) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-  }\r
-\r
-  //\r
-  // write PadFile FFS header with PadType, don't need to set PAD file guid in its header.\r
-  //\r
-  PadFile->Type       = EFI_FV_FILETYPE_FFS_PAD;\r
-  PadFile->Attributes = 0;\r
-\r
   //\r
   // Calculate the pad file size\r
   //\r
@@ -587,11 +566,7 @@ Returns:
   // This is the earliest possible valid offset (current plus pad file header\r
   // plus the next file header)\r
   //\r
-  if (ExtHeader != NULL) {\r
-    PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2) + ExtHeader->ExtHeaderSize;\r
-  } else {\r
-    PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2);\r
-  }\r
+  PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2);\r
 \r
   //\r
   // Add whatever it takes to get to the next aligned address\r
@@ -609,6 +584,31 @@ Returns:
   //\r
   PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage;\r
   \r
+  //\r
+  // Append extension header size\r
+  //\r
+  if (ExtHeader != NULL) {\r
+    PadFileSize = PadFileSize + ExtHeader->ExtHeaderSize;\r
+  }\r
+\r
+  //\r
+  // Verify that we have enough space for the file header\r
+  //\r
+  if (((UINTN) FvImage->CurrentFilePointer + PadFileSize) > (UINTN) FvEnd) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  //\r
+  // Write pad file header\r
+  //\r
+  PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;\r
+\r
+  //\r
+  // Write PadFile FFS header with PadType, don't need to set PAD file guid in its header.\r
+  //\r
+  PadFile->Type       = EFI_FV_FILETYPE_FFS_PAD;\r
+  PadFile->Attributes = 0;\r
+\r
   //\r
   // Write pad file size (calculated size minus next file header size)\r
   //\r
@@ -630,26 +630,26 @@ Returns:
     (EFI_FFS_FILE_HEADER *) PadFile,\r
     (EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage\r
     );\r
-  \r
+\r
+  //\r
+  // Update the current FV pointer\r
+  //\r
+  FvImage->CurrentFilePointer += PadFileSize;\r
+\r
   if (ExtHeader != NULL) {\r
     //\r
     // Copy Fv Extension Header and Set Fv Extension header offset\r
     //\r
     memcpy (PadFile + 1, ExtHeader, ExtHeader->ExtHeaderSize);\r
     ((EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage)->ExtHeaderOffset = (UINT16) ((UINTN) (PadFile + 1) - (UINTN) FvImage->FileImage);\r
+         //\r
+         // Make next file start at QWord Boundry\r
+         //\r
+         while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {\r
+           FvImage->CurrentFilePointer++;\r
+         }\r
   }\r
 \r
-  //\r
-  // Verify that we have enough space (including the padding)\r
-  //\r
-  if (((UINTN)PadFile + PadFileSize) >= (UINTN) FvImage->Eof) {\r
-    return EFI_OUT_OF_RESOURCES;\r
-  }\r
-  //\r
-  // Update the current FV pointer\r
-  //\r
-  FvImage->CurrentFilePointer += PadFileSize;\r
-\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -726,7 +726,7 @@ Returns:
   EFI_IMAGE_OPTIONAL_HEADER_UNION     *ImgHdr;\r
   EFI_TE_IMAGE_HEADER                 *TEImageHeader;\r
   EFI_IMAGE_SECTION_HEADER            *SectionHeader;\r
-  \r
+  unsigned long long                  TempLongAddress;\r
   //\r
   // Init local variable\r
   //\r
@@ -806,20 +806,20 @@ Returns:
   //\r
   if (ImageBaseAddress == 0) {\r
     fprintf (FvMapFile, "%s (dummy) (", KeyWord);\r
-    fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress);\r
+    fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) ImageBaseAddress);\r
   } else {\r
     fprintf (FvMapFile, "%s (", KeyWord);\r
-    fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress + Offset);\r
+    fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) (ImageBaseAddress + Offset));\r
   }\r
-  fprintf (FvMapFile, "EntryPoint=%08lx, ", ImageBaseAddress + AddressOfEntryPoint);\r
+  fprintf (FvMapFile, "EntryPoint=%08llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));\r
   fprintf (FvMapFile, "GUID=%s", FileGuidName);\r
   fprintf (FvMapFile, ")\n"); \r
   \r
   for (; Index > 0; Index --, SectionHeader ++) {\r
         if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {\r
-               fprintf (FvMapFile, ".textbaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress);\r
+               fprintf (FvMapFile, ".textbaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));\r
        } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {\r
-         fprintf (FvMapFile, ".databaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress);\r
+         fprintf (FvMapFile, ".databaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));\r
        }\r
   }\r
   fprintf (FvMapFile, "\n\n"); \r
@@ -869,25 +869,27 @@ Returns:
     // Printf Function Information\r
     //\r
     if (FunctionType == 1) {\r
-      sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);\r
+      sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);\r
+      FunctionAddress = (UINT64) TempLongAddress;\r
       if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {\r
-        fprintf (FvMapFile, "  %016lx ", ImageBaseAddress + FunctionAddress);\r
-        fprintf (FvMapFile, "(%08lx) F  ", FunctionAddress - Offset);\r
+        fprintf (FvMapFile, "  %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));\r
+        fprintf (FvMapFile, "(%08llx) F  ", (unsigned long long) (FunctionAddress - Offset));\r
         fprintf (FvMapFile, "%s\n", FunctionName);\r
     } else {\r
-        fprintf (FvMapFile, "  %016lx ", ImageBaseAddress + FunctionAddress);\r
-        fprintf (FvMapFile, "(%08lx)    ", FunctionAddress - Offset);\r
+        fprintf (FvMapFile, "  %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));\r
+        fprintf (FvMapFile, "(%08llx)    ", (unsigned long long) (FunctionAddress - Offset));\r
         fprintf (FvMapFile, "%s\n", FunctionName);\r
       }\r
     } else if (FunctionType == 2) {\r
-      sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);\r
+      sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);\r
+      FunctionAddress = (UINT64) TempLongAddress;\r
       if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {\r
-        fprintf (FvMapFile, "  %016lx ", ImageBaseAddress + FunctionAddress);\r
-        fprintf (FvMapFile, "(%08lx) FS ", FunctionAddress - Offset);\r
+        fprintf (FvMapFile, "  %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));\r
+        fprintf (FvMapFile, "(%08llx) FS ", (unsigned long long) (FunctionAddress - Offset));\r
         fprintf (FvMapFile, "%s\n", FunctionName);\r
       } else {\r
-        fprintf (FvMapFile, "  %016lx ", ImageBaseAddress + FunctionAddress);\r
-        fprintf (FvMapFile, "(%08lx)    ", FunctionAddress - Offset);\r
+        fprintf (FvMapFile, "  %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));\r
+        fprintf (FvMapFile, "(%08llx)    ", (unsigned long long) (FunctionAddress - Offset));\r
         fprintf (FvMapFile, "%s\n", FunctionName);\r
       }\r
     }\r
@@ -1028,7 +1030,7 @@ Returns:
   //\r
   for (Index1 = 0; Index1 < Index; Index1 ++) {\r
     if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {\r
-      Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %dth file have the same file GUID.", Index1 + 1, Index + 1);\r
+      Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %uth file have the same file GUID.", (unsigned) Index1 + 1, (unsigned) Index + 1);\r
       PrintGuid ((EFI_GUID *) FileBuffer);\r
       return EFI_INVALID_PARAMETER;\r
     }\r
@@ -1067,7 +1069,7 @@ Returns:
       // Sanity check. The file MUST align appropriately\r
       //\r
       if (((UINTN) *VtfFileImage + sizeof (EFI_FFS_FILE_HEADER) - (UINTN) FvImage->FileImage) % (1 << CurrentFileAlignment)) {\r
-        Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %d-byte boundary.", 1 << CurrentFileAlignment);\r
+        Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %u-byte boundary.", (unsigned) (1 << CurrentFileAlignment));\r
         free (FileBuffer);\r
         return EFI_ABORTED;\r
       }\r
@@ -1096,7 +1098,7 @@ Returns:
   //\r
   // Add pad file if necessary\r
   //\r
-  Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, NULL);\r
+  Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, *VtfFileImage, NULL);\r
   if (EFI_ERROR (Status)) {\r
     Error (NULL, 0, 4002, "Resource", "FV space is full, could not add pad file for data alignment property.");\r
     free (FileBuffer);\r
@@ -1105,7 +1107,7 @@ Returns:
   //\r
   // Add file\r
   //\r
-  if ((FvImage->CurrentFilePointer + FileSize) < FvImage->Eof) {\r
+  if ((UINTN) (FvImage->CurrentFilePointer + FileSize) <= (UINTN) (*VtfFileImage)) {\r
     //\r
     // Rebase the PE or TE image in FileBuffer of FFS file for XIP. \r
     // Rebase Bs and Rt drivers for the debug genfvmap tool.\r
@@ -1174,6 +1176,10 @@ Returns:
     return EFI_SUCCESS;\r
   }\r
 \r
+  if ((UINTN) VtfFileImage < (UINTN) FvImage->CurrentFilePointer) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   //\r
   // Pad file starts at beginning of free space\r
   //\r
@@ -1261,11 +1267,11 @@ Returns:
   UINT8                     *BytePointer2;\r
   UINT16                    *WordPointer;\r
   UINT16                    CheckSum;\r
+  UINT32                    IpiVector;\r
   UINTN                     Index;\r
   EFI_FFS_FILE_STATE        SavedState;\r
   UINT64                    FitAddress;\r
   FIT_TABLE                 *FitTablePtr;\r
-  UINT32                    IpiVector;\r
 \r
   //\r
   // Verify input parameters\r
@@ -1325,7 +1331,7 @@ Returns:
   SecCorePhysicalAddress = FvInfo->BaseAddress;\r
   SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;\r
   SecCorePhysicalAddress += EntryPoint;\r
-  DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%X", SecCorePhysicalAddress); \r
+  DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress); \r
 \r
   //\r
   // Find the PEI Core\r
@@ -1365,7 +1371,7 @@ Returns:
   PeiCorePhysicalAddress = FvInfo->BaseAddress;\r
   PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;\r
   PeiCorePhysicalAddress += EntryPoint;\r
-  DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress);\r
+  DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);\r
 \r
   if (MachineType == EFI_IMAGE_MACHINE_IA64) {\r
     //\r
@@ -1381,8 +1387,8 @@ Returns:
     //\r
     if (PeiCorePhysicalAddress & 0xF) {\r
       Error (NULL, 0, 3000, "Invalid",\r
-        "PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %Xh.",\r
-        PeiCorePhysicalAddress\r
+        "PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %llXh.",\r
+        (unsigned long long) PeiCorePhysicalAddress\r
         );\r
       return EFI_ABORTED;\r
     }\r
@@ -1411,8 +1417,8 @@ Returns:
     //\r
     if (SecCorePhysicalAddress & 0xF) {\r
       Error (NULL, 0, 3000, "Invalid",\r
-        "SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %Xh.",\r
-        SecCorePhysicalAddress\r
+        "SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %llXh.",\r
+        (unsigned long long) SecCorePhysicalAddress\r
         );\r
       return EFI_ABORTED;\r
     }\r
@@ -1448,7 +1454,7 @@ Returns:
     // \r
     Ia32ResetAddressPtr  = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET);\r
     \r
-    Ia32SecEntryOffset   = SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2);\r
+    Ia32SecEntryOffset   = (INT32) (SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2));\r
     if (Ia32SecEntryOffset <= -65536) {\r
       Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K.");\r
       return STATUS_ERROR;\r
@@ -1461,7 +1467,7 @@ Returns:
     //\r
     Ia32ResetAddressPtr   = (UINT32 *) ((UINTN) FvImage->Eof - 4);\r
     *Ia32ResetAddressPtr  = (UINT32) (FvInfo->BaseAddress);\r
-    DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%X.", FvInfo->BaseAddress);\r
+    DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%llX.", (unsigned long long) FvInfo->BaseAddress);\r
 \r
     //\r
     // Update the Startup AP in the FVH header block ZeroVector region.\r
@@ -1507,9 +1513,9 @@ Returns:
     //\r
     // IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV. \r
     //\r
-    IpiVector  = FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer);\r
-    DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", IpiVector);\r
-    if (IpiVector & 0xFFF != 0) {\r
+    IpiVector  = (UINT32) (FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer));\r
+    DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", (unsigned) IpiVector);\r
+    if ((IpiVector & 0xFFF) != 0) {\r
       Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned");\r
       return EFI_ABORTED;\r
     }\r
@@ -1527,7 +1533,7 @@ Returns:
     // Volume Top File, but if you have one for some reason don't crash...\r
     //\r
   } else {\r
-    Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", (UINT32) MachineType);\r
+    Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", MachineType);\r
     return EFI_ABORTED;\r
   }\r
 \r
@@ -1575,7 +1581,7 @@ Routine Description:
   FIQ              +24\r
 \r
   We support two schemes on ARM.\r
-  1) Begining of the FV is the reset vector\r
+  1) Beginning of the FV is the reset vector\r
   2) Reset vector is data bytes FDF file and that code branches to reset vector \r
     in the beginning of the FV (fixed size offset).\r
 \r
@@ -1671,7 +1677,7 @@ Returns:
       PeiCorePhysicalAddress = FvInfo->BaseAddress;\r
       PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;\r
       PeiCorePhysicalAddress += EntryPoint;\r
-      DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress);\r
+      DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);\r
 \r
       if (MachineType == EFI_IMAGE_MACHINE_ARMT) {\r
         memset (ResetVector, 0, sizeof (ResetVector));\r
@@ -1726,7 +1732,7 @@ Returns:
   SecCorePhysicalAddress = FvInfo->BaseAddress;\r
   SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;\r
   SecCorePhysicalAddress += EntryPoint;\r
-  DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%X", SecCorePhysicalAddress); \r
+  DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress); \r
 \r
   //\r
   // Find the PEI Core. It may not exist if SEC loads DXE core directly\r
@@ -1764,7 +1770,7 @@ Returns:
     PeiCorePhysicalAddress = FvInfo->BaseAddress;\r
     PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;\r
     PeiCorePhysicalAddress += EntryPoint;\r
-    DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress);\r
+    DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);\r
   }\r
   \r
   \r
@@ -1880,7 +1886,7 @@ Returns:
     // Verify NT header is expected\r
     //\r
     if (ImgHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {\r
-      Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", ImgHdr->Pe32.Signature);\r
+      Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", (unsigned) ImgHdr->Pe32.Signature);\r
       return EFI_UNSUPPORTED;\r
     }\r
     //\r
@@ -1990,7 +1996,7 @@ Returns:
   //\r
   if (mFvDataInfo.FvFileSystemGuidSet) {\r
     DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
-                  mFvDataInfo.FvFileSystemGuid.Data1,\r
+                  (unsigned) mFvDataInfo.FvFileSystemGuid.Data1,\r
                   mFvDataInfo.FvFileSystemGuid.Data2,\r
                   mFvDataInfo.FvFileSystemGuid.Data3,\r
                   mFvDataInfo.FvFileSystemGuid.Data4[0],\r
@@ -2007,7 +2013,7 @@ Returns:
   //\r
   if (mFvDataInfo.FvNameGuidSet) {\r
       DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
-                  mFvDataInfo.FvNameGuid.Data1,\r
+                  (unsigned) mFvDataInfo.FvNameGuid.Data1,\r
                   mFvDataInfo.FvNameGuid.Data2,\r
                   mFvDataInfo.FvNameGuid.Data3,\r
                   mFvDataInfo.FvNameGuid.Data4[0],\r
@@ -2043,7 +2049,7 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     return Status;    \r
   }\r
-  VerboseMsg ("the generated FV image size is %d bytes", mFvDataInfo.Size);\r
+  VerboseMsg ("the generated FV image size is %u bytes", (unsigned) mFvDataInfo.Size);\r
   \r
   //\r
   // support fv image and empty fv image\r
@@ -2120,7 +2126,7 @@ Returns:
   //\r
   // If there is no FFS file, generate one empty FV\r
   //\r
-  if (mFvDataInfo.FvFiles[0][0] == 0) {\r
+  if (mFvDataInfo.FvFiles[0][0] == 0 && !mFvDataInfo.FvNameGuidSet) {\r
     goto WriteFile;\r
   }\r
 \r
@@ -2155,15 +2161,15 @@ Returns:
   //\r
   if (mFvTotalSize != 0) {\r
     fprintf (FvMapFile, EFI_FV_TOTAL_SIZE_STRING);\r
-    fprintf (FvMapFile, " = 0x%x\n", mFvTotalSize);\r
+    fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTotalSize);\r
   }\r
   if (mFvTakenSize != 0) {\r
     fprintf (FvMapFile, EFI_FV_TAKEN_SIZE_STRING);\r
-    fprintf (FvMapFile, " = 0x%x\n", mFvTakenSize);\r
+    fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTakenSize);\r
   }\r
   if (mFvTotalSize != 0 && mFvTakenSize != 0) {\r
     fprintf (FvMapFile, EFI_FV_SPACE_SIZE_STRING);\r
-    fprintf (FvMapFile, " = 0x%x\n\n", mFvTotalSize - mFvTakenSize);\r
+    fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize));\r
   }\r
 \r
   //\r
@@ -2172,7 +2178,7 @@ Returns:
   if (mFvDataInfo.FvNameGuidSet) {\r
     memcpy (&FvExtHeader.FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));\r
     FvExtHeader.ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);\r
-    AddPadFile (&FvImageMemoryFile, 8, &FvExtHeader);\r
+    AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, &FvExtHeader);\r
     //\r
     // Fv Extension header change update Fv Header Check sum\r
     //\r
@@ -2382,7 +2388,9 @@ Returns:
   UINT32              FfsAlignment;\r
   EFI_FFS_FILE_HEADER FfsHeader;\r
   BOOLEAN             VtfFileFlag;\r
+  UINTN               VtfFileSize;\r
   \r
+  VtfFileSize = 0;\r
   VtfFileFlag = FALSE;\r
   fpin  = NULL;\r
   Index = 0;\r
@@ -2453,24 +2461,22 @@ Returns:
                return EFI_ABORTED;\r
              }\r
              VtfFileFlag = TRUE;\r
-             //\r
-             // The space between Vft File and the latest file must be able to contain \r
-             // one ffs file header in order to add one pad file.\r
-             //\r
-             CurrentOffset += sizeof (EFI_FFS_FILE_HEADER);\r
-           }\r
-           //\r
-           // Get the alignment of FFS file \r
-           //\r
-           ReadFfsAlignment (&FfsHeader, &FfsAlignment);\r
-           FfsAlignment = 1 << FfsAlignment;\r
-           //\r
-           // Add Pad file\r
-           //\r
-           if (((CurrentOffset + sizeof (EFI_FFS_FILE_HEADER)) % FfsAlignment) != 0) {\r
-             CurrentOffset = (CurrentOffset + sizeof (EFI_FFS_FILE_HEADER) * 2 + FfsAlignment - 1) & ~(FfsAlignment - 1);\r
-             CurrentOffset -= sizeof (EFI_FFS_FILE_HEADER);\r
-           }\r
+        VtfFileSize = FfsFileSize;\r
+        continue;\r
+      }\r
+\r
+      //\r
+      // Get the alignment of FFS file \r
+      //\r
+      ReadFfsAlignment (&FfsHeader, &FfsAlignment);\r
+      FfsAlignment = 1 << FfsAlignment;\r
+      //\r
+      // Add Pad file\r
+      //\r
+      if (((CurrentOffset + sizeof (EFI_FFS_FILE_HEADER)) % FfsAlignment) != 0) {\r
+        CurrentOffset = (CurrentOffset + sizeof (EFI_FFS_FILE_HEADER) * 2 + FfsAlignment - 1) & ~(FfsAlignment - 1);\r
+        CurrentOffset -= sizeof (EFI_FFS_FILE_HEADER);\r
+      }\r
          }\r
 \r
     //\r
@@ -2489,8 +2495,8 @@ Returns:
        CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);\r
     }\r
   }\r
-  \r
-  DebugMsg (NULL, 0, 9, "FvImage size", "The caculated fv image size is 0x%x and the current set fv image size is 0x%x", CurrentOffset, FvInfoPtr->Size);\r
+  CurrentOffset += VtfFileSize;\r
+  DebugMsg (NULL, 0, 9, "FvImage size", "The caculated fv image size is 0x%x and the current set fv image size is 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);\r
   \r
   if (FvInfoPtr->Size == 0) { \r
     //\r
@@ -2504,7 +2510,7 @@ Returns:
     //\r
     // Not invalid\r
     //\r
-    Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", CurrentOffset, FvInfoPtr->Size);\r
+    Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   \r
@@ -2627,8 +2633,8 @@ Returns:
   //\r
   // Check XipAddress, BootAddress and RuntimeAddress\r
   //\r
-  Flags = 0;\r
-\r
+  Flags   = 0;\r
+  XipBase = 0;\r
   if (FvInfo->BaseAddress != 0) {\r
     Flags  |= REBASE_XIP_FILE;\r
     XipBase = FvInfo->BaseAddress + XipOffset;\r
@@ -2686,7 +2692,7 @@ Returns:
     ImageContext.ImageRead  = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;\r
     Status                  = PeCoffLoaderGetImageInfo (&ImageContext);\r
     if (EFI_ERROR (Status)) {\r
-      Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, Status);\r
+      Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);\r
       return Status;\r
     }\r
 \r
@@ -2785,7 +2791,7 @@ Returns:
           ImageContext.Handle = PeFileBuffer;\r
           Status              = PeCoffLoaderGetImageInfo (&ImageContext);\r
           if (EFI_ERROR (Status)) {\r
-            Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, Status);\r
+            Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);\r
             return Status;\r
           }\r
           ImageContext.RelocationsStripped = FALSE;\r
@@ -2935,7 +2941,7 @@ Returns:
       ImgHdr->Pe32Plus.OptionalHeader.ImageBase     = NewPe32BaseAddress;\r
     } else {\r
       Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",\r
-        (UINT32) ImgHdr->Pe32.OptionalHeader.Magic,\r
+        ImgHdr->Pe32.OptionalHeader.Magic,\r
         FileName\r
         );\r
       return EFI_ABORTED;\r
@@ -3018,7 +3024,7 @@ WritePeMap:
     ImageContext.ImageRead  = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;\r
     Status                  = PeCoffLoaderGetImageInfo (&ImageContext);\r
     if (EFI_ERROR (Status)) {\r
-      Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, Status);\r
+      Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);\r
       return Status;\r
     }\r
 \r
@@ -3101,7 +3107,7 @@ WritePeMap:
         ImageContext.Handle = PeFileBuffer;\r
         Status              = PeCoffLoaderGetImageInfo (&ImageContext);\r
         if (EFI_ERROR (Status)) {\r
-          Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, Status);\r
+          Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);\r
           return Status;\r
         }\r
         ImageContext.RelocationsStripped = FALSE;\r
@@ -3365,8 +3371,14 @@ Returns:
   if (Status == EFI_SUCCESS) {\r
     if (strstr (Value, "PopulateSystemTable") != NULL) {\r
       CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;\r
+      if (strstr (Value, "InitiateReset") != NULL) {\r
+        CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;\r
+      }\r
     } else if (strstr (Value, "PersistAcrossReset") != NULL) {\r
       CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET; \r
+      if (strstr (Value, "InitiateReset") != NULL) {\r
+        CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;\r
+      }\r
     } else {\r
       Error (NULL, 0, 2000, "Invalid parameter", "invalid Flag setting for %s.", EFI_CAPSULE_FLAGS_STRING);\r
       return EFI_ABORTED;\r
@@ -3403,7 +3415,7 @@ Returns:
       // Add the file\r
       //\r
       strcpy (CapInfo->CapFiles[Index], Value);\r
-      DebugMsg (NULL, 0, 9, "Capsule component file", "the %dth file name is %s", Index, CapInfo->CapFiles[Index]); \r
+      DebugMsg (NULL, 0, 9, "Capsule component file", "the %uth file name is %s", (unsigned) Index, CapInfo->CapFiles[Index]); \r
     } else {\r
       break;\r
     }\r
@@ -3568,7 +3580,7 @@ Returns:
   fwrite (CapBuffer, 1, CapSize, fpout);\r
   fclose (fpout);\r
   \r
-  VerboseMsg ("The size of the generated capsule image is %d bytes", CapSize);\r
+  VerboseMsg ("The size of the generated capsule image is %u bytes", (unsigned) CapSize);\r
 \r
   return EFI_SUCCESS;\r
 }\r
index d570f633d531a76f7e5f3eac67ac47a3b43b8d2d..8c648eb4073d8d05a7c8aaf3a381412dc2a0a1bd 100644 (file)
@@ -23,6 +23,7 @@ Abstract:
 \r
 #ifndef __GNUC__\r
 #include <windows.h>\r
+#include <io.h>\r
 #endif\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
@@ -43,6 +44,8 @@ Abstract:
 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>\r
 \r
 #include "CommonLib.h"\r
+#include "PeCoffLib.h"\r
+#include "ParseInf.h"\r
 #include "EfiUtilityMsgs.h"\r
 \r
 #include "elf_common.h"\r
@@ -321,6 +324,10 @@ Returns:
       ExpectedLength = sizeof(EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE);\r
       break;\r
     default:\r
+      if (AcpiHeader->Revision > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {\r
+        ExpectedLength = AcpiHeader->Length;\r
+        break;\r
+      }\r
       Error (NULL, 0, 3000, "Invalid", "FACP revision check failed.");\r
       return STATUS_ERROR;\r
     }\r
@@ -335,7 +342,10 @@ Returns:
   //\r
   case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:\r
     Facs = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)AcpiTable;\r
-    if ((Facs->Version != 0) &&\r
+    if (Facs->Version > EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) {\r
+      break;\r
+    }\r
+    if ((Facs->Version != EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&\r
         (Facs->Version != EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&\r
         (Facs->Version != EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION)){\r
       Error (NULL, 0, 3000, "Invalid", "FACS version check failed.");\r
@@ -354,8 +364,7 @@ Returns:
   //\r
   case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:\r
     if (AcpiHeader->Revision > EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION) {\r
-      Error (NULL, 0, 3000, "Invalid", "DSDT revision check failed.");\r
-      return STATUS_ERROR;\r
+      break;\r
     }\r
     if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER)) {\r
       Error (NULL, 0, 3000, "Invalid", "DSDT length check failed.");\r
@@ -367,6 +376,9 @@ Returns:
   // "APIC" Multiple APIC Description Table\r
   //\r
   case EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:\r
+    if (AcpiHeader->Revision > EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) {\r
+      break;\r
+    }\r
     if ((AcpiHeader->Revision != EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&\r
         (AcpiHeader->Revision != EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&\r
         (AcpiHeader->Revision != EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION)) {\r
@@ -383,6 +395,9 @@ Returns:
   // "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table\r
   //\r
   case EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE:\r
+    if (AcpiHeader->Revision > EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {\r
+      break;\r
+    }\r
     if (AcpiHeader->Revision != EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {\r
       Error (NULL, 0, 3000, "Invalid", "MCFG revision check failed.");\r
       return STATUS_ERROR;\r
@@ -437,7 +452,7 @@ Elf_Phdr *gPhdrBase;
 // PE section alignment.\r
 //\r
 const UINT32 CoffAlignment = 0x20;\r
-const UINT32 CoffNbrSections = 4;\r
+const UINT16 CoffNbrSections = 4;\r
 \r
 //\r
 // Current offset in coff file.\r
@@ -508,7 +523,7 @@ CheckElfHeader(
     return 0;\r
   }\r
   if (Ehdr->e_version != EV_CURRENT) {\r
-    Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%d) not EV_CURRENT (%d)", Ehdr->e_version, EV_CURRENT);\r
+    Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) Ehdr->e_version, EV_CURRENT);\r
     return 0;\r
   }\r
 \r
@@ -707,7 +722,7 @@ ScanSections(
   }\r
 \r
   NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections;\r
-  NtHdr->Pe32.FileHeader.TimeDateStamp = time(NULL);\r
+  NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL);\r
   NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0;\r
   NtHdr->Pe32.FileHeader.NumberOfSymbols = 0;\r
   NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader);\r
@@ -787,7 +802,7 @@ WriteSections(
         //\r
         //  Ignore for unkown section type.\r
         //\r
-        VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (UINTN)Shdr->sh_type);\r
+        VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type);\r
         break;\r
       }\r
     }\r
@@ -846,7 +861,7 @@ WriteSections(
               - (SecOffset - SecShdr->sh_addr);\r
             break;\r
           default:\r
-            Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF_R_TYPE(Rel->r_info));\r
+            Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));\r
           }\r
         } else if (Ehdr->e_machine == EM_ARM) {\r
           switch (ELF32_R_TYPE(Rel->r_info)) {\r
@@ -862,7 +877,7 @@ WriteSections(
             *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + CoffSectionsOffset[Sym->st_shndx];\r
             break;\r
           default:\r
-            Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF32_R_TYPE(Rel->r_info));\r
+            Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));\r
           }\r
         }\r
       }\r
@@ -918,7 +933,7 @@ CoffAddFixup(
   //\r
   // Fill the entry.\r
   //\r
-  CoffAddFixupEntry((Type << 12) | (Offset & 0xfff));\r
+  CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));\r
 }\r
 \r
 \r
@@ -976,7 +991,7 @@ WriteRelocations(
               EFI_IMAGE_REL_BASED_HIGHLOW);\r
               break;\r
             default:\r
-              Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF_R_TYPE(Rel->r_info));\r
+              Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));\r
             }\r
           } else if (Ehdr->e_machine == EM_ARM) {\r
             switch (ELF32_R_TYPE(Rel->r_info)) {\r
@@ -993,10 +1008,10 @@ WriteRelocations(
                 );\r
               break;\r
             default:\r
-              Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF32_R_TYPE(Rel->r_info));\r
+              Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));\r
             }\r
           } else {\r
-            Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %d (processor type).", Ehdr->e_machine);\r
+            Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) Ehdr->e_machine);\r
           }\r
         }\r
       }\r
@@ -1214,19 +1229,20 @@ ZeroXdataSection (
   CHAR8  KeyWord [MAX_LINE_LEN];\r
   CHAR8  SectionName [MAX_LINE_LEN];\r
   UINT32 FunctionType = 0;\r
-  UINT32 SectionOffset;\r
-  UINT32 SectionLength;\r
-  UINT32 SectionNumber;\r
+  unsigned SectionOffset = 0;\r
+  unsigned SectionLength = 0;\r
+  unsigned SectionNumber = 0;\r
   CHAR8  *PdbPointer;\r
-  INT32  Index = 0;\r
+  INT32  Index;\r
+  UINT32 Index2;\r
 \r
-  for (Index = 0; Index < SectionTotalNumber; Index ++) {\r
-    if (stricmp ((char *)SectionHeader[Index].Name, ".zdata") == 0) {\r
+  for (Index2 = 0; Index2 < SectionTotalNumber; Index2++) {\r
+    if (stricmp ((char *)SectionHeader[Index2].Name, ".zdata") == 0) {\r
       //\r
       // try to zero the customized .zdata section, which is mapped to .xdata\r
       //\r
-      memset (FileBuffer + SectionHeader[Index].PointerToRawData, 0, SectionHeader[Index].SizeOfRawData);\r
-      DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[Index].PointerToRawData, SectionHeader[Index].SizeOfRawData);\r
+      memset (FileBuffer + SectionHeader[Index2].PointerToRawData, 0, SectionHeader[Index2].SizeOfRawData);\r
+      DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[Index2].PointerToRawData, (unsigned) SectionHeader[Index2].SizeOfRawData);\r
       return;\r
     }\r
   }\r
@@ -1329,7 +1345,7 @@ ZeroXdataSection (
   // Zero .xdata Section data\r
   //\r
   memset (FileBuffer + SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, 0, SectionLength);\r
-  DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength);\r
+  DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength);\r
   fclose (fpMapFile);\r
   return;\r
 }\r
@@ -1610,7 +1626,7 @@ Returns:
         goto Finish;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);\r
         goto Finish;\r
       }\r
       SetPrintLevel (LogLevel);\r
@@ -1631,7 +1647,7 @@ Returns:
       InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *));\r
       if (InputFileName == NULL) {\r
         Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
-        return EFI_OUT_OF_RESOURCES;\r
+        goto Finish;\r
       }\r
 \r
       memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));\r
@@ -1646,7 +1662,7 @@ Returns:
 \r
       if (InputFileName == NULL) {\r
         Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
-        return EFI_OUT_OF_RESOURCES;\r
+        goto Finish;\r
       }\r
 \r
       memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));\r
@@ -1883,7 +1899,7 @@ Returns:
     }\r
 \r
     if (Index != FileLength) {\r
-      Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, FileLength, Index);\r
+      Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, (unsigned) FileLength, (unsigned) Index);\r
       goto Finish;\r
     }\r
 \r
@@ -1899,7 +1915,7 @@ Returns:
       Index       += sizeof (*DataPointer);\r
     }\r
     if (CheckSum != 0) {\r
-      Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", CheckSum, mInImageName);\r
+      Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", (unsigned) CheckSum, mInImageName);\r
       goto Finish;\r
     }\r
     //\r
@@ -1923,7 +1939,7 @@ Returns:
         goto Finish;\r
       }\r
     }\r
-    VerboseMsg ("the size of output file is %d bytes", FileLength);\r
+    VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);\r
     //\r
     //  Convert Mci.TXT to Mci.bin file successfully\r
     //\r
@@ -1950,7 +1966,7 @@ Returns:
   fread (FileBuffer, 1, FileLength, fpIn);\r
   fclose (fpIn);\r
 \r
-  DebugMsg (NULL, 0, 9, "input file info", "the input file size is %d bytes", FileLength);\r
+  DebugMsg (NULL, 0, 9, "input file info", "the input file size is %u bytes", (unsigned) FileLength);\r
 \r
   //\r
   // Replace file\r
@@ -1978,11 +1994,11 @@ Returns:
       fprintf (fpInOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);\r
       fprintf (fpInOut, "%17X subsystems\n", TEImageHeader.Subsystem);\r
       fprintf (fpInOut, "%17X stripped size\n", TEImageHeader.StrippedSize);\r
-      fprintf (fpInOut, "%17X entry point\n", TEImageHeader.AddressOfEntryPoint);\r
-      fprintf (fpInOut, "%17X base of code\n", TEImageHeader.BaseOfCode);\r
-      fprintf (fpInOut, "%17lX image base\n", (long unsigned int)TEImageHeader.ImageBase);\r
-      fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", TEImageHeader.DataDirectory[0].VirtualAddress, TEImageHeader.DataDirectory[0].Size);\r
-      fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", TEImageHeader.DataDirectory[1].VirtualAddress, TEImageHeader.DataDirectory[1].Size);\r
+      fprintf (fpInOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);\r
+      fprintf (fpInOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);\r
+      fprintf (fpInOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);\r
+      fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);\r
+      fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);\r
     }\r
 \r
     if (fpOut != NULL) {\r
@@ -1992,11 +2008,11 @@ Returns:
       fprintf (fpOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);\r
       fprintf (fpOut, "%17X subsystems\n", TEImageHeader.Subsystem);\r
       fprintf (fpOut, "%17X stripped size\n", TEImageHeader.StrippedSize);\r
-      fprintf (fpOut, "%17X entry point\n", TEImageHeader.AddressOfEntryPoint);\r
-      fprintf (fpOut, "%17X base of code\n", TEImageHeader.BaseOfCode);\r
-      fprintf (fpOut, "%17lX image base\n", (long unsigned int)TEImageHeader.ImageBase);\r
-      fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", TEImageHeader.DataDirectory[0].VirtualAddress, TEImageHeader.DataDirectory[0].Size);\r
-      fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", TEImageHeader.DataDirectory[1].VirtualAddress, TEImageHeader.DataDirectory[1].Size);\r
+      fprintf (fpOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);\r
+      fprintf (fpOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);\r
+      fprintf (fpOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);\r
+      fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);\r
+      fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);\r
     }\r
     goto Finish;\r
   }\r
@@ -2201,7 +2217,7 @@ Returns:
     if (fpInOut != NULL) {\r
       fwrite (FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, 1, FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders, fpInOut);\r
     }\r
-    VerboseMsg ("the size of output file is %d bytes", FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders);\r
+    VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders));\r
     goto Finish;\r
   }\r
 \r
@@ -2211,7 +2227,7 @@ Returns:
   if (OutImageType == FW_ZERO_DEBUG_IMAGE) {\r
     Status = ZeroDebugData (FileBuffer, TRUE);\r
     if (EFI_ERROR (Status)) {\r
-      Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%lx", (UINTN) Status);\r
+      Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%x", (int) Status);\r
       goto Finish;\r
     }\r
 \r
@@ -2221,7 +2237,7 @@ Returns:
     if (fpInOut != NULL) {\r
       fwrite (FileBuffer, 1, FileLength, fpInOut);\r
     }\r
-    VerboseMsg ("the size of output file is %d bytes", FileLength);\r
+    VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);\r
     goto Finish;\r
   }\r
 \r
@@ -2240,7 +2256,7 @@ Returns:
     if (fpInOut != NULL) {\r
       fwrite (FileBuffer, 1, FileLength, fpInOut);\r
     }\r
-    VerboseMsg ("the size of output file is %d bytes", FileLength);\r
+    VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);\r
     goto Finish;\r
   }\r
 \r
@@ -2274,7 +2290,7 @@ Returns:
         if (fpInOut != NULL) {\r
           fwrite (FileBuffer + SectionHeader->PointerToRawData, 1, FileLength, fpInOut);\r
         }\r
-        VerboseMsg ("the size of output file is %d bytes", FileLength);\r
+        VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);\r
         goto Finish;\r
       }\r
     }\r
@@ -2291,7 +2307,7 @@ Returns:
     DosHdr->e_lfanew = BackupDosHdr.e_lfanew;\r
   \r
     for (Index = sizeof (EFI_IMAGE_DOS_HEADER); Index < (UINT32 ) DosHdr->e_lfanew; Index++) {\r
-      FileBuffer[Index] = DosHdr->e_cp;\r
+      FileBuffer[Index] = (UINT8) DosHdr->e_cp;\r
     }\r
   }\r
 \r
@@ -2397,7 +2413,7 @@ Returns:
                 Optional32->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);\r
                 SectionHeader->SizeOfRawData = AllignedRelocSize;\r
                 FileLength = Optional32->SizeOfImage;\r
-                DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %d", SectionHeader->SizeOfRawData - AllignedRelocSize);\r
+                DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));\r
               }\r
             }\r
           }\r
@@ -2505,7 +2521,7 @@ Returns:
                 Optional64->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);\r
                 SectionHeader->SizeOfRawData = AllignedRelocSize;\r
                 FileLength = Optional64->SizeOfImage;\r
-                DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %d", SectionHeader->SizeOfRawData - AllignedRelocSize);\r
+                DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));\r
               }\r
             }\r
           }\r
@@ -2561,8 +2577,8 @@ Returns:
       goto Finish;\r
     }\r
 \r
-    DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %X",\r
-              TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, TEImageHeader.AddressOfEntryPoint, TEImageHeader.BaseOfCode, TEImageHeader.ImageBase);\r
+    DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %llX",\r
+              TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, (unsigned) TEImageHeader.AddressOfEntryPoint, (unsigned) TEImageHeader.BaseOfCode, (unsigned long long) TEImageHeader.ImageBase);\r
     //\r
     // Update Image to TeImage\r
     //\r
@@ -2574,7 +2590,7 @@ Returns:
       fwrite (&TEImageHeader, 1, sizeof (EFI_TE_IMAGE_HEADER), fpInOut);\r
       fwrite (FileBuffer + TEImageHeader.StrippedSize, 1, FileLength - TEImageHeader.StrippedSize, fpInOut);\r
     }\r
-    VerboseMsg ("the size of output file is %d bytes", FileLength - TEImageHeader.StrippedSize);\r
+    VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - TEImageHeader.StrippedSize));\r
     goto Finish;\r
   }\r
 WriteFile:\r
@@ -2587,7 +2603,7 @@ WriteFile:
   if (fpInOut != NULL) {\r
     fwrite (FileBuffer, 1, FileLength, fpInOut);\r
   }\r
-  VerboseMsg ("the size of output file is %d bytes", FileLength);\r
+  VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);\r
 \r
 Finish:\r
   if (fpInOut != NULL) {\r
@@ -2813,13 +2829,13 @@ Returns:
   struct tm                       stime;\r
   struct tm                       *ptime;\r
   time_t                          newtime;\r
-  UINT32                           Index;\r
-  UINT32                           DebugDirectoryEntryRva;\r
-  UINT32                           DebugDirectoryEntryFileOffset;\r
-  UINT32                           ExportDirectoryEntryRva;\r
-  UINT32                           ExportDirectoryEntryFileOffset;\r
-  UINT32                           ResourceDirectoryEntryRva;\r
-  UINT32                           ResourceDirectoryEntryFileOffset;\r
+  UINT32                          Index;\r
+  UINT32                          DebugDirectoryEntryRva;\r
+  UINT32                          DebugDirectoryEntryFileOffset;\r
+  UINT32                          ExportDirectoryEntryRva;\r
+  UINT32                          ExportDirectoryEntryFileOffset;\r
+  UINT32                          ResourceDirectoryEntryRva;\r
+  UINT32                          ResourceDirectoryEntryFileOffset;\r
   EFI_IMAGE_DOS_HEADER            *DosHdr;\r
   EFI_IMAGE_FILE_HEADER           *FileHdr;\r
   EFI_IMAGE_OPTIONAL_HEADER32     *Optional32Hdr;\r
@@ -2830,9 +2846,12 @@ Returns:
   //\r
   // Init variable.\r
   //\r
-  DebugDirectoryEntryRva    = 0;\r
-  ExportDirectoryEntryRva   = 0;\r
-  ResourceDirectoryEntryRva = 0;\r
+  DebugDirectoryEntryRva           = 0;\r
+  DebugDirectoryEntryFileOffset    = 0;\r
+  ExportDirectoryEntryRva          = 0;\r
+  ExportDirectoryEntryFileOffset   = 0;\r
+  ResourceDirectoryEntryRva        = 0;\r
+  ResourceDirectoryEntryFileOffset = 0;\r
   //\r
   // Get time and date that will be set.\r
   //\r
@@ -3041,6 +3060,7 @@ Returns:
 {\r
   CHAR8  Line[MAX_LINE_LEN];\r
   CHAR8  *cptr;\r
+  unsigned ScannedData = 0;\r
 \r
   Line[MAX_LINE_LEN - 1]  = 0;\r
   while (1) {\r
@@ -3080,10 +3100,11 @@ Returns:
     for (; *cptr && isspace(*cptr); cptr++) {\r
     }\r
     if (isxdigit (*cptr)) {\r
-      if (sscanf (cptr, "%X", Data) != 1) {\r
+      if (sscanf (cptr, "%X", &ScannedData) != 1) {\r
         return STATUS_ERROR;\r
       }\r
     }\r
+    *Data = (UINT32) ScannedData;\r
     return STATUS_SUCCESS;\r
   }\r
 \r
diff --git a/BaseTools/Source/C/GenFw/elf_generic.h b/BaseTools/Source/C/GenFw/elf_generic.h
deleted file mode 100644 (file)
index dd4f8e1..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * Copyright (c) 1998 John D. Polstra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/sys/elf_generic.h,v 1.6.14.2 2007/12/03 21:30:36 marius Exp $
- */
-
-#ifndef _SYS_ELF_GENERIC_H_
-#define _SYS_ELF_GENERIC_H_ 1
-
-#include <sys/cdefs.h>
-
-/*
- * Definitions of generic ELF names which relieve applications from
- * needing to know the word size.
- */
-
-#if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64
-#error "__ELF_WORD_SIZE must be defined as 32 or 64"
-#endif
-
-#define ELF_CLASS      __CONCAT(ELFCLASS,__ELF_WORD_SIZE)
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define ELF_DATA       ELFDATA2LSB
-#elif BYTE_ORDER == BIG_ENDIAN
-#define ELF_DATA       ELFDATA2MSB
-#else
-#error "Unknown byte order"
-#endif
-
-#define __elfN(x)      __CONCAT(__CONCAT(__CONCAT(elf,__ELF_WORD_SIZE),_),x)
-#define __ElfN(x)      __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x)
-#define __ELFN(x)      __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x)
-#define __ElfType(x)   typedef __ElfN(x) __CONCAT(Elf_,x)
-
-__ElfType(Addr);
-__ElfType(Half);
-__ElfType(Off);
-__ElfType(Sword);
-__ElfType(Word);
-__ElfType(Ehdr);
-__ElfType(Shdr);
-__ElfType(Phdr);
-__ElfType(Dyn);
-__ElfType(Rel);
-__ElfType(Rela);
-__ElfType(Sym);
-__ElfType(Verdef);
-__ElfType(Verdaux);
-__ElfType(Verneed);
-__ElfType(Vernaux);
-__ElfType(Versym);
-
-/* Non-standard ELF types. */
-__ElfType(Hashelt);
-__ElfType(Size);
-__ElfType(Ssize);
-
-#define ELF_R_SYM      __ELFN(R_SYM)
-#define ELF_R_TYPE     __ELFN(R_TYPE)
-#define ELF_R_INFO     __ELFN(R_INFO)
-#define ELF_ST_BIND    __ELFN(ST_BIND)
-#define ELF_ST_TYPE    __ELFN(ST_TYPE)
-#define ELF_ST_INFO    __ELFN(ST_INFO)
-
-#endif /* !_SYS_ELF_GENERIC_H_ */
index 99fbc1e4720683660a3284bc9e8e876389189ddc..dac55889d512bbd944217151b45452312e48a54a 100644 (file)
@@ -35,6 +35,7 @@ Abstract:
 #include <string.h>\r
 #include "VirtualMemory.h"\r
 #include "EfiUtilityMsgs.h"\r
+#include "ParseInf.h"\r
 \r
 #define EFI_PAGE_BASE_OFFSET_IN_LDR 0x70000\r
 #define EFI_PAGE_BASE_ADDRESS       (EFI_PAGE_BASE_OFFSET_IN_LDR + 0x20000)\r
@@ -252,7 +253,7 @@ return:
   FileSize = ftell (NoPageFile);\r
   fseek (NoPageFile, 0, SEEK_SET);\r
   if (FileSize > gPageTableOffsetInFile) {\r
-    Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input file size (0x%x) exceeds the Page Table Offset (0x%x)", FileSize, gPageTableOffsetInFile);\r
+    Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input file size (0x%lx) exceeds the Page Table Offset (0x%x)", FileSize, (unsigned) gPageTableOffsetInFile);\r
     fclose (PageFile);\r
     fclose (NoPageFile);\r
     return -1;\r
@@ -380,7 +381,7 @@ main (
         return STATUS_ERROR;\r
       }\r
       if (TempValue > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", TempValue);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) TempValue);\r
         return STATUS_ERROR;\r
       }\r
       argc -= 2;\r
index 952034ad5f3e465e75a224c7104b69ac7b42abed..32b8cfd5a0c5ad40cba785abf648a8828180025b 100644 (file)
@@ -160,7 +160,8 @@ Returns:
                         EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION,\n\\r
                         EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW,\n\\r
                         EFI_SECTION_FREEFORM_SUBTYPE_GUID,\n\\r
-                        EFI_SECTION_PEI_DEPEX. if -s option is not given, \n\\r
+                        EFI_SECTION_PEI_DEPEX, EFI_SECTION_SMM_DEPEX.\n\\r
+                        if -s option is not given, \n\\r
                         EFI_SECTION_ALL is default section type.\n");\r
   fprintf (stdout, "  -c [Type], --compress [Type]\n\\r
                         Compress method type can be PI_NONE or PI_STD.\n\\r
@@ -282,16 +283,16 @@ Returns:
   fseek (InFile, 0, SEEK_END);\r
   InputFileLength = ftell (InFile);\r
   fseek (InFile, 0, SEEK_SET);\r
-  DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %d bytes", InputFileName[0], InputFileLength);\r
+  DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %u bytes", InputFileName[0], (unsigned) InputFileLength);\r
   TotalLength     = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength;\r
   //\r
   // Size must fit in 3 bytes\r
   //\r
   if (TotalLength >= MAX_SECTION_SIZE) {\r
-    Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%dM).", InputFileName[0], TotalLength, MAX_SECTION_SIZE>>20);\r
+    Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%uM).", InputFileName[0], (unsigned) TotalLength, MAX_SECTION_SIZE>>20);\r
     goto Done;\r
   }\r
-  VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
+  VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);\r
   //\r
   // Fill in the fields in the local section header structure\r
   //\r
@@ -404,7 +405,7 @@ Returns:
     fseek (InFile, 0, SEEK_END);\r
     FileSize = ftell (InFile);\r
     fseek (InFile, 0, SEEK_SET);\r
-    DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %d bytes", InputFileName[Index], FileSize); \r
+    DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize); \r
     //\r
     // Now read the contents of the file into the buffer\r
     // Buffer must be enough to contain the file content.\r
@@ -561,10 +562,10 @@ Returns:
   }\r
 \r
   DebugMsg (NULL, 0, 9, "comprss file size", \r
-            "the original section size is %d bytes and the compressed section size is %d bytes", InputLength, CompressedLength);\r
+            "the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);\r
   TotalLength = CompressedLength + sizeof (EFI_COMPRESSION_SECTION);\r
   if (TotalLength >= MAX_SECTION_SIZE) {\r
-    Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);\r
+    Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);\r
     if (FileBuffer != NULL) {\r
       free (FileBuffer);\r
     }\r
@@ -573,7 +574,7 @@ Returns:
     }\r
     return STATUS_ERROR;\r
   }\r
-  VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
+  VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);\r
 \r
   //\r
   // Add the section header for the compressed data\r
@@ -708,7 +709,7 @@ Returns:
 \r
     TotalLength = InputLength + sizeof (CRC32_SECTION_HEADER);\r
     if (TotalLength >= MAX_SECTION_SIZE) {\r
-      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);\r
+      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);\r
       free (FileBuffer);\r
       return STATUS_ERROR;\r
     }\r
@@ -722,12 +723,12 @@ Returns:
     Crc32GuidSect->GuidSectionHeader.Attributes  = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;\r
     Crc32GuidSect->GuidSectionHeader.DataOffset  = sizeof (CRC32_SECTION_HEADER);\r
     Crc32GuidSect->CRC32Checksum                 = Crc32Checksum;\r
-    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", Crc32GuidSect->GuidSectionHeader.DataOffset);\r
+    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", Crc32GuidSect->GuidSectionHeader.DataOffset);\r
 \r
   } else {\r
     TotalLength = InputLength + sizeof (EFI_GUID_DEFINED_SECTION);\r
     if (TotalLength >= MAX_SECTION_SIZE) {\r
-      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);\r
+      Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);\r
       free (FileBuffer);\r
       return STATUS_ERROR;\r
     }\r
@@ -739,10 +740,10 @@ Returns:
     VendorGuidSect->CommonHeader.Size[2]  = (UINT8) ((TotalLength & 0xff0000) >> 16);\r
     memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));\r
     VendorGuidSect->Attributes  = DataAttribute;\r
-    VendorGuidSect->DataOffset  = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize;\r
-    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect->DataOffset);\r
+    VendorGuidSect->DataOffset  = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize);\r
+    DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", VendorGuidSect->DataOffset);\r
   }\r
-  VerboseMsg ("the size of the created section file is %d bytes", TotalLength);\r
+  VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);\r
   \r
   //\r
   // Set OutFileBuffer \r
@@ -785,7 +786,7 @@ Returns:
   CHAR8                     *CompressionName;\r
   CHAR8                     *StringBuffer;\r
   EFI_GUID                  VendorGuid = mZeroGuid;\r
-  INT32                     VersionNumber;\r
+  int                       VersionNumber;\r
   UINT8                     SectType;\r
   UINT8                     SectCompSubType;\r
   UINT16                    SectGuidAttribute; \r
@@ -972,7 +973,7 @@ Returns:
         goto Finish;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", (int) LogLevel);\r
         goto Finish;\r
       }\r
       SetPrintLevel (LogLevel);\r
@@ -1059,7 +1060,7 @@ Returns:
       SectGuidAttribute = 0;\r
     }\r
     VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
-                VendorGuid.Data1,\r
+                (unsigned) VendorGuid.Data1,\r
                 VendorGuid.Data2,\r
                 VendorGuid.Data3,\r
                 VendorGuid.Data4[0],\r
@@ -1077,7 +1078,7 @@ Returns:
       VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]);\r
     }\r
     if (SectGuidHeaderLength != 0) {\r
-      VerboseMsg ("Guid Data Header size is 0x%x", SectGuidHeaderLength);\r
+      VerboseMsg ("Guid Data Header size is 0x%llx", (unsigned long long) SectGuidHeaderLength);\r
     }\r
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PE32]) == 0) {\r
     SectType = EFI_SECTION_PE32;\r
@@ -1087,6 +1088,8 @@ Returns:
     SectType = EFI_SECTION_TE;\r
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) {\r
     SectType = EFI_SECTION_DXE_DEPEX;\r
+  } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_SMM_DEPEX]) == 0) {\r
+    SectType = EFI_SECTION_SMM_DEPEX;\r
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_VERSION]) == 0) {\r
     SectType = EFI_SECTION_VERSION;\r
     if (VersionNumber < 0 || VersionNumber > 9999) {\r
@@ -1139,7 +1142,7 @@ Returns:
   // Check whether there is output file\r
   //\r
   for (Index = 0; Index < InputFileNum; Index ++) {\r
-    VerboseMsg ("the %dth input file name is %s", Index, InputFileName[Index]);\r
+    VerboseMsg ("the %uth input file name is %s", (unsigned) Index, InputFileName[Index]);\r
   }\r
   if (OutputFileName == NULL) {\r
     Error (NULL, 0, 1001, "Missing options", "Output file");\r
@@ -1199,7 +1202,7 @@ Returns:
     VersionSect->CommonHeader.Size[2]  = (UINT8) ((Index & 0xff0000) >> 16);\r
     VersionSect->BuildNumber           = (UINT16) VersionNumber;\r
     Ascii2UnicodeString (StringBuffer, VersionSect->VersionString);\r
-    VerboseMsg ("the size of the created section file is %d bytes", Index);\r
+    VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);\r
     break;\r
 \r
   case EFI_SECTION_USER_INTERFACE:\r
@@ -1219,7 +1222,7 @@ Returns:
     UiSect->CommonHeader.Size[1]  = (UINT8) ((Index & 0xff00) >> 8);\r
     UiSect->CommonHeader.Size[2]  = (UINT8) ((Index & 0xff0000) >> 16);\r
     Ascii2UnicodeString (StringBuffer, UiSect->FileNameString);\r
-    VerboseMsg ("the size of the created section file is %d bytes", Index);\r
+    VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);\r
    break;\r
 \r
   case EFI_SECTION_ALL:\r
@@ -1250,7 +1253,7 @@ Returns:
                 &InputLength\r
                 );\r
     }\r
-    VerboseMsg ("the size of the created section file is %d bytes", InputLength);\r
+    VerboseMsg ("the size of the created section file is %u bytes", (unsigned) InputLength);\r
     break;\r
   default:\r
     //\r
@@ -1266,7 +1269,7 @@ Returns:
   }\r
   \r
   if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {\r
-    Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (UINTN) Status);\r
+    Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);\r
          goto Finish;\r
   }\r
 \r
index e633b7ccf83a0d61d6d5fee4525c6b95ec9b0a95..eafbcbf0023df9d7fd435445529d5239d0a89110 100644 (file)
@@ -122,8 +122,8 @@ Returns:
   CHAR8  StrPtr[40];\r
   CHAR8  *Token;\r
   UINTN  Length;\r
-  UINT32 Major;\r
-  UINT32 Minor;\r
+  unsigned Major;\r
+  unsigned Minor;\r
 \r
   Major = 0;\r
   Minor = 0;\r
@@ -278,7 +278,7 @@ InitializeComps (
 \r
 Routine Description:\r
 \r
-  This function intializes the relevant global variable which is being\r
+  This function initializes the relevant global variable which is being\r
   used to store the information retrieved from INF file.  This also initializes\r
   the VTF symbol file.\r
 \r
@@ -316,7 +316,7 @@ ParseAndUpdateComponents (
 \r
 Routine Description:\r
 \r
-  This function intializes the relevant global variable which is being\r
+  This function initializes the relevant global variable which is being\r
   used to store the information retrieved from INF file.\r
 \r
 Arguments:\r
@@ -347,7 +347,7 @@ Returns:
     } else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) {\r
       TokenStr++;\r
       if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {\r
-        Error (NULL, 0, 5001, "Cannot get: \"0x%x\".", *TokenStr);\r
+        Error (NULL, 0, 5001, "Cannot get: \"0x%s\".", *TokenStr);\r
         return ;\r
       }\r
 \r
@@ -1970,7 +1970,7 @@ Returns:
 \r
   Fv1BaseAddress        = StartAddress1;\r
   Fv1EndAddress         = Fv1BaseAddress + Size1;\r
-  if (Fv1EndAddress != 0x100000000 || Size1 < 0x100000) {\r
+  if (Fv1EndAddress != 0x100000000ULL || Size1 < 0x100000) {\r
     Error (NULL, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!");\r
     if (Size1 < 0x100000) {\r
       Error (NULL, 0, 2000, "Invalid parameter", "The FwVolumeSize must be larger than 1M!");\r
@@ -2281,11 +2281,7 @@ Returns:
       //\r
       TokenAddress += BaseAddress &~IPF_CACHE_BIT;\r
 \r
-#ifdef __GNUC__\r
-      fprintf (DestFile, "%s | %016lX | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);\r
-#else\r
-       fprintf (DestFile, "%s | %016I64X | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);\r
-#endif\r
+      fprintf (DestFile, "%s | %016llX | %s | %s%s\n", Type, (unsigned long long) TokenAddress, Section, BaseToken, Token);\r
     }\r
   }\r
 \r
@@ -2689,7 +2685,7 @@ Returns:
       break;\r
 \r
     case EFI_ABORTED:\r
-      Error (NULL, 0, 3000, "Invaild", "Error detected while creating the file image.");\r
+      Error (NULL, 0, 3000, "Invalid", "Error detected while creating the file image.");\r
       break;\r
 \r
     case EFI_OUT_OF_RESOURCES:\r
@@ -2697,11 +2693,11 @@ Returns:
       break;\r
 \r
     case EFI_VOLUME_CORRUPTED:\r
-      Error (NULL, 0, 3000, "Invaild", "No base address was specified.");\r
+      Error (NULL, 0, 3000, "Invalid", "No base address was specified.");\r
       break;\r
 \r
     default:\r
-      Error (NULL, 0, 3000, "Invaild", "GenVtfImage function returned unknown status %x.",Status );\r
+      Error (NULL, 0, 3000, "Invalid", "GenVtfImage function returned unknown status %x.", (int) Status );\r
       break;\r
     }\r
   }\r
index 25ce1141badd4a1af070d63a7ad1e06184392743..eab14f3aa602affdd39cd3922d3c6aa88af1d196 100644 (file)
@@ -33,6 +33,9 @@ Abstract:
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
+#ifndef __GNUC__\r
+#include <io.h>\r
+#endif\r
 #include "assert.h"\r
 #include <Common/PiFirmwareFile.h>\r
 #include "ParseInf.h"\r
index 178bec24764be8885739f9827dbaa5c3e9b7a860..6a25bee957c144cec08a974f310ef3d8c3f695fc 100644 (file)
@@ -27,6 +27,9 @@ Abstract:
 #include <string.h>\r
 #include <Common/UefiBaseTypes.h>\r
 \r
+#include "ParseInf.h"\r
+#include "EfiUtilityMsgs.h"\r
+\r
 //\r
 // Utility Name\r
 //\r
@@ -293,10 +296,10 @@ PrintUsage (
      [-h, --help]\n");\r
 }\r
 \r
-INTN\r
+int\r
 main (\r
-  INTN  argc,\r
-  CHAR8 *argv[]\r
+  int  argc,\r
+  char *argv[]\r
   )\r
 {\r
   CHAR8          *AppName;\r
@@ -393,7 +396,7 @@ main (
         return 1;\r
       }\r
       if (LogLevel > 9) {\r
-        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel);\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);\r
         return 1;\r
       }\r
       SetPrintLevel (LogLevel);\r
index 438d949a6b3575c310c53ae3a28906379a2108c1..43721ae469198d8a3dfa10d1f6251817bc6f703e 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdarg.h>\r
 \r
 //\r
-// Modifiers to absract standard types to aid in debug of problems\r
+// Modifiers to abstract standard types to aid in debug of problems\r
 //\r
 #define CONST     const\r
 #define STATIC    static\r
@@ -38,8 +38,8 @@
 //\r
 #ifndef IN\r
 //\r
-// Some other envirnments use this construct, so #ifndef to prevent\r
-// mulitple definition.\r
+// Some other environments use this construct, so #ifndef to prevent\r
+// multiple definition.\r
 //\r
 #define IN\r
 #define OUT\r
 //\r
 //  Support for variable length argument lists using the ANSI standard.\r
 //  \r
-//  Since we are using the ANSI standard we used the standard nameing and\r
-//  did not folow the coding convention\r
+//  Since we are using the ANSI standard we used the standard naming and\r
+//  did not follow the coding convention\r
 //\r
 //  VA_LIST  - typedef for argument list.\r
 //  VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.\r
 //  VA_END (VA_LIST Marker) - Clear Marker\r
-//  VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from\r
+//  VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from\r
 //    the ... list. You must know the size and pass it in this macro.\r
 //\r
 //  example:\r
 #define _CR(Record, TYPE, Field)  ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))\r
 \r
 ///\r
-///  ALIGN_POINTER - aligns a pointer to the lowest boundry\r
+///  ALIGN_POINTER - aligns a pointer to the lowest boundary\r
 ///\r
 #define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))\r
 \r
 ///\r
-///  ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor\r
+///  ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor\r
 ///\r
 #define ALIGN_VARIABLE(Value, Adjustment) \\r
   Adjustment = 0U; \\r
index 1e9f6028b4c5b83d4294f90313a9800303cfed93..158e6729705e674cae45ef3025acebd2977a87a6 100644 (file)
@@ -134,6 +134,7 @@ typedef UINT8 EFI_SECTION_TYPE;
 #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18\r
 #define EFI_SECTION_RAW                   0x19\r
 #define EFI_SECTION_PEI_DEPEX             0x1B\r
+#define EFI_SECTION_SMM_DEPEX             0x1C\r
 \r
 typedef struct {\r
   UINT8             Size[3];\r
index d50492662bb813d37be5df1b6d14f2670a11e221..70d87234f72e756f249333ad5a49a17d3342498b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Defines for the EFI Capsule functionality.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation  All rights reserved.\r
+  Copyright (c) 2006 - 2009, Intel Corporation  All rights reserved.\r
 \r
   This program and the accompanying materials are licensed and made available\r
   under the terms and conditions of the BSD License which accompanies this\r
@@ -30,5 +30,6 @@ typedef struct {
 \r
 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET          0x00010000\r
 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE         0x00020000\r
+#define CAPSULE_FLAGS_INITIATE_RESET                0x00040000\r
 \r
 #endif // #ifndef _EFI_CAPSULE_H_\r
index a127c952d447638586e9e068a427fbf0e15ddd9e..f54614abf25ee6f5806ed1b227b8a91d564fbe2d 100644 (file)
@@ -839,7 +839,7 @@ typedef struct _EFI_IFR_REF4 {
 \r
 typedef struct _EFI_IFR_RESET_BUTTON {\r
   EFI_IFR_OP_HEADER        Header;\r
-  EFI_IFR_QUESTION_HEADER  Question;\r
+  EFI_IFR_STATEMENT_HEADER Statement;\r
   EFI_DEFAULT_ID           DefaultId;\r
 } EFI_IFR_RESET_BUTTON;\r
 \r
index 122a0b11786216ccc206c5f0a76ab7aa9341765f..df778a583e4a0a0d07603b9364c55181910a594b 100644 (file)
@@ -54,7 +54,7 @@
 #pragma warning ( disable : 4057 )\r
 \r
 //\r
-// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
+// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r
 //\r
 #pragma warning ( disable : 4127 )\r
 \r
@@ -141,7 +141,7 @@ typedef INT32   INTN;
 //\r
 // Modifier to ensure that all protocol member functions and EFI intrinsics\r
 // use the correct C calling convention. All protocol member functions and\r
-// EFI intrinsics are required to modify thier member functions with EFIAPI.\r
+// EFI intrinsics are required to modify their member functions with EFIAPI.\r
 //\r
 #if _MSC_EXTENSIONS\r
   //\r
index 946c524ddbf69c5d5b00fbcf12319af579b45af2..fb8599333ce17ec35aaeb5c79be0ddd7696cfb57 100644 (file)
@@ -114,6 +114,7 @@ typedef struct {
 #define EFI_ACPI_1_0_TMR_VAL_EXT  (1 << 8)\r
 #define EFI_ACPI_1_0_DCK_CAP      (1 << 9)\r
 \r
+#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION  0x0\r
 //\r
 // Firmware ACPI Control Structure\r
 //\r
index 7207a752a17245acb83dba01d2f9b96d12460ebc..16b91da177344ed79ca27dc7080466ac01f05a7f 100644 (file)
@@ -208,7 +208,7 @@ int main2(int numArgs, const char *args[], char *rs)
   CFileSeqInStream inStream;\r
   CFileOutStream outStream;\r
   int res;\r
-  int encodeMode;\r
+  int encodeMode = 0;\r
   Bool modeWasSet = False;\r
   const char *inputFile = NULL;\r
   const char *outputFile = "file.tmp";\r
index 271b141a81a787d74e99f16a68b4e36d71e4d77c..a4dc2255e750bad52d32a52a960b501f1def3a23 100644 (file)
@@ -25,7 +25,7 @@ endif
 
 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 
 CPPFLAGS = $(INCLUDE)
-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -c -g
+CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g
 
 .PHONY: all
 .PHONY: install
index 2385518c1be919ce71196c26b0990adcc6471e96..1523ce75caa5d3fe5a74d8bc0518e333f6f3755a 100644 (file)
@@ -44,6 +44,6 @@ LINKER = $(LD)
 
 INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
 
-CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
+CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
 CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
 
index 5ebda0901bae0c476de5ea6abe27ba260afcf577..22e1a2be499891dadd1bbcf2a205b420580fa619 100644 (file)
@@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <stdlib.h>\r
 #ifdef __GNUC__\r
 #include <unistd.h>\r
+#else\r
+#include <direct.h>\r
 #endif\r
 #include <ctype.h>\r
 #include "ParseInf.h"\r
@@ -219,7 +221,7 @@ Returns:
   CHAR8         *OutputDir = NULL;\r
   CHAR8         *OutFileName1 = NULL;\r
   CHAR8         *OutFileName2 = NULL;\r
-  UINT64        SplitValue = -1;\r
+  UINT64        SplitValue = (UINT64) -1;\r
   FILE          *Out1;\r
   FILE          *Out2;\r
   CHAR8         *OutName1 = NULL;\r
index b3ce640fdec9c11b36f70d6d697252a8bb47ac7b..ef35f1721d19733b0644cca28985cda5e12a58e9 100644 (file)
@@ -84,7 +84,7 @@ STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC -
 \r
 STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;\r
 \r
-static  UINT     DebugLevel;\r
+static  UINT64     DebugLevel;\r
 static  BOOLEAN    DebugMode;\r
 //\r
 // functions\r
@@ -180,12 +180,11 @@ Returns:
 \r
   if (mCompSize + 1 + 8 > *DstSize) {\r
     *DstSize = mCompSize + 1 + 8;    \r
-       return EFI_BUFFER_TOO_SMALL;\r
-    } else {\r
+    return EFI_BUFFER_TOO_SMALL;\r
+  } else {\r
     *DstSize = mCompSize + 1 + 8;   \r
-      return EFI_SUCCESS;\r
-   }\r
-  return EFI_SUCCESS;\r
+    return EFI_SUCCESS;\r
+  }\r
 }\r
 \r
 STATIC\r
index b24cc725f047274ba7f2791548b0f572f7762ef4..963bd2da42698659559d1920352cc4cd402eb39e 100644 (file)
@@ -201,7 +201,11 @@ CVfrErrorHandle::PrintMsg (
 {\r
   CHAR8                  *FileName = NULL;\r
   UINT32                 FileLine;\r
-\r
+  \r
+  if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {\r
+    VerboseMsg (ErrorMsg);\r
+    return;\r
+  }\r
   GetFileNameLineNum (LineNum, &FileName, &FileLine);\r
   Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);\r
 }\r
index 654daed5490ca422147c191cfe7870b8abed2e47..298eb0289b7d83bd49d0179b0ff9471202cb9399 100644 (file)
@@ -787,11 +787,22 @@ CIfrRecordInfoDB::IfrRecordInfoUpdate (
   )\r
 {\r
   SIfrRecord *pNode;\r
+  SIfrRecord *Prev;\r
 \r
   if ((pNode = GetRecordInfoFromIdx (RecordIdx)) == NULL) {\r
     return;\r
   }\r
 \r
+  if (LineNo == 0) {\r
+    //\r
+    // Line number is not specified explicitly, try to use line number of previous opcode\r
+    //\r
+    Prev = GetRecordInfoFromIdx (RecordIdx - 1);\r
+    if (Prev != NULL) {\r
+      LineNo = Prev->mLineNo;\r
+    }\r
+  }\r
+\r
   pNode->mLineNo    = LineNo;\r
   pNode->mOffset    = Offset;\r
   pNode->mBinBufLen = BinBufLen;\r
index 3f387666bd50d9d03abc0cd7b48945f0641b9ceb..fa671c1b1ecb10863a2c60b3dc5c6e6dce181839 100644 (file)
@@ -254,7 +254,7 @@ public:
 \r
   VOID DecLength (UINT8 Size) {\r
     if (mHeader->Length >= Size) {\r
-         mHeader -= Size;\r
+      mHeader -= Size;\r
     }\r
   }\r
 \r
@@ -358,7 +358,7 @@ public:
 \r
   VOID SetVarStoreInfo (IN EFI_VARSTORE_INFO *Info) {\r
     mHeader->VarStoreId             = Info->mVarStoreId;\r
-         mHeader->VarStoreInfo.VarName   = Info->mInfo.mVarName;\r
+    mHeader->VarStoreInfo.VarName   = Info->mInfo.mVarName;\r
     mHeader->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;\r
   }\r
 \r
@@ -398,7 +398,8 @@ public:
   }\r
 };\r
 \r
-static CIfrQuestionHeader *gCurrentQuestion = NULL;\r
+static CIfrQuestionHeader *gCurrentQuestion  = NULL;\r
+static CIfrObj            *gCurrentIfrOpcode = NULL;\r
 \r
 /*\r
  * The definition of CIfrMinMaxStepData\r
@@ -537,6 +538,12 @@ public:
   }\r
 \r
   EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {\r
+    if (FormId == 0) {\r
+      //\r
+      // FormId can't be 0.\r
+      //\r
+      return VFR_RETURN_INVALID_PARAMETER;\r
+    }\r
     if (CIfrForm::ChekFormIdFree (FormId) == FALSE) {\r
       return VFR_RETURN_FORMID_REDEFINED;\r
     }\r
@@ -688,7 +695,7 @@ public:
     ) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault),\r
         CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header) {\r
     mDefault->Type      = Type;\r
-         mDefault->Value     = Value;\r
+    mDefault->Value     = Value;\r
     mDefault->DefaultId = DefaultId;\r
   }\r
 \r
@@ -722,7 +729,7 @@ private:
 public:\r
   CIfrSubtitle () : CIfrObj (EFI_IFR_SUBTITLE_OP, (CHAR8 **)&mSubtitle),\r
                   CIfrOpHeader (EFI_IFR_SUBTITLE_OP, &mSubtitle->Header),\r
-                                 CIfrStatementHeader (&mSubtitle->Statement) {\r
+  CIfrStatementHeader (&mSubtitle->Statement) {\r
     mSubtitle->Flags = 0;\r
   }\r
 \r
@@ -856,7 +863,7 @@ private:
 public:\r
   CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP, (CHAR8 **)&mResetButton),\r
                        CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &mResetButton->Header), \r
-                                          CIfrStatementHeader (&mResetButton->Question.Header) {\r
+  CIfrStatementHeader (&mResetButton->Statement) {\r
     mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
   }\r
 \r
@@ -874,11 +881,11 @@ public:
                      CIfrOpHeader (EFI_IFR_CHECKBOX_OP, &mCheckBox->Header), \r
                      CIfrQuestionHeader (&mCheckBox->Question) {\r
     mCheckBox->Flags = 0;\r
-    gCurrentQuestion = this;\r
+    gCurrentQuestion  = this;\r
   }\r
 \r
   ~CIfrCheckBox () {\r
-    gCurrentQuestion = NULL;\r
+    gCurrentQuestion  = NULL;\r
   }\r
 \r
   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, UINT8 LFlags) {\r
@@ -974,11 +981,13 @@ public:
                    CIfrQuestionHeader (&mNumeric->Question),\r
                    CIfrMinMaxStepData (&mNumeric->data) {\r
     mNumeric->Flags  = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;\r
-    gCurrentQuestion = this;\r
+    gCurrentQuestion  = this;\r
+    gCurrentIfrOpcode = this;\r
   }\r
 \r
   ~CIfrNumeric () {\r
-    gCurrentQuestion = NULL;\r
+    gCurrentQuestion  = NULL;\r
+    gCurrentIfrOpcode = NULL;\r
   }\r
 \r
   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {\r
@@ -1008,11 +1017,13 @@ public:
                  CIfrQuestionHeader (&mOneOf->Question),\r
                  CIfrMinMaxStepData (&mOneOf->data) {\r
     mOneOf->Flags    = 0;\r
-    gCurrentQuestion = this;\r
+    gCurrentQuestion  = this;\r
+    gCurrentIfrOpcode = this;\r
   }\r
 \r
   ~CIfrOneOf () {\r
-    gCurrentQuestion = NULL;\r
+    gCurrentQuestion  = NULL;\r
+    gCurrentIfrOpcode = NULL;\r
   }\r
 \r
   EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {\r
index f91a2c3ceaf88c9dfaa4ce2f59754e0681ff38c4..c01f16e5d58303cf04c08c457eb5fa260dd34d1f 100644 (file)
@@ -1078,7 +1078,7 @@ vfrStatementRules :
 vfrStatementDefault :\r
   <<\r
      BOOLEAN               IsExp         = FALSE;\r
-     EFI_IFR_TYPE_VALUE    Val = gZeroEfiIfrTypeValue;\r
+     EFI_IFR_TYPE_VALUE    Val           = gZeroEfiIfrTypeValue;\r
      CIfrDefault           DObj;\r
      EFI_DEFAULT_ID        DefaultId     = EFI_HII_DEFAULT_CLASS_STANDARD;\r
      CHAR8                 *VarStoreName = NULL;\r
@@ -1087,9 +1087,73 @@ vfrStatementDefault :
   D:Default                                         << DObj.SetLineNo(D->getLine()); >>\r
   (\r
     (\r
-        vfrStatementValue ","                       << IsExp = TRUE; DObj.SetScope (1); >>\r
-      | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","\r
-                                                    << DObj.SetType (_GET_CURRQEST_DATATYPE()); DObj.SetValue(Val); >>\r
+        vfrStatementValue ","                       << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>\r
+      | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","  << \r
+\r
+                                                        if (gCurrentIfrOpcode != NULL && gCurrentIfrOpcode->GetObjBinAddr() != NULL) {\r
+                                                          EFI_IFR_OP_HEADER *TempOpCode;\r
+                                                          TempOpCode = (EFI_IFR_OP_HEADER *) gCurrentIfrOpcode->GetObjBinAddr();\r
+                                                          switch (TempOpCode->OpCode) {\r
+                                                          case EFI_IFR_NUMERIC_OP:\r
+                                                            EFI_IFR_NUMERIC *TempNumricCode;\r
+                                                            TempNumricCode = (EFI_IFR_NUMERIC *) TempOpCode;\r
+                                                            switch (_GET_CURRQEST_DATATYPE()) {\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_64:\r
+                                                              if (Val.u64 < TempNumricCode->data.u64.MinValue || Val.u64 > TempNumricCode->data.u64.MaxValue) {\r
+                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
+                                                              }\r
+                                                              break;\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_32:\r
+                                                              if (Val.u32 < TempNumricCode->data.u32.MinValue || Val.u32 > TempNumricCode->data.u32.MaxValue) {\r
+                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
+                                                              }\r
+                                                              break;\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_16:\r
+                                                              if (Val.u16 < TempNumricCode->data.u16.MinValue || Val.u16 > TempNumricCode->data.u16.MaxValue) {\r
+                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
+                                                              }\r
+                                                              break;\r
+                                                            case EFI_IFR_TYPE_NUM_SIZE_8:\r
+                                                              if (Val.u8 < TempNumricCode->data.u8.MinValue || Val.u8 > TempNumricCode->data.u8.MaxValue) {\r
+                                                                _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");\r
+                                                              }\r
+                                                              break;\r
+                                                            }\r
+                                                            break;\r
+                                                          case EFI_IFR_ONE_OF_OP:\r
+                                                            EFI_IFR_ONE_OF *TempOneOfCode;\r
+                                                            TempOneOfCode = (EFI_IFR_ONE_OF *) TempOpCode;\r
+                                                            if (TempOneOfCode->data.u64.MinValue != 0 || TempOneOfCode->data.u64.MaxValue != 0 || TempOneOfCode->data.u64.Step != 0) {\r
+                                                              //OneOf MinMaxStep Data is set, Val value will be checked for MinMaxStep.\r
+                                                              switch (_GET_CURRQEST_DATATYPE()) {\r
+                                                              case EFI_IFR_TYPE_NUM_SIZE_64:\r
+                                                                if (Val.u64 < TempOneOfCode->data.u64.MinValue || Val.u64 > TempOneOfCode->data.u64.MaxValue) {\r
+                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
+                                                                }\r
+                                                                break;\r
+                                                              case EFI_IFR_TYPE_NUM_SIZE_32:\r
+                                                                if (Val.u32 < TempOneOfCode->data.u32.MinValue || Val.u32 > TempOneOfCode->data.u32.MaxValue) {\r
+                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
+                                                                }\r
+                                                                break;\r
+                                                              case EFI_IFR_TYPE_NUM_SIZE_16:\r
+                                                                if (Val.u16 < TempOneOfCode->data.u16.MinValue || Val.u16 > TempOneOfCode->data.u16.MaxValue) {\r
+                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
+                                                                }\r
+                                                                break;\r
+                                                              case EFI_IFR_TYPE_NUM_SIZE_8:\r
+                                                                if (Val.u8 < TempOneOfCode->data.u8.MinValue || Val.u8 > TempOneOfCode->data.u8.MaxValue) {\r
+                                                                  _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");\r
+                                                                }\r
+                                                                break;\r
+                                                              }\r
+                                                            }\r
+                                                            break;\r
+                                                          }\r
+                                                        }\r
+                                                        DObj.SetType (_GET_CURRQEST_DATATYPE()); \r
+                                                        DObj.SetValue(Val);\r
+                                                    >>\r
     )\r
     {\r
       DefaultStore "=" SN:StringIdentifier ","      << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>\r
@@ -1167,7 +1231,7 @@ flagsField :
 vfrStatementValue :\r
   << CIfrValue VObj; >>\r
   V:Value                                              << VObj.SetLineNo(V->getLine()); >>\r
-  "=" vfrStatementExpression[0]\r
+  "=" vfrStatementExpression[0]                        << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>\r
   ;\r
 \r
 vfrStatementSubTitle :\r
@@ -1588,15 +1652,30 @@ vfrStatementDate :
   ;\r
 \r
 minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :\r
-  Minimum   "=" Number ","\r
-  Maximum   "=" Number ","\r
+  Minimum   "=" MinN:Number ","\r
+  Maximum   "=" MaxN:Number ","\r
   { "step"    "=" Number "," }\r
   {\r
     "default" "=" N:Number ","                         <<\r
                                                           switch (KeyValue) {\r
-                                                          case 0: D.Year  = _STOU16(N->getText()); break;\r
-                                                          case 1: D.Month = _STOU8(N->getText()); break;\r
-                                                          case 2: D.Day   = _STOU8(N->getText()); break;\r
+                                                          case 0: \r
+                                                            D.Year  = _STOU16(N->getText());\r
+                                                            if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");\r
+                                                            }\r
+                                                            break;\r
+                                                          case 1: \r
+                                                            D.Month = _STOU8(N->getText()); \r
+                                                            if (D.Month < 1 || D.Month > 12) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");\r
+                                                            }\r
+                                                            break;\r
+                                                          case 2: \r
+                                                            D.Day = _STOU8(N->getText()); \r
+                                                            if (D.Day < 1 || D.Day > 31) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");\r
+                                                            }\r
+                                                            break;\r
                                                           }\r
                                                        >>\r
   }\r
@@ -1642,10 +1721,30 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
   Maximum   "=" A:Number ","\r
                                                        <<\r
                                                           switch (_GET_CURRQEST_DATATYPE ()) {\r
-                                                          case EFI_IFR_TYPE_NUM_SIZE_64 : MaxU8 = _STOU64(A->getText()); break;\r
-                                                          case EFI_IFR_TYPE_NUM_SIZE_32 : MaxU4 = _STOU32(A->getText()); break;\r
-                                                          case EFI_IFR_TYPE_NUM_SIZE_16 : MaxU2 = _STOU16(A->getText()); break;\r
-                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :  MaxU1 = _STOU8(A->getText());  break;\r
+                                                          case EFI_IFR_TYPE_NUM_SIZE_64 : \r
+                                                            MaxU8 = _STOU64(A->getText()); \r
+                                                            if (MaxU8 < MinU8) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
+                                                            }\r
+                                                            break;\r
+                                                          case EFI_IFR_TYPE_NUM_SIZE_32 : \r
+                                                            MaxU4 = _STOU32(A->getText()); \r
+                                                            if (MaxU4 < MinU4) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
+                                                            }\r
+                                                            break;\r
+                                                          case EFI_IFR_TYPE_NUM_SIZE_16 : \r
+                                                            MaxU2 = _STOU16(A->getText()); \r
+                                                            if (MaxU2 < MinU2) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
+                                                            }\r
+                                                            break;\r
+                                                          case EFI_IFR_TYPE_NUM_SIZE_8 :  \r
+                                                            MaxU1 = _STOU8(A->getText());  \r
+                                                            if (MaxU1 < MinU1) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");\r
+                                                            }\r
+                                                            break;\r
                                                           }\r
                                                        >>\r
   {\r
@@ -1894,9 +1993,24 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
   {\r
     "default" "=" N:Number ","                         <<\r
                                                           switch (KeyValue) {\r
-                                                          case 0: T.Hour   = _STOU8(N->getText()); break;\r
-                                                          case 1: T.Minute = _STOU8(N->getText()); break;\r
-                                                          case 2: T.Second = _STOU8(N->getText()); break;\r
+                                                          case 0: \r
+                                                            T.Hour   = _STOU8(N->getText()); \r
+                                                            if (T.Hour > 23) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");\r
+                                                            }\r
+                                                            break;\r
+                                                          case 1: \r
+                                                            T.Minute = _STOU8(N->getText()); \r
+                                                            if (T.Minute > 59) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");\r
+                                                            }\r
+                                                            break;\r
+                                                          case 2: \r
+                                                            T.Second = _STOU8(N->getText());\r
+                                                            if (T.Second > 59) {\r
+                                                              _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");\r
+                                                            }\r
+                                                            break;\r
                                                           }\r
                                                        >>\r
   }\r
@@ -3090,7 +3204,6 @@ public:
 \r
   VOID                _STRCAT (IN OUT CHAR8 **, IN CHAR8 *);\r
 \r
-  VOID                _CRGUID (EFI_GUID *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *);\r
   VOID                _DeclareDefaultLinearVarStore (IN UINT32);\r
   VOID                _DeclareStandardDefaultStorage (IN UINT32);\r
   VOID                _DeclareDefaultFrameworkVarStore (IN UINT32);\r
@@ -3490,35 +3603,6 @@ EfiVfrParser::_STRCAT (
   *Dest = NewStr;\r
 }\r
 \r
-VOID\r
-EfiVfrParser::_CRGUID (\r
-  IN EFI_GUID *Guid,\r
-  IN CHAR8    *G1,\r
-  IN CHAR8    *G2,\r
-  IN CHAR8    *G3,\r
-  IN CHAR8    *G4,\r
-  IN CHAR8    *G5,\r
-  IN CHAR8    *G6,\r
-  IN CHAR8    *G7,\r
-  IN CHAR8    *G8,\r
-  IN CHAR8    *G9,\r
-  IN CHAR8    *G10,\r
-  IN CHAR8    *G11\r
-  )\r
-{\r
-  Guid->Data1 = _STOU32 (G1);\r
-  Guid->Data2 = _STOU16 (G2);\r
-  Guid->Data3 = _STOU16 (G3);\r
-  Guid->Data4[0] = _STOU8(G4);\r
-  Guid->Data4[1] = _STOU8(G5);\r
-  Guid->Data4[2] = _STOU8(G6);\r
-  Guid->Data4[3] = _STOU8(G7);\r
-  Guid->Data4[4] = _STOU8(G8);\r
-  Guid->Data4[5] = _STOU8(G9);\r
-  Guid->Data4[6] = _STOU8(G10);\r
-  Guid->Data4[7] = _STOU8(G11);\r
-}\r
-\r
 //\r
 // framework vfr to default declare varstore for each structure\r
 //\r
index e59fbb7743dacdbc94928eef66dc6d8d670fd44c..f047b2c471905ed5494c6eefb389f4bb067b6c31 100644 (file)
@@ -870,7 +870,7 @@ CVfrVarDataTypeDB::Pack (
     SVfrPackStackNode *pNode = NULL;\r
 \r
     if (mPackStack == NULL) {\r
-      gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", "#pragma pack(pop...) : more pops than pushes");\r
+      gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "#pragma pack(pop...) : more pops than pushes");\r
     }\r
 \r
     for (pNode = mPackStack; pNode != NULL; pNode = pNode->mNext) {\r
@@ -884,7 +884,7 @@ CVfrVarDataTypeDB::Pack (
   if (Action & VFR_PACK_ASSIGN) {\r
     PackAlign = (Number > 1) ? Number + Number % 2 : Number;\r
     if ((PackAlign == 0) || (PackAlign > 16)) {\r
-      gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", "expected pragma parameter to be '1', '2', '4', '8', or '16'");\r
+      gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");\r
     } else {\r
       mPackAlign = PackAlign;\r
     }\r
index 76d7873e543acd9fc5c0b290aa986b6eb137278b..cb15f280d03fe70b8f630fc39b6c346db94117ba 100644 (file)
@@ -2,7 +2,7 @@
   \r
   Vfr common library functions.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation                                                         \r
+Copyright (c) 2004 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -421,7 +421,4 @@ public:
   UINT8 GetRuleId (IN CHAR8 *);\r
 };\r
 \r
-#define MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2))\r
-#define MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))\r
-\r
 #endif\r
index 1df182e4d6ec7af207952a2a828abedb29b905c7..b7237b08e82f21a43ea35e7376bf7a55c797f91c 100644 (file)
@@ -164,7 +164,7 @@ Returns:
   EFI_FIRMWARE_VOLUME_HEADER  *FvImage;
   UINT32                      FvSize;
   EFI_STATUS                  Status;
-  UINT32                      Offset;
+  int                         Offset;
   BOOLEAN                     ErasePolarity;
 
   SetUtilityName (UTILITY_NAME);
@@ -622,8 +622,8 @@ Returns:
   //
   // Print FV header information
   //
-  printf ("Signature:        %s (%X)\n", (char *) Signature, VolumeHeader.Signature);
-  printf ("Attributes:       %X\n", VolumeHeader.Attributes);
+  printf ("Signature:        %s (%X)\n", (char *) Signature, (unsigned) VolumeHeader.Signature);
+  printf ("Attributes:       %X\n", (unsigned) VolumeHeader.Attributes);
 
   if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) {
     printf ("       EFI_FVB2_READ_DISABLED_CAP\n");
@@ -907,8 +907,8 @@ Returns:
     BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
 
     if (BlockMap.NumBlocks != 0) {
-      printf ("Number of Blocks:      0x%08X\n", BlockMap.NumBlocks);
-      printf ("Block Length:          0x%08X\n", BlockMap.Length);
+      printf ("Number of Blocks:      0x%08X\n", (unsigned) BlockMap.NumBlocks);
+      printf ("Block Length:          0x%08X\n", (unsigned) BlockMap.Length);
       Size += BlockMap.NumBlocks * BlockMap.Length;
     }
 
@@ -924,7 +924,7 @@ Returns:
     return EFI_ABORTED;
   }
 
-  printf ("Total Volume Size:     0x%08X\n", Size);
+  printf ("Total Volume Size:     0x%08X\n", (unsigned) Size);
 
   *FvSize = Size;
 
@@ -998,7 +998,7 @@ Returns:
   //
   FileLength = GetLength (FileHeader->Size);
   printf ("File Offset:      0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
-  printf ("File Length:      0x%08X\n", FileLength);
+  printf ("File Length:      0x%08X\n", (unsigned) FileLength);
   printf ("File Attributes:  0x%02X\n", FileHeader->Attributes);
   printf ("File State:       0x%02X\n", FileHeader->State);
 
@@ -1242,7 +1242,7 @@ Returns:
 
     SectionName = SectionNameToStr (Type);
     printf ("------------------------------------------------------------\n");
-    printf ("  Type:  %s\n  Size:  0x%08X\n", SectionName, SectionLength);
+    printf ("  Type:  %s\n  Size:  0x%08X\n", SectionName, (unsigned) SectionLength);
     free (SectionName);
 
     switch (Type) {
@@ -1288,7 +1288,7 @@ Returns:
       CompressedLength    = SectionLength - sizeof (EFI_COMPRESSION_SECTION);
       UncompressedLength  = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength;
       CompressionType     = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType;
-      printf ("  Uncompressed Length:  0x%08X\n", UncompressedLength);
+      printf ("  Uncompressed Length:  0x%08X\n", (unsigned) UncompressedLength);
 
       if (CompressionType == EFI_NOT_COMPRESSED) {
         printf ("  Compression Type:  EFI_NOT_COMPRESSED\n");
@@ -1342,7 +1342,7 @@ Returns:
           return EFI_SECTION_ERROR;
         }
       } else {
-        Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", (UINT32) CompressionType);
+        Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType);
         return EFI_SECTION_ERROR;
       }
 
@@ -1365,8 +1365,8 @@ Returns:
       printf ("  SectionDefinitionGuid:  ");
       PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid);
       printf ("\n");
-      printf ("  DataOffset:             0x%04X\n", ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
-      printf ("  Attributes:             0x%04X\n", ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
+      printf ("  DataOffset:             0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
+      printf ("  Attributes:             0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
 
       ExtractionTool =
         LookupGuidedSectionToolPath (
@@ -1465,7 +1465,7 @@ Returns:
       //
       // Unknown section, return error
       //
-      Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", (UINT32) Type);
+      Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type);
       return EFI_SECTION_ERROR;
     }
 
@@ -1588,7 +1588,7 @@ Returns:
       break;
 
     default:
-      printf ("Unrecognized byte in depex: 0x%X\n", (UINT32) *Ptr);
+      printf ("Unrecognized byte in depex: 0x%X\n", *Ptr);
       return EFI_SUCCESS;
     }
   }
@@ -1732,11 +1732,14 @@ LoadGuidedSectionToolsTxt (
 {
   CHAR8* PeerFilename;
   CHAR8* Places[] = {
-    FirmwareVolumeFilename,
-    //mUtilityFilename,
+    NULL,
+    //NULL,
     };
   UINTN Index;
 
+  Places[0] = FirmwareVolumeFilename;
+  //Places[1] = mUtilityFilename;
+
   mParsedGuidedSectionTools = NULL;
 
   for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) {
index 028c4e34e3542f3e992f13819af2c9282f3b302c..647e1d0052168c858efc1d4cb99d78d776ac7116 100644 (file)
@@ -1061,12 +1061,45 @@ class PlatformAutoGen(AutoGen):
     #
     def _ExpandBuildOption(self, Options):
         BuildOptions = {}
+        FamilyMatch  = False
+        FamilyIsNull = True
         for Key in Options:
             Family = Key[0]
             Target, Tag, Arch, Tool, Attr = Key[1].split("_")
             # if tool chain family doesn't match, skip it
-            if Family and Tool in self.ToolDefinition and Family != self.ToolDefinition[Tool]["FAMILY"]:
+            if Tool in self.ToolDefinition and Family != "":
+                FamilyIsNull = False
+                if self.ToolDefinition[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":
+                    if Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
+                        continue
+                elif Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_FAMILY]:
+                    continue
+                FamilyMatch = True
+            # expand any wildcard
+            if Target == "*" or Target == self.BuildTarget:
+                if Tag == "*" or Tag == self.ToolChain:
+                    if Arch == "*" or Arch == self.Arch:
+                        if Tool not in BuildOptions:
+                            BuildOptions[Tool] = {}
+                        if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
+                            BuildOptions[Tool][Attr] = Options[Key]
+                        else:
+                            # append options for the same tool
+                            BuildOptions[Tool][Attr] += " " + Options[Key]
+        # Build Option Family has been checked, which need't to be checked again for family.
+        if FamilyMatch or FamilyIsNull:
+            return BuildOptions
+        
+        for Key in Options:
+            Family = Key[0]
+            Target, Tag, Arch, Tool, Attr = Key[1].split("_")
+            # if tool chain family doesn't match, skip it
+            if Tool not in self.ToolDefinition or Family =="":
                 continue
+            # option has been added before
+            if Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_FAMILY]:
+                continue
+
             # expand any wildcard
             if Target == "*" or Target == self.BuildTarget:
                 if Tag == "*" or Tag == self.ToolChain:
index f689a8692db8060933017392690fe0d6c99494a5..c5d8991e07677bb307c68f3381e8109ba5115f7b 100644 (file)
@@ -1308,8 +1308,14 @@ ${END}\t@cd $(BUILD_DIR)\n
         if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":
             FdfFileList = [PlatformInfo.FdfFile]
             # macros passed to GenFds
+            # MacroList.append('"%s=%s"' % ("WORKSPACE", GlobalData.gWorkspace))
+            MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource))
+            MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource))
             for MacroName in GlobalData.gGlobalDefines:
-                MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
+                if GlobalData.gGlobalDefines[MacroName] != "":
+                    MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
+                else:
+                    MacroList.append('"%s"' % MacroName)
         else:
             FdfFileList = []
 
index e82ad3a10be3aa5653b2f3ce3e904ab4d09bae20..0f644445dcb8abd7f0df151c0a52386b707295e9 100644 (file)
@@ -171,9 +171,15 @@ def CreateHFileContent(BaseName, UniObjectClass):
         if Name != None:\r
             Line = ''\r
             if Referenced == True:\r
-                Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4)\r
+                if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:\r
+                    Line = DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4)\r
+                else:\r
+                    Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4)\r
             else:\r
-                Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED\r
+                if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:\r
+                    Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED\r
+                else:\r
+                    Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED\r
             Str = WriteLine(Str, Line)\r
 \r
     Str =  WriteLine(Str, '')\r
index ddccf6507da64170dae0ae4c23df60027d145cfd..50b6cc5bcefd753559e17943423af42b4f129ccd 100644 (file)
@@ -385,10 +385,11 @@ class Dsc(DscObject):
             for IncludeFile in IncludeFiles:\r
                 if IncludeFile[1] == Arch or IncludeFile[1] == TAB_ARCH_COMMON.upper():\r
                     Filename = CheckFileExist(self.WorkspaceDir, IncludeFile[0], ContainerFile, TAB_LIBRARIES, '', IncludeFile[2])\r
-                    for NewItem in open(Filename, 'r').readlines():\r
-                        if CleanString(NewItem) == '':\r
-                            continue\r
-                        MergeArches(Libraries, NewItem, Arch)\r
+                    if os.path.exists(Filename):\r
+                        for NewItem in open(Filename, 'r').readlines():\r
+                            if CleanString(NewItem) == '':\r
+                                continue\r
+                            MergeArches(Libraries, NewItem, Arch)\r
 \r
             for Record in RecordSet:\r
                 if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():\r
index 59006fa5c51a89ac4ff3493a645942d4e7f2c737..5099ed611c9f062aa2938673b8086d26fd7ffb4e 100644 (file)
@@ -1599,7 +1599,7 @@ class FdfParser(object):
         if not self.__GetNextWord():\r
             return True\r
         \r
-        if not self.__Token in ("SET", "FV", "FILE", "DATA"):\r
+        if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE"):\r
             self.__UndoToken()\r
             RegionObj.PcdOffset = self.__GetNextPcdName()\r
             self.Profile.PcdDict[RegionObj.PcdOffset] = RegionObj.Offset + long(Fd.BaseAddress, 0)\r
@@ -1620,10 +1620,14 @@ class FdfParser(object):
             if not self.__GetNextWord():\r
                 return True\r
             \r
-        if self.__Token == "FV":\r
+        elif self.__Token == "FV":\r
             self.__UndoToken()\r
             self.__GetRegionFvType( RegionObj)\r
 \r
+        elif self.__Token == "CAPSULE":\r
+            self.__UndoToken()\r
+            self.__GetRegionCapType( RegionObj)\r
+\r
         elif self.__Token == "FILE":\r
             self.__UndoToken()\r
             self.__GetRegionFileType( RegionObj)\r
@@ -1664,7 +1668,38 @@ class FdfParser(object):
                 raise Warning("expected FV name At Line ", self.FileName, self.CurrentLineNumber)\r
         \r
             RegionObj.RegionDataList.append(self.__Token)\r
-        \r
+\r
+    ## __GetRegionCapType() method\r
+    #\r
+    #   Get region capsule data for region\r
+    #\r
+    #   @param  self        The object pointer\r
+    #   @param  RegionObj   for whom region data is got\r
+    #\r
+    def __GetRegionCapType(self, RegionObj):\r
+\r
+        if not self.__IsKeyword("CAPSULE"):\r
+            raise Warning("expected Keyword 'CAPSULE' at line", self.FileName, self.CurrentLineNumber)\r
+\r
+        if not self.__IsToken("="):\r
+            raise Warning("expected '=' at line", self.FileName, self.CurrentLineNumber)\r
+\r
+        if not self.__GetNextToken():\r
+            raise Warning("expected CAPSULE name at line", self.FileName, self.CurrentLineNumber)\r
+\r
+        RegionObj.RegionType = "CAPSULE"\r
+        RegionObj.RegionDataList.append(self.__Token)\r
+\r
+        while self.__IsKeyword("CAPSULE"):\r
+\r
+            if not self.__IsToken("="):\r
+                raise Warning("expected '=' at line", self.FileName, self.CurrentLineNumber)\r
+\r
+            if not self.__GetNextToken():\r
+                raise Warning("expected CAPSULE name at line", self.FileName, self.CurrentLineNumber)\r
+\r
+            RegionObj.RegionDataList.append(self.__Token)\r
+\r
     ## __GetRegionFileType() method\r
     #\r
     #   Get region file data for region\r
@@ -2713,7 +2748,7 @@ class FdfParser(object):
         \r
         Arch = self.__SkippedChars.rstrip(".")\r
         if Arch.upper() not in ("IA32", "X64", "IPF", "EBC", "ARM", "COMMON"):\r
-            raise Warning("Unknown Arch At line ", self.FileName, self.CurrentLineNumber)\r
+            raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.CurrentLineNumber)\r
         \r
         ModuleType = self.__GetModuleType()\r
         \r
@@ -2763,7 +2798,7 @@ class FdfParser(object):
                              "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \\r
                              "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \\r
                              "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \\r
-                             "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION"):\r
+                             "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"):\r
             raise Warning("Unknown Module type At line ", self.FileName, self.CurrentLineNumber)\r
         return self.__Token\r
     \r
@@ -2803,11 +2838,11 @@ class FdfParser(object):
             raise Warning("expected FILE At Line ", self.FileName, self.CurrentLineNumber)\r
         \r
         if not self.__GetNextWord():\r
-            raise Warning("expected FV type At Line ", self.FileName, self.CurrentLineNumber)\r
+            raise Warning("expected FFS type At Line ", 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"):\r
+                             "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"):\r
             raise Warning("Unknown FV type At line ", self.FileName, self.CurrentLineNumber)\r
 \r
         if not self.__IsToken("="):\r
index 14f6550f297f3d996f905a0df9a1e077c4654be6..2c1041c55b12b7fdc43700ca340d8c359756c664 100644 (file)
@@ -418,6 +418,14 @@ def RealPath(File, Dir='', OverrideDir=''):
     return NewFile
 
 def RealPath2(File, Dir='', OverrideDir=''):
+    if OverrideDir:
+        NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
+        if NewFile:
+            if OverrideDir[-1] == os.path.sep:
+                return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
+            else:
+                return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)]
+
     NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
     if NewFile:
         if Dir:
@@ -428,10 +436,6 @@ def RealPath2(File, Dir='', OverrideDir=''):
         else:
             return NewFile, ''
 
-    if OverrideDir:
-        NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
-        if NewFile:
-            return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)]
     return None, None
 
 ## Check if gvien file exists or not
index 4767645d0576e625330a0bce59534b20518cffcf..ea9d0b343c955080add93ce9789e9c4d25acc26e 100644 (file)
@@ -29,6 +29,7 @@ from Common.FdfClassObject import Fdf
 from Common.String import NormPath\r
 from Common import BuildToolError\r
 import c\r
+import re, string\r
 from Exception import *\r
 \r
 ## Ecc\r
@@ -51,29 +52,29 @@ class Ecc(object):
         self.IsInit = True\r
         self.ScanSourceCode = True\r
         self.ScanMetaData = True\r
-        \r
+\r
         # Parse the options and args\r
         self.ParseOption()\r
 \r
         # Generate checkpoints list\r
         EccGlobalData.gConfig = Configuration(self.ConfigFile)\r
-        \r
+\r
         # Generate exception list\r
         EccGlobalData.gException = ExceptionCheck(self.ExceptionFile)\r
-        \r
+\r
         # Init Ecc database\r
         EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH)\r
         EccGlobalData.gDb.InitDatabase(self.IsInit)\r
-        \r
+\r
         # Build ECC database\r
         self.BuildDatabase()\r
-        \r
+\r
         # Start to check\r
         self.Check()\r
-        \r
+\r
         # Show report\r
         self.GenReport()\r
-        \r
+\r
         # Close Database\r
         EccGlobalData.gDb.Close()\r
 \r
@@ -94,7 +95,7 @@ class Ecc(object):
         # Clean report table\r
         EccGlobalData.gDb.TblReport.Drop()\r
         EccGlobalData.gDb.TblReport.Create()\r
-        \r
+\r
         # Build database\r
         if self.IsInit:\r
             if self.ScanSourceCode:\r
@@ -103,9 +104,9 @@ class Ecc(object):
             if self.ScanMetaData:\r
                 EdkLogger.quiet("Building database for source code done!")\r
                 self.BuildMetaDataFileDatabase()\r
-        \r
+\r
         EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)\r
-    \r
+\r
     ## BuildMetaDataFileDatabase\r
     #\r
     # Build the database for meta data files\r
@@ -115,10 +116,11 @@ class Ecc(object):
         Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')\r
         #SkipDirs = Read from config file\r
         SkipDirs = EccGlobalData.gConfig.SkipDirList\r
+        SkipDirString = string.join(SkipDirs, '|')\r
+        p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)\r
         for Root, Dirs, Files in os.walk(EccGlobalData.gTarget):\r
-            for Dir in Dirs:\r
-                if Dir.upper() in SkipDirs:\r
-                    Dirs.remove(Dir)\r
+            if p.match(Root.upper()):\r
+                continue\r
 \r
             for Dir in Dirs:\r
                 Dirname = os.path.join(Root, Dir)\r
@@ -152,15 +154,15 @@ class Ecc(object):
                     Filename = os.path.normpath(os.path.join(Root, File))\r
                     EdkLogger.quiet("Parsing %s" % Filename)\r
                     Op.write("%s\r" % Filename)\r
-                    Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)                    \r
+                    Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)\r
                     continue\r
         Op.close()\r
-        \r
+\r
         # Commit to database\r
         EccGlobalData.gDb.Conn.commit()\r
-        \r
+\r
         EdkLogger.quiet("Building database for meta data files done!")\r
-    \r
+\r
     ##\r
     #\r
     # Check each checkpoint\r
@@ -170,7 +172,7 @@ class Ecc(object):
         EccCheck = Check()\r
         EccCheck.Check()\r
         EdkLogger.quiet("Checking  done!")\r
-    \r
+\r
     ##\r
     #\r
     # Generate the scan report\r
@@ -179,7 +181,7 @@ class Ecc(object):
         EdkLogger.quiet("Generating report ...")\r
         EccGlobalData.gDb.TblReport.ToCSV(self.ReportFile)\r
         EdkLogger.quiet("Generating report done!")\r
-        \r
+\r
     def GetRealPathCase(self, path):\r
         TmpPath = path.rstrip(os.sep)\r
         PathParts = TmpPath.split(os.sep)\r
@@ -193,7 +195,7 @@ class Ecc(object):
             for Dir in Dirs:\r
                 if Dir.upper() == PathParts[0].upper():\r
                     return Dir\r
-        \r
+\r
         if PathParts[0].strip().endswith(':'):\r
             PathParts[0] = PathParts[0].upper()\r
         ParentDir = PathParts[0]\r
@@ -201,7 +203,7 @@ class Ecc(object):
         if PathParts[0] == '':\r
             RealPath = os.sep\r
             ParentDir = os.sep\r
-        \r
+\r
         PathParts.remove(PathParts[0])    # need to remove the parent\r
         for Part in PathParts:\r
             Dirs = os.listdir(ParentDir + os.sep)\r
@@ -212,9 +214,9 @@ class Ecc(object):
                     break\r
             ParentDir += os.sep\r
             ParentDir += Dir\r
-            \r
+\r
         return RealPath\r
-        \r
+\r
     ## ParseOption\r
     #\r
     # Parse options\r
@@ -222,10 +224,10 @@ class Ecc(object):
     def ParseOption(self):\r
         EdkLogger.quiet("Loading ECC configuration ... done")\r
         (Options, Target) = self.EccOptionParser()\r
-        \r
+\r
         # Check workspace envirnoment\r
         if "WORKSPACE" not in os.environ:\r
-            EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found", \r
+            EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",\r
                             ExtraData="WORKSPACE")\r
         else:\r
             EccGlobalData.gWorkspace = os.path.normpath(os.getenv("WORKSPACE"))\r
@@ -234,7 +236,7 @@ class Ecc(object):
             os.environ["WORKSPACE"] = EccGlobalData.gWorkspace\r
         # Set log level\r
         self.SetLogLevel(Options)\r
-        \r
+\r
         # Set other options\r
         if Options.ConfigFile != None:\r
             self.ConfigFile = Options.ConfigFile\r
@@ -258,12 +260,12 @@ class Ecc(object):
             self.ScanSourceCode = False\r
         if Options.sourcecode != None:\r
             self.ScanMetaData = False\r
-        \r
+\r
     ## SetLogLevel\r
     #\r
     # Set current log level of the tool based on args\r
     #\r
-    # @param Option:  The option list including log level setting \r
+    # @param Option:  The option list including log level setting\r
     #\r
     def SetLogLevel(self, Option):\r
         if Option.verbose != None:\r
@@ -295,19 +297,19 @@ class Ecc(object):
         Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.")\r
         Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.")\r
         Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.")\r
-        Parser.add_option("-l", "--log filename", action="store", dest="LogFile", help="""If specified, the tool should emit the changes that \r
-                                                                                          were made by the tool after printing the result message. \r
-                                                                                          If filename, the emit to the file, otherwise emit to \r
-                                                                                          standard output. If no modifications were made, then do not \r
+        Parser.add_option("-l", "--log filename", action="store", dest="LogFile", help="""If specified, the tool should emit the changes that\r
+                                                                                          were made by the tool after printing the result message.\r
+                                                                                          If filename, the emit to the file, otherwise emit to\r
+                                                                                          standard output. If no modifications were made, then do not\r
                                                                                           create a log file, or output a log message.""")\r
         Parser.add_option("-q", "--quiet", action="store_true", type=None, help="Disable all messages except FATAL ERRORS.")\r
         Parser.add_option("-v", "--verbose", action="store_true", type=None, help="Turn on verbose output with informational messages printed, "\\r
                                                                                    "including library instances selected, final dependency expression, "\\r
                                                                                    "and warning messages, etc.")\r
         Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")\r
-    \r
+\r
         (Opt, Args)=Parser.parse_args()\r
-        \r
+\r
         return (Opt, Args)\r
 \r
 ##\r
index 7f17fcda684d0ab6c6d2746c13058534974d8326..961b88a45837b34bdb26a668f80d35f47dc7b659 100644 (file)
@@ -21,6 +21,7 @@ import os
 import subprocess\r
 import StringIO\r
 from Common.Misc import SaveFileOnChange\r
+from GenFds import GenFds\r
 \r
 \r
 T_CHAR_LF = '\n'\r
@@ -39,17 +40,26 @@ class Capsule (CapsuleClassObject) :
         self.BlockSize = None\r
         # For GenFv\r
         self.BlockNum = None\r
+        self.CapsuleName = None\r
 \r
     ## Generate capsule\r
     #\r
     #   @param  self        The object pointer\r
+    #   @retval string      Generated Capsule file path\r
     #\r
     def GenCapsule(self):\r
+        if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict.keys():\r
+            return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']\r
+\r
+        GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)\r
         CapInfFile = self.GenCapInf()\r
         CapInfFile.writelines("[files]" + T_CHAR_LF)\r
-\r
+        CapFileList = []\r
         for CapsuleDataObj in self.CapsuleDataList :\r
+            CapsuleDataObj.CapsuleName = self.CapsuleName\r
             FileName = CapsuleDataObj.GenCapsuleSubItem()\r
+            CapsuleDataObj.CapsuleName = None\r
+            CapFileList.append(FileName)\r
             CapInfFile.writelines("EFI_FILE_NAME = " + \\r
                                    FileName      + \\r
                                    T_CHAR_LF)\r
@@ -63,9 +73,14 @@ class Capsule (CapsuleClassObject) :
         GenFdsGlobalVariable.GenerateFirmwareVolume(\r
                                 CapOutputFile,\r
                                 [self.CapInfFileName],\r
-                                Capsule=True\r
+                                Capsule=True,\r
+                                FfsList=CapFileList\r
                                 )\r
+\r
+        GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s Capsule Successfully" %self.UiCapsuleName)\r
         GenFdsGlobalVariable.SharpCounter = 0\r
+        GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap'] = CapOutputFile\r
+        return CapOutputFile\r
 \r
     ## Generate inf file for capsule\r
     #\r
index db29737963d1fb49600cbd53690345612d188555..0940094de0efe686354f3fb0389303bcccdb734b 100644 (file)
@@ -45,6 +45,7 @@ class CapsuleFfs (CapsuleData):
     #\r
     def __init_(self) :\r
         self.Ffs = None\r
+        self.FvName = None\r
 \r
     ## generate FFS capsule data\r
     #\r
@@ -64,7 +65,9 @@ class CapsuleFv (CapsuleData):
     #   @param  self        The object pointer\r
     #\r
     def __init__(self) :\r
+        self.Ffs = None\r
         self.FvName = None\r
+        self.CapsuleName = None\r
 \r
     ## generate FV capsule data\r
     #\r
@@ -76,9 +79,11 @@ class CapsuleFv (CapsuleData):
             if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
                 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
                 FdBuffer = StringIO.StringIO('')\r
+                FvObj.CapsuleName = self.CapsuleName\r
                 FvFile = FvObj.AddToBuffer(FdBuffer)\r
+                FvObj.CapsuleName = None\r
+                FdBuffer.close()\r
                 return FvFile\r
-            \r
         else:\r
             FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName)\r
             return FvFile\r
index 99baa6abe55796c8c0d897bebfad6aa503e18730..370008c91897191178404fd30a96e7e6704d8b50 100644 (file)
@@ -26,6 +26,7 @@ from CommonDataClass.FdfClass import FDClassObject
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 from Common.Misc import SaveFileOnChange\r
+from GenFds import GenFds\r
 \r
 ## generate FD\r
 #\r
@@ -42,11 +43,12 @@ class FD(FDClassObject):
     #\r
     #   Generate FD\r
     #\r
-    #   @param  self        The object pointer\r
-    #   @param  FvBinDict   dictionary contains generated FV name and its file name\r
     #   @retval string      Generated FD file name\r
     #\r
-    def GenFd (self, FvBinDict):\r
+    def GenFd (self):\r
+        if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict.keys():\r
+            return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']\r
+\r
         #\r
         # Print Information\r
         #\r
@@ -80,7 +82,7 @@ class FD(FDClassObject):
                 PadRegion = Region.Region()\r
                 PadRegion.Offset = PreviousRegionStart + PreviousRegionSize\r
                 PadRegion.Size = RegionObj.Offset - PadRegion.Offset\r
-                PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, FvBinDict, self.vtfRawDict, self.DefineVarDict)\r
+                PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
             PreviousRegionStart = RegionObj.Offset\r
             PreviousRegionSize = RegionObj.Size\r
             #\r
@@ -89,23 +91,19 @@ class FD(FDClassObject):
             if PreviousRegionSize > self.Size:\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s size too small' % self.FdUiName)\r
             GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')\r
-            RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, FvBinDict, self.vtfRawDict, self.DefineVarDict)\r
+            RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
         #\r
         # Create a empty Fd file\r
         #\r
         GenFdsGlobalVariable.VerboseLogger ('Create an empty Fd file')\r
-        FdFileName = os.path.join(GenFdsGlobalVariable.FvDir,\r
-                                  self.FdUiName + '.fd')\r
-        #FdFile = open(FdFileName, 'wb')\r
-\r
+        FdFileName = os.path.join(GenFdsGlobalVariable.FvDir,self.FdUiName + '.fd')\r
         #\r
         # Write the buffer contents to Fd file\r
         #\r
         GenFdsGlobalVariable.VerboseLogger('Write the buffer contents to Fd file')\r
         SaveFileOnChange(FdFileName, FdBuffer.getvalue())\r
-        #FdFile.write(FdBuffer.getvalue());\r
-        #FdFile.close();\r
         FdBuffer.close();\r
+        GenFds.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName\r
         return FdFileName\r
 \r
     ## generate VTF\r
index 0bf8f5514bf7e779dd663605a62a5e6cafa335ab..07de92610a463912edccdbf4fa9d4c988d5b4113 100644 (file)
@@ -173,7 +173,7 @@ class FileProfile :
 \r
         self.FdDict = {}\r
         self.FvDict = {}\r
-        self.CapsuleList = []\r
+        self.CapsuleDict = {}\r
         self.VtfList = []\r
         self.RuleDict = {}\r
         self.OptRomDict = {}\r
@@ -1622,7 +1622,7 @@ class FdfParser:
         if not self.__GetNextWord():\r
             return True\r
 \r
-        if not self.__Token in ("SET", "FV", "FILE", "DATA"):\r
+        if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE"):\r
             self.__UndoToken()\r
             RegionObj.PcdOffset = self.__GetNextPcdName()\r
             self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))\r
@@ -1639,10 +1639,14 @@ class FdfParser:
             if not self.__GetNextWord():\r
                 return True\r
 \r
-        if self.__Token == "FV":\r
+        elif self.__Token == "FV":\r
             self.__UndoToken()\r
             self.__GetRegionFvType( RegionObj)\r
 \r
+        elif self.__Token == "CAPSULE":\r
+            self.__UndoToken()\r
+            self.__GetRegionCapType( RegionObj)\r
+\r
         elif self.__Token == "FILE":\r
             self.__UndoToken()\r
             self.__GetRegionFileType( RegionObj)\r
@@ -1684,6 +1688,37 @@ class FdfParser:
 \r
             RegionObj.RegionDataList.append(self.__Token)\r
 \r
+    ## __GetRegionCapType() method\r
+    #\r
+    #   Get region capsule data for region\r
+    #\r
+    #   @param  self        The object pointer\r
+    #   @param  RegionObj   for whom region data is got\r
+    #\r
+    def __GetRegionCapType(self, RegionObj):\r
+\r
+        if not self.__IsKeyword("CAPSULE"):\r
+            raise Warning("expected Keyword 'CAPSULE'", self.FileName, self.CurrentLineNumber)\r
+\r
+        if not self.__IsToken("="):\r
+            raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+\r
+        if not self.__GetNextToken():\r
+            raise Warning("expected CAPSULE name", self.FileName, self.CurrentLineNumber)\r
+\r
+        RegionObj.RegionType = "CAPSULE"\r
+        RegionObj.RegionDataList.append(self.__Token)\r
+\r
+        while self.__IsKeyword("CAPSULE"):\r
+\r
+            if not self.__IsToken("="):\r
+                raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+\r
+            if not self.__GetNextToken():\r
+                raise Warning("expected CAPSULE name", self.FileName, self.CurrentLineNumber)\r
+\r
+            RegionObj.RegionDataList.append(self.__Token)\r
+\r
     ## __GetRegionFileType() method\r
     #\r
     #   Get region file data for region\r
@@ -2624,7 +2659,7 @@ class FdfParser:
             CapsuleObj.CreateFile = self.__Token\r
 \r
         self.__GetCapsuleStatements(CapsuleObj)\r
-        self.Profile.CapsuleList.append(CapsuleObj)\r
+        self.Profile.CapsuleDict[CapsuleObj.UiCapsuleName] = CapsuleObj\r
         return True\r
 \r
     ## __GetCapsuleStatements() method\r
@@ -2638,10 +2673,9 @@ class FdfParser:
         self.__GetCapsuleTokens(Obj)\r
         self.__GetDefineStatements(Obj)\r
         self.__GetSetStatements(Obj)\r
-\r
         self.__GetCapsuleData(Obj)\r
 \r
-    ## __GetCapsuleStatements() method\r
+    ## __GetCapsuleTokens() method\r
     #\r
     #   Get token statements for capsule\r
     #\r
@@ -3558,51 +3592,53 @@ class FdfParser:
     def __GetOptRomOverrides(self, Obj):\r
         if self.__IsToken('{'):\r
             Overrides = OptionRom.OverrideAttribs()\r
-            if self.__IsKeyword( "PCI_VENDOR_ID"):\r
-                if not self.__IsToken( "="):\r
-                    raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-                if not self.__GetNextHexNumber():\r
-                    raise Warning("expected Hex vendor id", self.FileName, self.CurrentLineNumber)\r
-                Overrides.PciVendorId = self.__Token\r
-    \r
-            if self.__IsKeyword( "PCI_CLASS_CODE"):\r
-                if not self.__IsToken( "="):\r
-                    raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-                if not self.__GetNextHexNumber():\r
-                    raise Warning("expected Hex class code", self.FileName, self.CurrentLineNumber)\r
-                Overrides.PciClassCode = self.__Token\r
-    \r
-            if self.__IsKeyword( "PCI_DEVICE_ID"):\r
-                if not self.__IsToken( "="):\r
-                    raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-                if not self.__GetNextHexNumber():\r
-                    raise Warning("expected Hex device id", self.FileName, self.CurrentLineNumber)\r
-    \r
-                Overrides.PciDeviceId = self.__Token\r
-    \r
-            if self.__IsKeyword( "PCI_REVISION"):\r
-                if not self.__IsToken( "="):\r
-                    raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-                if not self.__GetNextHexNumber():\r
-                    raise Warning("expected Hex revision", self.FileName, self.CurrentLineNumber)\r
-                Overrides.PciRevision = self.__Token\r
-                    \r
-            if self.__IsKeyword( "COMPRESS"):\r
-                if not self.__IsToken( "="):\r
-                    raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-                if not self.__GetNextToken():\r
-                    raise Warning("expected TRUE/FALSE for compress", self.FileName, self.CurrentLineNumber)\r
-                \r
-                if self.__Token.upper() == 'TRUE':\r
-                    Overrides.NeedCompress = True        \r
-                \r
-            if not self.__IsToken( "}"):\r
-                \r
-                if self.__Token not in ("PCI_CLASS_CODE", "PCI_VENDOR_ID", "PCI_DEVICE_ID", "PCI_REVISION", "COMPRESS"):\r
-                    raise Warning("unknown attribute %s" % self.__Token, self.FileName, self.CurrentLineNumber)\r
-                \r
-                raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
-            \r
+            while True:\r
+                if self.__IsKeyword( "PCI_VENDOR_ID"):\r
+                    if not self.__IsToken( "="):\r
+                        raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                    if not self.__GetNextHexNumber():\r
+                        raise Warning("expected Hex vendor id", self.FileName, self.CurrentLineNumber)\r
+                    Overrides.PciVendorId = self.__Token\r
+                    continue\r
+\r
+                if self.__IsKeyword( "PCI_CLASS_CODE"):\r
+                    if not self.__IsToken( "="):\r
+                        raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                    if not self.__GetNextHexNumber():\r
+                        raise Warning("expected Hex class code", self.FileName, self.CurrentLineNumber)\r
+                    Overrides.PciClassCode = self.__Token\r
+                    continue\r
+\r
+                if self.__IsKeyword( "PCI_DEVICE_ID"):\r
+                    if not self.__IsToken( "="):\r
+                        raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                    if not self.__GetNextHexNumber():\r
+                        raise Warning("expected Hex device id", self.FileName, self.CurrentLineNumber)\r
+\r
+                    Overrides.PciDeviceId = self.__Token\r
+                    continue\r
+\r
+                if self.__IsKeyword( "PCI_REVISION"):\r
+                    if not self.__IsToken( "="):\r
+                        raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                    if not self.__GetNextHexNumber():\r
+                        raise Warning("expected Hex revision", self.FileName, self.CurrentLineNumber)\r
+                    Overrides.PciRevision = self.__Token\r
+                    continue\r
+\r
+                if self.__IsKeyword( "COMPRESS"):\r
+                    if not self.__IsToken( "="):\r
+                        raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                    if not self.__GetNextToken():\r
+                        raise Warning("expected TRUE/FALSE for compress", self.FileName, self.CurrentLineNumber)\r
+                    Overrides.NeedCompress = self.__Token.upper() == 'TRUE'\r
+                    continue\r
+\r
+                if self.__IsToken( "}"):\r
+                    break\r
+                else:\r
+                    EdkLogger.error("FdfParser", FORMAT_INVALID, File=self.FileName, Line=self.CurrentLineNumber)\r
+\r
             Obj.OverrideAttribs = Overrides\r
             \r
     ## __GetOptRomFileStatement() method\r
@@ -3635,8 +3671,52 @@ class FdfParser:
         Obj.FfsList.append(FfsFileObj)\r
 \r
         return True\r
-        \r
-            \r
+\r
+    ## __GetCapInFd() method\r
+    #\r
+    #   Get Cap list contained in FD\r
+    #\r
+    #   @param  self        The object pointer\r
+    #   @param  FdName      FD name\r
+    #   @retval CapList     List of Capsule in FD\r
+    #\r
+    def __GetCapInFd (self, FdName):\r
+\r
+        CapList = []\r
+        if FdName.upper() in self.Profile.FdDict.keys():\r
+            FdObj = self.Profile.FdDict[FdName.upper()]\r
+            for elementRegion in FdObj.RegionList:\r
+                if elementRegion.RegionType == 'CAPSULE':\r
+                    for elementRegionData in elementRegion.RegionDataList:\r
+                        if elementRegionData.endswith(".cap"):\r
+                            continue\r
+                        if elementRegionData != None and elementRegionData.upper() not in CapList:\r
+                            CapList.append(elementRegionData.upper())\r
+        return CapList\r
+\r
+    ## __GetReferencedFdCapTuple() method\r
+    #\r
+    #   Get FV and FD list referenced by a capsule image\r
+    #\r
+    #   @param  self        The object pointer\r
+    #   @param  CapObj      Capsule section to be searched\r
+    #   @param  RefFdList   referenced FD by section\r
+    #   @param  RefFvList   referenced FV by section\r
+    #\r
+    def __GetReferencedFdCapTuple(self, CapObj, RefFdList = [], RefFvList = []):\r
+\r
+        for CapsuleDataObj in CapObj.CapsuleDataList :\r
+            if CapsuleDataObj.FvName != None and CapsuleDataObj.FvName.upper() not in RefFvList:\r
+                RefFvList.append (CapsuleDataObj.FvName.upper())\r
+            elif CapsuleDataObj.Ffs != None:\r
+              if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.FileStatement):\r
+                  if CapsuleDataObj.Ffs.FvName != None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:\r
+                      RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())\r
+                  elif CapsuleDataObj.Ffs.FdName != None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:\r
+                      RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())\r
+                  else:\r
+                      self.__GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)\r
+\r
     ## __GetFvInFd() method\r
     #\r
     #   Get FV list contained in FD\r
@@ -3653,6 +3733,8 @@ class FdfParser:
             for elementRegion in FdObj.RegionList:\r
                 if elementRegion.RegionType == 'FV':\r
                     for elementRegionData in elementRegion.RegionDataList:\r
+                        if elementRegionData.endswith(".fv"):\r
+                            continue\r
                         if elementRegionData != None and elementRegionData.upper() not in FvList:\r
                             FvList.append(elementRegionData.upper())\r
         return FvList\r
@@ -3711,60 +3793,126 @@ class FdfParser:
     #   @retval False       Not exists cycle reference\r
     #\r
     def CycleReferenceCheck(self):\r
+        #\r
+        # Check the cycle between FV and FD image\r
+        #\r
+        MaxLength = len (self.Profile.FvDict)\r
+        for FvName in self.Profile.FvDict.keys():\r
+            LogStr = "\nCycle Reference Checking for FV: %s\n" % FvName\r
+            RefFvStack = []\r
+            RefFvStack.append(FvName)\r
+            FdAnalyzedList = []\r
+            \r
+            Index = 0\r
+            while RefFvStack != [] and Index < MaxLength:\r
+                Index = Index + 1\r
+                FvNameFromStack = RefFvStack.pop()\r
+                if FvNameFromStack.upper() in self.Profile.FvDict.keys():\r
+                    FvObj = self.Profile.FvDict[FvNameFromStack.upper()]\r
+                else:\r
+                    continue\r
 \r
-        CycleRefExists = False\r
+                RefFdList = []\r
+                RefFvList = []\r
+                self.__GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)\r
 \r
-        try:\r
-            for FvName in self.Profile.FvDict.keys():\r
-                LogStr = "Cycle Reference Checking for FV: %s\n" % FvName\r
-                RefFvStack = []\r
-                RefFvStack.append(FvName)\r
-                FdAnalyzedList = []\r
-\r
-                while RefFvStack != []:\r
-                    FvNameFromStack = RefFvStack.pop()\r
-                    if FvNameFromStack.upper() in self.Profile.FvDict.keys():\r
-                        FvObj = self.Profile.FvDict[FvNameFromStack.upper()]\r
-                    else:\r
+                for RefFdName in RefFdList:\r
+                    if RefFdName in FdAnalyzedList:\r
                         continue\r
 \r
-                    RefFdList = []\r
-                    RefFvList = []\r
-                    self.__GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)\r
+                    LogStr += "FV %s contains FD %s\n" % (FvNameFromStack, RefFdName)\r
+                    FvInFdList = self.__GetFvInFd(RefFdName)\r
+                    if FvInFdList != []:\r
+                        for FvNameInFd in FvInFdList:\r
+                            LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)\r
+                            if FvNameInFd not in RefFvStack:\r
+                                RefFvStack.append(FvNameInFd)\r
+\r
+                            if FvName in RefFvStack or FvNameFromStack in RefFvStack:\r
+                                EdkLogger.info(LogStr)\r
+                                return True\r
+                    FdAnalyzedList.append(RefFdName)\r
 \r
+                for RefFvName in RefFvList:\r
+                    LogStr += "FV %s contains FV %s\n" % (FvNameFromStack, RefFvName)\r
+                    if RefFvName not in RefFvStack:\r
+                        RefFvStack.append(RefFvName)\r
+\r
+                    if FvName in RefFvStack or FvNameFromStack in RefFvStack:\r
+                        EdkLogger.info(LogStr)\r
+                        return True\r
+\r
+        #\r
+        # Check the cycle between Capsule and FD image\r
+        #\r
+        MaxLength = len (self.Profile.CapsuleDict)\r
+        for CapName in self.Profile.CapsuleDict.keys():\r
+            #\r
+            # Capsule image to be checked.\r
+            #\r
+            LogStr = "\n\n\nCycle Reference Checking for Capsule: %s\n" % CapName\r
+            RefCapStack = []\r
+            RefCapStack.append(CapName)\r
+            FdAnalyzedList = []\r
+            FvAnalyzedList = []\r
+            \r
+            Index = 0\r
+            while RefCapStack != [] and Index < MaxLength:\r
+                Index = Index + 1\r
+                CapNameFromStack = RefCapStack.pop()\r
+                if CapNameFromStack.upper() in self.Profile.CapsuleDict.keys():\r
+                    CapObj = self.Profile.CapsuleDict[CapNameFromStack.upper()]\r
+                else:\r
+                    continue\r
+\r
+                RefFvList = []\r
+                RefFdList = []\r
+                self.__GetReferencedFdCapTuple(CapObj, RefFdList, RefFvList)\r
+\r
+                FvListLength = 0\r
+                FdListLength = 0\r
+                while FvListLength < len (RefFvList) or FdListLength < len (RefFdList):\r
                     for RefFdName in RefFdList:\r
                         if RefFdName in FdAnalyzedList:\r
                             continue\r
 \r
-                        LogStr += "FD %s is referenced by FV %s\n" % (RefFdName, FvNameFromStack)\r
+                        LogStr += "Capsule %s contains FD %s\n" % (CapNameFromStack, RefFdName)\r
+                        CapInFdList = self.__GetCapInFd(RefFdName)\r
+                        if CapInFdList != []:\r
+                            for CapNameInFd in CapInFdList:\r
+                                LogStr += "FD %s contains Capsule %s\n" % (RefFdName,CapNameInFd)\r
+                                if CapNameInFd not in RefCapStack:\r
+                                    RefCapStack.append(CapNameInFd)\r
+\r
+                                if CapName in RefCapStack or CapNameFromStack in RefCapStack:\r
+                                    EdkLogger.info(LogStr)\r
+                                    return True\r
+\r
                         FvInFdList = self.__GetFvInFd(RefFdName)\r
                         if FvInFdList != []:\r
-                            LogStr += "FD %s contains FV: " % RefFdName\r
-                            for FvObj in FvInFdList:\r
-                                LogStr += FvObj\r
-                                LogStr += ' \n'\r
-                                if FvObj not in RefFvStack:\r
-                                    RefFvStack.append(FvObj)\r
-\r
-                                if FvName in RefFvStack:\r
-                                    CycleRefExists = True\r
-                                    raise Warning(LogStr)\r
-                        FdAnalyzedList.append(RefFdName)\r
+                            for FvNameInFd in FvInFdList:\r
+                                LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)\r
+                                if FvNameInFd not in RefFvList:\r
+                                    RefFvList.append(FvNameInFd)\r
 \r
+                        FdAnalyzedList.append(RefFdName)\r
+                    #\r
+                    # the number of the parsed FV and FD image\r
+                    #\r
+                    FvListLength = len (RefFvList)\r
+                    FdListLength = len (RefFdList)\r
                     for RefFvName in RefFvList:\r
-                        LogStr += "FV %s is referenced by FV %s\n" % (RefFvName, FvNameFromStack)\r
-                        if RefFvName not in RefFvStack:\r
-                            RefFvStack.append(RefFvName)\r
-\r
-                        if FvName in RefFvStack:\r
-                            CycleRefExists = True\r
-                            raise Warning(LogStr)\r
-\r
-        except Warning:\r
-            print LogStr\r
+                        if RefFvName in FvAnalyzedList:\r
+                            continue\r
+                        LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)\r
+                        if RefFvName.upper() in self.Profile.FvDict.keys():\r
+                            FvObj = self.Profile.FvDict[RefFvName.upper()]\r
+                        else:\r
+                            continue\r
+                        self.__GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)\r
+                        FvAnalyzedList.append(RefFvName)\r
 \r
-        finally:\r
-            return CycleRefExists\r
+        return False\r
 \r
 if __name__ == "__main__":\r
     parser = FdfParser("..\LakeportX64Pkg.fdf")\r
index ed778f3d44cad837bc894b59c266cb2a42947ade..e3f2e68fb888fb281a112498f415194aa39c48cc 100644 (file)
@@ -78,8 +78,7 @@ class FileStatement (FileStatementClassObject) :
             if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))\r
             Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
-            FvBin = {}\r
-            FileName = Fd.GenFd(FvBin)\r
+            FileName = Fd.GenFd()\r
             SectionFiles = [FileName]\r
 \r
         elif self.FileName != None:\r
index 74248f71c316675dcfd98240d6a56d975700a669..23ec58200b1ebcdf00878d35ed8b6eab23839d57 100644 (file)
@@ -44,6 +44,7 @@ class FV (FvClassObject):
         self.BaseAddress = None\r
         self.InfFileName = None\r
         self.FvAddressFileName = None\r
+        self.CapsuleName = None\r
 \r
     ## AddToBuffer()\r
     #\r
@@ -61,10 +62,27 @@ class FV (FvClassObject):
     #\r
     def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}) :\r
 \r
-        if self.UiFvName.upper() in GenFds.FvBinDict.keys():\r
-            return GenFds.FvBinDict[self.UiFvName.upper()]\r
-\r
-        GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV ..." %self.UiFvName)\r
+        if self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
+            return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']\r
+        \r
+        #\r
+        # Check whether FV in Capsule is in FD flash region.\r
+        # If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.\r
+        #\r
+        if self.CapsuleName != None:\r
+            for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
+                FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
+                for RegionObj in FdObj.RegionList:\r
+                    if RegionObj.RegionType == 'FV':\r
+                        for RegionData in RegionObj.RegionDataList:\r
+                            if RegionData.endswith(".fv"):\r
+                                continue\r
+                            elif RegionData.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
+                                continue\r
+                            elif self.UiFvName.upper() == RegionData.upper():\r
+                               GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))\r
+\r
+        GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)\r
 \r
         self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)\r
         #\r
@@ -115,12 +133,12 @@ class FV (FvClassObject):
         #\r
         FvFileObj = open ( FvOutputFile,'r+b')\r
 \r
-        GenFdsGlobalVariable.InfLogger( "\nGenerate %s FV Successfully" %self.UiFvName)\r
+        GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" %self.UiFvName)\r
         GenFdsGlobalVariable.SharpCounter = 0\r
 \r
         Buffer.write(FvFileObj.read())\r
         FvFileObj.close()\r
-        GenFds.FvBinDict[self.UiFvName.upper()] = FvOutputFile\r
+        GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile\r
         return FvOutputFile\r
 \r
     ## __InitializeInf__()\r
index 2bc416f828107215bb4d7a5f0cd47f871e532ed7..1df19100d3fc99127e1c7d480615052c88eba6a2 100644 (file)
@@ -20,7 +20,7 @@ import sys
 import os
 import linecache
 import FdfParser
-from Common.BuildToolError import *
+import Common.BuildToolError as BuildToolError
 from GenFdsGlobalVariable import GenFdsGlobalVariable
 from Workspace.WorkspaceDatabase import WorkspaceDatabase
 from Workspace.BuildClassObject import PcdClassObject
@@ -77,10 +77,10 @@ def main():
             EdkLogger.SetLevel(EdkLogger.INFO)
 
         if (Options.Workspace == None):
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "WORKSPACE not defined",
+            EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined",
                             ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
         elif not os.path.exists(Options.Workspace):
-            EdkLogger.error("GenFds", BuildToolError.PARAMETER_INVALID, "WORKSPACE is invalid",
+            EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid",
                             ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
         else:
             Workspace = os.path.normcase(Options.Workspace)
@@ -95,17 +95,17 @@ def main():
             FdfFilename = Options.filename
             FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
         else:
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing FDF filename")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF filename")
 
         if (Options.BuildTarget):
             GenFdsGlobalVariable.TargetName = Options.BuildTarget
         else:
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build target")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing build target")
 
         if (Options.ToolChain):
             GenFdsGlobalVariable.ToolChainTag = Options.ToolChain
         else:
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing tool chain tag")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing tool chain tag")
 
         if FdfFilename[0:2] == '..':
             FdfFilename = os.path.realpath(FdfFilename)
@@ -113,7 +113,7 @@ def main():
             FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
 
         if not os.path.exists(FdfFilename):
-            EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=FdfFilename)
+            EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename)
         GenFdsGlobalVariable.FdfFile = FdfFilename
         GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename)
 
@@ -128,19 +128,19 @@ def main():
                 ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
 
             if not os.path.exists(ActivePlatform)  :
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
 
             if ActivePlatform.find(Workspace) == -1:
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")
 
             ActivePlatform = ActivePlatform.replace(Workspace, '')
             if len(ActivePlatform) > 0 :
                 if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/':
                     ActivePlatform = ActivePlatform[1:]
             else:
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
         else :
-            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing active platform")
+            EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
 
         GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace)
 
@@ -148,26 +148,28 @@ def main():
         if os.path.isfile(BuildConfigurationFile) == True:
             TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile)
         else:
-            EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
+            EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
 
         if Options.Macros:
             for Pair in Options.Macros:
                 Pair.strip('"')
                 List = Pair.split('=')
                 if len(List) == 2:
-                    FdfParser.InputMacroDict[List[0].strip()] = List[1].strip()
                     if List[0].strip() == "EFI_SOURCE":
                         GlobalData.gEfiSource = List[1].strip()
+                        continue
                     elif List[0].strip() == "EDK_SOURCE":
                         GlobalData.gEdkSource = List[1].strip()
+                        continue
                     else:
                         GlobalData.gEdkGlobal[List[0].strip()] = List[1].strip()
+                        FdfParser.InputMacroDict[List[0].strip()] = List[1].strip()
                 else:
-                    FdfParser.InputMacroDict[List[0].strip()] = None
+                    FdfParser.InputMacroDict[List[0].strip()] = ""
 
         """call Workspace build create database"""
         os.environ["WORKSPACE"] = Workspace
-        BuildWorkSpace = WorkspaceDatabase(':memory:', GlobalData.gGlobalDefines)
+        BuildWorkSpace = WorkspaceDatabase(':memory:', FdfParser.InputMacroDict)
         BuildWorkSpace.InitDatabase()
         
         #
@@ -179,7 +181,7 @@ def main():
         if (Options.archList) :
             ArchList = Options.archList.split(',')
         else:
-#            EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build ARCH")
+#            EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH")
             ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList
 
         TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(ArchList)
@@ -206,7 +208,7 @@ def main():
                 OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
 
             if not os.path.exists(OutputDir):
-                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=OutputDir)
+                EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir)
             GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir
 
         """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """
@@ -214,20 +216,20 @@ def main():
         FdfParserObj.ParseFile()
 
         if FdfParserObj.CycleReferenceCheck():
-            EdkLogger.error("GenFds", BuildToolError.FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
+            EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
 
         if (Options.uiFdName) :
             if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys():
                 GenFds.OnlyGenerateThisFd = Options.uiFdName
             else:
-                EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID,
+                EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
                                 "No such an FD in FDF file: %s" % Options.uiFdName)
 
         if (Options.uiFvName) :
             if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys():
                 GenFds.OnlyGenerateThisFv = Options.uiFvName
             else:
-                EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID,
+                EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
                                 "No such an FV in FDF file: %s" % Options.uiFvName)
 
         """Modify images from build output if the feature of loading driver at fixed address is on."""
@@ -240,8 +242,8 @@ def main():
         GenFds.DisplayFvSpaceInfo(FdfParserObj)
         
     except FdfParser.Warning, X:
-        EdkLogger.error(X.ToolName, BuildToolError.FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
-        ReturnCode = BuildToolError.FORMAT_INVALID
+        EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
+        ReturnCode = FORMAT_INVALID
     except FatalError, X:
         if Options.debug != None:
             import traceback
@@ -309,8 +311,8 @@ def myOptionParser():
 #
 class GenFds :
     FdfParsef = None
-    # FvName in FDF, FvBinFile name
-    FvBinDict = {}
+    # FvName, FdName, CapName in FDF, Image file name
+    ImageBinDict = {}
     OnlyGenerateThisFd = None
     OnlyGenerateThisFv = None
 
@@ -324,17 +326,17 @@ class GenFds :
     def GenFd (OutputDir, FdfParser, WorkSpace, ArchList):
         GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)
 
-        GenFdsGlobalVariable.VerboseLogger("   Gen Fd  !")
+        GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")
         if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
             FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())
             if FdObj != None:
-                FdObj.GenFd(GenFds.FvBinDict)
-        elif GenFds.OnlyGenerateThisFv == None:
+                FdObj.GenFd()
+        elif GenFds.OnlyGenerateThisFd == None:
             for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
                 FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
-                FdObj.GenFd(GenFds.FvBinDict)
+                FdObj.GenFd()
 
-        GenFdsGlobalVariable.VerboseLogger(" Gen FV ! ")
+        GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")
         if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
             FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper())
             if FvObj != None:
@@ -343,7 +345,7 @@ class GenFds :
                 FvObj.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(FvObj))
                 Buffer.close()
                 return
-        elif GenFds.OnlyGenerateThisFd == None:
+        elif GenFds.OnlyGenerateThisFv == None:
             for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
                 Buffer = StringIO.StringIO('')
                 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
@@ -352,12 +354,14 @@ class GenFds :
                 Buffer.close()
 
         if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None:
-            GenFdsGlobalVariable.VerboseLogger(" Gen Capsule !")
-            for CapsuleObj in GenFdsGlobalVariable.FdfParser.Profile.CapsuleList:
-                CapsuleObj.GenCapsule()
-                
+            if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:
+                GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")
+                for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
+                    CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[CapsuleName]
+                    CapsuleObj.GenCapsule()
+
             if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
-                GenFdsGlobalVariable.VerboseLogger(" Gen Option ROM !")
+                GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!")
                 for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
                     OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
                     OptRomObj.AddToBuffer(None)
index d556ce7adeb698a734894837707d1a8cb9d94f4c..77c8821a055a6d188baec532cd0c5c48b27a5d5c 100644 (file)
@@ -360,7 +360,7 @@ class GenFdsGlobalVariable:
         try:
             PopenObject = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr= subprocess.PIPE)
         except Exception, X:
-            EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
+            EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
         (out, error) = PopenObject.communicate()
 
         while PopenObject.returncode == None :
@@ -371,7 +371,7 @@ class GenFdsGlobalVariable:
             GenFdsGlobalVariable.InfLogger (error)
             if PopenObject.returncode != 0:
                 print "###", cmd
-                EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, errorMess)
+                EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
 
     def VerboseLogger (msg):
         EdkLogger.verbose(msg)
@@ -380,7 +380,7 @@ class GenFdsGlobalVariable:
         EdkLogger.info(msg)
 
     def ErrorLogger (msg, File = None, Line = None, ExtraData = None):
-        EdkLogger.error('GenFds', BuildToolError.GENFDS_ERROR, msg, File, Line, ExtraData)
+        EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData)
 
     def DebugLogger (Level, msg):
         EdkLogger.debug(Level, msg)
index b9f0af54c9439cab251e722ab4789cce8cff19c9..8cd7429d58a44c794b66ffd364f4e7a8cbca8c1e 100644 (file)
@@ -48,7 +48,15 @@ class OptRomInfStatement (FfsInfStatement):
         \r
         if self.OverrideAttribs == None:\r
             self.OverrideAttribs = OptionRom.OverrideAttribs()\r
-        \r
+\r
+        if self.OverrideAttribs.NeedCompress == None:\r
+            self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('COMPRESS')\r
+            if self.OverrideAttribs.NeedCompress is not None:\r
+                if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'):\r
+                    GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for COMPRESS: %s" %self.InfFileName)\r
+                self.OverrideAttribs.NeedCompress = \\r
+                    self.OverrideAttribs.NeedCompress.upper() == 'TRUE'\r
+\r
         if self.OverrideAttribs.PciVendorId == None:\r
             self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID')\r
         \r
index e102e65f1c5a7df52b823502d46989e27b72865b..28e77aad5fbd4f1e918defc94942563be02f38a8 100644 (file)
@@ -135,6 +135,6 @@ class OverrideAttribs:
         self.PciClassCode = None\r
         self.PciDeviceId = None\r
         self.PciRevision = None\r
-        self.NeedCompress = False\r
+        self.NeedCompress = None\r
         \r
         
\ No newline at end of file
index ed16c6fa98da99eb3d2cb17dd744fd017f78fbb2..99f1ac39ac1092283a3e75c7960858cda6ccbedf 100644 (file)
@@ -20,10 +20,10 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
 import StringIO\r
 from CommonDataClass.FdfClass import RegionClassObject\r
 import os\r
+from stat import *\r
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 \r
-\r
 ## generate Region\r
 #\r
 #\r
@@ -52,9 +52,9 @@ class Region(RegionClassObject):
     #   @retval string      Generated FV file path\r
     #\r
 \r
-    def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, FvBinDict, vtfDict = None, MacroDict = {}):\r
+    def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict = None, MacroDict = {}):\r
         Size = self.Size\r
-        GenFdsGlobalVariable.InfLogger('Generate Region at Offset 0x%X' % self.Offset)\r
+        GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)\r
         GenFdsGlobalVariable.InfLogger("   Region Size = 0x%X" %Size)\r
         GenFdsGlobalVariable.SharpCounter = 0\r
 \r
@@ -62,15 +62,14 @@ class Region(RegionClassObject):
             #\r
             # Get Fv from FvDict\r
             #\r
-            FvBuffer = StringIO.StringIO('')\r
             RegionBlockSize = self.BlockSizeOfRegion(BlockSizeList)\r
             RegionBlockNum = self.BlockNumOfRegion(RegionBlockSize)\r
 \r
             self.FvAddress = int(BaseAddress, 16) + self.Offset\r
-            FvBaseAddress = '0x%X' %self.FvAddress\r
-\r
+            FvBaseAddress  = '0x%X' %self.FvAddress\r
+            FvOffset       = 0\r
             for RegionData in self.RegionDataList:\r
-\r
+                FileName = None\r
                 if RegionData.endswith(".fv"):\r
                     RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
                     GenFdsGlobalVariable.InfLogger('   Region FV File Name = .fv : %s'%RegionData)\r
@@ -79,83 +78,165 @@ class Region(RegionClassObject):
                     if not os.path.exists(RegionData):\r
                         EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
 \r
-                    BinFile = open (RegionData, 'r+b')\r
-                    FvBuffer.write(BinFile.read())\r
-                    if FvBuffer.len > Size:\r
+                    FileName = RegionData\r
+                elif RegionData.upper() + 'fv' in ImageBinDict.keys():\r
+                    GenFdsGlobalVariable.InfLogger('   Region Name = FV')\r
+                    FileName = ImageBinDict[RegionData.upper() + 'fv']\r
+                else:\r
+                    #\r
+                    # Generate FvImage.\r
+                    #\r
+                    FvObj = None\r
+                    if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
+                        FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())\r
+\r
+                    if FvObj != None :\r
+                        GenFdsGlobalVariable.InfLogger('   Region Name = FV')\r
+                        #\r
+                        # Call GenFv tool\r
+                        #\r
+                        BlockSize = RegionBlockSize\r
+                        BlockNum = RegionBlockNum\r
+                        if FvObj.BlockSizeList != []:\r
+                            if FvObj.BlockSizeList[0][0] != None:\r
+                                BlockSize = FvObj.BlockSizeList[0][0]\r
+                            if FvObj.BlockSizeList[0][1] != None:\r
+                                BlockNum = FvObj.BlockSizeList[0][1]\r
+                        self.FvAddress = self.FvAddress + FvOffset\r
+                        FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment)\r
+                        if self.FvAddress % FvAlignValue != 0:\r
+                            EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                            "FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))\r
+                        FvBuffer = StringIO.StringIO('')\r
+                        FvBaseAddress = '0x%X' %self.FvAddress\r
+                        FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)\r
+                        if FvBuffer.len > Size:\r
+                            FvBuffer.close()\r
+                            EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                            "Size of FV (%s) is larger than Region Size 0x%X specified." % (RegionData, Size))\r
+                        #\r
+                        # Put the generated image into FD buffer.\r
+                        #\r
+                        Buffer.write(FvBuffer.getvalue())\r
+                        FvBuffer.close()\r
+                        FvOffset = FvOffset + FvBuffer.len\r
+                        Size = Size - FvBuffer.len\r
+                        continue\r
+                    else:\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (RegionData))\r
+                #\r
+                # Add the exist Fv image into FD buffer\r
+                #\r
+                if FileName != None:\r
+                    FileLength = os.stat(FileName)[ST_SIZE]\r
+                    if FileLength > Size:\r
                         EdkLogger.error("GenFds", GENFDS_ERROR,\r
                                         "Size of FV File (%s) is larger than Region Size 0x%X specified." \\r
                                         % (RegionData, Size))\r
-                    break\r
-\r
-                if RegionData.upper() in FvBinDict.keys():\r
-                    continue\r
+                    BinFile = open (FileName, 'r+b')\r
+                    Buffer.write(BinFile.read())\r
+                    BinFile.close()\r
+                    Size = Size - FileLength\r
+            #\r
+            # Pad the left buffer\r
+            #\r
+            if Size > 0:\r
+                if (ErasePolarity == '1') :\r
+                    PadData = 0xFF\r
+                else :\r
+                    PadData = 0\r
+                for i in range(0, Size):\r
+                    Buffer.write(pack('B', PadData))\r
 \r
-                FvObj = None\r
-                if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
-                    FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())\r
+        if self.RegionType == 'CAPSULE':\r
+            #\r
+            # Get Capsule from Capsule Dict\r
+            #\r
+            for RegionData in self.RegionDataList:\r
+                if RegionData.endswith(".cap"):\r
+                    RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
+                    GenFdsGlobalVariable.InfLogger('   Region CAPSULE Image Name = .cap : %s'%RegionData)\r
+                    if RegionData[1] != ':' :\r
+                        RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
+                    if not os.path.exists(RegionData):\r
+                        EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
 \r
-                if FvObj != None :\r
-                    GenFdsGlobalVariable.InfLogger('   Region Name = FV')\r
+                    FileName = RegionData\r
+                elif RegionData.upper() + 'cap' in ImageBinDict.keys():\r
+                    GenFdsGlobalVariable.InfLogger('   Region Name = CAPSULE')\r
+                    FileName = ImageBinDict[RegionData.upper() + 'cap']\r
+                else:\r
                     #\r
-                    # Call GenFv tool\r
+                    # Generate Capsule image and Put it into FD buffer\r
                     #\r
-                    BlockSize = RegionBlockSize\r
-                    BlockNum = RegionBlockNum\r
-                    if FvObj.BlockSizeList != []:\r
-                        if FvObj.BlockSizeList[0][0] != None:\r
-                            BlockSize = FvObj.BlockSizeList[0][0]\r
-                        if FvObj.BlockSizeList[0][1] != None:\r
-                            BlockNum = FvObj.BlockSizeList[0][1]\r
-                    self.FvAddress = self.FvAddress + FvBuffer.len\r
-                    FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment)\r
-                    if self.FvAddress % FvAlignValue != 0:\r
-                        EdkLogger.error("GenFds", GENFDS_ERROR,\r
-                                        "FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))\r
-                    FvBaseAddress = '0x%X' %self.FvAddress\r
-                    FileName = FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)\r
-\r
-                    if FvBuffer.len > Size:\r
-                        EdkLogger.error("GenFds", GENFDS_ERROR,\r
-                                        "Size of FV (%s) is larger than Region Size 0x%X specified." % (RegionData, Size))\r
-                else:\r
-                    EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (RegionData))\r
+                    CapsuleObj = None\r
+                    if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():\r
+                        CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]\r
 \r
+                    if CapsuleObj != None :\r
+                        CapsuleObj.CapsuleName = RegionData.upper()\r
+                        GenFdsGlobalVariable.InfLogger('   Region Name = CAPSULE')\r
+                        #\r
+                        # Call GenFv tool to generate Capsule Image\r
+                        #\r
+                        FileName = CapsuleObj.GenCapsule()\r
+                        CapsuleObj.CapsuleName = None\r
+                    else:\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR, "Capsule (%s) is NOT described in FDF file!" % (RegionData))\r
 \r
-            if FvBuffer.len > 0:\r
-                Buffer.write(FvBuffer.getvalue())\r
-            else:\r
-                BinFile = open (FileName, 'rb')\r
+                #\r
+                # Add the capsule image into FD buffer\r
+                #\r
+                FileLength = os.stat(FileName)[ST_SIZE]\r
+                if FileLength > Size:\r
+                    EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                    "Size 0x%X of Capsule File (%s) is larger than Region Size 0x%X specified." \\r
+                                    % (FileLength, RegionData, Size))\r
+                BinFile = open (FileName, 'r+b')\r
                 Buffer.write(BinFile.read())\r
-\r
-            FvBuffer.close()\r
+                BinFile.close()\r
+                Size = Size - FileLength\r
+            #\r
+            # Pad the left buffer\r
+            #\r
+            if Size > 0:\r
+                if (ErasePolarity == '1') :\r
+                    PadData = 0xFF\r
+                else :\r
+                    PadData = 0\r
+                for i in range(0, Size):\r
+                    Buffer.write(pack('B', PadData))\r
 \r
         if self.RegionType == 'FILE':\r
-            FvBuffer = StringIO.StringIO('')\r
             for RegionData in self.RegionDataList:\r
                 RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
-                GenFdsGlobalVariable.InfLogger('   Region File Name = FILE: %s'%RegionData)\r
                 if RegionData[1] != ':' :\r
                     RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
                 if not os.path.exists(RegionData):\r
                     EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
-\r
-                BinFile = open (RegionData, 'r+b')\r
-                FvBuffer.write(BinFile.read())\r
-                if FvBuffer.len > Size :\r
+                #\r
+                # Add the file image into FD buffer\r
+                #\r
+                FileLength = os.stat(RegionData)[ST_SIZE]\r
+                if FileLength > Size:\r
                     EdkLogger.error("GenFds", GENFDS_ERROR,\r
-                                    "Size of File (%s) large than Region Size " % RegionData)\r
-\r
+                                    "Size of File (%s) is larger than Region Size 0x%X specified." \\r
+                                    % (RegionData, Size))\r
+                GenFdsGlobalVariable.InfLogger('   Region File Name = %s'%RegionData)\r
+                BinFile = open (RegionData, 'r+b')\r
+                Buffer.write(BinFile.read())\r
+                BinFile.close()\r
+                Size = Size - FileLength\r
             #\r
-            # If File contents less than region size, append "0xff" after it\r
+            # Pad the left buffer\r
             #\r
-            if FvBuffer.len < Size:\r
-                for index in range(0, (Size-FvBuffer.len)):\r
-                    if (ErasePolarity == '1'):\r
-                        FvBuffer.write(pack('B', int('0xFF', 16)))\r
-                    else:\r
-                        FvBuffer.write(pack('B', int('0x00', 16)))\r
-            Buffer.write(FvBuffer.getvalue())\r
-            FvBuffer.close()\r
+            if Size > 0:\r
+                if (ErasePolarity == '1') :\r
+                    PadData = 0xFF\r
+                else :\r
+                    PadData = 0\r
+                for i in range(0, Size):\r
+                    Buffer.write(pack('B', PadData))\r
 \r
         if self.RegionType == 'DATA' :\r
             GenFdsGlobalVariable.InfLogger('   Region Name = DATA')\r
@@ -168,12 +249,16 @@ class Region(RegionClassObject):
                 else:\r
                     for item in Data :\r
                         Buffer.write(pack('B', int(item, 16)))\r
-            if DataSize < Size:\r
-                if (ErasePolarity == '1'):\r
+                Size = Size - DataSize\r
+            #\r
+            # Pad the left buffer\r
+            #\r
+            if Size > 0:\r
+                if (ErasePolarity == '1') :\r
                     PadData = 0xFF\r
-                else:\r
+                else :\r
                     PadData = 0\r
-                for i in range(Size - DataSize):\r
+                for i in range(0, Size):\r
                     Buffer.write(pack('B', PadData))\r
 \r
         if self.RegionType == None:\r
index 294237daee08f17d314f09036b182bbeb7ec0a3c..40eb82656d73a9a88aedba4afa0b0bbbfdbfcd66 100644 (file)
@@ -16,6 +16,7 @@
 #
 import os
 import time
+import copy
 
 import Common.EdkLogger as EdkLogger
 from CommonDataClass.DataClass import *
@@ -55,7 +56,7 @@ class MetaFileParser(object):
         self._FileType = FileType
         self.MetaFile = FilePath
         self._FileDir = os.path.dirname(self.MetaFile)
-        self._Macros = {}
+        self._Macros = copy.copy(Macros)
 
         # for recursive parsing
         self._Owner = Owner
@@ -87,7 +88,9 @@ class MetaFileParser(object):
     ## Set parsing complete flag in both class and table
     def _Done(self):
         self._Finished = True
-        self._Table.SetEndFlag()
+        ## Do not set end flag when processing included files
+        if self._From == -1:
+            self._Table.SetEndFlag()
 
     ## Return the table containg parsed data
     #
@@ -208,11 +211,14 @@ class MetaFileParser(object):
         if TokenList[0] == '':
             EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-        if len(TokenList) == 1:
-            self._Macros[TokenList[0]] = ''
-        else:
-            # keep the macro definition for later use
-            self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
+
+        # Macros defined in the command line override ones defined in the meta-data file
+        if not TokenList[0] in self._Macros:
+            if len(TokenList) == 1:
+                self._Macros[TokenList[0]] = ''
+            else:
+                # keep the macro definition for later use
+                self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
 
         return TokenList[0], self._Macros[TokenList[0]]
 
index df0fa81ebb7d3bf72260afd63da64afa461f08bf..348d219aa9efd30907bbf6ef9c74a0e238d3049b 100644 (file)
@@ -17,6 +17,7 @@
 import sqlite3
 import os
 import os.path
+import pickle
 
 import Common.EdkLogger as EdkLogger
 import Common.GlobalData as GlobalData
@@ -24,6 +25,7 @@ import Common.GlobalData as GlobalData
 from Common.String import *
 from Common.DataType import *
 from Common.Misc import *
+from types import *
 
 from CommonDataClass.CommonClass import SkuInfoClass
 
@@ -1109,6 +1111,7 @@ class InfBuildData(ModuleBuildClassObject):
         "BS_DRIVER"             :   "DXE_DRIVER",
         "RT_DRIVER"             :   "DXE_RUNTIME_DRIVER",
         "SAL_RT_DRIVER"         :   "DXE_SAL_DRIVER",
+        "SMM_DRIVER"            :   "SMM_DRIVER",
     #    "BS_DRIVER"             :   "DXE_SMM_DRIVER",
     #    "BS_DRIVER"             :   "UEFI_DRIVER",
         "APPLICATION"           :   "UEFI_APPLICATION",
@@ -2059,11 +2062,11 @@ class WorkspaceDatabase(object):
         if DbPath != ':memory:':
             DbDir = os.path.split(DbPath)[0]
             if not os.path.exists(DbDir):
-                os.makedirs(DbDir)\r
-                
-        # remove db file in case inconsistency between db and file in file system
-        if self._CheckWhetherDbNeedRenew(RenewDb, DbPath):\r
-            os.remove(DbPath)\r
+                os.makedirs(DbDir)
+
+            # remove db file in case inconsistency between db and file in file system
+            if self._CheckWhetherDbNeedRenew(RenewDb, DbPath):
+                os.remove(DbPath)
         
         # create db with optimized parameters
         self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')
@@ -2084,60 +2087,95 @@ class WorkspaceDatabase(object):
         # conversion object for build or file format conversion purpose
         self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
         self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self)
-\r
-    ## Check whether workspace database need to be renew.\r
-    #  The renew reason maybe:\r
-    #  1) If user force to renew;\r
-    #  2) If user do not force renew, and\r
-    #     a) If the time of last modified python source is newer than database file;\r
-    #     b) If the time of last modified frozen executable file is newer than database file;\r
-    #\r
-    #  @param force     User force renew database\r
-    #  @param DbPath    The absolute path of workspace database file\r
-    #\r
-    #  @return Bool value for whether need renew workspace databse\r
-    #\r
-    def _CheckWhetherDbNeedRenew (self, force, DbPath):\r
-        # if database does not exist, we need do nothing\r
-        if not os.path.exists(DbPath): return False\r
-            \r
-        # if user force to renew database, then not check whether database is out of date\r
-        if force: return True\r
-        \r
-        #    \r
-        # Check the time of last modified source file or build.exe\r
-        # if is newer than time of database, then database need to be re-created.\r
-        #\r
-        timeOfToolModified = 0\r
-        if hasattr(sys, "frozen"):\r
-            exePath             = os.path.abspath(sys.executable)\r
-            timeOfToolModified  = os.stat(exePath).st_mtime\r
-        else:\r
-            curPath  = os.path.dirname(__file__) # curPath is the path of WorkspaceDatabase.py\r
-            rootPath = os.path.split(curPath)[0] # rootPath is root path of python source, such as /BaseTools/Source/Python\r
-            if rootPath == "" or rootPath == None:\r
-                EdkLogger.verbose("\nFail to find the root path of build.exe or python sources, so can not \\r
-determine whether database file is out of date!\n")\r
-        \r
-            # walk the root path of source or build's binary to get the time last modified.\r
-        \r
-            for root, dirs, files in os.walk (rootPath):\r
-                for dir in dirs:\r
-                    # bypass source control folder \r
-                    if dir.lower() in [".svn", "_svn", "cvs"]:\r
-                        dirs.remove(dir)\r
-                        \r
-                for file in files:\r
-                    ext = os.path.splitext(file)[1]\r
-                    if ext.lower() == ".py":            # only check .py files\r
-                        fd = os.stat(os.path.join(root, file))\r
-                        if timeOfToolModified < fd.st_mtime:\r
-                            timeOfToolModified = fd.st_mtime\r
-        if timeOfToolModified > os.stat(DbPath).st_mtime:\r
-            EdkLogger.verbose("\nWorkspace database is out of data!")\r
-            return True\r
-            \r
-        return False\r
+
+    ## Check whether workspace database need to be renew.
+    #  The renew reason maybe:
+    #  1) If user force to renew;
+    #  2) If user do not force renew, and
+    #     a) If the time of last modified python source is newer than database file;
+    #     b) If the time of last modified frozen executable file is newer than database file;
+    #
+    #  @param force     User force renew database
+    #  @param DbPath    The absolute path of workspace database file
+    #
+    #  @return Bool value for whether need renew workspace databse
+    #
+    def _CheckWhetherDbNeedRenew (self, force, DbPath):
+        DbDir = os.path.split(DbPath)[0]
+        MacroFilePath = os.path.normpath(os.path.join(DbDir, "build.mac"))
+        MacroMatch = False
+        if os.path.exists(MacroFilePath) and os.path.isfile(MacroFilePath):
+            LastMacros = None
+            try:
+                f = open(MacroFilePath,'r')
+                LastMacros = pickle.load(f)
+                f.close()
+            except IOError:
+                pass
+            except:
+                f.close()
+
+            if LastMacros != None and type(LastMacros) is DictType:
+                if LastMacros == self._GlobalMacros:
+                    MacroMatch = True
+                    for Macro in LastMacros.keys():
+                        if not (Macro in self._GlobalMacros and LastMacros[Macro] == self._GlobalMacros[Macro]):
+                            MacroMatch = False;
+                            break;
+
+        if not MacroMatch:
+            # save command line macros to file
+            try:
+                f = open(MacroFilePath,'w')
+                pickle.dump(self._GlobalMacros, f, 2)
+                f.close()
+            except IOError:
+                pass
+            except:
+                f.close()
+
+            force = True
+
+        # if database does not exist, we need do nothing
+        if not os.path.exists(DbPath): return False
+            
+        # if user force to renew database, then not check whether database is out of date
+        if force: return True
+        
+        #    
+        # Check the time of last modified source file or build.exe
+        # if is newer than time of database, then database need to be re-created.
+        #
+        timeOfToolModified = 0
+        if hasattr(sys, "frozen"):
+            exePath             = os.path.abspath(sys.executable)
+            timeOfToolModified  = os.stat(exePath).st_mtime
+        else:
+            curPath  = os.path.dirname(__file__) # curPath is the path of WorkspaceDatabase.py
+            rootPath = os.path.split(curPath)[0] # rootPath is root path of python source, such as /BaseTools/Source/Python
+            if rootPath == "" or rootPath == None:
+                EdkLogger.verbose("\nFail to find the root path of build.exe or python sources, so can not \
+determine whether database file is out of date!\n")
+        
+            # walk the root path of source or build's binary to get the time last modified.
+        
+            for root, dirs, files in os.walk (rootPath):
+                for dir in dirs:
+                    # bypass source control folder 
+                    if dir.lower() in [".svn", "_svn", "cvs"]:
+                        dirs.remove(dir)
+                        
+                for file in files:
+                    ext = os.path.splitext(file)[1]
+                    if ext.lower() == ".py":            # only check .py files
+                        fd = os.stat(os.path.join(root, file))
+                        if timeOfToolModified < fd.st_mtime:
+                            timeOfToolModified = fd.st_mtime
+        if timeOfToolModified > os.stat(DbPath).st_mtime:
+            EdkLogger.verbose("\nWorkspace database is out of data!")
+            return True
+            
+        return False
             
     ## Initialize build database
     def InitDatabase(self):
index c92b44261592ec6b9c32bec37ceb752212c603b4..7d14e1542048585e640b5694eeafa709b4d2ff59 100644 (file)
@@ -158,13 +158,6 @@ def CheckEnvVariable():
         EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
                         ExtraData="PATH")
 
-    # for macro replacement in R9 DSC/DEC/INF file
-    GlobalData.gGlobalDefines["WORKSPACE"] = ""
-
-    # for macro replacement in R8 INF file
-    GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir
-    GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir
-
     GlobalData.gWorkspace = WorkspaceDir
     GlobalData.gEfiSource = EfiSourceDir
     GlobalData.gEdkSource = EdkSourceDir
@@ -705,8 +698,8 @@ class Build():
 
         self.TargetTxt      = TargetTxtClassObject()
         self.ToolDef        = ToolDefClassObject()
-        #self.Db             = WorkspaceDatabase(None, GlobalData.gGlobalDefines, self.Reparse)
-        self.Db             = WorkspaceDatabase(None, {}, self.Reparse)
+        self.Db             = WorkspaceDatabase(None, GlobalData.gGlobalDefines, self.Reparse)
+        #self.Db             = WorkspaceDatabase(None, {}, self.Reparse)
         self.BuildDatabase  = self.Db.BuildObject
         self.Platform       = None
 
@@ -1258,6 +1251,7 @@ def MyOptionParser():
                                                                                "including library instances selected, final dependency expression, "\
                                                                                "and warning messages, etc.")
     Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+    Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
 
     (Opt, Args)=Parser.parse_args()
     return (Opt, Args)
@@ -1321,7 +1315,7 @@ def Main():
             EdkLogger.error("build", OPTION_NOT_SUPPORTED, "Not supported target [%s]." % Target,
                             ExtraData="Please select one of: %s" %(' '.join(gSupportedTarget)))
 
-        # GlobalData.gGlobalDefines = ParseDefines(Option.Defines)
+        GlobalData.gGlobalDefines = ParseDefines(Option.Macros)
         #
         # Check environment variable: EDK_TOOLS_PATH, WORKSPACE, PATH
         #
index 67d2ca4756b1842bbfd0b5863b9ea1ad35b11b8b..47eb81fce82955cb17f741e55c8177b6b728607d 100644 (file)
@@ -29,8 +29,8 @@ class Tests(TestTools.BaseToolsTest):
     def SingleFileTest(self, filename):
         try:
             py_compile.compile(filename, doraise=True)
-        except:
-            self.fail('syntax error: ' + filename)
+        except Exception, e:
+            self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
 
 def MakePythonSyntaxCheckTests():
     def GetAllPythonSourceFiles():
index 525bffa7cfdf509b28e42c5c68b1d9ff1df88efe..36cd9d2491b17788a5830312d616972f6b11696c 100755 (executable)
@@ -3,7 +3,7 @@
 @REM   however it may be executed directly from the BaseTools project folder\r
 @REM   if the file is not executed within a WORKSPACE\BaseTools folder.\r
 @REM\r
-@REM Copyright (c) 2006 - 2008, Intel Corporation.  All rights reserved.\r
+@REM Copyright (c) 2006 - 2009, Intel Corporation.  All rights reserved.\r
 @REM\r
 @REM This program and the accompanying materials are licensed and made available\r
 @REM under the terms and conditions of the BSD Licensewhich accompanies this \r
@@ -261,7 +261,7 @@ goto end
       set PYTHON_HOME=%PYTHONHOME%\r
     ) else (\r
       echo.\r
-      echo  !!! ERROR !!! PYTHON is required to build or execute the tools !!!\r
+      echo  !!! ERROR !!! PYTHON_HOME is required to build or execute the tools, please set it. !!!\r
       echo.\r
       goto end\r
     )\r