Sync tool code to BuildTools project r1739.
authorlgao4 <lgao4@de2fecce-e211-0410-80a6-f3fac2684e05>
Mon, 9 Nov 2009 11:47:35 +0000 (11:47 +0000)
committerlgao4 <lgao4@de2fecce-e211-0410-80a6-f3fac2684e05>
Mon, 9 Nov 2009 11:47:35 +0000 (11:47 +0000)
git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@9397 de2fecce-e211-0410-80a6-f3fac2684e05

65 files changed:
edk2/BaseTools/Bin/Win32/BootSectImage.exe
edk2/BaseTools/Bin/Win32/EfiLdrImage.exe
edk2/BaseTools/Bin/Win32/EfiRom.exe
edk2/BaseTools/Bin/Win32/Fpd2Dsc.exe
edk2/BaseTools/Bin/Win32/GenBootSector.exe
edk2/BaseTools/Bin/Win32/GenCrc32.exe
edk2/BaseTools/Bin/Win32/GenDepex.exe
edk2/BaseTools/Bin/Win32/GenFds.exe
edk2/BaseTools/Bin/Win32/GenFfs.exe
edk2/BaseTools/Bin/Win32/GenFv.exe
edk2/BaseTools/Bin/Win32/GenFw.exe
edk2/BaseTools/Bin/Win32/GenPage.exe
edk2/BaseTools/Bin/Win32/GenSec.exe
edk2/BaseTools/Bin/Win32/GenVtf.exe
edk2/BaseTools/Bin/Win32/LzmaCompress.exe
edk2/BaseTools/Bin/Win32/MigrationMsa2Inf.exe
edk2/BaseTools/Bin/Win32/Spd2Dec.exe
edk2/BaseTools/Bin/Win32/Split.exe
edk2/BaseTools/Bin/Win32/TargetTool.exe
edk2/BaseTools/Bin/Win32/TianoCompress.exe
edk2/BaseTools/Bin/Win32/Trim.exe
edk2/BaseTools/Bin/Win32/VfrCompile.exe
edk2/BaseTools/Bin/Win32/VolInfo.exe
edk2/BaseTools/Bin/Win32/build.exe
edk2/BaseTools/Conf/build_rule.template
edk2/BaseTools/Conf/tools_def.template
edk2/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
edk2/BaseTools/Source/C/Common/FvLib.c
edk2/BaseTools/Source/C/GenFfs/GenFfs.c
edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.c
edk2/BaseTools/Source/C/GenFv/GenFvInternalLib.h
edk2/BaseTools/Source/C/GenFw/GenFw.c
edk2/BaseTools/Source/C/GenVtf/GenVtf.c
edk2/BaseTools/Source/C/GenVtf/GenVtf.h
edk2/BaseTools/Source/C/Include/Common/PiFirmwareFile.h
edk2/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
edk2/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
edk2/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
edk2/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
edk2/BaseTools/Source/C/VfrCompile/VfrSyntax.g
edk2/BaseTools/Source/C/VolInfo/VolInfo.c
edk2/BaseTools/Source/Python/AutoGen/AutoGen.py
edk2/BaseTools/Source/Python/AutoGen/GenC.py
edk2/BaseTools/Source/Python/AutoGen/GenDepex.py
edk2/BaseTools/Source/Python/AutoGen/StrGather.py
edk2/BaseTools/Source/Python/AutoGen/UniClassObject.py
edk2/BaseTools/Source/Python/Common/DataType.py
edk2/BaseTools/Source/Python/Common/FdfParserLite.py
edk2/BaseTools/Source/Python/Common/InfClassObject.py
edk2/BaseTools/Source/Python/Common/Misc.py
edk2/BaseTools/Source/Python/CommonDataClass/CommonClass.py
edk2/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
edk2/BaseTools/Source/Python/CommonDataClass/PackageClass.py
edk2/BaseTools/Source/Python/GenFds/DepexSection.py
edk2/BaseTools/Source/Python/GenFds/Fd.py
edk2/BaseTools/Source/Python/GenFds/FdfParser.py
edk2/BaseTools/Source/Python/GenFds/Ffs.py
edk2/BaseTools/Source/Python/GenFds/FfsInfStatement.py
edk2/BaseTools/Source/Python/GenFds/Fv.py
edk2/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
edk2/BaseTools/Source/Python/GenFds/Section.py
edk2/BaseTools/Source/Python/Workspace/MetaFileParser.py
edk2/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
edk2/BaseTools/Source/Python/build/build.py

index b239a9d..a20f3a3 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/BootSectImage.exe and b/edk2/BaseTools/Bin/Win32/BootSectImage.exe differ
index 377f851..2e3b102 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/EfiLdrImage.exe and b/edk2/BaseTools/Bin/Win32/EfiLdrImage.exe differ
index e9264b4..413f2bb 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/EfiRom.exe and b/edk2/BaseTools/Bin/Win32/EfiRom.exe differ
index 0908d2c..59212c5 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/Fpd2Dsc.exe and b/edk2/BaseTools/Bin/Win32/Fpd2Dsc.exe differ
index bee5b51..406f903 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenBootSector.exe and b/edk2/BaseTools/Bin/Win32/GenBootSector.exe differ
index 2ae3c80..d8185c5 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenCrc32.exe and b/edk2/BaseTools/Bin/Win32/GenCrc32.exe differ
index d27b507..ba0bc6c 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenDepex.exe and b/edk2/BaseTools/Bin/Win32/GenDepex.exe differ
index 0d10d13..96572b8 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenFds.exe and b/edk2/BaseTools/Bin/Win32/GenFds.exe differ
index 3ef968b..a479bd8 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenFfs.exe and b/edk2/BaseTools/Bin/Win32/GenFfs.exe differ
index 25f8904..2281b88 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenFv.exe and b/edk2/BaseTools/Bin/Win32/GenFv.exe differ
index a88916e..cb6f95f 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenFw.exe and b/edk2/BaseTools/Bin/Win32/GenFw.exe differ
index 72d8c9d..6b64ebc 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenPage.exe and b/edk2/BaseTools/Bin/Win32/GenPage.exe differ
index d042527..c19a2fd 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenSec.exe and b/edk2/BaseTools/Bin/Win32/GenSec.exe differ
index 3ab5630..19aa09c 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/GenVtf.exe and b/edk2/BaseTools/Bin/Win32/GenVtf.exe differ
index 20a90b0..76c369f 100644 (file)
Binary files a/edk2/BaseTools/Bin/Win32/LzmaCompress.exe and b/edk2/BaseTools/Bin/Win32/LzmaCompress.exe differ
index b360966..089252d 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/MigrationMsa2Inf.exe and b/edk2/BaseTools/Bin/Win32/MigrationMsa2Inf.exe differ
index c28ace4..c88b721 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/Spd2Dec.exe and b/edk2/BaseTools/Bin/Win32/Spd2Dec.exe differ
index bd4ad84..2583f30 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/Split.exe and b/edk2/BaseTools/Bin/Win32/Split.exe differ
index f3bafab..b0c6cde 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/TargetTool.exe and b/edk2/BaseTools/Bin/Win32/TargetTool.exe differ
index b8862c0..65e7b65 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/TianoCompress.exe and b/edk2/BaseTools/Bin/Win32/TianoCompress.exe differ
index 5cfb19e..d99729f 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/Trim.exe and b/edk2/BaseTools/Bin/Win32/Trim.exe differ
index da9bdb6..bcf7958 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/VfrCompile.exe and b/edk2/BaseTools/Bin/Win32/VfrCompile.exe differ
index 389d913..116efbd 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/VolInfo.exe and b/edk2/BaseTools/Bin/Win32/VolInfo.exe differ
index 3999ed1..b636e70 100755 (executable)
Binary files a/edk2/BaseTools/Bin/Win32/build.exe and b/edk2/BaseTools/Bin/Win32/build.exe differ
index f036fb3..0ce61b7 100644 (file)
@@ -69,6 +69,7 @@
 #   $(<tool>_FLAGS)     Tools flags of current module\r
 #   $(MODULE_NAME)      Current module name\r
 #   $(MODULE_TYPE)      Current module type\r
+#   $(MODULE_GUID)      Current module guid\r
 #   $(ARCH)             Architecture of current module\r
 #   $(TOOLCHAIN)        Toolchain used to build current module\r
 #   $(TARGET)           Target of current module (DEBUG/RELEASE)\r
         "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)\r
 \r
     <Command.GCC>\r
-        "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @"$(OBJECT_FILES_LIST)"\r
+        "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)\r
     \r
     <Command.RVCT>\r
         "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)\r
         "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)\r
 \r
     <Command.GCC>\r
-        "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @"$(STATIC_LIBRARY_FILES_LIST)" -\) $(DLINK2_FLAGS)\r
+        "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)\r
         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}\r
 \r
     <Command.RVCT>\r
     <Command>\r
         $(OPTROM) -i $(PCI_DEVICE_ID) -f $(PCI_VENDOR_ID) -l $(PCI_CLASS_CODE) -r $(PCI_REVISION) -o $dst $(OPTROM_FLAGS) $src\r
 \r
+[Unicode-Text-File.UEFI_HII]\r
+    <InputFile>\r
+        *.uni, *.Uni, *.UNI\r
+\r
+    <OutputFile>\r
+        $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk\r
+        $(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h\r
+\r
+    <Command>\r
+\r
+[Visual-Form-Representation-File.UEFI_HII]\r
+    <InputFile>\r
+        ?.vfr\r
+        ?.Vfr\r
+        ?.VFR\r
+\r
+    <ExtraDependency>\r
+        $(MAKE_FILE)\r
+\r
+    <OutputFile>\r
+        $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.hpk\r
+\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
+        -$(MD) $(OUTPUT_DIR)(+)${s_dir} > NUL 2>&1\r
+        "$(VFR)" $(VFR_FLAGS) --create-ifr-package --output-directory $(OUTPUT_DIR)(+)${s_dir} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i\r
+\r
+[Hii-Binary-Package.UEFI_HII]\r
+    <InputFile>\r
+        *.hpk\r
+\r
+    <OutputFile>\r
+        $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib\r
+\r
+    <Command.MSFT, Command.INTEL>\r
+        GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES)\r
+        "$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc\r
+\r
+    <Command.GCC>\r
+        GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES)\r
+        "$(RC)" (RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}\r
index b3132a0..cbff0b1 100644 (file)
@@ -27,6 +27,16 @@ DEFINE VS2005x86_DLL    = C:\Program Files (x86)\Microsoft Visual Studio 8\Commo
 DEFINE VS2005x86_BINX64 = DEF(VS2005x86_BIN)\x86_amd64\r
 DEFINE VS2005x86_BIN64  = DEF(VS2005x86_BIN)\x86_ia64\r
 \r
+\r
+# These defines are needed for certain Microsoft Visual Studio tools that\r
+# are used by other toolchains.  An example is that ICC on Windows normally\r
+# uses Microsoft's nmake.exe.\r
+\r
+# Some MS_VS_BIN options: DEF(VS2003_BIN), DEF(VS2005_BIN), DEF(VS2005x86_BIN)\r
+DEFINE MS_VS_BIN   = DEF(VS2005_BIN)\r
+# Some MS_VS_DLL options: DEF(VS2003_DLL), DEF(VS2005_DLL), DEF(VS2005x86_DLL)\r
+DEFINE MS_VS_DLL   = DEF(VS2005_DLL)\r
+\r
 DEFINE WINDDK_BIN16     = C:\WINDDK\3790.1830\bin\bin16\r
 DEFINE WINDDK_BIN32     = C:\WINDDK\3790.1830\bin\x86\r
 DEFINE WINDDK_BINX64    = C:\WINDDK\3790.1830\bin\win64\x86\amd64\r
@@ -80,7 +90,7 @@ DEFINE UNIXGCC_IPF_PETOOLS_PREFIX  = /opt/tiano/ia64-pc-elf/ia64-pc-elf/bin/
 #\r
 \r
 DEFINE CYGWIN_BIN              = c:/cygwin/bin\r
-DEFINE CYGWIN_BIN32            = c:/cygwin/opt/tiano/i386-tiano-pe/i386-tiano-pe/bin/\r
+DEFINE CYGWIN_BINIA32          = c:/cygwin/opt/tiano/i386-tiano-pe/i386-tiano-pe/bin/\r
 DEFINE CYGWIN_BINX64           = c:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin/\r
 DEFINE CYGWIN_BINIPF           = c:/cygwin/opt/tiano/gcc/ipf/bin/ia64-pc-elf-\r
 \r
@@ -237,7 +247,7 @@ DEFINE ARMGCC_BIN              = /
 *_VS2003_IA32_ASLCC_PATH            = DEF(VS2003_BIN)\cl.exe\r
 *_VS2003_IA32_ASLPP_PATH            = DEF(VS2003_BIN)\cl.exe\r
 *_VS2003_IA32_ASLDLINK_PATH         = DEF(VS2003_BIN)\link.exe\r
-\r
+*_VS2003_IA32_RC_PATH               = DEF(VS2003_BIN)\rc.exe\r
 \r
       *_VS2003_IA32_MAKE_FLAGS      = /nologo\r
       *_VS2003_IA32_APP_FLAGS       = /nologo /E /TC\r
@@ -248,8 +258,8 @@ RELEASE_VS2003_IA32_CC_FLAGS        = /nologo /c /WX /W4 /Gs8192 /Gy /D UNICODE
   DEBUG_VS2003_IA32_ASM_FLAGS       = /nologo /c /WX /W3 /coff /Cx /Zd /Zi\r
 RELEASE_VS2003_IA32_ASM_FLAGS       = /nologo /c /WX /W3 /coff /Cx /Zd\r
       *_VS2003_IA32_SLINK_FLAGS     = /nologo /LTCG\r
-  DEBUG_VS2003_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2003_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2003_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2003_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_VS2003_IA32_ASMLINK_FLAGS   = /nologo /tiny\r
 \r
 ##################\r
@@ -263,6 +273,7 @@ RELEASE_VS2003_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:RE
 *_VS2003_EBC_CC_PATH                = DEF(EBC_BIN)\iec.exe\r
 *_VS2003_EBC_SLINK_PATH             = DEF(EBC_BIN)\link.exe\r
 *_VS2003_EBC_DLINK_PATH             = DEF(EBC_BIN)\link.exe\r
+*_VS2003_EBC_RC_PATH                = DEF(VS2003_BIN)\rc.exe\r
 \r
 *_VS2003_EBC_MAKE_FLAGS             = /nologo\r
 *_VS2003_EBC_PP_FLAGS               = /nologo /E /TC /FIAutoGen.h\r
@@ -306,6 +317,7 @@ RELEASE_VS2003_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:RE
 *_VS2003xASL_IA32_ASLCC_PATH            = DEF(VS2003_BIN)\cl.exe\r
 *_VS2003xASL_IA32_ASLPP_PATH            = DEF(VS2003_BIN)\cl.exe\r
 *_VS2003xASL_IA32_ASLDLINK_PATH         = DEF(VS2003_BIN)\link.exe\r
+*_VS2003xASL_IA32_RC_PATH               = DEF(VS2003_BIN)\rc.exe\r
 \r
 \r
       *_VS2003xASL_IA32_MAKE_FLAGS      = /nologo\r
@@ -317,8 +329,8 @@ RELEASE_VS2003xASL_IA32_CC_FLAGS        = /nologo /c /WX /W4 /Gs8192 /Gy /D UNIC
   DEBUG_VS2003xASL_IA32_ASM_FLAGS       = /nologo /c /WX /W3 /coff /Cx /Zd /Zi\r
 RELEASE_VS2003xASL_IA32_ASM_FLAGS       = /nologo /c /WX /W3 /coff /Cx /Zd\r
       *_VS2003xASL_IA32_SLINK_FLAGS     = /nologo /LTCG\r
-  DEBUG_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_VS2003xASL_IA32_ASMLINK_FLAGS   = /nologo /tiny\r
 \r
 ##################\r
@@ -332,6 +344,7 @@ RELEASE_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
 *_VS2003xASL_EBC_CC_PATH                = DEF(EBC_BIN)\iec.exe\r
 *_VS2003xASL_EBC_SLINK_PATH             = DEF(EBC_BIN)\link.exe\r
 *_VS2003xASL_EBC_DLINK_PATH             = DEF(EBC_BIN)\link.exe\r
+*_VS2003xASL_EBC_RC_PATH                = DEF(VS2003_BIN)\rc.exe\r
 \r
 *_VS2003xASL_EBC_MAKE_FLAGS             = /nologo\r
 *_VS2003xASL_EBC_PP_FLAGS               = /nologo /E /TC /FIAutoGen.h\r
@@ -352,6 +365,7 @@ RELEASE_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
 \r
 *_VS2005_*_MAKE_PATH              = DEF(VS2005_BIN)\nmake.exe\r
 *_VS2005_*_MAKE_FLAGS             = /nologo\r
+*_VS2005_*_RC_PATH                = DEF(VS2005_BIN)\rc.exe\r
 \r
 *_VS2005_*_SLINK_FLAGS            = /NOLOGO /LTCG\r
 *_VS2005_*_APP_FLAGS              = /nologo /E /TC\r
@@ -391,8 +405,8 @@ RELEASE_VS2003xASL_IA32_DLINK_FLAGS     = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OP
 RELEASE_VS2005_IA32_CC_FLAGS      = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005_IA32_ASM_FLAGS     = /nologo /c /WX /W3 /Cx /coff /Zd /Zi\r
 RELEASE_VS2005_IA32_ASM_FLAGS     = /nologo /c /WX /W3 /Cx /coff /Zd\r
-  DEBUG_VS2005_IA32_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005_IA32_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005_IA32_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005_IA32_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_VS2005_IA32_ASMLINK_FLAGS = /nologo /tiny\r
 \r
 ##################\r
@@ -416,8 +430,8 @@ RELEASE_VS2005_IA32_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 RELEASE_VS2005_X64_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_VS2005_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_VS2005_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -439,8 +453,8 @@ RELEASE_VS2005_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /O
 RELEASE_VS2005_IPF_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32\r
   DEBUG_VS2005_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_VS2005_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_VS2005_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_VS2005_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+  DEBUG_VS2005_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_VS2005_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
 \r
 ##################\r
 # EBC definitions\r
@@ -473,6 +487,7 @@ RELEASE_VS2005_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF
 \r
 *_VS2005xASL_*_MAKE_PATH       = DEF(VS2005_BIN)\nmake.exe\r
 *_VS2005xASL_*_MAKE_FLAG       = /nologo\r
+*_VS2005xASL_*_RC_PATH         = DEF(VS2005_BIN)\rc.exe\r
 \r
 *_VS2005xASL_*_SLINK_FLAGS     = /NOLOGO /LTCG\r
 *_VS2005xASL_*_APP_FLAGS       = /nologo /E /TC\r
@@ -512,8 +527,8 @@ RELEASE_VS2005_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF
 RELEASE_VS2005xASL_IA32_CC_FLAGS    = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005xASL_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /Cx /coff /Zd /Zi\r
 RELEASE_VS2005xASL_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /Cx /coff /Zd\r
-  DEBUG_VS2005xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_VS2005xASL_IA32_ASMLINK_FLAGS= /nologo /tiny\r
 \r
 ##################\r
@@ -537,8 +552,8 @@ RELEASE_VS2005xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:RE
 RELEASE_VS2005xASL_X64_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005xASL_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_VS2005xASL_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_VS2005xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -560,8 +575,8 @@ RELEASE_VS2005xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:RE
 RELEASE_VS2005xASL_IPF_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32\r
   DEBUG_VS2005xASL_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_VS2005xASL_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_VS2005xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_VS2005xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+  DEBUG_VS2005xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_VS2005xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
 \r
 ##################\r
 # EBC definitions\r
@@ -594,6 +609,7 @@ RELEASE_VS2005xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.
 \r
 *_VS2005x86_*_MAKE_PATH       = DEF(VS2005x86_BIN)\nmake.exe\r
 *_VS2005x86_*_MAKE_FLAGS      = /nologo\r
+*_VS2005x86_*_RC_PATH         = DEF(VS2005x86_BIN)\rc.exe\r
 \r
 *_VS2005x86_*_SLINK_FLAGS     = /NOLOGO /LTCG\r
 *_VS2005x86_*_APP_FLAGS       = /nologo /E /TC\r
@@ -633,8 +649,8 @@ RELEASE_VS2005xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.
 RELEASE_VS2005x86_IA32_CC_FLAGS    = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005x86_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /Cx /coff /Zd /Zi\r
 RELEASE_VS2005x86_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /Cx /coff /Zd\r
-  DEBUG_VS2005x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_VS2005x86_IA32_ASMLINK_FLAGS= /nologo /tiny\r
 \r
 ##################\r
@@ -658,8 +674,8 @@ RELEASE_VS2005x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 RELEASE_VS2005x86_X64_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005x86_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_VS2005x86_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_VS2005x86_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005x86_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005x86_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005x86_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -681,8 +697,8 @@ RELEASE_VS2005x86_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
 RELEASE_VS2005x86_IPF_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32\r
   DEBUG_VS2005x86_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_VS2005x86_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_VS2005x86_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_VS2005x86_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+  DEBUG_VS2005x86_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_VS2005x86_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
 \r
 ##################\r
 # EBC definitions\r
@@ -715,6 +731,7 @@ RELEASE_VS2005x86_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.I
 \r
 *_VS2005x86xASL_*_MAKE_PATH       = DEF(VS2005x86_BIN)\nmake.exe\r
 *_VS2005x86xASL_*_MAKE_FLAGS      = /nologo\r
+*_VS2005x86xASL_*_RC_PATH         = DEF(VS2005x86_BIN)\rc.exe\r
 \r
 *_VS2005x86xASL_*_SLINK_FLAGS     = /NOLOGO /LTCG\r
 *_VS2005x86xASL_*_APP_FLAGS       = /nologo /E /TC\r
@@ -754,8 +771,8 @@ RELEASE_VS2005x86_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.I
 RELEASE_VS2005x86xASL_IA32_CC_FLAGS    = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005x86xASL_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /Cx /coff /Zd /Zi\r
 RELEASE_VS2005x86xASL_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /Cx /coff /Zd\r
-  DEBUG_VS2005x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_VS2005x86xASL_IA32_ASMLINK_FLAGS= /nologo /tiny\r
 \r
 ##################\r
@@ -779,8 +796,8 @@ RELEASE_VS2005x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT
 RELEASE_VS2005x86xASL_X64_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_VS2005x86xASL_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_VS2005x86xASL_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_VS2005x86xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_VS2005x86xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_VS2005x86xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_VS2005x86xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -802,8 +819,8 @@ RELEASE_VS2005x86xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT
 RELEASE_VS2005x86xASL_IPF_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32\r
   DEBUG_VS2005x86xASL_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_VS2005x86xASL_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_VS2005x86xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_VS2005x86xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+  DEBUG_VS2005x86xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_VS2005x86xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
 \r
 ##################\r
 # EBC definitions\r
@@ -836,6 +853,7 @@ RELEASE_VS2005x86xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:R
 \r
 *_DDK3790_*_MAKE_PATH       = DEF(WINDDK_BIN32)\nmake.exe\r
 *_DDK3790_*_MAKE_FLAGS           = /nologo\r
+*_DDK3790_*_RC_PATH         = DEF(WINDDK_BIN32)\rc.exe\r
 \r
 *_DDK3790_*_PP_FLAGS             = /nologo /E /TC /FIAutoGen.h\r
 *_DDK3790_*_APP_FLAGS            = /nologo /E /TC\r
@@ -871,8 +889,8 @@ RELEASE_VS2005x86xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:R
 RELEASE_DDK3790_IA32_CC_FLAGS    = /nologo /c /WX /W4 /Gy /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_DDK3790_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /coff /Cx /Zd /Zi\r
 RELEASE_DDK3790_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /coff /Cx /Zd\r
-  DEBUG_DDK3790_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_DDK3790_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_DDK3790_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_DDK3790_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
     *_DDK3790_IA32_ASMLINK_FLAGS = /nologo /tiny\r
 \r
 ##################\r
@@ -893,8 +911,8 @@ RELEASE_DDK3790_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /
 RELEASE_DDK3790_X64_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_DDK3790_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_DDK3790_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_DDK3790_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_DDK3790_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_DDK3790_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_DDK3790_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -915,8 +933,8 @@ RELEASE_DDK3790_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /
 RELEASE_DDK3790_IPF_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32\r
   DEBUG_DDK3790_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_DDK3790_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_DDK3790_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_DDK3790_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
+  DEBUG_DDK3790_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_DDK3790_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
 \r
 ##################\r
 # EBC definitions\r
@@ -945,6 +963,7 @@ RELEASE_DDK3790_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF
 \r
 *_DDK3790xASL_*_MAKE_PATH       = DEF(WINDDK_BIN32)\nmake.exe\r
 *_DDK3790xASL_*_MAKE_FLAGS           = /nologo\r
+*_DDK3790xASL_*_RC_PATH         = DEF(WINDDK_BIN32)\rc.exe\r
 \r
 *_DDK3790xASL_*_PP_FLAGS             = /nologo /E /TC /FIAutoGen.h\r
 *_DDK3790xASL_*_APP_FLAGS            = /nologo /E /TC\r
@@ -980,8 +999,8 @@ RELEASE_DDK3790_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF
 RELEASE_DDK3790xASL_IA32_CC_FLAGS    = /nologo /c /WX /W4 /Gy /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_DDK3790xASL_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /coff /Cx /Zd /Zi\r
 RELEASE_DDK3790xASL_IA32_ASM_FLAGS   = /nologo /c /WX /W3 /coff /Cx /Zd\r
-  DEBUG_DDK3790xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_DDK3790xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_DDK3790xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_DDK3790xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
     *_DDK3790xASL_IA32_ASMLINK_FLAGS = /nologo /tiny\r
 \r
 ##################\r
@@ -1002,8 +1021,8 @@ RELEASE_DDK3790xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:R
 RELEASE_DDK3790xASL_X64_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_DDK3790xASL_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_DDK3790xASL_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_DDK3790xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_DDK3790xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_DDK3790xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_DDK3790xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -1024,8 +1043,8 @@ RELEASE_DDK3790xASL_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:R
 RELEASE_DDK3790xASL_IPF_CC_FLAGS     = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32\r
   DEBUG_DDK3790xASL_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_DDK3790xASL_IPF_ASM_FLAGS    = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_DDK3790xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_DDK3790xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
+  DEBUG_DDK3790xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_DDK3790xASL_IPF_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
 \r
 ##################\r
 # EBC definitions\r
@@ -1104,8 +1123,10 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_UNIXGCC_IA32_ASLDLINK_PATH        = DEF(UNIXGCC_IA32_PETOOLS_PREFIX)ld\r
 *_UNIXGCC_IA32_ASM_PATH             = DEF(UNIXGCC_IA32_PETOOLS_PREFIX)gcc\r
 *_UNIXGCC_IA32_VFRPP_PATH           = DEF(UNIXGCC_IA32_PETOOLS_PREFIX)gcc\r
+*_UNIXGCC_IA32_RC_PATH              = DEF(UNIXGCC_IA32_PETOOLS_PREFIX)windres\r
 \r
 *_UNIXGCC_IA32_CC_FLAGS             = -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition \r
+*_UNIXGCC_IA32_RC_FLAGS             = -J rc -O coff\r
 \r
 ##################\r
 # X64 definitions\r
@@ -1119,8 +1140,10 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_UNIXGCC_X64_PP_PATH               = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc\r
 *_UNIXGCC_X64_ASLPP_PATH            = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc\r
 *_UNIXGCC_X64_VFRPP_PATH            = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc\r
+*_UNIXGCC_X64_RC_PATH               = DEF(UNIXGCC_X64_PETOOLS_PREFIX)windres\r
 \r
 *_UNIXGCC_X64_CC_FLAGS              = -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h -mno-red-zone -Wno-address\r
+*_UNIXGCC_X64_RC_FLAGS              = -J rc -O coff\r
 \r
 ##################\r
 # IPF definitions\r
@@ -1136,11 +1159,13 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_UNIXGCC_IPF_VFRPP_PATH           = DEF(UNIXGCC_IPF_PETOOLS_PREFIX)gcc\r
 *_UNIXGCC_IPF_OBJCOPY_PATH         = DEF(UNIXGCC_IPF_PETOOLS_PREFIX)objcopy\r
 *_UNIXGCC_IPF_SYMRENAME_PATH       = DEF(UNIXGCC_IPF_PETOOLS_PREFIX)objcopy\r
+*_UNIXGCC_IPF_RC_PATH              = DEF(UNIXGCC_IPF_PETOOLS_PREFIX)objcopy\r
 \r
 *_UNIXGCC_IPF_CC_FLAGS             = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h -minline-int-divide-min-latency\r
 *_UNIXGCC_IPF_DLINK_FLAGS          = -nostdlib -O2 --gc-sections --dll -static --entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
 *_UNIXGCC_IPF_OBJCOPY_FLAGS        = -I elf64-ia64-little -O efi-bsdrv-ia64\r
 *_UNIXGCC_IPF_SYMRENAME_FLAGS      = --redefine-sym memcpy=CopyMem\r
+*_UNIXGCC_IPF_RC_FLAGS             = -I binary -O elf64-ia64 --rename-section .data=.hii\r
 \r
 ####################################################################################\r
 #\r
@@ -1152,7 +1177,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCC_*_*_FAMILY              = GCC\r
 \r
 *_CYGGCC_*_*_DLL                 = DEF(CYGWIN_BIN)\r
-*_CYGGCC_*_MAKE_PATH             = DEF(VS2003_BIN)\nmake.exe\r
+*_CYGGCC_*_MAKE_PATH             = DEF(MS_VS_BIN)\nmake.exe\r
 \r
 *_CYGGCC_*_MAKE_FLAGS                 = /nologo\r
 *_CYGGCC_*_PP_FLAGS                   = -E -x assembler-with-cpp -include AutoGen.h\r
@@ -1174,18 +1199,20 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 ##################\r
 # IA32 definitions\r
 ##################\r
-*_CYGGCC_IA32_CC_PATH            = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_SLINK_PATH         = DEF(CYGWIN_BIN32)ar\r
-*_CYGGCC_IA32_DLINK_PATH         = DEF(CYGWIN_BIN32)ld\r
-*_CYGGCC_IA32_ASM_PATH           = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_PP_PATH            = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_APP_PATH           = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_VFRPP_PATH         = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_ASLCC_PATH         = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_ASLPP_PATH         = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCC_IA32_ASLDLINK_PATH      = DEF(CYGWIN_BIN32)ld\r
+*_CYGGCC_IA32_CC_PATH            = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_SLINK_PATH         = DEF(CYGWIN_BINIA32)ar\r
+*_CYGGCC_IA32_DLINK_PATH         = DEF(CYGWIN_BINIA32)ld\r
+*_CYGGCC_IA32_ASM_PATH           = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_PP_PATH            = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_APP_PATH           = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_VFRPP_PATH         = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_ASLCC_PATH         = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_ASLPP_PATH         = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCC_IA32_ASLDLINK_PATH      = DEF(CYGWIN_BINIA32)ld\r
+*_CYGGCC_IA32_RC_PATH            = DEF(CYGWIN_BINIA32)windres\r
 \r
 *_CYGGCC_IA32_CC_FLAGS           = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include AutoGen.h\r
+*_CYGGCC_IA32_RC_FLAGS           = -J rc -O coff\r
 \r
 ##################\r
 # X64 definitions\r
@@ -1200,8 +1227,10 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCC_X64_ASLCC_PATH          = DEF(CYGWIN_BINX64)gcc\r
 *_CYGGCC_X64_ASLPP_PATH          = DEF(CYGWIN_BINX64)gcc\r
 *_CYGGCC_X64_ASLDLINK_PATH       = DEF(CYGWIN_BINX64)ld\r
+*_CYGGCC_X64_RC_PATH             = DEF(CYGWIN_BINX64)windres\r
 \r
 *_CYGGCC_X64_CC_FLAGS            = -Os -fshort-wchar -fno-strict-aliasing -mno-red-zone -Wall -Werror -c -include AutoGen.h -D_EFI_P64\r
+*_CYGGCC_X64_RC_FLAGS            = -J rc -O coff\r
 \r
 ##################\r
 # IPF definitions\r
@@ -1217,11 +1246,13 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCC_IPF_ASLPP_PATH          = DEF(CYGWIN_BINIPF)gcc\r
 *_CYGGCC_IPF_OBJCOPY_PATH        = DEF(CYGWIN_BINIPF)objcopy\r
 *_CYGGCC_IPF_SYMRENAME_PATH      = DEF(CYGWIN_BINIPF)objcopy\r
+*_CYGGCC_IPF_RC_PATH             = DEF(CYGWIN_BINIPF)objcopy\r
 \r
 *_CYGGCC_IPF_CC_FLAGS             = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h -minline-int-divide-min-latency\r
 *_CYGGCC_IPF_DLINK_FLAGS          = -nostdlib -O2 --gc-sections --dll -static --entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
 *_CYGGCC_IPF_OBJCOPY_FLAGS        = -I elf64-ia64-little -O efi-bsdrv-ia64\r
 *_CYGGCC_IPF_SYMRENAME_FLAGS      = --redefine-sym memcpy=CopyMem\r
+*_CYGGCC_IPF_RC_FLAGS             = -I binary -O elf64-ia64 --rename-section .data=.hii\r
 \r
 ##################\r
 # EBC definitions\r
@@ -1233,6 +1264,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCC_EBC_DLINK_PATH    = DEF(EBC_BIN)\link.exe\r
 *_CYGGCC_EBC_SLINK_PATH    = DEF(EBC_BIN)\link.exe\r
 *_CYGGCC_EBC_VFRPP_PATH    = DEF(EBC_BIN)\iec.exe\r
+*_CYGGCC_EBC_RC_PATH       = DEF(MS_VS_BIN)\rc.exe\r
 \r
 *_CYGGCC_EBC_CC_FLAGS           = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)\r
 *_CYGGCC_EBC_SLINK_FLAGS        = /lib /NOLOGO /MACHINE:EBC\r
@@ -1248,7 +1280,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCCxASL_*_*_FAMILY              = GCC\r
 \r
 *_CYGGCCxASL_*_*_DLL                 = DEF(CYGWIN_BIN)\r
-*_CYGGCCxASL_*_MAKE_PATH             = DEF(VS2003_BIN)\nmake.exe\r
+*_CYGGCCxASL_*_MAKE_PATH             = DEF(MS_VS_BIN)\nmake.exe\r
 \r
 *_CYGGCCxASL_*_MAKE_FLAGS                 = /nologo\r
 *_CYGGCCxASL_*_PP_FLAGS                   = -E -x assembler-with-cpp -include AutoGen.h\r
@@ -1270,18 +1302,20 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 ##################\r
 # IA32 definitions\r
 ##################\r
-*_CYGGCCxASL_IA32_CC_PATH            = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_SLINK_PATH         = DEF(CYGWIN_BIN32)ar\r
-*_CYGGCCxASL_IA32_DLINK_PATH         = DEF(CYGWIN_BIN32)ld\r
-*_CYGGCCxASL_IA32_ASM_PATH           = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_PP_PATH            = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_APP_PATH           = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_VFRPP_PATH         = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_ASLCC_PATH         = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_ASLPP_PATH         = DEF(CYGWIN_BIN32)gcc\r
-*_CYGGCCxASL_IA32_ASLDLINK_PATH      = DEF(CYGWIN_BIN32)ld\r
+*_CYGGCCxASL_IA32_CC_PATH            = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_SLINK_PATH         = DEF(CYGWIN_BINIA32)ar\r
+*_CYGGCCxASL_IA32_DLINK_PATH         = DEF(CYGWIN_BINIA32)ld\r
+*_CYGGCCxASL_IA32_ASM_PATH           = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_PP_PATH            = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_APP_PATH           = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_VFRPP_PATH         = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_ASLCC_PATH         = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_ASLPP_PATH         = DEF(CYGWIN_BINIA32)gcc\r
+*_CYGGCCxASL_IA32_ASLDLINK_PATH      = DEF(CYGWIN_BINIA32)ld\r
+*_CYGGCCxASL_IA32_RC_PATH            = DEF(CYGWIN_BINIA32)windres\r
 \r
 *_CYGGCCxASL_IA32_CC_FLAGS           = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -c -include AutoGen.h\r
+*_CYGGCCxASL_IA32_RC_FLAGS           = -J rc -O coff\r
 \r
 ##################\r
 # X64 definitions\r
@@ -1296,8 +1330,10 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCCxASL_X64_ASLCC_PATH          = DEF(CYGWIN_BINX64)gcc\r
 *_CYGGCCxASL_X64_ASLPP_PATH          = DEF(CYGWIN_BINX64)gcc\r
 *_CYGGCCxASL_X64_ASLDLINK_PATH       = DEF(CYGWIN_BINX64)ld\r
+*_CYGGCCxASL_X64_RC_PATH             = DEF(CYGWIN_BINX64)windres\r
 \r
 *_CYGGCCxASL_X64_CC_FLAGS            = -Os -fshort-wchar -fno-strict-aliasing -mno-red-zone -Wall -Werror -c -include AutoGen.h -D_EFI_P64\r
+*_CYGGCCxASL_X64_RC_FLAGS            = -J rc -O coff\r
 \r
 ##################\r
 # IPF definitions\r
@@ -1313,11 +1349,13 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCCxASL_IPF_ASLPP_PATH          = DEF(CYGWIN_BINIPF)gcc\r
 *_CYGGCCxASL_IPF_OBJCOPY_PATH        = DEF(CYGWIN_BINIPF)objcopy\r
 *_CYGGCCxASL_IPF_SYMRENAME_PATH      = DEF(CYGWIN_BINIPF)objcopy\r
+*_CYGGCCxASL_IPF_RC_PATH             = DEF(CYGWIN_BINIPF)objcopy\r
 \r
 *_CYGGCCxASL_IPF_CC_FLAGS             = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h -minline-int-divide-min-latency\r
 *_CYGGCCxASL_IPF_DLINK_FLAGS          = -nostdlib -O2 --gc-sections --dll -static --entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
 *_CYGGCCxASL_IPF_OBJCOPY_FLAGS        = -I elf64-ia64-little -O efi-bsdrv-ia64\r
 *_CYGGCCxASL_IPF_SYMRENAME_FLAGS      = --redefine-sym memcpy=CopyMem\r
+*_CYGGCCxASL_IPF_RC_FLAGS             = -I binary -O elf64-ia64 --rename-section .data=.hii\r
 \r
 ##################\r
 # EBC definitions\r
@@ -1329,6 +1367,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_CYGGCCxASL_EBC_DLINK_PATH    = DEF(EBC_BIN)\link.exe\r
 *_CYGGCCxASL_EBC_SLINK_PATH    = DEF(EBC_BIN)\link.exe\r
 *_CYGGCCxASL_EBC_VFRPP_PATH    = DEF(EBC_BIN)\iec.exe\r
+*_CYGGCCxASL_EBC_RC_PATH       = DEF(MS_VS_BIN)\rc.exe\r
 \r
 *_CYGGCCxASL_EBC_CC_FLAGS           = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)\r
 *_CYGGCCxASL_EBC_SLINK_FLAGS        = /lib /NOLOGO /MACHINE:EBC\r
@@ -1369,6 +1408,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ELFGCC32_IA32_ASLCC_PATH          = DEF(ELFGCC_BIN)/gcc\r
 *_ELFGCC32_IA32_ASLPP_PATH          = DEF(ELFGCC_BIN)/gcc\r
 *_ELFGCC32_IA32_ASLDLINK_PATH       = DEF(ELFGCC_BIN)/ld\r
+*_ELFGCC_IA32_RC_PATH               = DEF(ELFGCC_BIN)/objcopy\r
 \r
 *_ELFGCC_IA32_CC_FLAGS              = -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings\r
 *_ELFGCC_IA32_SLINK_FLAGS           =\r
@@ -1377,6 +1417,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ELFGCC_IA32_ASM_FLAGS             = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h\r
 *_ELFGCC_IA32_PP_FLAGS              = -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
 *_ELFGCC_IA32_VFRPP_FLAGS           = -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+*_ELFGCC_IA32_RC_FLAGS              = -I binary -O elf32-i386 -B i386 --rename-section .data=.hii\r
 \r
 ##################\r
 # X64 definitions\r
@@ -1390,6 +1431,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ELFGCC_X64_PP_PATH               = DEF(ELFGCC_BIN)/gcc\r
 *_ELFGCC_X64_ASLPP_PATH            = DEF(ELFGCC_BIN)/gcc\r
 *_ELFGCC_X64_VFRPP_PATH            = DEF(ELFGCC_BIN)/gcc\r
+*_ELFGCC_X64_RC_PATH               = DEF(ELFGCC_BIN)/objcopy\r
 \r
 *_ELFGCC_X64_CC_FLAGS              = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address -Wno-array-bounds -c -include AutoGen.h -D_EFI_P64\r
 *_ELFGCC_X64_DLINK_FLAGS           = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)\r
@@ -1397,6 +1439,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ELFGCC_X64_ASM_FLAGS             = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h\r
 *_ELFGCC_X64_PP_FLAGS              = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
 *_ELFGCC_X64_VFRPP_FLAGS           = -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+*_ELFGCC_X64_RC_FLAGS              = -I binary -O elf64-x86-64 -B i386 --rename-section .data=.hii\r
 \r
 ##################\r
 # IPF definitions\r
@@ -1410,6 +1453,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ELFGCC_IPF_PP_PATH              = DEF(ELFGCC_BIN)/gcc\r
 *_ELFGCC_IPF_ASLPP_PATH           = DEF(ELFGCC_BIN)/gcc\r
 *_ELFGCC_IPF_VFRPP_PATH           = DEF(ELFGCC_BIN)/gcc\r
+*_ELFGCC_IPF_RC_PATH              = DEF(ELFGCC_BIN)/objcopy\r
 \r
 *_ELFGCC_IPF_CC_FLAGS             = -Os -fshort-wchar -Wall -Werror -c -include AutoGen.h -D_EFI_P64\r
 *_ELFGCC_IPF_DLINK_FLAGS          = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)\r
@@ -1417,6 +1461,7 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ELFGCC_IPF_ASM_FLAGS            = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h\r
 *_ELFGCC_IPF_PP_FLAGS             = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h\r
 *_ELFGCC_IPF_VFRPP_FLAGS          = -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h\r
+*_ELFGCC_IPF_RC_FLAGS             = -I binary -O elf64-ia64-little -B ia64 --rename-section .data=.hii\r
 \r
 ####################################################################################\r
 #\r
@@ -1429,7 +1474,8 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 #   ICC              - Intel C Compiler V9.1\r
 *_ICC_*_*_FAMILY                    = INTEL\r
 \r
-*_ICC_*_MAKE_PATH                   = DEF(VS2005_BIN)\nmake.exe\r
+*_ICC_*_MAKE_PATH                   = DEF(MS_VS_BIN)\nmake.exe\r
+*_ICC_*_RC_PATH                     = DEF(MS_VS_BIN)\rc.exe\r
 \r
 *_ICC_*_MAKE_FLAGS                       = /nologo\r
 *_ICC_*_VFRPP_FLAGS                      = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h\r
@@ -1452,14 +1498,14 @@ DEFINE UNIXGCC_DLINK_FLAGS_COMMON        = -nostdlib -s --pie
 *_ICC_IA32_CC_PATH                  = DEF(ICC_BIN32)\icl.exe\r
 *_ICC_IA32_SLINK_PATH               = DEF(ICC_BIN32)\xilib.exe\r
 # xilib.exe needs lib.exe from Visual Studio\r
-*_ICC_IA32_SLINK_DLL                = DEF(VS2005_BIN)\r
+*_ICC_IA32_SLINK_DLL                = DEF(MS_VS_BIN)\r
 *_ICC_IA32_DLINK_PATH               = DEF(ICC_BIN32)\xilink.exe\r
 *_ICC_IA32_ASMLINK_PATH             = DEF(WINDDK_BIN16)\link16.exe\r
 *_ICC_IA32_PP_PATH                  = DEF(ICC_BIN32)\icl.exe\r
 *_ICC_IA32_VFRPP_PATH               = DEF(ICC_BIN32)\icl.exe\r
 *_ICC_IA32_APP_PATH                 = DEF(ICC_BIN32)\icl.exe\r
-*_ICC_IA32_ASM_PATH                 = DEF(VS2005_BIN)\ml.exe\r
-*_ICC_IA32_ASM_DLL                  = DEF(VS2005_DLL)\r
+*_ICC_IA32_ASM_PATH                 = DEF(MS_VS_BIN)\ml.exe\r
+*_ICC_IA32_ASM_DLL                  = DEF(MS_VS_DLL)\r
 *_ICC_IA32_ASLCC_PATH               = DEF(ICC_BIN32)\icl.exe\r
 *_ICC_IA32_ASLPP_PATH               = DEF(ICC_BIN32)\icl.exe\r
 *_ICC_IA32_ASLDLINK_PATH            = DEF(ICC_BIN32)\xilink.exe\r
@@ -1469,8 +1515,8 @@ RELEASE_ICC_IA32_CC_FLAGS                = /nologo /c /WX /W4 /Gy /Gs8192 /D UNI
   DEBUG_ICC_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd /Zi\r
 RELEASE_ICC_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd\r
       *_ICC_IA32_SLINK_FLAGS             = /nologo\r
-  DEBUG_ICC_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICC_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICC_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICC_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICC_IA32_ASMLINK_FLAGS           = /nologo /tiny\r
 \r
 ##################\r
@@ -1479,13 +1525,13 @@ RELEASE_ICC_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /O
 *_ICC_X64_CC_PATH                   = DEF(ICC_BINX64)\icl.exe\r
 *_ICC_X64_SLINK_PATH                = DEF(ICC_BINX64)\xilib.exe\r
 # xilib.exe needs lib.exe from Visual Studio\r
-*_ICC_X64_SLINK_DLL                 = DEF(VS2005_BIN)\r
+*_ICC_X64_SLINK_DLL                 = DEF(MS_VS_BIN)\r
 *_ICC_X64_DLINK_PATH                = DEF(ICC_BINX64)\xilink.exe\r
 *_ICC_X64_PP_PATH                   = DEF(ICC_BINX64)\icl.exe\r
 *_ICC_X64_VFRPP_PATH                = DEF(ICC_BINX64)\icl.exe\r
 *_ICC_X64_APP_PATH                  = DEF(ICC_BINX64)\icl.exe\r
 *_ICC_X64_ASM_PATH                  = DEF(WINDDK_BINX64)\ml64.exe\r
-*_ICC_X64_ASM_DLL                   = DEF(VS2005_DLL)\r
+*_ICC_X64_ASM_DLL                   = DEF(MS_VS_DLL)\r
 *_ICC_X64_ASLCC_PATH                = DEF(ICC_BINX64)\icl.exe\r
 *_ICC_X64_ASLPP_PATH                = DEF(ICC_BINX64)\icl.exe\r
 *_ICC_X64_ASLDLINK_PATH             = DEF(ICC_BINX64)\xilink.exe\r
@@ -1494,8 +1540,8 @@ RELEASE_ICC_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /O
 RELEASE_ICC_X64_CC_FLAGS                 = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF\r
   DEBUG_ICC_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_ICC_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_ICC_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICC_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICC_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICC_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICC_X64_SLINK_FLAGS              = /nologo /LTCG\r
 \r
 \r
@@ -1504,10 +1550,10 @@ RELEASE_ICC_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /O
 ##################\r
 *_ICC_IPF_CC_PATH                   = DEF(ICC_BIN64)\icl.exe\r
 # icl.exe needs cl.exe from Visual Studio\r
-*_ICC_IPF_CC_DLL                    = DEF(VS2005_BIN)\r
+*_ICC_IPF_CC_DLL                    = DEF(MS_VS_BIN)\r
 *_ICC_IPF_SLINK_PATH                = DEF(ICC_BIN64)\xilib.exe\r
 # xilib.exe needs lib.exe from Visual Studio\r
-*_ICC_IPF_SLINK_DLL                 = DEF(VS2005_BIN);DEF(VS2005_DLL)\r
+*_ICC_IPF_SLINK_DLL                 = DEF(MS_VS_BIN);DEF(MS_VS_DLL)\r
 *_ICC_IPF_DLINK_PATH                = DEF(ICC_BIN64)\xilink.exe\r
 *_ICC_IPF_PP_PATH                   = DEF(ICC_BIN64)\icl.exe\r
 *_ICC_IPF_VFRPP_PATH                = DEF(ICC_BIN64)\icl.exe\r
@@ -1521,8 +1567,8 @@ RELEASE_ICC_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /O
 RELEASE_ICC_IPF_CC_FLAGS                 = /nologo /c /WX /W4 /GX /Gy /Od /FI$(DEST_DIR_DEBUG)/AutoGen.h /QIA64_fr32 /GF\r
   DEBUG_ICC_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -d debug -F COFF32\r
 RELEASE_ICC_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -F COFF32\r
-  DEBUG_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
+  DEBUG_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
       *_ICC_IPF_SLINK_FLAGS              = /nologo\r
 \r
 ##################\r
@@ -1530,7 +1576,7 @@ RELEASE_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
 ##################\r
 *_ICC_EBC_*_FAMILY              = INTEL\r
 \r
-*_ICC_EBC_MAKE_PATH             = DEF(VS2005_BIN)\nmake.exe\r
+*_ICC_EBC_MAKE_PATH             = DEF(MS_VS_BIN)\nmake.exe\r
 *_ICC_EBC_PP_PATH               = DEF(EBC_BIN)\iec.exe\r
 *_ICC_EBC_VFRPP_PATH            = DEF(EBC_BIN)\iec.exe\r
 *_ICC_EBC_CC_PATH               = DEF(EBC_BIN)\iec.exe\r
@@ -1555,7 +1601,8 @@ RELEASE_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
 #   ICCxASL              - Intel C Compiler V9.1\r
 *_ICCxASL_*_*_FAMILY                    = INTEL\r
 \r
-*_ICCxASL_*_MAKE_PATH                   = DEF(VS2005_BIN)\nmake.exe\r
+*_ICCxASL_*_MAKE_PATH                   = DEF(MS_VS_BIN)\nmake.exe\r
+*_ICCxASL_*_RC_PATH                     = DEF(MS_VS_BIN)\rc.exe\r
 \r
 *_ICCxASL_*_MAKE_FLAGS                       = /nologo\r
 *_ICCxASL_*_VFRPP_FLAGS                      = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h\r
@@ -1578,14 +1625,14 @@ RELEASE_ICC_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
 *_ICCxASL_IA32_CC_PATH                  = DEF(ICC_BIN32)\icl.exe\r
 *_ICCxASL_IA32_SLINK_PATH               = DEF(ICC_BIN32)\xilib.exe\r
 # xilib.exe needs lib.exe from Visual Studio\r
-*_ICCxASL_IA32_SLINK_DLL                = DEF(VS2005_BIN)\r
+*_ICCxASL_IA32_SLINK_DLL                = DEF(MS_VS_BIN)\r
 *_ICCxASL_IA32_DLINK_PATH               = DEF(ICC_BIN32)\xilink.exe\r
 *_ICCxASL_IA32_ASMLINK_PATH             = DEF(WINDDK_BIN16)\link16.exe\r
 *_ICCxASL_IA32_PP_PATH                  = DEF(ICC_BIN32)\icl.exe\r
 *_ICCxASL_IA32_VFRPP_PATH               = DEF(ICC_BIN32)\icl.exe\r
 *_ICCxASL_IA32_APP_PATH                 = DEF(ICC_BIN32)\icl.exe\r
-*_ICCxASL_IA32_ASM_PATH                 = DEF(VS2005_BIN)\ml.exe\r
-*_ICCxASL_IA32_ASM_DLL                  = DEF(VS2005_DLL)\r
+*_ICCxASL_IA32_ASM_PATH                 = DEF(MS_VS_BIN)\ml.exe\r
+*_ICCxASL_IA32_ASM_DLL                  = DEF(MS_VS_DLL)\r
 *_ICCxASL_IA32_ASLCC_PATH               = DEF(ICC_BIN32)\icl.exe\r
 *_ICCxASL_IA32_ASLPP_PATH               = DEF(ICC_BIN32)\icl.exe\r
 *_ICCxASL_IA32_ASLDLINK_PATH            = DEF(ICC_BIN32)\xilink.exe\r
@@ -1595,8 +1642,8 @@ RELEASE_ICCxASL_IA32_CC_FLAGS                = /nologo /c /WX /W4 /Gy /Gs8192 /D
   DEBUG_ICCxASL_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd /Zi\r
 RELEASE_ICCxASL_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd\r
       *_ICCxASL_IA32_SLINK_FLAGS             = /nologo\r
-  DEBUG_ICCxASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICCxASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICCxASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICCxASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICCxASL_IA32_ASMLINK_FLAGS           = /nologo /tiny\r
 \r
 ##################\r
@@ -1605,13 +1652,13 @@ RELEASE_ICCxASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:408
 *_ICCxASL_X64_CC_PATH                   = DEF(ICC_BINX64)\icl.exe\r
 *_ICCxASL_X64_SLINK_PATH                = DEF(ICC_BINX64)\xilib.exe\r
 # xilib.exe needs lib.exe from Visual Studio\r
-*_ICCxASL_X64_SLINK_DLL                 = DEF(VS2005_BIN)\r
+*_ICCxASL_X64_SLINK_DLL                 = DEF(MS_VS_BIN)\r
 *_ICCxASL_X64_DLINK_PATH                = DEF(ICC_BINX64)\xilink.exe\r
 *_ICCxASL_X64_PP_PATH                   = DEF(ICC_BINX64)\icl.exe\r
 *_ICCxASL_X64_VFRPP_PATH                = DEF(ICC_BINX64)\icl.exe\r
 *_ICCxASL_X64_APP_PATH                  = DEF(ICC_BINX64)\icl.exe\r
 *_ICCxASL_X64_ASM_PATH                  = DEF(WINDDK_BINX64)\ml64.exe\r
-*_ICCxASL_X64_ASM_DLL                   = DEF(VS2005_DLL)\r
+*_ICCxASL_X64_ASM_DLL                   = DEF(MS_VS_DLL)\r
 *_ICCxASL_X64_ASLCC_PATH                = DEF(ICC_BINX64)\icl.exe\r
 *_ICCxASL_X64_ASLPP_PATH                = DEF(ICC_BINX64)\icl.exe\r
 *_ICCxASL_X64_ASLDLINK_PATH             = DEF(ICC_BINX64)\xilink.exe\r
@@ -1620,8 +1667,8 @@ RELEASE_ICCxASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:408
 RELEASE_ICCxASL_X64_CC_FLAGS                 = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF\r
   DEBUG_ICCxASL_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_ICCxASL_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_ICCxASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICCxASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICCxASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICCxASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICCxASL_X64_SLINK_FLAGS              = /nologo /LTCG\r
 \r
 \r
@@ -1630,10 +1677,10 @@ RELEASE_ICCxASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:408
 ##################\r
 *_ICCxASL_IPF_CC_PATH                   = DEF(ICC_BIN64)\icl.exe\r
 # icl.exe needs cl.exe from Visual Studio\r
-*_ICCxASL_IPF_CC_DLL                    = DEF(VS2005_BIN)\r
+*_ICCxASL_IPF_CC_DLL                    = DEF(MS_VS_BIN)\r
 *_ICCxASL_IPF_SLINK_PATH                = DEF(ICC_BIN64)\xilib.exe\r
 # xilib.exe needs lib.exe from Visual Studio\r
-*_ICCxASL_IPF_SLINK_DLL                 = DEF(VS2005_BIN);DEF(VS2005_DLL)\r
+*_ICCxASL_IPF_SLINK_DLL                 = DEF(MS_VS_BIN);DEF(MS_VS_DLL)\r
 *_ICCxASL_IPF_DLINK_PATH                = DEF(ICC_BIN64)\xilink.exe\r
 *_ICCxASL_IPF_PP_PATH                   = DEF(ICC_BIN64)\icl.exe\r
 *_ICCxASL_IPF_VFRPP_PATH                = DEF(ICC_BIN64)\icl.exe\r
@@ -1647,8 +1694,8 @@ RELEASE_ICCxASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:408
 RELEASE_ICCxASL_IPF_CC_FLAGS                 = /nologo /c /WX /W4 /GX /Gy /Od /FI$(DEST_DIR_DEBUG)/AutoGen.h /QIA64_fr32 /GF\r
   DEBUG_ICCxASL_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -d debug -F COFF32\r
 RELEASE_ICCxASL_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -F COFF32\r
-  DEBUG_ICCxASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_ICCxASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
+  DEBUG_ICCxASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_ICCxASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
       *_ICCxASL_IPF_SLINK_FLAGS              = /nologo\r
 \r
 ##################\r
@@ -1656,7 +1703,7 @@ RELEASE_ICCxASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL
 ##################\r
 *_ICCxASL_EBC_*_FAMILY              = INTEL\r
 \r
-*_ICCxASL_EBC_MAKE_PATH             = DEF(VS2005_BIN)\nmake.exe\r
+*_ICCxASL_EBC_MAKE_PATH             = DEF(MS_VS_BIN)\nmake.exe\r
 *_ICCxASL_EBC_PP_PATH               = DEF(EBC_BIN)\iec.exe\r
 *_ICCxASL_EBC_VFRPP_PATH            = DEF(EBC_BIN)\iec.exe\r
 *_ICCxASL_EBC_CC_PATH               = DEF(EBC_BIN)\iec.exe\r
@@ -1683,6 +1730,7 @@ RELEASE_ICCxASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL
 *_ICCx86_*_*_FAMILY                    = INTEL\r
 \r
 *_ICCx86_*_MAKE_PATH                   = DEF(VS2005x86_BIN)\nmake.exe\r
+*_ICCx86_*_RC_PATH                     = DEF(VS2005x86_BIN)\rc.exe\r
 \r
 *_ICCx86_*_MAKE_FLAGS                       = /nologo\r
 *_ICCx86_*_VFRPP_FLAGS                      = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h\r
@@ -1722,8 +1770,8 @@ RELEASE_ICCx86_IA32_CC_FLAGS                = /nologo /c /WX /W4 /Gy /Gs8192 /D
   DEBUG_ICCx86_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd /Zi\r
 RELEASE_ICCx86_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd\r
       *_ICCx86_IA32_SLINK_FLAGS             = /nologo\r
-  DEBUG_ICCx86_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICCx86_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICCx86_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICCx86_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICCx86_IA32_ASMLINK_FLAGS           = /nologo /tiny\r
 \r
 ##################\r
@@ -1747,8 +1795,8 @@ RELEASE_ICCx86_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086
 RELEASE_ICCx86_X64_CC_FLAGS                 = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF\r
   DEBUG_ICCx86_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_ICCx86_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_ICCx86_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICCx86_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICCx86_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICCx86_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICCx86_X64_SLINK_FLAGS              = /nologo /LTCG\r
 \r
 \r
@@ -1774,8 +1822,8 @@ RELEASE_ICCx86_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086
 RELEASE_ICCx86_IPF_CC_FLAGS                 = /nologo /c /WX /W4 /GX /Gy /Od /FI$(DEST_DIR_DEBUG)/AutoGen.h /QIA64_fr32 /GF\r
   DEBUG_ICCx86_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -d debug -F COFF32\r
 RELEASE_ICCx86_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -F COFF32\r
-  DEBUG_ICCx86_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_ICCx86_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
+  DEBUG_ICCx86_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_ICCx86_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
       *_ICCx86_IPF_SLINK_FLAGS              = /nologo\r
 \r
 ##################\r
@@ -1810,6 +1858,7 @@ RELEASE_ICCx86_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /
 *_ICCx86xASL_*_*_FAMILY                    = INTEL\r
 \r
 *_ICCx86xASL_*_MAKE_PATH                   = DEF(VS2005x86_BIN)\nmake.exe\r
+*_ICCx86xASL_*_RC_PATH                     = DEF(VS2005x86_BIN)\rc.exe\r
 \r
 *_ICCx86xASL_*_MAKE_FLAGS                       = /nologo\r
 *_ICCx86xASL_*_VFRPP_FLAGS                      = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h\r
@@ -1849,8 +1898,8 @@ RELEASE_ICCx86xASL_IA32_CC_FLAGS                = /nologo /c /WX /W4 /Gy /Gs8192
   DEBUG_ICCx86xASL_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd /Zi\r
 RELEASE_ICCx86xASL_IA32_ASM_FLAGS               = /nologo /c /WX /W3 /Zd\r
       *_ICCx86xASL_IA32_SLINK_FLAGS             = /nologo\r
-  DEBUG_ICCx86xASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICCx86xASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICCx86xASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICCx86xASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICCx86xASL_IA32_ASMLINK_FLAGS           = /nologo /tiny\r
 \r
 ##################\r
@@ -1874,8 +1923,8 @@ RELEASE_ICCx86xASL_IA32_DLINK_FLAGS             = /NOLOGO /NODEFAULTLIB /IGNORE:
 RELEASE_ICCx86xASL_X64_CC_FLAGS                 = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FI$(DEST_DIR_DEBUG)/AutoGen.h /EHs-c- /GF\r
   DEBUG_ICCx86xASL_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_ICCx86xASL_X64_ASM_FLAGS                = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_ICCx86xASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_ICCx86xASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_ICCx86xASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_ICCx86xASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
       *_ICCx86xASL_X64_SLINK_FLAGS              = /nologo /LTCG\r
 \r
 \r
@@ -1901,8 +1950,8 @@ RELEASE_ICCx86xASL_X64_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /IGNORE:
 RELEASE_ICCx86xASL_IPF_CC_FLAGS                 = /nologo /c /WX /W4 /GX /Gy /Od /FI$(DEST_DIR_DEBUG)/AutoGen.h /QIA64_fr32 /GF\r
   DEBUG_ICCx86xASL_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -d debug -F COFF32\r
 RELEASE_ICCx86xASL_IPF_ASM_FLAGS                = -N us -X explicit -M ilp64 -N so -W3 -F COFF32\r
-  DEBUG_ICCx86xASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_ICCx86xASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
+  DEBUG_ICCx86xASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_ICCx86xASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:64 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEST_DIR_DEBUG)/$(BASE_NAME).pdb\r
       *_ICCx86xASL_IPF_SLINK_FLAGS              = /nologo\r
 \r
 ##################\r
@@ -1971,13 +2020,14 @@ RELEASE_ICCx86xASL_IPF_DLINK_FLAGS              = /NOLOGO /NODEFAULTLIB /LTCG /D
 *_MYTOOLS_IA32_ASLCC_PATH           = DEF(VS2005_BIN)\cl.exe\r
 *_MYTOOLS_IA32_ASLPP_PATH           = DEF(VS2005_BIN)\cl.exe\r
 *_MYTOOLS_IA32_ASLDLINK_PATH        = DEF(VS2005_BIN)\link.exe\r
+*_MYTOOLS_IA32_RC_PATH              = DEF(VS2005_BIN)\rc.exe\r
 \r
   DEBUG_MYTOOLS_IA32_CC_FLAGS            = /nologo /c /WX /GS- /W4 /Gs8192 /Gy /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm\r
 RELEASE_MYTOOLS_IA32_CC_FLAGS            = /nologo /c /WX /GS- /W4 /Gs8192 /Gy /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_MYTOOLS_IA32_ASM_FLAGS           = /nologo /c /WX /W3 /coff /Cx /Zd /Zi\r
 RELEASE_MYTOOLS_IA32_ASM_FLAGS           = /nologo /c /WX /W3 /coff /Cx /Zd\r
-  DEBUG_MYTOOLS_IA32_DLINK_FLAGS         = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
-RELEASE_MYTOOLS_IA32_DLINK_FLAGS         = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+  DEBUG_MYTOOLS_IA32_DLINK_FLAGS         = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+RELEASE_MYTOOLS_IA32_DLINK_FLAGS         = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
       *_MYTOOLS_IA32_ASMLINK_FLAGS       = /nologo /tiny\r
 \r
 ##################\r
@@ -1996,13 +2046,14 @@ RELEASE_MYTOOLS_IA32_DLINK_FLAGS         = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /O
 *_MYTOOLS_X64_ASLCC_PATH            = DEF(VS2005_BINX64)\cl.exe\r
 *_MYTOOLS_X64_ASLPP_PATH            = DEF(VS2005_BINX64)\cl.exe\r
 *_MYTOOLS_X64_ASLDLINK_PATH         = DEF(VS2005_BINX64)\link.exe\r
+*_MYTOOLS_X64_RC_PATH               = DEF(VS2005_BIN)\rc.exe\r
 \r
   DEBUG_MYTOOLS_X64_CC_FLAGS             = /nologo /c /WX /GS- /W4 /Gs8192 /Gy /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm\r
 RELEASE_MYTOOLS_X64_CC_FLAGS             = /nologo /c /WX /GS- /W4 /Gs8192 /Gy /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF\r
   DEBUG_MYTOOLS_X64_ASM_FLAGS            = /nologo /c /WX /W3 /Cx /Zd /Zi\r
 RELEASE_MYTOOLS_X64_ASM_FLAGS            = /nologo /c /WX /W3 /Cx /Zd\r
-  DEBUG_MYTOOLS_X64_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
-RELEASE_MYTOOLS_X64_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
+  DEBUG_MYTOOLS_X64_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG\r
+RELEASE_MYTOOLS_X64_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text\r
 \r
 ##################\r
 # IPF definitions\r
@@ -2018,14 +2069,15 @@ RELEASE_MYTOOLS_X64_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /O
 *_MYTOOLS_IPF_ASLCC_PATH            = DEF(WINDDK_BIN64)\cl.exe\r
 *_MYTOOLS_IPF_ASLPP_PATH            = DEF(WINDDK_BIN64)\cl.exe\r
 *_MYTOOLS_IPF_ASLDLINK_PATH         = DEF(WINDDK_BIN64)\link.exe\r
-      *_MYTOOLS_IPF_ASM_OUTPUT           = "-o "\r
+*_MYTOOLS_IPF_RC_PATH               = DEF(WINDDK_BIN32)\rc.exe\r
 \r
+      *_MYTOOLS_IPF_ASM_OUTPUT           = "-o "\r
   DEBUG_MYTOOLS_IPF_CC_FLAGS             = /nologo /c /WX /GS- /X /W4 /Gy /Ox /GL /FIAutoGen.h /EHs-c- /GR- /GF /Zx /QIPF_fr32 /Zi\r
 RELEASE_MYTOOLS_IPF_CC_FLAGS             = /nologo /c /WX /GS- /X /W4 /Gy /Ox /GL /FIAutoGen.h /EHs-c- /GR- /GF /Zx /QIPF_fr32\r
   DEBUG_MYTOOLS_IPF_ASM_FLAGS            = -N us -X explicit -M ilp64 -N so -W4 -d debug\r
 RELEASE_MYTOOLS_IPF_ASM_FLAGS            = -N us -X explicit -M ilp64 -N so -W4\r
-  DEBUG_MYTOOLS_IPF_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF /OPT:ICF=10 /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
-RELEASE_MYTOOLS_IPF_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF /OPT:ICF=10 /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
+  DEBUG_MYTOOLS_IPF_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF /OPT:ICF=10 /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG\r
+RELEASE_MYTOOLS_IPF_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF /OPT:ICF=10 /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEST_DIR_DEBUG)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb\r
       *_MYTOOLS_IPF_SLINK_FLAGS          = /nologo /LTCG\r
 \r
 ##################\r
@@ -2039,6 +2091,7 @@ RELEASE_MYTOOLS_IPF_DLINK_FLAGS          = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
 *_MYTOOLS_EBC_CC_PATH               = DEF(EBC_BIN)\iec.exe\r
 *_MYTOOLS_EBC_SLINK_PATH            = DEF(EBC_BIN)\link.exe\r
 *_MYTOOLS_EBC_DLINK_PATH            = DEF(EBC_BIN)\link.exe\r
+*_MYTOOLS_EBC_RC_PATH               = DEF(VS2005_BIN)\rc.exe\r
 \r
 *_MYTOOLS_EBC_MAKE_FLAGS                 = /nologo\r
 *_MYTOOLS_EBC_PP_FLAGS                   = /nologo /E /TC /FIAutoGen.h\r
index d51e359..2d3b135 100644 (file)
@@ -236,8 +236,8 @@ Returns:
 \r
   if (File->Attributes & FFS_ATTRIB_CHECKSUM) {\r
     File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 (\r
-                                                (VOID*)File,\r
-                                                FileSize\r
+                                                (VOID*)(File + 1),\r
+                                                FileSize - sizeof (EFI_FFS_FILE_HEADER)\r
                                                 );\r
   } else {\r
     File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;\r
index 292b077..dc50e87 100644 (file)
@@ -703,8 +703,8 @@ Returns:
     // Verify file data checksum\r
     //\r
     FileLength          = GetLength (FfsHeader->Size);\r
-    Checksum            = CalculateSum8 ((UINT8 *) FfsHeader, FileLength);\r
-    Checksum            = (UINT8) (Checksum - FfsHeader->State);\r
+    Checksum            = CalculateSum8 ((UINT8 *) (FfsHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER));\r
+    Checksum            = Checksum + FfsHeader->IntegrityCheck.Checksum.File;\r
     if (Checksum != 0) {\r
       Error (NULL, 0, 0006, "invalid FFS file checksum", "Ffs file with Guid %s", FileGuidString);\r
       return EFI_ABORTED;\r
@@ -712,7 +712,7 @@ Returns:
   } else {\r
     //\r
     // File does not have a checksum\r
-    // Verify contents are 0x5A as spec'd\r
+    // Verify contents are 0xAA as spec'd\r
     //\r
     if (FfsHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {\r
       Error (NULL, 0, 0006, "invalid fixed FFS file header checksum", "Ffs file with Guid %s", FileGuidString);\r
index 12a3b2f..324490a 100644 (file)
@@ -134,6 +134,8 @@ Returns:
                         EFI_FV_FILETYPE_PEI_CORE, EFI_FV_FILETYPE_DXE_CORE,\n\\r
                         EFI_FV_FILETYPE_DRIVER, EFI_FV_FILETYPE_APPLICATION,\n\\r
                         EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,\n\\r
+                        EFI_FV_FILETYPE_SMM, EFI_FV_FILETYPE_SMM_CORE,\n\\r
+                        EFI_FV_FILETYPE_COMBINED_SMM_DXE, \n\\r
                         EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE.\n");\r
   fprintf (stdout, "  -g FileGuid, --fileguid FileGuid\n\\r
                         FileGuid is one module guid.\n\\r
index 917baa1..6b5d6bd 100644 (file)
@@ -229,22 +229,11 @@ Returns:
   }\r
 \r
   //\r
-  // Read the FV Name Guid\r
+  // Read the FV Extension Header File Name\r
   //\r
-  if (!FvInfo->FvNameGuidSet) {\r
-    Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FV_NAMEGUID_STRING, 0, Value);\r
-    if (Status == EFI_SUCCESS) {\r
-      //\r
-      // Get the guid value\r
-      //\r
-      Status = StringToGuid (Value, &GuidValue);\r
-      if (EFI_ERROR (Status)) {\r
-        Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_NAMEGUID_STRING, Value);\r
-        return EFI_ABORTED;\r
-      }\r
-      memcpy (&FvInfo->FvNameGuid, &GuidValue, sizeof (EFI_GUID));\r
-      FvInfo->FvNameGuidSet = TRUE;\r
-    }\r
+  Status = FindToken (InfFile, ATTRIBUTES_SECTION_STRING, EFI_FV_EXT_HEADER_FILE_NAME, 0, Value);\r
+  if (Status == EFI_SUCCESS) {\r
+    strcpy (FvInfo->FvExtHeaderFile, Value);\r
   }\r
 \r
   //\r
@@ -1272,6 +1261,7 @@ Returns:
   EFI_FFS_FILE_STATE        SavedState;\r
   UINT64                    FitAddress;\r
   FIT_TABLE                 *FitTablePtr;\r
+  BOOLEAN                   Vtf0Detected;\r
 \r
   //\r
   // Verify input parameters\r
@@ -1292,11 +1282,32 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (\r
+      (((UINTN)FvImage->Eof - (UINTN)FvImage->FileImage) >=\r
+        IA32_X64_VTF_SIGNATURE_OFFSET) &&\r
+      (*(UINT32 *)(VOID*)((UINTN) FvImage->Eof -\r
+                                  IA32_X64_VTF_SIGNATURE_OFFSET) ==\r
+        IA32_X64_VTF0_SIGNATURE)\r
+     ) {\r
+    Vtf0Detected = TRUE;\r
+  } else {\r
+    Vtf0Detected = FALSE;\r
+  }\r
+\r
   //\r
   // Find the Sec Core\r
   //\r
   Status = GetFileByType (EFI_FV_FILETYPE_SECURITY_CORE, 1, &SecCoreFile);\r
   if (EFI_ERROR (Status) || SecCoreFile == NULL) {\r
+    if (Vtf0Detected) {\r
+      //\r
+      // If the SEC core file is not found, but the VTF-0 signature\r
+      // is found, we'll treat it as a VTF-0 'Volume Top File'.\r
+      // This means no modifications are required to the VTF.\r
+      //\r
+      return EFI_SUCCESS;\r
+    }\r
+\r
     Error (NULL, 0, 3000, "Invalid", "could not find the SEC core file in the FV.");\r
     return EFI_ABORTED;\r
   }\r
@@ -1325,6 +1336,19 @@ Returns:
     return EFI_ABORTED;\r
   }  \r
 \r
+  if (\r
+       Vtf0Detected &&\r
+       (MachineType == EFI_IMAGE_MACHINE_IA32 ||\r
+        MachineType == EFI_IMAGE_MACHINE_X64)\r
+     ) {\r
+    //\r
+    // If the SEC core code is IA32 or X64 and the VTF-0 signature\r
+    // is found, we'll treat it as a VTF-0 'Volume Top File'.\r
+    // This means no modifications are required to the VTF.\r
+    //\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
   //\r
   // Physical address is FV base + offset of PE32 + offset of the entry point\r
   //\r
@@ -1428,16 +1452,6 @@ Returns:
     SecCoreEntryAddressPtr  = (EFI_PHYSICAL_ADDRESS *) ((UINTN) FvImage->Eof - IPF_SALE_ENTRY_ADDRESS_OFFSET);\r
     *SecCoreEntryAddressPtr = SecCorePhysicalAddress;\r
 \r
-  } else if (\r
-    (MachineType == EFI_IMAGE_MACHINE_IA32 ||\r
-     MachineType == EFI_IMAGE_MACHINE_X64) &&\r
-    (((UINTN)FvImage->Eof - (UINTN)FvImage->FileImage) >= IA32_X64_VTF_SIGNATURE_OFFSET) &&\r
-    (*(UINT32 *)(VOID*)((UINTN) FvImage->Eof - IA32_X64_VTF_SIGNATURE_OFFSET) ==\r
-      IA32_X64_VTF0_SIGNATURE)\r
-    ) {\r
-    //\r
-    // If VTF-0 signature is found, then no modifications are needed.\r
-    //\r
   } else if (MachineType == EFI_IMAGE_MACHINE_IA32 || MachineType == EFI_IMAGE_MACHINE_X64) {\r
     //\r
     // Get the location to update\r
@@ -1545,8 +1559,8 @@ Returns:
   VtfFile->State                        = 0;\r
   if (VtfFile->Attributes & FFS_ATTRIB_CHECKSUM) {\r
     VtfFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (\r
-                                              (UINT8 *) VtfFile,\r
-                                              GetLength (VtfFile->Size)\r
+                                              (UINT8 *) (VtfFile + 1),\r
+                                              GetLength (VtfFile->Size) - sizeof (EFI_FFS_FILE_HEADER)\r
                                               );\r
   } else {\r
     VtfFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;\r
@@ -1938,19 +1952,21 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_STATUS                  Status;\r
-  MEMORY_FILE                 InfMemoryFile;\r
-  MEMORY_FILE                 FvImageMemoryFile;\r
-  UINTN                       Index;\r
-  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;\r
-  EFI_FFS_FILE_HEADER         *VtfFileImage;\r
-  UINT8                       *FvBufferHeader; // to make sure fvimage header 8 type alignment.\r
-  UINT8                       *FvImage;\r
-  UINTN                       FvImageSize;\r
-  FILE                        *FvFile;\r
-  CHAR8                       FvMapName [_MAX_PATH];\r
-  FILE                        *FvMapFile;\r
-  EFI_FIRMWARE_VOLUME_EXT_HEADER FvExtHeader;\r
+  EFI_STATUS                      Status;\r
+  MEMORY_FILE                     InfMemoryFile;\r
+  MEMORY_FILE                     FvImageMemoryFile;\r
+  UINTN                           Index;\r
+  EFI_FIRMWARE_VOLUME_HEADER      *FvHeader;\r
+  EFI_FFS_FILE_HEADER             *VtfFileImage;\r
+  UINT8                           *FvBufferHeader; // to make sure fvimage header 8 type alignment.\r
+  UINT8                           *FvImage;\r
+  UINTN                           FvImageSize;\r
+  FILE                            *FvFile;\r
+  CHAR8                           FvMapName [_MAX_PATH];\r
+  FILE                            *FvMapFile;\r
+  EFI_FIRMWARE_VOLUME_EXT_HEADER  *FvExtHeader;\r
+  FILE                            *FvExtHeaderFile;\r
+  UINTN                           FileSize;\r
 \r
   FvBufferHeader = NULL;\r
   FvFile         = NULL;\r
@@ -2008,6 +2024,58 @@ Returns:
                   mFvDataInfo.FvFileSystemGuid.Data4[6],\r
                   mFvDataInfo.FvFileSystemGuid.Data4[7]);\r
   }\r
+\r
+  //\r
+  // Add PI FV extension header\r
+  //\r
+  FvExtHeader = NULL;\r
+  FvExtHeaderFile = NULL;\r
+  if (mFvDataInfo.FvExtHeaderFile[0] != 0) {\r
+    //\r
+    // Open the FV Extension Header file\r
+    //\r
+    FvExtHeaderFile = fopen (mFvDataInfo.FvExtHeaderFile, "rb");\r
+\r
+    //\r
+    // Get the file size\r
+    //\r
+    FileSize = _filelength (fileno (FvExtHeaderFile));\r
+\r
+    //\r
+    // Allocate a buffer for the FV Extension Header\r
+    //\r
+    FvExtHeader = malloc(FileSize);\r
+    if (FvExtHeader == NULL) {\r
+      fclose (FvExtHeaderFile);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+\r
+    //\r
+    // Read the FV Extension Header\r
+    //\r
+    fread (FvExtHeader, sizeof (UINT8), FileSize, FvExtHeaderFile);\r
+    fclose (FvExtHeaderFile);\r
+\r
+    //\r
+    // See if there is an override for the FV Name GUID\r
+    //\r
+    if (mFvDataInfo.FvNameGuidSet) {\r
+      memcpy (&FvExtHeader->FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));\r
+    }\r
+    memcpy (&mFvDataInfo.FvNameGuid, &FvExtHeader->FvName, sizeof (EFI_GUID));\r
+    mFvDataInfo.FvNameGuidSet = TRUE;\r
+  } else if (mFvDataInfo.FvNameGuidSet) {\r
+    //\r
+    // Allocate a buffer for the FV Extension Header\r
+    //\r
+    FvExtHeader = malloc(sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER));\r
+    if (FvExtHeader == NULL) {\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+    memcpy (&FvExtHeader->FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));\r
+    FvExtHeader->ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);\r
+  }\r
+\r
   //\r
   // Debug message Fv Name Guid\r
   //\r
@@ -2173,12 +2241,14 @@ Returns:
   }\r
 \r
   //\r
-  // Set PI FV extension header\r
+  // Add PI FV extension header\r
   //\r
-  if (mFvDataInfo.FvNameGuidSet) {\r
-    memcpy (&FvExtHeader.FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));\r
-    FvExtHeader.ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);\r
-    AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, &FvExtHeader);\r
+  if (FvExtHeader != NULL) {\r
+    //\r
+    // Add FV Extended Header contents to the FV as a PAD file\r
+    //\r
+    AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, FvExtHeader);\r
+\r
     //\r
     // Fv Extension header change update Fv Header Check sum\r
     //\r
@@ -2282,6 +2352,10 @@ Finish:
   if (FvBufferHeader != NULL) {\r
     free (FvBufferHeader);\r
   }\r
+\r
+  if (FvExtHeader != NULL) {\r
+    free (FvExtHeader);\r
+  }\r
   \r
   if (FvFile != NULL) {\r
     fclose (FvFile);\r
@@ -2385,11 +2459,13 @@ Returns:
   UINTN               Index;\r
   FILE                *fpin;\r
   UINTN               FfsFileSize;\r
+  UINTN               FvExtendHeaderSize;\r
   UINT32              FfsAlignment;\r
   EFI_FFS_FILE_HEADER FfsHeader;\r
   BOOLEAN             VtfFileFlag;\r
   UINTN               VtfFileSize;\r
   \r
+  FvExtendHeaderSize = 0;\r
   VtfFileSize = 0;\r
   VtfFileFlag = FALSE;\r
   fpin  = NULL;\r
@@ -2418,7 +2494,17 @@ Returns:
   //\r
   // Calculate PI extension header\r
   //\r
-  if (CompareGuid (&mFvDataInfo.FvNameGuid, &mZeroGuid) != 0) {\r
+  if (mFvDataInfo.FvExtHeaderFile[0] != '\0') {\r
+    fpin = fopen (mFvDataInfo.FvExtHeaderFile, "rb");\r
+    if (fpin == NULL) {\r
+      Error (NULL, 0, 0001, "Error opening file", mFvDataInfo.FvExtHeaderFile);\r
+      return EFI_ABORTED;\r
+    }\r
+    FvExtendHeaderSize = _filelength (fileno (fpin));\r
+    fclose (fpin);\r
+    CurrentOffset += sizeof (EFI_FFS_FILE_HEADER) + FvExtendHeaderSize;\r
+    CurrentOffset = (CurrentOffset + 7) & (~7);\r
+  } else if (mFvDataInfo.FvNameGuidSet) {\r
     CurrentOffset += sizeof (EFI_FFS_FILE_HEADER) + sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);\r
     CurrentOffset = (CurrentOffset + 7) & (~7);\r
   }\r
@@ -2959,15 +3045,10 @@ Returns:
       SavedState  = FfsFile->State;\r
       FfsFile->IntegrityCheck.Checksum.File = 0;\r
       FfsFile->State                        = 0;\r
-      if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {\r
-        FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (\r
-                                                  (UINT8 *) FfsFile,\r
-                                                  GetLength (FfsFile->Size)\r
-                                                  );\r
-      } else {\r
-        FfsFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;\r
-      }\r
-\r
+      FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (\r
+                                                (UINT8 *) (FfsFile + 1),\r
+                                                GetLength (FfsFile->Size) - sizeof (EFI_FFS_FILE_HEADER)\r
+                                                );\r
       FfsFile->State = SavedState;\r
     }\r
 \r
@@ -3189,15 +3270,10 @@ WritePeMap:
       SavedState  = FfsFile->State;\r
       FfsFile->IntegrityCheck.Checksum.File = 0;\r
       FfsFile->State                        = 0;\r
-      if (FfsFile->Attributes & FFS_ATTRIB_CHECKSUM) {\r
-        FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (\r
-                                                  (UINT8 *) FfsFile,\r
-                                                  GetLength (FfsFile->Size)\r
-                                                  );\r
-      } else {\r
-        FfsFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;\r
-      }\r
-\r
+      FfsFile->IntegrityCheck.Checksum.File = CalculateChecksum8 (\r
+                                                (UINT8 *)(FfsFile + 1),\r
+                                                GetLength (FfsFile->Size) - sizeof (EFI_FFS_FILE_HEADER)\r
+                                                );\r
       FfsFile->State = SavedState;\r
     }\r
     //\r
index d6b3ad7..3c0e933 100644 (file)
@@ -61,13 +61,12 @@ Abstract:
 #define MAX_NUMBER_OF_FILES_IN_FV       1000\r
 #define MAX_NUMBER_OF_FILES_IN_CAP      1000\r
 #define EFI_FFS_FILE_HEADER_ALIGNMENT   8\r
-\r
 //\r
 // INF file strings\r
 //\r
-#define OPTIONS_SECTION_STRING            "[options]"\r
-#define ATTRIBUTES_SECTION_STRING         "[attributes]"\r
-#define FILES_SECTION_STRING              "[files]"\r
+#define OPTIONS_SECTION_STRING                "[options]"\r
+#define ATTRIBUTES_SECTION_STRING             "[attributes]"\r
+#define FILES_SECTION_STRING                  "[files]"\r
 \r
 //\r
 // Options section\r
@@ -157,6 +156,12 @@ Abstract:
 #define FALSE_STRING              "FALSE"\r
 #define NULL_STRING               "NULL"\r
 \r
+//\r
+//\r
+//\r
+#define EFI_FV_EXT_HEADER_FILE_NAME     "EFI_FV_EXT_HEADER_FILE_NAME"\r
+\r
+\r
 //\r
 // VTF (Firmware Volume Top File) signatures\r
 //\r
@@ -229,6 +234,7 @@ typedef struct {
   BOOLEAN                 FvFileSystemGuidSet;\r
   EFI_GUID                FvNameGuid;\r
   BOOLEAN                 FvNameGuidSet;\r
+  CHAR8                   FvExtHeaderFile[_MAX_PATH];\r
   UINTN                   Size;\r
   EFI_FVB_ATTRIBUTES      FvAttributes;\r
   CHAR8                   FvName[_MAX_PATH];\r
index 8c648eb..e72f052 100644 (file)
@@ -33,6 +33,7 @@ Abstract:
 \r
 #include <Common/UefiBaseTypes.h>\r
 #include <IndustryStandard/PeImage.h>\r
+#include <Common/UefiInternalFormRepresentation.h>\r
 \r
 //\r
 // Acpi Table definition\r
@@ -60,6 +61,8 @@ Abstract:
 #define UTILITY_MAJOR_VERSION 0\r
 #define UTILITY_MINOR_VERSION 2\r
 \r
+#define HII_RESOURCE_SECTION_INDEX  1\r
+#define HII_RESOURCE_SECTION_NAME   "HII"\r
 //\r
 // Action for this tool.\r
 //\r
@@ -73,6 +76,7 @@ Abstract:
 #define FW_MCI_IMAGE         7\r
 #define FW_MERGE_IMAGE       8\r
 #define FW_RELOC_STRIPEED_IMAGE 9\r
+#define FW_HII_PACKAGE_LIST_RCIMAGE 10\r
 \r
 #define DUMP_TE_HEADER       0x11\r
 \r
@@ -100,6 +104,15 @@ typedef struct {
   UINT32  Reserved[3];\r
 } MICROCODE_IMAGE_HEADER;\r
 \r
+static EFI_GUID mZeroGuid = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};\r
+\r
+static const char *gHiiPackageRCFileHeader[] = {\r
+  "//",\r
+  "//  DO NOT EDIT -- auto-generated file",\r
+  "//",\r
+  NULL\r
+};\r
+\r
 STATIC CHAR8 *mInImageName;\r
 \r
 STATIC\r
@@ -258,6 +271,16 @@ Returns:
   fprintf (stdout, "  -r, --replace         Overwrite the input file with the output content.\n\\r
                         If more input files are specified,\n\\r
                         the last input file will be as the output file.\n");\r
+  fprintf (stdout, "  -g HiiPackageListGuid, --hiiguid HiiPackageListGuid\n\\r
+                        HiiListPackageGuidGuid is from the module guid.\n\\r
+                        Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n\\r
+                        If not specified, the first Form FormSet guid is used.\n");\r
+  fprintf (stdout, "  --hiipackage          Combine all input binary hii pacakges into \n\\r
+                        a single package list as the text resource data(RC).\n\\r
+                        It can't be combined with other action options\n\\r
+                        except for -o option. It is a action option.\n\\r
+                        If it is combined with other action options, the later\n\\r
+                        input action option will override the previous one.\n");\r
   fprintf (stdout, "  -v, --verbose         Turn on verbose output with informational messages.\n");\r
   fprintf (stdout, "  -q, --quiet           Disable all messages except key message and fatal error\n");\r
   fprintf (stdout, "  -d, --debug level     Enable debug messages, at input debug level.\n");\r
@@ -440,7 +463,7 @@ typedef Elf32_Dyn Elf_Dyn;
 #define ELFCLASS ELFCLASS32\r
 #define ELF_R_TYPE(r) ELF32_R_TYPE(r)\r
 #define ELF_R_SYM(r) ELF32_R_SYM(r)\r
-\r
+#define ELF_HII_SECTION_NAME ".hii"\r
 //\r
 // Well known ELF structures.\r
 //\r
@@ -452,7 +475,7 @@ Elf_Phdr *gPhdrBase;
 // PE section alignment.\r
 //\r
 const UINT32 CoffAlignment = 0x20;\r
-const UINT16 CoffNbrSections = 4;\r
+const UINT16 CoffNbrSections = 5;\r
 \r
 //\r
 // Current offset in coff file.\r
@@ -475,8 +498,15 @@ UINT32 NtHdrOffset;
 UINT32 TableOffset;\r
 UINT32 TextOffset;\r
 UINT32 DataOffset;\r
+UINT32 HiiRsrcOffset;\r
 UINT32 RelocOffset;\r
 \r
+//\r
+// HiiBinData\r
+//\r
+UINT8* HiiBinData = NULL;\r
+UINT32 HiiBinSize = 0;\r
+\r
 EFI_IMAGE_BASE_RELOCATION *CoffBaseRel;\r
 UINT16 *CoffEntryRel;\r
 \r
@@ -547,11 +577,28 @@ IsTextShdr(
   return (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC;\r
 }\r
 \r
+int\r
+IsHiiRsrcShdr(\r
+  Elf_Shdr *Shdr\r
+  )\r
+{\r
+  Elf_Shdr *Namedr = GetShdrByIndex(Ehdr->e_shstrndx);\r
+\r
+  if (strcmp((CHAR8*)Ehdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0) {\r
+    return 1;\r
+  }\r
+\r
+  return 0;\r
+}\r
+\r
 int\r
 IsDataShdr(\r
   Elf_Shdr *Shdr\r
   )\r
 {\r
+  if (IsHiiRsrcShdr(Shdr)) {\r
+    return 0;\r
+  }\r
   return (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);\r
 }\r
 \r
@@ -580,6 +627,128 @@ CreateSectionHeader(
   TableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);\r
 }\r
 \r
+VOID\r
+GetBinaryHiiData (\r
+  CHAR8   *RcString,\r
+  UINT32  Size,\r
+  UINT32  OffsetToFile\r
+  )\r
+{\r
+  unsigned  Data16;\r
+  UINT32  HiiBinOffset;\r
+  UINT32  Index;\r
+  EFI_IMAGE_RESOURCE_DIRECTORY        *ResourceDirectory;\r
+  EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY  *ResourceDirectoryEntry;\r
+  EFI_IMAGE_RESOURCE_DIRECTORY_STRING *ResourceDirectoryString;\r
+  EFI_IMAGE_RESOURCE_DATA_ENTRY       *ResourceDataEntry;\r
+\r
+  Index = 0;\r
+  while (Index < Size && *RcString != '\0' && *RcString != '{') {\r
+    RcString ++;\r
+    Index ++;\r
+  }\r
+  \r
+  if (*RcString == '\0' || Index == Size) {\r
+    return;\r
+  }\r
+  \r
+  //\r
+  // Skip '{' character\r
+  // Skip space and ',' character\r
+  //\r
+  RcString ++;\r
+  Index ++;\r
+  while (Index < Size && *RcString != '\0' && (isspace (*RcString) || *RcString == ',')){\r
+    RcString ++;\r
+    Index ++;\r
+  }\r
+\r
+  //\r
+  // '}' end character\r
+  //\r
+  if (*RcString == '}' || Index == Size) {\r
+    return;\r
+  }\r
+\r
+  HiiBinOffset = 0;\r
+  HiiBinSize   = 0x1000;\r
+  HiiBinData   = (UINT8 *) malloc (HiiBinSize);\r
+  if (HiiBinData == NULL) {\r
+    return;\r
+  }\r
+  memset (HiiBinData, 0, HiiBinSize);\r
+  //\r
+  // Fill Resource section entry\r
+  //\r
+  ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiBinData + HiiBinOffset);\r
+  HiiBinOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);\r
+  ResourceDirectory->NumberOfNamedEntries = 1;\r
+\r
+  ResourceDirectoryEntry = (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY *) (HiiBinData + HiiBinOffset);\r
+  HiiBinOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY);\r
+  ResourceDirectoryEntry->u1.s.NameIsString = 1;\r
+  ResourceDirectoryEntry->u1.s.NameOffset   = HiiBinOffset;\r
+\r
+  ResourceDirectoryString = (EFI_IMAGE_RESOURCE_DIRECTORY_STRING *) (HiiBinData + HiiBinOffset);\r
+  ResourceDirectoryString->Length = 3;\r
+  ResourceDirectoryString->String[0] =L'H';\r
+  ResourceDirectoryString->String[1] =L'I';\r
+  ResourceDirectoryString->String[2] =L'I';\r
+  HiiBinOffset = HiiBinOffset + sizeof (ResourceDirectoryString->Length) + ResourceDirectoryString->Length * sizeof (ResourceDirectoryString->String[0]);\r
+\r
+  ResourceDirectoryEntry->u2.OffsetToData = HiiBinOffset;\r
+  ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiBinData + HiiBinOffset);\r
+  HiiBinOffset += sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);\r
+  ResourceDataEntry->OffsetToData = OffsetToFile + HiiBinOffset;\r
+\r
+  while (sscanf (RcString, "0x%X", &Data16) != EOF) {\r
+    //\r
+    // Convert the string data to the binary data.\r
+    //\r
+    *(UINT16 *)(HiiBinData + HiiBinOffset) = (UINT16) Data16;\r
+    HiiBinOffset += 2;\r
+    //\r
+    // Jump to the next data.\r
+    //\r
+    RcString = RcString + 2 + 4;\r
+    Index    = Index + 2 + 4;\r
+    //\r
+    // Skip space and ',' character\r
+    //\r
+    while (Index < Size && *RcString != '\0' && (isspace (*RcString) || *RcString == ',')){\r
+      RcString ++;\r
+      Index ++;\r
+    }\r
+    //\r
+    // '}' end character\r
+    //\r
+    if (*RcString == '}'|| Index == Size) {\r
+      break;\r
+    }\r
+    //\r
+    // Check BinBuffer size\r
+    //\r
+    if (HiiBinOffset >= HiiBinSize) {\r
+      HiiBinSize += 0x1000;\r
+      HiiBinData = (UINT8 *) realloc (HiiBinData, HiiBinSize);\r
+      //\r
+      // Memory allocation is failure.\r
+      //\r
+      if (HiiBinData == NULL) {\r
+        HiiBinSize = 0;\r
+        break;\r
+      }\r
+    }\r
+  }\r
+\r
+  if (HiiBinData != NULL) {\r
+    HiiBinSize = HiiBinOffset;\r
+    ResourceDataEntry->Size = HiiBinSize + OffsetToFile - ResourceDataEntry->OffsetToData;\r
+  }\r
+  \r
+  return;\r
+}\r
+\r
 VOID\r
 ScanSections(\r
   VOID\r
@@ -605,11 +774,11 @@ ScanSections(
        break;\r
   case EM_X86_64:\r
   case EM_IA_64:\r
-       CoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64);\r
+    CoffOffset += sizeof (EFI_IMAGE_NT_HEADERS64);\r
        break;\r
   default:\r
     VerboseMsg ("%s unknown e_machine type. Assume IA-32", (UINTN)Ehdr->e_machine);\r
-       CoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32);\r
+    CoffOffset += sizeof (EFI_IMAGE_NT_HEADERS32);\r
        break;\r
   }\r
 \r
@@ -672,13 +841,41 @@ ScanSections(
           Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");\r
         }\r
       }\r
-\r
       CoffSectionsOffset[i] = CoffOffset;\r
       CoffOffset += shdr->sh_size;\r
     }\r
   }\r
   CoffOffset = CoffAlign(CoffOffset);\r
 \r
+  //\r
+  //  The HII resource sections.\r
+  //\r
+  HiiRsrcOffset = CoffOffset;\r
+  for (i = 0; i < Ehdr->e_shnum; i++) {\r
+    Elf_Shdr *shdr = GetShdrByIndex(i);\r
+    if (IsHiiRsrcShdr(shdr)) {\r
+      if ((shdr->sh_addralign != 0) && (shdr->sh_addralign != 1)) {\r
+        // the alignment field is valid\r
+        if ((shdr->sh_addr & (shdr->sh_addralign - 1)) == 0) {\r
+          // if the section address is aligned we must align PE/COFF \r
+          CoffOffset = (CoffOffset + shdr->sh_addralign - 1) & ~(shdr->sh_addralign - 1);\r
+        } else if ((shdr->sh_addr % shdr->sh_addralign) != (CoffOffset % shdr->sh_addralign)) {\r
+          // ARM RVCT tools have behavior outside of the ELF specification to try \r
+          // and make images smaller.  If sh_addr is not aligned to sh_addralign \r
+          // then the section needs to preserve sh_addr MOD sh_addralign. \r
+          // Normally doing nothing here works great.\r
+          Error (NULL, 0, 3000, "Invalid", "Unsupported section alignment.");\r
+        }\r
+      }\r
+      GetBinaryHiiData ((CHAR8*)Ehdr + shdr->sh_offset, shdr->sh_size, HiiRsrcOffset);\r
+      if (HiiBinSize != 0) {\r
+        CoffOffset += HiiBinSize;\r
+        CoffOffset = CoffAlign(CoffOffset);\r
+      }\r
+      break;\r
+    }\r
+  }\r
+\r
   RelocOffset = CoffOffset;\r
 \r
   //\r
@@ -760,8 +957,8 @@ ScanSections(
     NtHdr->Pe32.FileHeader.NumberOfSections--;\r
   }\r
 \r
-  if ((RelocOffset - TextOffset) > 0) {\r
-    CreateSectionHeader (".data", DataOffset, RelocOffset - DataOffset,\r
+  if ((HiiRsrcOffset - DataOffset) > 0) {\r
+    CreateSectionHeader (".data", DataOffset, HiiRsrcOffset - DataOffset,\r
             EFI_IMAGE_SCN_CNT_INITIALIZED_DATA\r
             | EFI_IMAGE_SCN_MEM_WRITE\r
             | EFI_IMAGE_SCN_MEM_READ);\r
@@ -769,6 +966,24 @@ ScanSections(
     // Don't make a section of size 0. \r
     NtHdr->Pe32.FileHeader.NumberOfSections--;\r
   }\r
+\r
+  if ((RelocOffset - HiiRsrcOffset) > 0) {\r
+    CreateSectionHeader (".rsrc", HiiRsrcOffset, RelocOffset - HiiRsrcOffset,\r
+            EFI_IMAGE_SCN_CNT_INITIALIZED_DATA\r
+            | EFI_IMAGE_SCN_MEM_READ);\r
+\r
+    NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = HiiBinSize;\r
+    NtHdr->Pe32.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = HiiRsrcOffset;\r
+\r
+    memcpy(CoffFile + HiiRsrcOffset, HiiBinData, HiiBinSize);\r
+    free (HiiBinData);\r
+    HiiBinData = NULL;\r
+    HiiBinSize = 0;\r
+  } else {\r
+    // Don't make a section of size 0. \r
+    NtHdr->Pe32.FileHeader.NumberOfSections--;\r
+  }\r
+\r
 }\r
 \r
 VOID\r
@@ -1215,141 +1430,6 @@ ConvertElf (
   }\r
 }\r
 \r
-void\r
-ZeroXdataSection (\r
- IN     CHAR8                 *ImageName,\r
- IN OUT UINT8                 *FileBuffer,\r
- IN EFI_IMAGE_SECTION_HEADER  *SectionHeader,\r
- IN     UINT32                 SectionTotalNumber\r
-  )\r
-{\r
-  FILE   *fpMapFile;\r
-  CHAR8  MapFileName[_MAX_PATH];\r
-  CHAR8  Line [MAX_LINE_LEN];\r
-  CHAR8  KeyWord [MAX_LINE_LEN];\r
-  CHAR8  SectionName [MAX_LINE_LEN];\r
-  UINT32 FunctionType = 0;\r
-  unsigned SectionOffset = 0;\r
-  unsigned SectionLength = 0;\r
-  unsigned SectionNumber = 0;\r
-  CHAR8  *PdbPointer;\r
-  INT32  Index;\r
-  UINT32 Index2;\r
-\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[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
-  //\r
-  // Try to get PDB file name\r
-  //\r
-  PdbPointer = (CHAR8  *) PeCoffLoaderGetPdbPointer (FileBuffer);\r
-  if (PdbPointer != NULL) {\r
-    strcpy (MapFileName, PdbPointer);\r
-  } else {\r
-    strcpy (MapFileName, ImageName);\r
-  }\r
-\r
-  //\r
-  // Construct map file name\r
-  //\r
-  Index = strlen (MapFileName) - 1;\r
-  while (Index >= 0 && MapFileName[Index] != '.') {\r
-    Index --;\r
-  }\r
-  if (Index < 0) {\r
-    //\r
-    // don't know how to costruct map file\r
-    //\r
-    return;\r
-  }\r
-\r
-  //\r
-  // fill map file postfix\r
-  //\r
-  MapFileName[Index + 1] = 'm';\r
-  MapFileName[Index + 2] = 'a';\r
-  MapFileName[Index + 3] = 'p';\r
-  MapFileName[Index + 4] = '\0';\r
-\r
-  //\r
-  // try opening Map File\r
-  //\r
-  fpMapFile = fopen (MapFileName, "r");\r
-  if (fpMapFile == NULL) {\r
-    //\r
-    // Can't open Map file. Maybe it doesn't exist.\r
-    //\r
-    return;\r
-  }\r
-\r
-  //\r
-  // Output Functions information into Fv Map file\r
-  //\r
-  while (fgets (Line, MAX_LINE_LEN, fpMapFile) != NULL) {\r
-    //\r
-    // Skip blank line\r
-    //\r
-    if (Line[0] == 0x0a) {\r
-      if (FunctionType != 0) {\r
-        //\r
-        // read all section table data\r
-        //\r
-        FunctionType = 0;\r
-        break;\r
-      }\r
-      FunctionType = 0;\r
-      continue;\r
-    }\r
-\r
-    //\r
-    // By Start keyword\r
-    //\r
-    if (FunctionType == 0) {\r
-      sscanf (Line, "%s", KeyWord);\r
-      if (stricmp (KeyWord, "Start") == 0) {\r
-        //\r
-        // function list\r
-        //\r
-        FunctionType = 1;\r
-      }\r
-      continue;\r
-    }\r
-    //\r
-    // Printf Function Information\r
-    //\r
-    if (FunctionType == 1) {\r
-      sscanf (Line, "%x:%x %xH %s", &SectionNumber, &SectionOffset, &SectionLength, SectionName);\r
-      if (stricmp (SectionName, ".xdata") == 0) {\r
-        FunctionType = 2;\r
-        break;\r
-      }\r
-    }\r
-  }\r
-\r
-  if (FunctionType != 2) {\r
-    //\r
-    // no .xdata section is found\r
-    //\r
-    fclose (fpMapFile);\r
-    return;\r
-  }\r
-\r
-  //\r
-  // 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", (unsigned) SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength);\r
-  fclose (fpMapFile);\r
-  return;\r
-}\r
-\r
 int\r
 main (\r
   int  argc,\r
@@ -1413,6 +1493,14 @@ Returns:
   EFI_IMAGE_OPTIONAL_HEADER64      *Optional64;\r
   EFI_IMAGE_DOS_HEADER             BackupDosHdr;\r
   MICROCODE_IMAGE_HEADER           *MciHeader;\r
+  UINT8                            *HiiPackageListBuffer;\r
+  UINT8                            *HiiPackageDataPointer;\r
+  EFI_GUID                         HiiPackageListGuid;\r
+  EFI_HII_PACKAGE_LIST_HEADER      HiiPackageListHeader;\r
+  EFI_HII_PACKAGE_HEADER           HiiPackageHeader;\r
+  EFI_IFR_FORM_SET                 IfrFormSet;\r
+  UINT8                            NumberOfFormPacakge;\r
+  EFI_HII_PACKAGE_HEADER           EndPackage;\r
 \r
   SetUtilityName (UTILITY_NAME);\r
 \r
@@ -1445,6 +1533,12 @@ Returns:
   Optional64        = NULL;\r
   KeepExceptionTableFlag = FALSE;\r
   KeepZeroPendingFlag    = FALSE;\r
+  NumberOfFormPacakge    = 0;\r
+  HiiPackageListBuffer   = NULL;\r
+  HiiPackageDataPointer  = NULL;\r
+  EndPackage.Length      = sizeof (EFI_HII_PACKAGE_HEADER);\r
+  EndPackage.Type        = EFI_HII_PACKAGE_END;\r
+  memset (&HiiPackageListGuid, 0, sizeof (HiiPackageListGuid));\r
 \r
   if (argc == 1) {\r
     Error (NULL, 0, 1001, "Missing options", "No input options.");\r
@@ -1636,6 +1730,24 @@ Returns:
       continue;\r
     }\r
     \r
+    if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--hiiguid") == 0)) {\r
+      Status = StringToGuid (argv[1], &HiiPackageListGuid);\r
+      if (EFI_ERROR (Status)) {\r
+        Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
+        goto Finish;\r
+      }\r
+      argc -= 2;\r
+      argv += 2;\r
+      continue;\r
+    }\r
+\r
+    if (stricmp (argv[0], "--hiipackage") == 0) {\r
+      OutImageType = FW_HII_PACKAGE_LIST_RCIMAGE;\r
+      argc --;\r
+      argv ++;\r
+      continue;\r
+    }\r
+\r
     if (argv[0][0] == '-') {\r
       Error (NULL, 0, 1000, "Unknown option", argv[0]);\r
       goto Finish;\r
@@ -1699,6 +1811,14 @@ Returns:
     goto Finish;\r
   }\r
 \r
+  //\r
+  // Combine HiiBinary packages to a single package list\r
+  //\r
+  if ((OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) && ReplaceFlag) {\r
+    Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with --hiipackage merge files option.");\r
+    goto Finish;\r
+  }\r
+\r
   //\r
   // Input image file\r
   //\r
@@ -1739,6 +1859,9 @@ Returns:
   case FW_MERGE_IMAGE:\r
     VerboseMsg ("Combine the input multi microcode bin files to one bin file.");\r
     break;\r
+  case FW_HII_PACKAGE_LIST_RCIMAGE:\r
+    VerboseMsg ("Combine the input multi hii bin packages to one text pacakge list RC file.");\r
+    break;\r
   default:\r
     break;\r
   }\r
@@ -1779,6 +1902,107 @@ Returns:
     }\r
   }\r
 \r
+  //\r
+  // Combine multi binary HII package files to a single text package list RC file.\r
+  //\r
+  if (OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) {\r
+    //\r
+    // Get hii package list lenght\r
+    //\r
+    HiiPackageListHeader.PackageLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);\r
+    for (Index = 0; Index < InputFileNum; Index ++) {\r
+      fpIn = fopen (InputFileName [Index], "rb");\r
+      if (!fpIn) {\r
+        Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);\r
+        goto Finish;\r
+      }\r
+      FileLength = _filelength (fileno (fpIn));\r
+      fread (&HiiPackageHeader, 1, sizeof (HiiPackageHeader), fpIn);\r
+      if (HiiPackageHeader.Type == EFI_HII_PACKAGE_FORM) {\r
+        if (HiiPackageHeader.Length != FileLength) {\r
+          Error (NULL, 0, 3000, "Invalid", "The wrong package size is in HII package file %s", InputFileName [Index]);\r
+          fclose (fpIn);\r
+          goto Finish;\r
+        }\r
+        if (memcmp (&HiiPackageListGuid, &mZeroGuid, sizeof (EFI_GUID)) == 0) {\r
+          fread (&IfrFormSet, 1, sizeof (IfrFormSet), fpIn);\r
+          memcpy (&HiiPackageListGuid, &IfrFormSet.Guid, sizeof (EFI_GUID));\r
+        }\r
+        NumberOfFormPacakge ++;\r
+      }\r
+      HiiPackageListHeader.PackageLength += FileLength;\r
+      fclose (fpIn);\r
+    }\r
+    HiiPackageListHeader.PackageLength += sizeof (EndPackage);\r
+    //\r
+    // Check whether hii packages are valid\r
+    //\r
+    if (NumberOfFormPacakge > 1) {\r
+      Error (NULL, 0, 3000, "Invalid", "The input hii packages contains more than one hii form package");\r
+      goto Finish;\r
+    }\r
+    if (memcmp (&HiiPackageListGuid, &mZeroGuid, sizeof (EFI_GUID)) == 0) {\r
+      Error (NULL, 0, 3000, "Invalid", "HII pacakge list guid is not specified!");\r
+      goto Finish;\r
+    }\r
+    memcpy (&HiiPackageListHeader.PackageListGuid, &HiiPackageListGuid, sizeof (EFI_GUID));\r
+    //\r
+    // read hii packages\r
+    //\r
+    HiiPackageListBuffer = malloc (HiiPackageListHeader.PackageLength);\r
+    if (HiiPackageListBuffer == NULL) {\r
+      Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+      goto Finish;\r
+    }\r
+    memcpy (HiiPackageListBuffer, &HiiPackageListHeader, sizeof (HiiPackageListHeader));\r
+    HiiPackageDataPointer = HiiPackageListBuffer + sizeof (HiiPackageListHeader);\r
+    for (Index = 0; Index < InputFileNum; Index ++) {\r
+      fpIn = fopen (InputFileName [Index], "rb");\r
+      if (!fpIn) {\r
+        Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);\r
+        free (HiiPackageListBuffer);\r
+        goto Finish;\r
+      }\r
+\r
+      FileLength = _filelength (fileno (fpIn));\r
+      fread (HiiPackageDataPointer, 1, FileLength, fpIn);\r
+      fclose (fpIn);\r
+      HiiPackageDataPointer = HiiPackageDataPointer + FileLength;\r
+    }\r
+    memcpy (HiiPackageDataPointer, &EndPackage, sizeof (EndPackage));\r
+    //\r
+    // write the hii package into the text package list rc file.\r
+    //\r
+    for (Index = 0; gHiiPackageRCFileHeader[Index] != NULL; Index++) {\r
+      fprintf (fpOut, "%s\n", gHiiPackageRCFileHeader[Index]);\r
+    }\r
+    fprintf (fpOut, "\n%d %s\n{", HII_RESOURCE_SECTION_INDEX, HII_RESOURCE_SECTION_NAME);\r
+\r
+    HiiPackageDataPointer = HiiPackageListBuffer;\r
+    for (Index = 0; Index + 2 < HiiPackageListHeader.PackageLength; Index += 2) {\r
+      if (Index % 16 == 0) {\r
+        fprintf (fpOut, "\n ");\r
+      }\r
+      fprintf (fpOut, " 0x%04X,", *(UINT16 *) HiiPackageDataPointer);\r
+      HiiPackageDataPointer += 2;\r
+    }\r
+    \r
+    if (Index % 16 == 0) {\r
+      fprintf (fpOut, "\n ");\r
+    }\r
+    if ((Index + 2) == HiiPackageListHeader.PackageLength) {\r
+      fprintf (fpOut, " 0x%04X\n}\n", *(UINT16 *) HiiPackageDataPointer);\r
+    }\r
+    if ((Index + 1) == HiiPackageListHeader.PackageLength) {\r
+      fprintf (fpOut, " 0x%04X\n}\n", *(UINT8 *) HiiPackageDataPointer);\r
+    }\r
+    free (HiiPackageListBuffer);\r
+    //\r
+    // Done successfully\r
+    //\r
+    goto Finish;\r
+  }\r
+\r
   //\r
   // Combine MciBinary files to one file\r
   //\r
@@ -2471,12 +2695,13 @@ Returns:
             for (Index1 = 0; Index1 < Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size / sizeof (RUNTIME_FUNCTION); Index1++, RuntimeFunction++) {\r
               SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);\r
               for (Index2 = 0; Index2 < PeHdr->Pe32.FileHeader.NumberOfSections; Index2++, SectionHeader++) {\r
-                if (RuntimeFunction->UnwindInfoAddress > SectionHeader->VirtualAddress && RuntimeFunction->UnwindInfoAddress < (SectionHeader->VirtualAddress + SectionHeader->SizeOfRawData)) {\r
+                if (RuntimeFunction->UnwindInfoAddress >= SectionHeader->VirtualAddress && RuntimeFunction->UnwindInfoAddress < (SectionHeader->VirtualAddress + SectionHeader->SizeOfRawData)) {\r
                   UnwindInfo = (UNWIND_INFO *)(FileBuffer + SectionHeader->PointerToRawData + (RuntimeFunction->UnwindInfoAddress - SectionHeader->VirtualAddress));\r
                   if (UnwindInfo->Version == 1) {\r
                     memset (UnwindInfo + 1, 0, UnwindInfo->CountOfUnwindCodes * sizeof (UINT16));\r
                     memset (UnwindInfo, 0, sizeof (UNWIND_INFO));\r
                   }\r
+                  break;\r
                 }\r
               }\r
               memset (RuntimeFunction, 0, sizeof (RUNTIME_FUNCTION));\r
@@ -2552,7 +2777,16 @@ Returns:
   //\r
   if (!KeepExceptionTableFlag) {\r
     SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);\r
-    ZeroXdataSection(mInImageName, FileBuffer, SectionHeader, PeHdr->Pe32.FileHeader.NumberOfSections);\r
+    for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++) {\r
+      if (stricmp ((char *)SectionHeader[Index].Name, ".xdata") == 0) {\r
+        //\r
+        // zero .xdata section\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", (unsigned) SectionHeader[Index].PointerToRawData, (unsigned) SectionHeader[Index].SizeOfRawData);\r
+        break;\r
+      }\r
+    }\r
   }\r
 \r
   //\r
index eafbcbf..890cfd9 100644 (file)
@@ -1267,7 +1267,7 @@ Returns:
   //\r
   // Update the SYM file for this component based on it's start address.\r
   //\r
-  Status = UpdateSymFile (CompStartAddress, SymFileName, VtfInfo->CompSymName);\r
+  Status = UpdateSymFile (CompStartAddress, SymFileName, VtfInfo->CompSymName, FileSize);\r
   if (EFI_ERROR (Status)) {\r
 \r
     //\r
@@ -1406,7 +1406,7 @@ Returns:
   //\r
   // Update the SYM file for this component based on it's start address.\r
   //\r
-  Status = UpdateSymFile (PalStartAddress, SymFileName, VtfInfo->CompSymName);\r
+  Status = UpdateSymFile (PalStartAddress, SymFileName, VtfInfo->CompSymName, FileSize);\r
   if (EFI_ERROR (Status)) {\r
 \r
     //\r
@@ -1688,7 +1688,7 @@ Returns:
   FileHeader->IntegrityCheck.Checksum.File    = 0;\r
   FileHeader->State                           = 0;\r
   FileHeader->IntegrityCheck.Checksum.Header  = CalculateChecksum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));\r
-  FileHeader->IntegrityCheck.Checksum.File    = CalculateChecksum8 ((UINT8 *) FileHeader, TotalVtfSize);\r
+  FileHeader->IntegrityCheck.Checksum.File    = CalculateChecksum8 ((UINT8 *) (FileHeader + 1), TotalVtfSize - sizeof (EFI_FFS_FILE_HEADER));\r
   FileHeader->State                           = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;\r
 \r
   return EFI_SUCCESS;\r
@@ -2153,7 +2153,9 @@ EFI_STATUS
 UpdateSymFile (\r
   IN UINT64 BaseAddress,\r
   IN CHAR8  *DestFileName,\r
-  IN CHAR8  *SourceFileName\r
+  IN CHAR8  *SourceFileName,\r
+  IN UINT64 FileSize\r
+\r
   )\r
 /*++\r
 \r
@@ -2167,6 +2169,7 @@ Arguments:
   BaseAddress    - The base address for the new SYM tokens.\r
   DestFileName   - The destination file.\r
   SourceFileName - The source file.\r
+  FileSize       - Size of bin file.\r
 \r
 Returns:\r
 \r
@@ -2185,7 +2188,7 @@ Returns:
   CHAR8   Token[_MAX_PATH];\r
   CHAR8   BaseToken[_MAX_PATH];\r
   UINT64  TokenAddress;\r
-  long      StartLocation;\r
+  long    StartLocation;\r
 \r
   //\r
   // Verify input parameters.\r
@@ -2275,13 +2278,20 @@ Returns:
       // Get the token address\r
       //\r
       AsciiStringToUint64 (Address, TRUE, &TokenAddress);\r
+      if (TokenAddress > FileSize) {\r
+        //\r
+        // Symbol offset larger than FileSize. This Symbol can't be in Bin file. Don't print them.\r
+        //\r
+        break;\r
+      }\r
 \r
       //\r
       // Add the base address, the size of the FFS file header and the size of the peim header.\r
       //\r
       TokenAddress += BaseAddress &~IPF_CACHE_BIT;\r
 \r
-      fprintf (DestFile, "%s | %016llX | %s | %s%s\n", Type, (unsigned long long) TokenAddress, Section, BaseToken, Token);\r
+      fprintf (DestFile, "%s | %016llX | ", Type, (unsigned long long) TokenAddress);\r
+      fprintf (DestFile, "%s | %s\n    %s\n", Section, Token, BaseToken); \r
     }\r
   }\r
 \r
index eab14f3..012ebb6 100644 (file)
@@ -205,7 +205,8 @@ EFI_STATUS
 UpdateSymFile (\r
   IN UINT64 BaseAddress,\r
   IN CHAR8  *DestFileName,\r
-  IN CHAR8  *SourceFileName\r
+  IN CHAR8  *SourceFileName,\r
+  IN UINT64 FileSize\r
   )\r
 /*++\r
 \r
@@ -219,6 +220,7 @@ Arguments:
   BaseAddress    - The base address for the new SYM tokens.\r
   DestFileName   - The destination file.\r
   SourceFileName - The source file.\r
+  FileSize       - Size of bin file.\r
 \r
 Returns:\r
 \r
index 158e672..33b5645 100644 (file)
@@ -50,7 +50,10 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 #define EFI_FV_FILETYPE_DRIVER                0x07\r
 #define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER  0x08\r
 #define EFI_FV_FILETYPE_APPLICATION           0x09\r
+#define EFI_FV_FILETYPE_SMM                   0x0A\r
 #define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B\r
+#define EFI_FV_FILETYPE_COMBINED_SMM_DXE      0x0C\r
+#define EFI_FV_FILETYPE_SMM_CORE              0x0D\r
 #define EFI_FV_FILETYPE_OEM_MIN               0xc0\r
 #define EFI_FV_FILETYPE_OEM_MAX               0xdf\r
 #define EFI_FV_FILETYPE_DEBUG_MIN             0xe0\r
index f54614a..5e926ac 100644 (file)
@@ -3,7 +3,7 @@
   IFR is primarily consumed by the EFI presentation engine, and produced by EFI\r
   internal application and drivers as well as all add-in card option-ROM drivers\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
@@ -268,8 +268,8 @@ typedef struct _EFI_HII_GUID_PACKAGE_HDR {
 // String Package\r
 //\r
 \r
-#define UEFI_CONFIG_LANG  L"x-UEFI"\r
-#define UEFI_CONFIG_LANG2 L"x-i-UEFI"     // BUGBUG, spec need to be updated.\r
+#define UEFI_CONFIG_LANG  "x-UEFI"\r
+#define UEFI_CONFIG_LANG2 "x-i-UEFI"\r
 \r
 typedef struct _EFI_HII_STRING_PACKAGE_HDR {\r
   EFI_HII_PACKAGE_HEADER  Header;\r
@@ -1034,12 +1034,12 @@ typedef struct _EFI_IFR_EQ_ID_VAL {
   UINT16                   Value;\r
 } EFI_IFR_EQ_ID_VAL;\r
 \r
-typedef struct _EFI_IFR_EQ_ID_LIST {\r
+typedef struct _EFI_IFR_EQ_ID_VAL_LIST {\r
   EFI_IFR_OP_HEADER        Header;\r
   EFI_QUESTION_ID          QuestionId;\r
   UINT16                   ListLength;\r
   UINT16                   ValueList[1];\r
-} EFI_IFR_EQ_ID_LIST;\r
+} EFI_IFR_EQ_ID_VAL_LIST;\r
 \r
 typedef struct _EFI_IFR_QUESTION_REF1 {\r
   EFI_IFR_OP_HEADER        Header;\r
index 1595a98..57cbc23 100644 (file)
@@ -656,6 +656,59 @@ typedef struct {
   UINT8  FrameRegisterOffset:4;\r
 } UNWIND_INFO;\r
 \r
+///\r
+/// Resource format.\r
+///\r
+typedef struct {\r
+  UINT32  Characteristics;\r
+  UINT32  TimeDateStamp;\r
+  UINT16  MajorVersion;\r
+  UINT16  MinorVersion;\r
+  UINT16  NumberOfNamedEntries;\r
+  UINT16  NumberOfIdEntries;\r
+  //\r
+  // Array of EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY entries goes here.\r
+  //\r
+} EFI_IMAGE_RESOURCE_DIRECTORY;\r
+\r
+///\r
+/// Resource directory entry format.\r
+///\r
+typedef struct {\r
+  union {\r
+    struct {\r
+      UINT32  NameOffset:31;\r
+      UINT32  NameIsString:1;\r
+    } s;\r
+    UINT32  Id;\r
+  } u1;\r
+  union {\r
+    UINT32  OffsetToData;\r
+    struct {\r
+      UINT32  OffsetToDirectory:31;\r
+      UINT32  DataIsDirectory:1;\r
+    } s;\r
+  } u2;\r
+} EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY;\r
+\r
+///\r
+/// Resource directory entry for string.\r
+///\r
+typedef struct {\r
+  UINT16  Length;\r
+  CHAR16  String[1];\r
+} EFI_IMAGE_RESOURCE_DIRECTORY_STRING;\r
+\r
+///\r
+/// Resource directory entry for data array.\r
+///\r
+typedef struct {\r
+  UINT32  OffsetToData;\r
+  UINT32  Size;\r
+  UINT32  CodePage;\r
+  UINT32  Reserved;\r
+} EFI_IMAGE_RESOURCE_DATA_ENTRY;\r
+\r
 ///\r
 /// Header format for TE images\r
 ///\r
index 195727c..e3c150c 100644 (file)
@@ -628,23 +628,27 @@ CVfrCompiler::GenCFile (
   if (!IS_RUN_STATUS(STATUS_GENBINARY)) {\r
     goto Fail;\r
   }\r
+  \r
+  if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {\r
+    if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {\r
+      Error (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);\r
+      goto Fail;\r
+    }\r
 \r
-  if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {\r
-    Error (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);\r
-    goto Fail;\r
-  }\r
-\r
-  for (Index = 0; gSourceFileHeader[Index] != NULL; Index++) {\r
-    fprintf (pFile, "%s\n", gSourceFileHeader[Index]);\r
-  }\r
+    for (Index = 0; gSourceFileHeader[Index] != NULL; Index++) {\r
+      fprintf (pFile, "%s\n", gSourceFileHeader[Index]);\r
+    }\r
 \r
-  gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);\r
+    if (mOptions.CompatibleMode) { \r
+      gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);\r
+    }\r
 \r
-  if (gCFormPkg.GenCFile (mOptions.VfrBaseFileName, pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {\r
+    if (gCFormPkg.GenCFile (mOptions.VfrBaseFileName, pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {\r
+      fclose (pFile);\r
+      goto Fail;\r
+    }\r
     fclose (pFile);\r
-    goto Fail;\r
   }\r
-  fclose (pFile);\r
 \r
   SET_RUN_STATUS (STATUS_FINISHED);\r
   return;\r
index 298eb02..87da95a 100644 (file)
@@ -2,7 +2,7 @@
   \r
   The definition of CFormPkg's member function\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
@@ -1228,7 +1228,7 @@ static struct {
   { sizeof (EFI_IFR_INCONSISTENT_IF), 1 },     // EFI_IFR_INCONSISTENT_IF_OP\r
   { sizeof (EFI_IFR_EQ_ID_VAL), 0 },           // EFI_IFR_EQ_ID_VAL_OP\r
   { sizeof (EFI_IFR_EQ_ID_ID), 0 },            // EFI_IFR_EQ_ID_ID_OP\r
-  { sizeof (EFI_IFR_EQ_ID_LIST), 0 },          // EFI_IFR_EQ_ID_LIST_OP - 0x14\r
+  { sizeof (EFI_IFR_EQ_ID_VAL_LIST), 0 },      // EFI_IFR_EQ_ID_LIST_OP - 0x14\r
   { sizeof (EFI_IFR_AND), 0 },                 // EFI_IFR_AND_OP\r
   { sizeof (EFI_IFR_OR), 0 },                  // EFI_IFR_OR_OP\r
   { sizeof (EFI_IFR_NOT), 0 },                 // EFI_IFR_NOT_OP\r
index fa671c1..324078a 100644 (file)
@@ -2,7 +2,7 @@
   \r
   The definition of CFormPkg's member function\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
@@ -1568,12 +1568,12 @@ public:
 \r
 class CIfrEqIdList : public CIfrObj, public CIfrOpHeader {\r
 private:\r
-  EFI_IFR_EQ_ID_LIST *mEqIdVList;\r
+  EFI_IFR_EQ_ID_VAL_LIST *mEqIdVList;\r
 \r
 public:\r
   CIfrEqIdList (\r
   IN UINT32 LineNo\r
-  ) : CIfrObj (EFI_IFR_EQ_ID_LIST_OP, (CHAR8 **)&mEqIdVList, sizeof (EFI_IFR_EQ_ID_LIST), TRUE),\r
+  ) : CIfrObj (EFI_IFR_EQ_ID_LIST_OP, (CHAR8 **)&mEqIdVList, sizeof (EFI_IFR_EQ_ID_VAL_LIST), TRUE),\r
                    CIfrOpHeader (EFI_IFR_EQ_ID_LIST_OP, &mEqIdVList->Header) {\r
     SetLineNo (LineNo);\r
     mEqIdVList->QuestionId   = EFI_QUESTION_ID_INVALID;\r
@@ -1584,7 +1584,7 @@ public:
   VOID UpdateIfrBuffer ( \r
   ) {\r
     _EMIT_PENDING_OBJ();\r
-    mEqIdVList = (EFI_IFR_EQ_ID_LIST *) GetObjBinAddr();\r
+    mEqIdVList = (EFI_IFR_EQ_ID_VAL_LIST *) GetObjBinAddr();\r
     UpdateHeader (&mEqIdVList->Header);\r
   }\r
 \r
index c01f16e..ea529a5 100644 (file)
@@ -1911,7 +1911,7 @@ vfrStatementOrderedList :
   >>\r
   L:OrderedList                                        << OLObj.SetLineNo(L->getLine()); >>\r
   vfrQuestionHeader[OLObj] ","\r
-                                                       << OLObj.SetMaxContainers ((UINT8)_GET_CURRQEST_VARSIZE()); >>\r
+                                                       << OLObj.SetMaxContainers ((UINT8) _GET_CURRQEST_ARRAY_SIZE()); >>\r
   {\r
     MaxContainers "=" M:Number ","                     << OLObj.SetMaxContainers (_STOU8(M->getText())); >>\r
   }\r
@@ -3179,6 +3179,7 @@ private:
 \r
   UINT8               _GET_CURRQEST_DATATYPE ();\r
   UINT32              _GET_CURRQEST_VARSIZE ();\r
+  UINT32              _GET_CURRQEST_ARRAY_SIZE();\r
 \r
 public:\r
   VOID                _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CHAR8 *);\r
@@ -3286,6 +3287,37 @@ EfiVfrParser::_GET_CURRQEST_VARTINFO (
   return mCurrQestVarInfo;\r
 }\r
 \r
+UINT32\r
+EfiVfrParser::_GET_CURRQEST_ARRAY_SIZE (\r
+  VOID\r
+  )\r
+{\r
+  UINT8 Size = 1;\r
+\r
+  switch (mCurrQestVarInfo.mVarType) {\r
+  case EFI_IFR_TYPE_NUM_SIZE_8:\r
+    Size = 1;\r
+    break;\r
+\r
+  case EFI_IFR_TYPE_NUM_SIZE_16:\r
+    Size = 2;\r
+    break;\r
+\r
+  case EFI_IFR_TYPE_NUM_SIZE_32:\r
+    Size = 4;\r
+    break;\r
+\r
+  case EFI_IFR_TYPE_NUM_SIZE_64:\r
+    Size = 8;\r
+    break;\r
+\r
+  default:\r
+    break;\r
+  }\r
+\r
+  return (mCurrQestVarInfo.mVarTotalSize / Size);\r
+}\r
+\r
 UINT8\r
 EfiVfrParser::_GET_CURRQEST_DATATYPE (\r
   VOID\r
index b7237b0..ff61c9b 100644 (file)
@@ -437,122 +437,126 @@ Returns:
 {
   CHAR8 *SectionStr;
   CHAR8 *SectionTypeStringTable[] = {
-    "EFI_SECTION_ALL",
     //
     // 0X00
     //
-    "EFI_SECTION_COMPRESSION",
+    "EFI_SECTION_ALL",
     //
     // 0x01
     //
-    "EFI_SECTION_GUID_DEFINED",
+    "EFI_SECTION_COMPRESSION",
     //
     // 0x02
     //
-    "Unknown section type - Reserved 0x03",
+    "EFI_SECTION_GUID_DEFINED",    
     //
     // 0x03
     //
-    "Unknown section type - Reserved 0x04",
+    "Unknown section type - Reserved 0x03",
     //
     // 0x04
     //
-    "Unknown section type - Reserved 0x05",
+    "Unknown section type - Reserved 0x04",
     //
     // 0x05
     //
-    "Unknown section type - Reserved 0x06",
+    "Unknown section type - Reserved 0x05",
     //
     // 0x06
     //
-    "Unknown section type - Reserved 0x07",
+    "Unknown section type - Reserved 0x06",
     //
     // 0x07
     //
-    "Unknown section type - Reserved 0x08",
+    "Unknown section type - Reserved 0x07",
     //
     // 0x08
     //
-    "Unknown section type - Reserved 0x09",
+    "Unknown section type - Reserved 0x08",
     //
     // 0x09
     //
-    "Unknown section type - Reserved 0x0A",
+    "Unknown section type - Reserved 0x09",
     //
     // 0x0A
     //
-    "Unknown section type - Reserved 0x0B",
+    "Unknown section type - Reserved 0x0A",
     //
     // 0x0B
     //
-    "Unknown section type - Reserved 0x0C",
+    "Unknown section type - Reserved 0x0B",
     //
     // 0x0C
     //
-    "Unknown section type - Reserved 0x0D",
+    "Unknown section type - Reserved 0x0C",
     //
     // 0x0D
     //
-    "Unknown section type - Reserved 0x0E",
+    "Unknown section type - Reserved 0x0D",
     //
     // 0x0E
     //
-    "Unknown section type - Reserved 0x0F",
+    "Unknown section type - Reserved 0x0E",
     //
     // 0x0F
     //
-    "EFI_SECTION_PE32",
+    "Unknown section type - Reserved 0x0E",
     //
     // 0x10
     //
-    "EFI_SECTION_PIC",
+    "EFI_SECTION_PE32",
     //
     // 0x11
     //
-    "EFI_SECTION_TE",
+    "EFI_SECTION_PIC",
     //
     // 0x12
     //
-    "EFI_SECTION_DXE_DEPEX",
+    "EFI_SECTION_TE",    
     //
     // 0x13
     //
-    "EFI_SECTION_VERSION",
+    "EFI_SECTION_DXE_DEPEX", 
     //
     // 0x14
     //
-    "EFI_SECTION_USER_INTERFACE",
+    "EFI_SECTION_VERSION",
     //
     // 0x15
     //
-    "EFI_SECTION_COMPATIBILITY16",
+    "EFI_SECTION_USER_INTERFACE",
     //
     // 0x16
     //
-    "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
+    "EFI_SECTION_COMPATIBILITY16",
     //
     // 0x17
     //
-    "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
+    "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
     //
     // 0x18
     //
-    "EFI_SECTION_RAW",
+    "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
     //
     // 0x19
     //
-    "Unknown section type - 0x1A",
+    "EFI_SECTION_RAW",
     //
     // 0x1A
     //
-    "EFI_SECTION_PEI_DEPEX",
+    "Unknown section type - 0x1A",
     //
     // 0x1B
     //
-    "Unknown section type - Reserved - beyond last defined section"
+    "EFI_SECTION_PEI_DEPEX",
+    //
+    // 0x1C
+    //
+    "EFI_SECTION_SMM_DEPEX",
     //
     // 0x1C+
     //
+    "Unknown section type - Reserved - beyond last defined section"
   };
 
   if (Type > EFI_SECTION_LAST_SECTION_TYPE) {
@@ -1055,15 +1059,15 @@ Returns:
       //
       // Calculate file checksum
       //
-      Checksum  = CalculateSum8 ((UINT8 *) FileHeader, FileLength);
-      Checksum  = (UINT8) (Checksum - FileHeader->State);
+      Checksum  = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER));
+      Checksum  = Checksum + FileHeader->IntegrityCheck.Checksum.File;
       if (Checksum != 0) {
         Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer);
         return EFI_ABORTED;
       }
     } else {
       if (FileHeader->IntegrityCheck.Checksum.File != FFS_FIXED_CHECKSUM) {
-        Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum -- not set to fixed value of 0x5A", GuidBuffer);
+        Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum -- not set to fixed value of 0xAA", GuidBuffer);
         return EFI_ABORTED;
       }
     }
@@ -1130,10 +1134,22 @@ Returns:
     printf ("EFI_FV_FILETYPE_APPLICATION\n");
     break;
 
+  case EFI_FV_FILETYPE_SMM:
+    printf ("EFI_FV_FILETYPE_SMM\n");
+    break;
+
   case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
     printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n");
     break;
 
+  case EFI_FV_FILETYPE_COMBINED_SMM_DXE:
+    printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
+    break;
+
+  case EFI_FV_FILETYPE_SMM_CORE:
+    printf ("EFI_FV_FILETYPE_SMM_CORE\n");
+    break;
+
   case EFI_FV_FILETYPE_FFS_PAD:
     printf ("EFI_FV_FILETYPE_FFS_PAD\n");
     break;
@@ -1273,8 +1289,9 @@ Returns:
       //
       break;
 
-    case EFI_SECTION_DXE_DEPEX:
     case EFI_SECTION_PEI_DEPEX:
+    case EFI_SECTION_DXE_DEPEX:
+    case EFI_SECTION_SMM_DEPEX:
       DumpDepexSection (Ptr, SectionLength);
       break;
 
index 647e1d0..9594ef0 100644 (file)
@@ -21,6 +21,7 @@ import copy
 import GenC
 import GenMake
 import GenDepex
+from StringIO import StringIO
 
 from StrGather import *
 from BuildEngine import BuildRule
@@ -48,8 +49,8 @@ gBuildRuleFile = 'Conf/build_rule.txt'
 gAutoGenCodeFileName = "AutoGen.c"
 gAutoGenHeaderFileName = "AutoGen.h"
 gAutoGenStringFileName = "%(module_name)sStrDefs.h"
+gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
 gAutoGenDepexFileName = "%(module_name)s.depex"
-gAutoGenSmmDepexFileName = "%(module_name)s.smm"
 
 ## Base class for AutoGen
 #
@@ -137,7 +138,8 @@ class WorkspaceAutoGen(AutoGen):
     #   @param  SkuId                   SKU id from command line
     #
     def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
-              BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId=''):
+              BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='', 
+              ReportFile=None, ReportType=None):
         self.MetaFile       = ActivePlatform.MetaFile
         self.WorkspaceDir   = WorkspaceDir
         self.Platform       = ActivePlatform
@@ -145,6 +147,8 @@ class WorkspaceAutoGen(AutoGen):
         self.ToolChain      = Toolchain
         self.ArchList       = ArchList
         self.SkuId          = SkuId
+        self.ReportFile     = ReportFile
+        self.ReportType     = ReportType
 
         self.BuildDatabase  = MetaFileDb
         self.TargetTxt      = BuildConfig
@@ -181,6 +185,325 @@ class WorkspaceAutoGen(AutoGen):
             Pa.CollectPlatformDynamicPcds()
             self.AutoGenObjectList.append(Pa)
 
+        AllPcds = {}
+        MaxLen = 0
+        for Pcd in Pa._DynaPcdList_ + Pa._NonDynaPcdList_:
+          if Pcd.TokenSpaceGuidCName not in AllPcds:
+            AllPcds[Pcd.TokenSpaceGuidCName] = {}
+          if Pcd.Type not in AllPcds[Pcd.TokenSpaceGuidCName]:
+            AllPcds[Pcd.TokenSpaceGuidCName][Pcd.Type] = []
+          AllPcds[Pcd.TokenSpaceGuidCName][Pcd.Type] += [Pcd]
+          if len(Pcd.TokenCName) > MaxLen:
+            MaxLen = len(Pcd.TokenCName)
+
+        if self.ReportFile <> None:
+          try:
+            if os.path.exists(self.ReportFile):
+              os.remove(self.ReportFile)
+
+            Fd = open(self.ReportFile, "w")
+       
+            Fd.write ('===============================================================================\n')
+            Fd.write ('Platform Configuration Database Report\n')
+            Fd.write ('===============================================================================\n')
+            Fd.write ('  *P  - Platform scoped PCD override in DSC file\n')
+            Fd.write ('  *F  - Platform scoped PCD override in FDF file\n')
+            Fd.write ('  *M  - Module scoped PCD override in DSC file\n')
+            Fd.write ('  *C  - Library has a constructor\n')
+            Fd.write ('  *D  - Library has a destructor\n')
+            Fd.write ('  *CD - Library has both a constructor and a destructor\n')
+            Fd.write ('===============================================================================\n')
+            Fd.write ('\n')
+            Fd.write ('===============================================================================\n')
+            Fd.write ('PLATFORM: %s\n' % (ActivePlatform.MetaFile))
+            Fd.write ('===============================================================================\n')
+            for Key in AllPcds:
+              Fd.write ('%s\n' % (Key))
+              for Type in AllPcds[Key]:
+                TypeName = ''
+                DecType = Type
+                if Type == 'FixedAtBuild':
+                  TypeName = 'FIXED'
+                if Type == 'PatchableInModule':
+                  TypeName = 'PATCH'
+                if Type == 'FeatureFlag':
+                  TypeName = 'FLAG'
+                if Type == 'Dynamic':
+                  TypeName = 'DYN'
+                if Type == 'DynamicHii':
+                  TypeName = 'DYNHII'
+                  DecType = 'Dynamic'
+                if Type == 'DynamicVpd':
+                  TypeName = 'DYNVPD'
+                  DecType = 'Dynamic'
+                if Type == 'DynamicEx':
+                  TypeName = 'DEX'
+                  DecType = 'Dynamic'
+                if Type == 'DynamicExHii':
+                  TypeName = 'DEXHII'
+                  DecType = 'Dynamic'
+                if Type == 'DynamicExVpd':
+                  TypeName = 'DEXVPD'
+                  DecType = 'Dynamic'
+                for Pcd in AllPcds[Key][Type]:
+                
+                  DecDefaultValue = None
+                  for F in Pa.Platform.Modules.keys():
+                    for Package in Pa.Platform.Modules[F].M.Module.Packages:
+                      if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType) in Package.Pcds:
+                        if DecDefaultValue == None:
+                          DecDefaultValue = Package.Pcds[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType].DefaultValue
+
+                  DscDefaultValue = None
+                  if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds:
+                    DscDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
+
+                  if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+                    if Pcd.DefaultValue.strip()[0:2].upper() == '0X':
+                      PcdDefaultValueNumber = int(Pcd.DefaultValue.strip(), 16)
+                    else:
+                      PcdDefaultValueNumber = int(Pcd.DefaultValue.strip())
+                  
+                    if DecDefaultValue == None:
+                      DecMatch = True
+                    else:
+                      if DecDefaultValue.strip()[0:2].upper() == '0X':
+                        DecDefaultValueNumber = int(DecDefaultValue.strip(), 16)
+                      else:
+                        DecDefaultValueNumber = int(DecDefaultValue.strip())
+                      DecMatch = (DecDefaultValueNumber == PcdDefaultValueNumber)
+                      
+                    if DscDefaultValue == None:
+                      DscMatch = True
+                    else:
+                      if DscDefaultValue.strip()[0:2].upper() == '0X':
+                        DscDefaultValueNumber = int(DscDefaultValue.strip(), 16)
+                      else:
+                        DscDefaultValueNumber = int(DscDefaultValue.strip())
+                      DscMatch = (DscDefaultValueNumber == PcdDefaultValueNumber)
+                  else:
+                    if DecDefaultValue == None:
+                      DecMatch = True
+                    else:
+                      DecMatch = (DecDefaultValue == Pcd.DefaultValue)
+                      
+                    if DscDefaultValue == None:
+                      DscMatch = True
+                    else:
+                      DscMatch = (DscDefaultValue == Pcd.DefaultValue)
+     
+                  if DecMatch:
+                    Fd.write ('    %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
+                  else:
+                    if DscMatch:
+                      if (Pcd.TokenCName, Key) in PcdSet:
+                        Fd.write (' *F %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
+                      else:
+                        Fd.write (' *P %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
+
+                  for F in Pa.Platform.Modules.keys():
+                    for ModulePcd in Pa.Platform.Modules[F].M.ModulePcdList + Pa.Platform.Modules[F].M.LibraryPcdList:
+                      if ModulePcd.TokenSpaceGuidCName <> Pcd.TokenSpaceGuidCName:
+                        continue
+                      if ModulePcd.TokenCName <> Pcd.TokenCName:
+                        continue
+                      if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+                        if ModulePcd.DefaultValue.strip()[0:2].upper() == '0X':
+                          ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip(), 16)
+                        else:
+                          ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip())
+                        Match = (ModulePcdDefaultValueNumber == PcdDefaultValueNumber)
+                      else:
+                        Match = (ModulePcd.DefaultValue == Pcd.DefaultValue)
+                      if Match:
+                        continue
+                      Fd.write (' *M %*s = %s\n' % (MaxLen + 21, str(F).split('\\')[-1], ModulePcd.DefaultValue))
+                      
+                  if not DecMatch and DscMatch and DecDefaultValue <> None:
+                    Fd.write ('    %*s = %s\n' % (MaxLen + 21, 'DEC DEFAULT', DecDefaultValue))
+                      
+              Fd.write ('\n')
+
+            Fd.write ('===============================================================================\n')
+            Fd.write ('===============================================================================\n')
+            
+            for F in Pa.Platform.Modules.keys():
+              Fd.write ('\n')
+              Fd.write ('===============================================================================\n')
+              Fd.write ('MODULE: %s\n' % (F))
+              Fd.write ('===============================================================================\n')
+              
+              Fd.write ('PLATFORM CONFIGURATION DATABASE\n')
+              Fd.write ('-------------------------------------------------------------------------------\n')
+              ModuleFirst = True
+              for Key in AllPcds:
+                First = True
+                for Type in AllPcds[Key]:
+                  TypeName = ''
+                  DecType = Type
+                  if Type == 'FixedAtBuild':
+                    TypeName = 'FIXED'
+                  if Type == 'PatchableInModule':
+                    TypeName = 'PATCH'
+                  if Type == 'FeatureFlag':
+                    TypeName = 'FLAG'
+                  if Type == 'Dynamic':
+                    TypeName = 'DYN'
+                  if Type == 'DynamicHii':
+                    TypeName = 'DYNHII'
+                    DecType = 'Dynamic'
+                  if Type == 'DynamicVpd':
+                    TypeName = 'DYNVPD'
+                    DecType = 'Dynamic'
+                  if Type == 'DynamicEx':
+                    TypeName = 'DEX'
+                    DecType = 'Dynamic'
+                  if Type == 'DynamicExHii':
+                    TypeName = 'DEXHII'
+                    DecType = 'Dynamic'
+                  if Type == 'DynamicExVpd':
+                    TypeName = 'DEXVPD'
+                    DecType = 'Dynamic'
+                  for Pcd in AllPcds[Key][Type]:
+                    for ModulePcd in Pa.Platform.Modules[F].M.ModulePcdList + Pa.Platform.Modules[F].M.LibraryPcdList:
+                      if ModulePcd.TokenSpaceGuidCName <> Pcd.TokenSpaceGuidCName:
+                        continue
+                      if ModulePcd.TokenCName <> Pcd.TokenCName:
+                        continue
+                      if ModulePcd.Type <> Pcd.Type:
+                        continue
+                      if First:
+                        if ModuleFirst:
+                          ModuleFirst = False
+                        else:
+                          Fd.write ('\n')
+                        Fd.write ('%s\n' % (Key))
+                        First = False
+
+                      InfDefaultValue = ModulePcd.InfDefaultValue
+                      if InfDefaultValue == '':
+                        InfDefaultValue = None
+
+                      DecDefaultValue = None
+                      for Package in Pa.Platform.Modules[F].M.Module.Packages:
+                        if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType) in Package.Pcds:
+                          if DecDefaultValue == None:
+                            DecDefaultValue = Package.Pcds[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType].DefaultValue
+
+                      DscDefaultValue = None
+                      if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds:
+                        DscDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
+
+                      DscModuleOverrideDefaultValue = None
+                      if F in self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules:
+                        if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules[F].Pcds:
+                          DscModuleOverrideDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules[F].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
+                      
+                      if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
+                        if ModulePcd.DefaultValue.strip()[0:2].upper() == '0X':
+                          ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip(), 16)
+                        else:
+                          ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip())
+                          
+                        if DecDefaultValue == None:
+                          DecMatch = True
+                        else:
+                          if DecDefaultValue.strip()[0:2].upper() == '0X':
+                            DecDefaultValueNumber = int(DecDefaultValue.strip(), 16)
+                          else:
+                            DecDefaultValueNumber = int(DecDefaultValue.strip())
+                          DecMatch = (DecDefaultValueNumber == ModulePcdDefaultValueNumber)
+                          
+                        if InfDefaultValue == None:
+                          InfMatch = True
+                        else:
+                          if InfDefaultValue.strip()[0:2].upper() == '0X':
+                            InfDefaultValueNumber = int(InfDefaultValue.strip(), 16)
+                          else:
+                            InfDefaultValueNumber = int(InfDefaultValue.strip())
+                          InfMatch = (InfDefaultValueNumber == ModulePcdDefaultValueNumber)
+
+                        if DscDefaultValue == None:
+                          DscMatch = True
+                        else:
+                          if DscDefaultValue.strip()[0:2].upper() == '0X':
+                            DscDefaultValueNumber = int(DscDefaultValue.strip(), 16)
+                          else:
+                            DscDefaultValueNumber = int(DscDefaultValue.strip())
+                          DscMatch = (DscDefaultValueNumber == ModulePcdDefaultValueNumber)
+                      else:
+                        if DecDefaultValue == None:
+                          DecMatch = True
+                        else:
+                          DecMatch = (DecDefaultValue == ModulePcd.DefaultValue)
+                          
+                        if InfDefaultValue == None:
+                          InfMatch = True
+                        else:
+                          InfMatch = (InfDefaultValue == ModulePcd.DefaultValue)
+                          
+                        if DscDefaultValue == None:
+                          DscMatch = True
+                        else:
+                          DscMatch = (DscDefaultValue == ModulePcd.DefaultValue)
+                          
+                      if DecMatch and InfMatch:
+                        Fd.write ('    %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+                      else:
+                        if DscMatch and DscModuleOverrideDefaultValue == None:
+                          if (Pcd.TokenCName, Key) in PcdSet:
+                            Fd.write (' *F %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+                          else:
+                            Fd.write (' *P %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+                        else:
+                          Fd.write (' *M %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
+                          if DscDefaultValue <> None:
+                            Fd.write ('    %*s = %s\n' % (MaxLen + 19, 'DSC DEFAULT', DscDefaultValue))
+                        if InfDefaultValue <> None:
+                          Fd.write ('    %*s = %s\n' % (MaxLen + 19, 'INF DEFAULT', InfDefaultValue))
+                        if DecDefaultValue <> None and not DecMatch:
+                          Fd.write ('    %*s = %s\n' % (MaxLen + 19, 'DEC DEFAULT', DecDefaultValue))
+              Fd.write ('-------------------------------------------------------------------------------\n')
+              Fd.write ('LIBRARIES\n')
+              Fd.write ('-------------------------------------------------------------------------------\n')
+              for Lib in Pa.Platform.Modules[F].M.DependentLibraryList:
+                if len(Lib.ConstructorList) > 0:
+                  if  len(Lib.DestructorList) > 0:
+                    Fd.write (' *CD')
+                  else:
+                    Fd.write (' *C ')
+                else:
+                  if  len(Lib.DestructorList) > 0:
+                    Fd.write (' *D ')
+                  else:
+                    Fd.write ('    ')
+                Fd.write (' %s\n' % (Lib))
+                for Depex in Lib.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]:
+                  Fd.write ('       DEPEX = %s\n' % (Depex))
+              Fd.write ('-------------------------------------------------------------------------------\n')
+
+              Fd.write ('MODULE DEPENDENCY EXPRESSION\n')
+              if len(Pa.Platform.Modules[F].M.Module.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]) == 0:
+                Fd.write ('  NONE\n')
+              else:
+                for Depex in Pa.Platform.Modules[F].M.Module.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]:
+                  Fd.write ('  %s\n' % (Depex))
+              Fd.write ('-------------------------------------------------------------------------------\n')
+
+              Fd.write ('MODULE + LIBRARY DEPENDENCY EXPRESSION\n')
+              if Pa.Platform.Modules[F].M.ModuleType in Pa.Platform.Modules[F].M.DepexExpressionList:
+                if Pa.Platform.Modules[F].M.DepexExpressionList[Pa.Platform.Modules[F].M.ModuleType] == '': 
+                  Fd.write ('  NONE\n')
+                else:
+                  Fd.write ('  %s\n' % (Pa.Platform.Modules[F].M.DepexExpressionList[Pa.Platform.Modules[F].M.ModuleType]))
+              else:
+                Fd.write ('  NONE\n')
+              Fd.write ('-------------------------------------------------------------------------------\n')
+              
+            Fd.close()
+          except:
+            EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=self.ReportFile)
+                  
         self._BuildDir = None
         self._FvDir = None
         self._MakeFileDir = None
@@ -421,6 +744,9 @@ class PlatformAutoGen(AutoGen):
         for F in self.Platform.Modules.keys():
             M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile)
             #GuidValue.update(M.Guids)
+            
+            self.Platform.Modules[F].M = M
+            
             for PcdFromModule in M.ModulePcdList+M.LibraryPcdList:
                 # make sure that the "VOID*" kind of datum has MaxDatumSize set
                 if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize == None:
@@ -1260,6 +1586,7 @@ class ModuleAutoGen(AutoGen):
         self._ProtocolList            = None
         self._PpiList                 = None
         self._DepexList               = None
+        self._DepexExpressionList     = None
         self._BuildOption             = None
         self._BuildTargets            = None
         self._IntroBuildTargetList    = None
@@ -1433,11 +1760,7 @@ class ModuleAutoGen(AutoGen):
             if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
                 return self._DepexList
 
-            if self.ModuleType == "DXE_SMM_DRIVER":
-                self._DepexList["DXE_DRIVER"] = []
-                self._DepexList["SMM_DRIVER"] = []
-            else:
-                self._DepexList[self.ModuleType] = []
+            self._DepexList[self.ModuleType] = []
 
             for ModuleType in self._DepexList:
                 DepexList = self._DepexList[ModuleType]
@@ -1463,6 +1786,42 @@ class ModuleAutoGen(AutoGen):
                     EdkLogger.verbose('')
         return self._DepexList
 
+    ## Merge dependency expression
+    #
+    #   @retval     list    The token list of the dependency expression after parsed
+    #
+    def _GetDepexExpressionTokenList(self):
+        if self._DepexExpressionList == None:
+            self._DepexExpressionList = {}
+            if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
+                return self._DepexExpressionList
+
+            self._DepexExpressionList[self.ModuleType] = ''
+
+            for ModuleType in self._DepexExpressionList:
+                DepexExpressionList = self._DepexExpressionList[ModuleType]
+                #
+                # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion
+                #
+                for M in [self.Module] + self.DependentLibraryList:
+                    Inherited = False
+                    for D in M.DepexExpression[self.Arch, ModuleType]:
+                        if DepexExpressionList != '':
+                            DepexExpressionList += ' AND '
+                        DepexExpressionList += '('
+                        DepexExpressionList += D
+                        DepexExpressionList = DepexExpressionList.rstrip('END').strip()
+                        DepexExpressionList += ')'
+                        Inherited = True
+                    if Inherited:
+                        EdkLogger.verbose("DEPEX[%s] (+%s) = %s" % (self.Name, M.BaseName, DepexExpressionList))
+                    if 'BEFORE' in DepexExpressionList or 'AFTER' in DepexExpressionList:
+                        break
+                if len(DepexExpressionList) > 0:
+                    EdkLogger.verbose('')
+                self._DepexExpressionList[ModuleType] = DepexExpressionList
+        return self._DepexExpressionList
+
     ## Return the list of specification version required for the module
     #
     #   @retval     list    The list of specification defined in module file
@@ -1580,12 +1939,12 @@ class ModuleAutoGen(AutoGen):
             if Source != File:
                 CreateDirectory(Source.Dir)
 
-            if FileType in self.BuildRules:
+            if File.IsBinary and File == Source:
+                RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]
+            elif FileType in self.BuildRules:
                 RuleObject = self.BuildRules[FileType]
             elif Source.Ext in self.BuildRules:
                 RuleObject = self.BuildRules[Source.Ext]
-            elif File.IsBinary and File == Source:
-                RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]
             else:
                 # stop at no more rules
                 if LastTarget:
@@ -1599,7 +1958,8 @@ class ModuleAutoGen(AutoGen):
 
             # stop at STATIC_LIBRARY for library
             if self.IsLibrary and FileType == TAB_STATIC_LIBRARY:
-                self._FinalBuildTargetList.add(LastTarget)
+                if LastTarget:
+                    self._FinalBuildTargetList.add(LastTarget)
                 break
 
             Target = RuleObject.Apply(Source)
@@ -1668,12 +2028,17 @@ class ModuleAutoGen(AutoGen):
     #   @retval     list        The list of auto-generated file
     #
     def _GetAutoGenFileList(self):
+        UniStringAutoGenC = True
+        UniStringBinBuffer = None
+        if self.BuildType == 'UEFI_HII':
+            UniStringBinBuffer = StringIO()
+            UniStringAutoGenC = False
         if self._AutoGenFileList == None:
             self._AutoGenFileList = {}
             AutoGenC = TemplateString()
             AutoGenH = TemplateString()
             StringH = TemplateString()
-            GenC.CreateCode(self, AutoGenC, AutoGenH, StringH)
+            GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, UniStringAutoGenC, UniStringBinBuffer)
             if str(AutoGenC) != "" and TAB_C_CODE_FILE in self.FileTypes:
                 AutoFile = PathClass(gAutoGenCodeFileName, self.DebugDir)
                 self._AutoGenFileList[AutoFile] = str(AutoGenC)
@@ -1686,6 +2051,13 @@ class ModuleAutoGen(AutoGen):
                 AutoFile = PathClass(gAutoGenStringFileName % {"module_name":self.Name}, self.DebugDir)
                 self._AutoGenFileList[AutoFile] = str(StringH)
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+            if UniStringBinBuffer != None and UniStringBinBuffer.getvalue() != "":
+                AutoFile = PathClass(gAutoGenStringFormFileName % {"module_name":self.Name}, self.OutputDir)
+                self._AutoGenFileList[AutoFile] = UniStringBinBuffer.getvalue()\r
+                AutoFile.IsBinary = True
+                self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
+            if UniStringBinBuffer != None:\r
+                UniStringBinBuffer.close()\r
         return self._AutoGenFileList
 
     ## Return the list of library modules explicitly or implicityly used by this module
@@ -1838,7 +2210,7 @@ class ModuleAutoGen(AutoGen):
         IgoredAutoGenList = []
 
         for File in self.AutoGenFileList:
-            if GenC.Generate(File.Path, self.AutoGenFileList[File]):
+            if GenC.Generate(File.Path, self.AutoGenFileList[File], File.IsBinary):
                 #Ignore R8 AutoGen.c
                 if self.AutoGenVersion < 0x00010005 and File.Name == 'AutoGen.c':
                         continue
@@ -1855,10 +2227,7 @@ class ModuleAutoGen(AutoGen):
             if len(self.DepexList[ModuleType]) == 0:
                 continue
             Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
-            if ModuleType == 'SMM_DRIVER':
-                DpxFile = gAutoGenSmmDepexFileName % {"module_name" : self.Name}
-            else:
-                DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
+            DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
 
             if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
                 AutoGenList.append(str(DpxFile))
@@ -1947,6 +2316,7 @@ class ModuleAutoGen(AutoGen):
     ProtocolList            = property(_GetProtocolList)
     PpiList                 = property(_GetPpiList)
     DepexList               = property(_GetDepexTokenList)
+    DepexExpressionList     = property(_GetDepexExpressionTokenList)
     BuildOption             = property(_GetModuleBuildOption)
     BuildCommand            = property(_GetBuildCommand)
 
index b62a127..0a2bb62 100644 (file)
@@ -383,28 +383,6 @@ ${Function} (
 ${END}
 """)
 
-## SMM_CORE Entry Point Templates
-gSmmCoreEntryPointString = TemplateString("""
-const UINT32 _gUefiDriverRevision = 0;
-${BEGIN}
-EFI_STATUS
-${Function} (
-  IN EFI_HANDLE         ImageHandle,
-  IN EFI_SYSTEM_TABLE   *SystemTable
-  );
-
-EFI_STATUS
-EFIAPI
-ProcessModuleEntryPointList (
-  IN EFI_HANDLE         ImageHandle,
-  IN EFI_SYSTEM_TABLE   *SystemTable
-  )
-{
-  return ${Function} (ImageHandle, SystemTable);
-}
-${END}
-""")
-
 gPeimEntryPointString = [
 TemplateString("""
 GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = ${PiSpecVersion};
@@ -461,6 +439,35 @@ ${END}
 """)
 ]
 
+## SMM_CORE Entry Point Templates
+gSmmCoreEntryPointPrototype = TemplateString("""
+${BEGIN}
+EFI_STATUS
+EFIAPI
+${Function} (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  );
+${END}
+""")
+
+gSmmCoreEntryPointString = TemplateString("""
+${BEGIN}
+const UINT32 _gUefiDriverRevision = ${EfiSpecVersion};
+const UINT32 _gDxeRevision = ${PiSpecVersion};
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  return ${Function} (ImageHandle, SystemTable);
+}
+${END}
+""")
+
 ## DXE SMM Entry Point Templates
 gDxeSmmEntryPointPrototype = TemplateString("""
 ${BEGIN}
@@ -890,8 +897,7 @@ gModuleTypeHeaderFile = {
     "DXE_SAL_DRIVER"    :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
     "UEFI_DRIVER"       :   ["Uefi.h",  "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoint.h"],
     "UEFI_APPLICATION"  :   ["Uefi.h",  "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntryPoint.h"],
-    "SMM_DRIVER"        :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/SmmDriverEntryPoint.h"],
-    "SMM_CORE"          :   ["PiDxe.h", "Library/DebugLib.h"],
+    "SMM_CORE"          :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
     "USER_DEFINED"      :   [gBasicHeaderFile]
 }
 
@@ -1504,7 +1510,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
             ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
             ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
         elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
-                                'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+                                'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:
             ConstructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
             ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
 
@@ -1530,7 +1536,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
         elif Info.ModuleType in ['PEI_CORE','PEIM']:
             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
         elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
-                                 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+                                 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:
             AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))
 
 ## Create code for library destructor
@@ -1561,7 +1567,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
             DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
             DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
         elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
-                                'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+                                'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_CORE']:
             DestructorPrototypeString.Append(gLibraryStructorPrototype['DXE'].Replace(Dict))
             DestructorCallingString.Append(gLibraryStructorCall['DXE'].Replace(Dict))
 
@@ -1587,7 +1593,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
         elif Info.ModuleType in ['PEI_CORE','PEIM']:
             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
         elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','DXE_RUNTIME_DRIVER',
-                                 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION', 'SMM_DRIVER', 'SMM_CORE']:
+                                 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLICATION','SMM_CORE']:
             AutoGenC.Append(gLibraryString['DXE'].Replace(Dict))
 
 
@@ -1635,26 +1641,25 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
         AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict))
     elif Info.ModuleType == 'SMM_CORE':
         AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict))
+        AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict))
     elif Info.ModuleType == 'PEIM':
         if NumEntryPoints < 2:
             AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(Dict))
         else:
             AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict))
         AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict))
-    elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SMM_DRIVER',
-                             'DXE_SAL_DRIVER','UEFI_DRIVER', 'SMM_DRIVER']:
-        if Info.ModuleType in ['DXE_SMM_DRIVER', 'SMM_DRIVER']:
-            if NumEntryPoints == 0:
-                AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
-            else:
-                AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
-            AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))
+    elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']:
+        if NumEntryPoints < 2:
+            AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))
         else:
-            if NumEntryPoints < 2:
-                AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Replace(Dict))
-            else:
-                AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
-            AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
+            AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict))
+        AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict))
+    elif Info.ModuleType == 'DXE_SMM_DRIVER':
+        if NumEntryPoints == 0:
+            AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict))
+        else:
+            AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict))
+        AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict))    
     elif Info.ModuleType == 'UEFI_APPLICATION':
         if NumEntryPoints < 2:
             AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoints].Replace(Dict))
@@ -1782,8 +1787,10 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
 #   @param      Info        The ModuleAutoGen object
 #   @param      AutoGenC    The TemplateString object for C code
 #   @param      AutoGenH    The TemplateString object for header file
+#   @param      UniGenCFlag     UniString is generated into AutoGen C file when it is set to True
+#   @param      UniGenBinBuffer Buffer to store uni string package data
 #
-def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH):
+def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH, UniGenCFlag, UniGenBinBuffer):
     WorkingDir = os.getcwd()
     os.chdir(Info.WorkspaceDir)
 
@@ -1823,13 +1830,15 @@ def CreateUnicodeStringCode(Info, AutoGenC, AutoGenH):
     else:
         ShellMode = False
 
-    Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode)
-    AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n")
-    AutoGenC.Append(Code)
-    AutoGenC.Append("\n")
+    Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer)
+    if CompatibleMode or UniGenCFlag:
+        AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n")
+        AutoGenC.Append(Code)
+        AutoGenC.Append("\n")
     AutoGenH.Append("\n//\n//Unicode String ID\n//\n")
     AutoGenH.Append(Header)
-    AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name)
+    if CompatibleMode or UniGenCFlag:
+        AutoGenH.Append("\n#define STRING_ARRAY_NAME %sStrings\n" % Info.Name)
     os.chdir(WorkingDir)
 
 ## Create common code
@@ -1890,8 +1899,10 @@ def CreateFooterCode(Info, AutoGenC, AutoGenH):
 #   @param      Info        The ModuleAutoGen object
 #   @param      AutoGenC    The TemplateString object for C code
 #   @param      AutoGenH    The TemplateString object for header file
+#   @param      UniGenCFlag     UniString is generated into AutoGen C file when it is set to True
+#   @param      UniGenBinBuffer Buffer to store uni string package data
 #
-def CreateCode(Info, AutoGenC, AutoGenH, StringH):
+def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer):
     CreateHeaderCode(Info, AutoGenC, AutoGenH)
 
     if Info.AutoGenVersion >= 0x00010005:
@@ -1908,7 +1919,7 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH):
         FileName = "%sStrDefs.h" % Info.Name
         StringH.Append(gAutoGenHeaderString.Replace({'FileName':FileName}))
         StringH.Append(gAutoGenHPrologueString.Replace({'File':'STRDEFS', 'Guid':Info.Guid.replace('-','_')}))
-        CreateUnicodeStringCode(Info, AutoGenC, StringH)
+        CreateUnicodeStringCode(Info, AutoGenC, StringH, UniGenCFlag, UniGenBinBuffer)
         StringH.Append("\n#endif\n")
         AutoGenH.Append('#include "%s"\n' % FileName)
 
@@ -1920,12 +1931,13 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH):
 
 ## Create the code file
 #
-#   @param      FilePath    The path of code file
-#   @param      Content     The content of code file
+#   @param      FilePath     The path of code file
+#   @param      Content      The content of code file
+#   @param      IsBinaryFile The flag indicating if the file is binary file or not
 #
 #   @retval     True        If file content is changed or file doesn't exist
 #   @retval     False       If the file exists and the content is not changed
 #
-def Generate(FilePath, Content):
-    return SaveFileOnChange(FilePath, Content, False)
+def Generate(FilePath, Content, IsBinaryFile):
+    return SaveFileOnChange(FilePath, Content, IsBinaryFile)
 
index a3d07b8..9ee615c 100644 (file)
@@ -41,7 +41,7 @@ gType2Phase = {
     "DXE_SAL_DRIVER"    :   "DXE",\r
     "UEFI_DRIVER"       :   "DXE",\r
     "UEFI_APPLICATION"  :   "DXE",\r
-    "SMM_DRIVER"        :   "DXE",\r
+    "SMM_CORE"          :   "DXE",\r
 }\r
 \r
 ## Convert dependency expression string into EFI internal representation\r
index 0f64444..903ac3c 100644 (file)
@@ -18,6 +18,8 @@ import re
 import Common.EdkLogger as EdkLogger\r
 from Common.BuildToolError import *\r
 from UniClassObject import *\r
+from StringIO import StringIO\r
+from struct import pack\r
 \r
 ##\r
 # Static definitions\r
@@ -60,6 +62,7 @@ OFFSET = 'offset'
 STRING = 'string'\r
 TO = 'to'\r
 STRING_TOKEN = re.compile('STRING_TOKEN *\(([A-Z0-9_]+) *\)', re.MULTILINE | re.UNICODE)\r
+COMPATIBLE_STRING_TOKEN = re.compile('STRING_TOKEN *\(([A-Za-z0-9_]+) *\)', re.MULTILINE | re.UNICODE)\r
 \r
 EFI_HII_ARRAY_SIZE_LENGTH = 4\r
 EFI_HII_PACKAGE_HEADER_LENGTH = 4\r
@@ -151,12 +154,14 @@ def CreateHFileHeader(BaseName):
 #\r
 # Create content of .h file\r
 #\r
-# @param BaseName:       The basename of strings\r
-# @param UniObjectClass: A UniObjectClass instance\r
+# @param BaseName:        The basename of strings\r
+# @param UniObjectClass   A UniObjectClass instance\r
+# @param IsCompatibleMode Compatible mode\r
+# @param UniGenCFlag      UniString is generated into AutoGen C file when it is set to True\r
 #\r
 # @retval Str:           A string of .h file content\r
 #\r
-def CreateHFileContent(BaseName, UniObjectClass):\r
+def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):\r
     Str = ''\r
     ValueStartPtr = 60\r
     Line = COMMENT_DEFINE_STR + ' ' + LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr - len(DEFINE_STR + LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(0, 4) + COMMENT_NOT_REFERENCED\r
@@ -182,21 +187,24 @@ def CreateHFileContent(BaseName, UniObjectClass):
                     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
-    Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 'Strings[];')\r
+    Str = WriteLine(Str, '')\r
+    if IsCompatibleMode or UniGenCFlag:\r
+        Str = WriteLine(Str, 'extern unsigned char ' + BaseName + 'Strings[];')\r
     return Str\r
 \r
 ## Create a complete .h file\r
 #\r
 # Create a complet .h file with file header and file content\r
 #\r
-# @param BaseName:       The basename of strings\r
-# @param UniObjectClass: A UniObjectClass instance\r
+# @param BaseName:        The basename of strings\r
+# @param UniObjectClass   A UniObjectClass instance\r
+# @param IsCompatibleMode Compatible mode\r
+# @param UniGenCFlag      UniString is generated into AutoGen C file when it is set to True\r
 #\r
 # @retval Str:           A string of complete .h file\r
 #\r
-def CreateHFile(BaseName, UniObjectClass):\r
-    HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass))\r
+def CreateHFile(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):\r
+    HFile = WriteLine('', CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag))\r
 \r
     return HFile\r
 \r
@@ -213,6 +221,15 @@ def CreateCFileHeader():
 \r
     return Str\r
 \r
+## Create a buffer to store all items in an array\r
+#\r
+# @param BinBuffer   Buffer to contain Binary data.\r
+# @param Array:      The array need to be formatted\r
+#\r
+def CreateBinBuffer(BinBuffer, Array):\r
+    for Item in Array:\r
+        BinBuffer.write(pack("B", int(Item,16)))\r
+\r
 ## Create a formatted string all items in an array\r
 #\r
 # Use ',' to join each item in an array, and break an new line when reaching the width (default is 16)\r
@@ -260,12 +277,14 @@ def CreateCFileStringValue(Value):
 #\r
 # Create content of .c file\r
 #\r
-# @param BaseName:       The basename of strings\r
-# @param UniObjectClass: A UniObjectClass instance\r
+# @param BaseName:        The basename of strings\r
+# @param UniObjectClass   A UniObjectClass instance\r
+# @param IsCompatibleMode Compatible mode\r
+# @param UniBinBuffer     UniBinBuffer to contain UniBinary data.\r
 #\r
 # @retval Str:           A string of .c file content\r
 #\r
-def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):\r
+def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer=None):\r
     #\r
     # Init array length\r
     #\r
@@ -280,9 +299,10 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
         Language = UniObjectClass.LanguageDef[IndexI][0]\r
         LangPrintName = UniObjectClass.LanguageDef[IndexI][1]\r
 \r
+        StringBuffer = StringIO()\r
         StrStringValue = ''\r
         ArrayLength = 0\r
-        NumberOfUseOhterLangDef = 0\r
+        NumberOfUseOtherLangDef = 0\r
         Index = 0\r
         for IndexJ in range(1, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[IndexI][0]])):\r
             Item = UniObjectClass.FindByToken(IndexJ, Language)\r
@@ -294,18 +314,19 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
             UseOtherLangDef = Item.UseOtherLangDef\r
 \r
             if UseOtherLangDef != '' and Referenced:\r
-                NumberOfUseOhterLangDef = NumberOfUseOhterLangDef + 1\r
+                NumberOfUseOtherLangDef = NumberOfUseOtherLangDef + 1\r
                 Index = Index + 1\r
             else:\r
-                if NumberOfUseOhterLangDef > 0:\r
-                    StrStringValue = WriteLine(StrStringValue, CreateArrayItem([StringSkipType] + DecToHexList(NumberOfUseOhterLangDef, 4)))\r
-                    NumberOfUseOhterLangDef = 0\r
+                if NumberOfUseOtherLangDef > 0:\r
+                    StrStringValue = WriteLine(StrStringValue, CreateArrayItem([StringSkipType] + DecToHexList(NumberOfUseOtherLangDef, 4)))\r
+                    CreateBinBuffer (StringBuffer, ([StringSkipType] + DecToHexList(NumberOfUseOtherLangDef, 4)))\r
+                    NumberOfUseOtherLangDef = 0\r
                     ArrayLength = ArrayLength + 3\r
                 if Referenced and Item.Token > 0:\r
                     Index = Index + 1\r
                     StrStringValue = WriteLine(StrStringValue, "// %s: %s:%s" % (DecToHexStr(Index, 4), Name, DecToHexStr(Token, 4)))\r
                     StrStringValue = Write(StrStringValue, CreateCFileStringValue(Value))\r
-                    Offset = Offset + Length\r
+                    CreateBinBuffer (StringBuffer, [StringBlockType] + Value)\r
                     ArrayLength = ArrayLength + Item.Length + 1 # 1 is for the length of string type\r
 \r
         #\r
@@ -340,6 +361,15 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
         # Add an EFI_HII_SIBT_END at last\r
         #\r
         Str = WriteLine(Str, '  ' + EFI_HII_SIBT_END + ",")\r
+        \r
+        #\r
+        # Create binary UNI string\r
+        #\r
+        if UniBinBuffer:\r
+            CreateBinBuffer (UniBinBuffer, List)\r
+            UniBinBuffer.write (StringBuffer.getvalue())\r
+            UniBinBuffer.write (pack("B", int(EFI_HII_SIBT_END,16)))\r
+        StringBuffer.close()\r
 \r
     #\r
     # Create line for string variable name\r
@@ -347,19 +377,18 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode):
     #\r
     AllStr = WriteLine('', CHAR_ARRAY_DEFIN + ' ' + BaseName + COMMON_FILE_NAME + '[] = {\n' )\r
 \r
-    #\r
-    # Create FRAMEWORK_EFI_HII_PACK_HEADER in compatible mode\r
-    #\r
     if IsCompatibleMode:\r
+        #\r
+        # Create FRAMEWORK_EFI_HII_PACK_HEADER in compatible mode\r
+        #\r
         AllStr = WriteLine(AllStr, '// FRAMEWORK PACKAGE HEADER Length')\r
         AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength + 2)) + '\n')\r
         AllStr = WriteLine(AllStr, '// FRAMEWORK PACKAGE HEADER Type')\r
         AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(2, 4)) + '\n')\r
-\r
-    #\r
-    # Create whole array length in UEFI mode\r
-    #\r
-    if not IsCompatibleMode:\r
+    else:\r
+        #\r
+        # Create whole array length in UEFI mode\r
+        #\r
         AllStr = WriteLine(AllStr, '// STRGATHER_OUTPUT_HEADER')\r
         AllStr = WriteLine(AllStr, CreateArrayItem(DecToHexList(TotalLength)) + '\n')\r
 \r
@@ -384,8 +413,9 @@ def CreateCFileEnd():
 #\r
 # Create a complete .c file\r
 #\r
-# @param BaseName:       The basename of strings\r
-# @param UniObjectClass: A UniObjectClass instance\r
+# @param BaseName:        The basename of strings\r
+# @param UniObjectClass   A UniObjectClass instance\r
+# @param IsCompatibleMode Compatible Mode\r
 #\r
 # @retval CFile:         A string of complete .c file\r
 #\r
@@ -447,10 +477,11 @@ def GetFileList(SourceFileList, IncludeList, SkipList):
 #\r
 # @param UniObjectClass:  Input UniObjectClass\r
 # @param FileList:        Search path list\r
+# @param IsCompatibleMode Compatible Mode\r
 #\r
 # @retval UniObjectClass: UniObjectClass after searched\r
 #\r
-def SearchString(UniObjectClass, FileList):\r
+def SearchString(UniObjectClass, FileList, IsCompatibleMode):\r
     if FileList == []:\r
         return UniObjectClass\r
 \r
@@ -458,7 +489,10 @@ def SearchString(UniObjectClass, FileList):
         if os.path.isfile(File):\r
             Lines = open(File, 'r')\r
             for Line in Lines:\r
-                StringTokenList = STRING_TOKEN.findall(Line)\r
+                if not IsCompatibleMode:\r
+                    StringTokenList = STRING_TOKEN.findall(Line)\r
+                else:\r
+                    StringTokenList = COMPATIBLE_STRING_TOKEN.findall(Line)\r
                 for StrName in StringTokenList:\r
                     EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)\r
                     UniObjectClass.SetStringReferenced(StrName)\r
@@ -472,7 +506,7 @@ def SearchString(UniObjectClass, FileList):
 # This function is used for UEFI2.1 spec\r
 #\r
 #\r
-def GetStringFiles(UniFilList, SourceFileList, IncludeList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False):\r
+def GetStringFiles(UniFilList, SourceFileList, IncludeList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None):\r
     Status = True\r
     ErrorMessage = ''\r
 \r
@@ -489,10 +523,14 @@ def GetStringFiles(UniFilList, SourceFileList, IncludeList, SkipList, BaseName,
 \r
     FileList = GetFileList(SourceFileList, IncludeList, SkipList)\r
 \r
-    Uni = SearchString(Uni, FileList)\r
+    Uni = SearchString(Uni, FileList, IsCompatibleMode)\r
 \r
-    HFile = CreateHFile(BaseName, Uni)\r
-    CFile = CreateCFile(BaseName, Uni, IsCompatibleMode)\r
+    HFile = CreateHFile(BaseName, Uni, IsCompatibleMode, UniGenCFlag)\r
+    CFile = None\r
+    if IsCompatibleMode or UniGenCFlag:\r
+        CFile = CreateCFile(BaseName, Uni, IsCompatibleMode)\r
+    if UniGenBinBuffer:\r
+        CreateCFileContent(BaseName, Uni, IsCompatibleMode, UniGenBinBuffer)\r
 \r
     return HFile, CFile\r
 \r
index 412fa72..dcfa264 100644 (file)
@@ -234,6 +234,11 @@ class UniFileClassObject(object):
         Value = ''\r
 \r
         Name = Item.split()[1]\r
+        # Check the string name is the upper character\r
+        if not self.IsCompatibleMode and Name != '':\r
+            MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)\r
+            if MatchString == None or MatchString.end(0) != len(Name):\r
+                EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' %(Name, self.File))\r
         LanguageList = Item.split(u'#language ')\r
         for IndexI in range(len(LanguageList)):\r
             if IndexI == 0:\r
@@ -365,6 +370,11 @@ class UniFileClassObject(object):
                         break\r
                 # Value = Value.replace(u'\r\n', u'')\r
                 Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)\r
+                # Check the string name is the upper character\r
+                if not self.IsCompatibleMode and Name != '':\r
+                    MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)\r
+                    if MatchString == None or MatchString.end(0) != len(Name):\r
+                        EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' %(Name, self.File))\r
                 self.AddStringToList(Name, Language, Value)\r
                 continue\r
 \r
index 8b6c4e4..c2da992 100644 (file)
@@ -56,12 +56,11 @@ SUP_MODULE_DXE_SMM_DRIVER = 'DXE_SMM_DRIVER'
 SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'\r
 SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'\r
 SUP_MODULE_USER_DEFINED = 'USER_DEFINED'\r
-SUP_MODULE_SMM_DRIVER = 'SMM_DRIVER'\r
 SUP_MODULE_SMM_CORE = 'SMM_CORE'\r
 \r
 SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, \\r
                    SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER, \\r
-                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_SMM_DRIVER, SUP_MODULE_SMM_CORE]\r
+                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_SMM_CORE]\r
 SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(l for l in SUP_MODULE_LIST)\r
 \r
 EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'\r
@@ -86,6 +85,7 @@ BINARY_FILE_TYPE_PE32 = 'PE32'
 BINARY_FILE_TYPE_PIC = 'PIC'\r
 BINARY_FILE_TYPE_PEI_DEPEX = 'PEI_DEPEX'\r
 BINARY_FILE_TYPE_DXE_DEPEX = 'DXE_DEPEX'\r
+BINARY_FILE_TYPE_SMM_DEPEX = 'SMM_DEPEX'\r
 BINARY_FILE_TYPE_TE = 'TE'\r
 BINARY_FILE_TYPE_VER = 'VER'\r
 BINARY_FILE_TYPE_UI = 'UI'\r
index 5099ed6..b397b16 100644 (file)
@@ -2408,7 +2408,7 @@ class FdfParser(object):
                 \r
             Obj.SectionList.append(FvImageSectionObj) \r
            \r
-        elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP"):\r
+        elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"):\r
             DepexSectionObj = CommonDataClass.FdfClass.DepexSectionClassObject()\r
             DepexSectionObj.Alignment = AlignValue\r
             DepexSectionObj.DepexType = self.__Token\r
@@ -2798,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", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"):\r
+                             "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE"):\r
             raise Warning("Unknown Module type At line ", self.FileName, self.CurrentLineNumber)\r
         return self.__Token\r
     \r
@@ -2842,7 +2842,7 @@ class FdfParser(object):
         \r
         Type = self.__Token.strip().upper()\r
         if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\\r
-                             "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"):\r
+                             "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE"):\r
             raise Warning("Unknown FV type At line ", self.FileName, self.CurrentLineNumber)\r
 \r
         if not self.__IsToken("="):\r
@@ -3221,8 +3221,8 @@ class FdfParser(object):
         elif SectionType == "RAW":\r
             if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"):\r
                 raise Warning("Incorrect section file type At Line ", self.FileName, self.CurrentLineNumber)\r
-        elif SectionType == "DXE_DEPEX":\r
-            if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX"):\r
+        elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX":\r
+            if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"):\r
                 raise Warning("Incorrect section file type At Line ", self.FileName, self.CurrentLineNumber)\r
         elif SectionType == "UI":\r
             if FileType not in ("UI", "SEC_UI"):\r
index a772840..27e67f3 100644 (file)
@@ -66,8 +66,6 @@ gComponentType2ModuleType = {
     "BS_DRIVER"             :   "DXE_DRIVER",\r
     "RT_DRIVER"             :   "DXE_RUNTIME_DRIVER",\r
     "SAL_RT_DRIVER"         :   "DXE_SAL_DRIVER",\r
-#    "BS_DRIVER"             :   "DXE_SMM_DRIVER",\r
-#    "BS_DRIVER"             :   "UEFI_DRIVER",\r
     "APPLICATION"           :   "UEFI_APPLICATION",\r
     "LOGO"                  :   "BASE",\r
 }\r
index 2c1041c..76dfbb6 100644 (file)
@@ -316,12 +316,14 @@ def DataRestore(File):
 #   @retval     None    If path doesn't exist
 #
 class DirCache:
-    _CACHE_ = {}
+    _CACHE_ = set()
+    _UPPER_CACHE_ = {}
 
     def __init__(self, Root):
         self._Root = Root
         for F in os.listdir(Root):
-            self._CACHE_[F.upper()] = F
+            self._CACHE_.add(F)
+            self._UPPER_CACHE_[F.upper()] = F
 
     # =[] operator
     def __getitem__(self, Path):
@@ -330,16 +332,18 @@ class DirCache:
             return self._Root
         if Path and Path[0] == os.path.sep:
             Path = Path[1:]
-        Path = Path.upper()
         if Path in self._CACHE_:
-            return os.path.join(self._Root, self._CACHE_[Path])
+            return os.path.join(self._Root, Path)
+        UpperPath = Path.upper()
+        if UpperPath in self._UPPER_CACHE_:
+            return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
 
         IndexList = []
         LastSepIndex = -1
         SepIndex = Path.find(os.path.sep)
         while SepIndex > -1:
-            Parent = Path[:SepIndex]
-            if Parent not in self._CACHE_:
+            Parent = UpperPath[:SepIndex]
+            if Parent not in self._UPPER_CACHE_:
                 break
             LastSepIndex = SepIndex
             SepIndex = Path.find(os.path.sep, LastSepIndex + 1)
@@ -351,22 +355,29 @@ class DirCache:
         os.chdir(self._Root)
         SepIndex = LastSepIndex
         while SepIndex > -1:
-            ParentKey = Path[:SepIndex]
-            if ParentKey not in self._CACHE_:
+            Parent = Path[:SepIndex]
+            ParentKey = UpperPath[:SepIndex]
+            if ParentKey not in self._UPPER_CACHE_:
                 os.chdir(Cwd)
                 return None
 
-            ParentDir = self._CACHE_[ParentKey]
+            if Parent in self._CACHE_:
+                ParentDir = Parent
+            else:
+                ParentDir = self._UPPER_CACHE_[ParentKey]
             for F in os.listdir(ParentDir):
                 Dir = os.path.join(ParentDir, F)
-                self._CACHE_[Dir.upper()] = Dir
+                self._CACHE_.add(Dir)
+                self._UPPER_CACHE_[Dir.upper()] = Dir
 
             SepIndex = Path.find(os.path.sep, SepIndex + 1)
 
         os.chdir(Cwd)
-        if Path not in self._CACHE_:
-            return None
-        return os.path.join(self._Root, self._CACHE_[Path])
+        if Path in self._CACHE_:
+            return os.path.join(self._Root, Path)
+        elif UpperPath in self._UPPER_CACHE_:
+            return os.path.join(self._Root, self._UPPER_CACHE_[UpperPath])
+        return None
 
 ## Get all files of a directory
 #
@@ -683,6 +694,7 @@ class TemplateString(object):
     ## Constructor
     def __init__(self, Template=None):
         self.String = ''
+        self.IsBinary = False
         self._Template = Template
         self._TemplateSectionList = self._Parse(Template)
 
index 763550f..e226f1b 100644 (file)
@@ -174,7 +174,7 @@ class IncludeStatementClass(object):
 # @var GuidTypeList:   To store value for GuidTypeList, selection scope is in below list\r
 #                      DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID\r
 # @var SupModuleList:  To store value for SupModuleList, selection scope is in below list\r
-#                      BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED\r
+#                      BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE\r
 #\r
 class GuidProtocolPpiCommonClass(CommonClass):\r
     def __init__(self):\r
@@ -202,7 +202,7 @@ class GuidProtocolPpiCommonClass(CommonClass):
 # @var RecommendedInstance:         To store value for RecommendedInstance, selection scope is in below list\r
 #                                   DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID\r
 # @var SupModuleList:               To store value for SupModuleList, selection scope is in below list\r
-#                                   BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED\r
+#                                   BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE\r
 #\r
 class LibraryClassClass(CommonClass, DefineClass):\r
     def __init__(self):\r
@@ -353,7 +353,7 @@ class PcdErrorClass(object):
 # @var SkuInfoList:            To store value for SkuInfoList\r
 #                              It is a set structure as { [SkuIdName] : SkuInfoClass } \r
 # @var SupModuleList:          To store value for SupModuleList, selection scope is in below list\r
-#                              BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED\r
+#                              BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE\r
 #\r
 class PcdClass(CommonClass):\r
     def __init__(self, CName = '', Token = '', TokenSpaceGuidCName = '', DatumType = '', MaxDatumSize = '', DefaultValue = '', ItemType = '', ValidUsage = None, SkuInfoList = None, SupModuleList = None):\r
index 9d78072..49d052d 100644 (file)
@@ -121,7 +121,7 @@ class ModuleSourceFileClass(CommonClass):
 #\r
 # @var BinaryFile:       To store value for BinaryFile\r
 # @var FileType:         To store value for FileType, selection scope is in below list\r
-#                        FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | TE | VER | UI | BIN | FV\r
+#                        FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | SMM_DEPEX| TE | VER | UI | BIN | FV\r
 # @var Target:           To store value for Target\r
 # @var ToolChainFamily:  To store value for ToolChainFamily\r
 #\r
index c064f25..1382b80 100644 (file)
@@ -62,7 +62,7 @@ class PackageIndustryStdHeaderClass(CommonClass):
 #\r
 # @var IncludeHeader:  To store value for IncludeHeader\r
 # @var ModuleType:     To store value for ModuleType, it is a set structure as\r
-#                      BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED\r
+#                      BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | TOOL | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE\r
 #\r
 class PackageIncludePkgHeaderClass(object):\r
     def __init__(self):\r
index 1c8c82a..a0a1905 100644 (file)
@@ -80,23 +80,27 @@ class DepexSection (DepexSectionClassObject):
             self.Expression = self.Expression.replace(Item, ExpGuidDict[Item])\r
 \r
         self.Expression = self.Expression.strip()\r
-        ModuleType = (self.DepexType.startswith('PEI') and ['PEIM'] or ['DXE_DRIVER'])[0]\r
-        if self.DepexType.startswith('SMM'):\r
-            ModuleType = 'SMM_DRIVER'\r
-        InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')\r
-        InputFile = os.path.normpath(InputFile)\r
+        if self.DepexType == 'PEI_DEPEX_EXP':\r
+            ModuleType = 'PEIM'\r
+            SecType    = 'PEI_DEPEX'\r
+        elif self.DepexType == 'DXE_DEPEX_EXP':\r
+            ModuleType = 'DXE_DRIVER'\r
+            SecType    = 'DXE_DEPEX'\r
+        elif self.DepexType == 'SMM_DEPEX_EXP':\r
+            ModuleType = 'DXE_SMM_DRIVER'\r
+            SecType    = 'SMM_DEPEX'\r
+        else:\r
+            EdkLogger.error("GenFds", FORMAT_INVALID,\r
+                            "Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))\r
 \r
-        Dpx = DependencyExpression(self.Expression, ModuleType)\r
-        Dpx.Generate(InputFile)\r
+        InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')\r
+        InputFile = os.path.normpath(InputFile)\r
+        Depex = DependencyExpression(self.Expression, ModuleType)\r
+        Depex.Generate(InputFile)\r
 \r
-        OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')\r
-        if self.DepexType.startswith('SMM'):\r
-            OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.smm')\r
+        OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')\r
         OutputFile = os.path.normpath(OutputFile)\r
-        SecType = (self.DepexType.startswith('PEI') and ['PEI_DEPEX'] or ['DXE_DEPEX'])[0]\r
-        if self.DepexType.startswith('SMM'):\r
-            SecType = 'SMM_DEPEX'\r
-        \r
+\r
         GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType))\r
         FileList = [OutputFile]\r
         return FileList, self.Alignment\r
index 370008c..26de500 100644 (file)
@@ -65,6 +65,33 @@ class FD(FDClassObject):
         GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################')\r
         self.GenVtfFile()\r
 \r
+        TempFdBuffer = StringIO.StringIO('')\r
+        PreviousRegionStart = -1\r
+        PreviousRegionSize = 1\r
+        \r
+        for RegionObj in self.RegionList :\r
+            if RegionObj.RegionType == 'CAPSULE':\r
+              continue\r
+            if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:\r
+              pass\r
+            elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):\r
+              pass\r
+            elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:\r
+                GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))\r
+                PadRegion = Region.Region()\r
+                PadRegion.Offset = PreviousRegionStart + PreviousRegionSize\r
+                PadRegion.Size = RegionObj.Offset - PadRegion.Offset\r
+                PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
+            PreviousRegionStart = RegionObj.Offset\r
+            PreviousRegionSize = RegionObj.Size\r
+            #\r
+            # Call each region's AddToBuffer function\r
+            #\r
+            if PreviousRegionSize > self.Size:\r
+              pass\r
+            GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')\r
+            RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
+        \r
         FdBuffer = StringIO.StringIO('')\r
         PreviousRegionStart = -1\r
         PreviousRegionSize = 1\r
index 07de926..24732a0 100644 (file)
@@ -1877,6 +1877,14 @@ class FdfParser:
         \r
         self.__GetFvNameGuid(FvObj)\r
 \r
+        FvObj.FvExtEntryTypeValue = []\r
+        FvObj.FvExtEntryType = []\r
+        FvObj.FvExtEntryData = []\r
+        while True:\r
+            isFvExtEntry = self.__GetFvExtEntryStatement(FvObj)\r
+            if not isFvExtEntry:\r
+                break\r
+\r
         self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())\r
         self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy())\r
 \r
@@ -1970,6 +1978,79 @@ class FdfParser:
 \r
         return\r
 \r
+    def __GetFvExtEntryStatement(self, FvObj):\r
+\r
+        if not self.__IsKeyword( "FV_EXT_ENTRY"):\r
+            return False\r
+\r
+        if not self.__IsKeyword ("TYPE"):\r
+            raise Warning("expected 'TYPE'", self.FileName, self.CurrentLineNumber)\r
+            \r
+        if not self.__IsToken( "="):\r
+            raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+\r
+        if not self.__GetNextHexNumber() and not self.__GetNextDecimalNumber():\r
+            raise Warning("expected Hex FV extension entry type value At Line ", self.FileName, self.CurrentLineNumber)\r
+\r
+        FvObj.FvExtEntryTypeValue += [self.__Token]\r
+\r
+        if not self.__IsToken( "{"):\r
+            raise Warning("expected '{'", self.FileName, self.CurrentLineNumber)\r
+\r
+        if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DATA"):\r
+            raise Warning("expected 'FILE' or 'DATA'", self.FileName, self.CurrentLineNumber)\r
+\r
+        FvObj.FvExtEntryType += [self.__Token]\r
+\r
+        if self.__Token == 'DATA':\r
+\r
+            if not self.__IsToken( "="):\r
+                raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                \r
+            if not self.__IsToken( "{"):\r
+                raise Warning("expected '{'", self.FileName, self.CurrentLineNumber)\r
+\r
+            if not self.__GetNextHexNumber():\r
+                raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber)\r
+\r
+            if len(self.__Token) > 4:\r
+                raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)\r
+\r
+            DataString = self.__Token\r
+            DataString += ","\r
+\r
+            while self.__IsToken(","):\r
+                if not self.__GetNextHexNumber():\r
+                    raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber)\r
+                if len(self.__Token) > 4:\r
+                    raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber)\r
+                DataString += self.__Token\r
+                DataString += ","\r
+\r
+            if not self.__IsToken( "}"):\r
+                raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
+\r
+            if not self.__IsToken( "}"):\r
+                raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
+\r
+            DataString = DataString.rstrip(",")\r
+            FvObj.FvExtEntryData += [DataString]\r
+\r
+        if self.__Token == 'FILE':\r
+        \r
+            if not self.__IsToken( "="):\r
+                raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+                \r
+            if not self.__GetNextToken():\r
+                raise Warning("expected FV Extension Entry file path At Line ", self.FileName, self.CurrentLineNumber)\r
+                \r
+            FvObj.FvExtEntryData += [self.__Token]\r
+\r
+            if not self.__IsToken( "}"):\r
+                raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
+\r
+        return True\r
+\r
     ## __GetAprioriSection() method\r
     #\r
     #   Get token statements\r
@@ -2683,15 +2764,31 @@ class FdfParser:
     #   @param  Obj         for whom token statements are got\r
     #\r
     def __GetCapsuleTokens(self, Obj):\r
-\r
-        if not self.__IsKeyword("CAPSULE_GUID"):\r
-            raise Warning("expected 'CAPSULE_GUID'", self.FileName, self.CurrentLineNumber)\r
-\r
-        while self.__CurrentLine().find("=") != -1:\r
-            NameValue = self.__CurrentLine().split("=")\r
-            Obj.TokensDict[NameValue[0].strip()] = NameValue[1].strip()\r
-            self.CurrentLineNumber += 1\r
-            self.CurrentOffsetWithinLine = 0\r
+        if not self.__GetNextToken():\r
+            return False\r
+        while self.__Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "CAPSULE_FLAGS"):\r
+            Name = self.__Token.strip()\r
+            if not self.__IsToken("="):\r
+                raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
+            if not self.__GetNextToken():\r
+                raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
+            if Name == 'CAPSULE_FLAGS':\r
+                if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"):\r
+                    raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)\r
+                Value = self.__Token.strip()\r
+                while self.__IsToken(","):\r
+                    Value += ','\r
+                    if not self.__GetNextToken():\r
+                        raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
+                    if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"):\r
+                        raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber)\r
+                    Value += self.__Token.strip()\r
+            else:\r
+                Value = self.__Token.strip()\r
+            Obj.TokensDict[Name] = Value  \r
+            if not self.__GetNextToken():\r
+                return False\r
+        self.__UndoToken()\r
 \r
     ## __GetCapsuleData() method\r
     #\r
@@ -2815,7 +2912,7 @@ class FdfParser:
                              "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", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"):\r
+                             "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE"):\r
             raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
         return self.__Token\r
 \r
@@ -2859,7 +2956,7 @@ class FdfParser:
 \r
         Type = self.__Token.strip().upper()\r
         if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\\r
-                             "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"):\r
+                             "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE"):\r
             raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
 \r
         if not self.__IsToken("="):\r
@@ -3238,8 +3335,8 @@ class FdfParser:
         elif SectionType == "RAW":\r
             if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"):\r
                 raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)\r
-        elif SectionType == "DXE_DEPEX":\r
-            if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX"):\r
+        elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX":\r
+            if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"):\r
                 raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber)\r
         elif SectionType == "UI":\r
             if FileType not in ("UI", "SEC_UI"):\r
index aaa7917..438bd18 100644 (file)
@@ -34,7 +34,6 @@ class Ffs(FDClassObject):
         'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER',\r
         'UEFI_DRIVER'       : 'EFI_FV_FILETYPE_DRIVER',\r
         'UEFI_APPLICATION'  : 'EFI_FV_FILETYPE_APPLICATION',\r
-        'SMM_DRIVER'        : 'EFI_FV_FILETYPE_SMM',\r
         'SMM_CORE'          : 'EFI_FV_FILETYPE_SMM_CORE'\r
     }\r
     \r
@@ -50,7 +49,6 @@ class Ffs(FDClassObject):
         'FV_IMAGE'          : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE',\r
         'RAW'               : 'EFI_FV_FILETYPE_RAW',\r
         'PEI_DXE_COMBO'     : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER',\r
-        'SMM_DXE_COMBO'     : 'EFI_FV_FILETYPE_COMBINED_SMM_DXE',\r
         'SMM'               : 'EFI_FV_FILETYPE_SMM',\r
         'SMM_CORE'          : 'EFI_FV_FILETYPE_SMM_CORE'\r
     }\r
@@ -70,7 +68,7 @@ class Ffs(FDClassObject):
         'COMPRESS'             : '.com',\r
         'GUIDED'               : '.guided',\r
         'PEI_DEPEX'            : '.dpx',\r
-        'SMM_DEPEX'            : '.smm'\r
+        'SMM_DEPEX'            : '.dpx'\r
     }\r
     \r
     ## The constructor\r
index 0dcd96d..ac13e4d 100644 (file)
@@ -47,6 +47,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         self.KeepRelocFromRule = None\r
         self.InDsc = True\r
         self.OptRomDefs = {}\r
+        self.PiSpecVersion = 0\r
         \r
     ## __InfParse() method\r
     #\r
@@ -89,6 +90,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.BaseName = Inf.BaseName\r
             self.ModuleGuid = Inf.Guid\r
             self.ModuleType = Inf.ModuleType\r
+            if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+                self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']\r
             if Inf.AutoGenVersion < 0x00010005:\r
                 self.ModuleType = Inf.ComponentType\r
             self.VersionString = Inf.Version\r
@@ -102,6 +105,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.BaseName = Inf.BaseName\r
             self.ModuleGuid = Inf.Guid\r
             self.ModuleType = Inf.ModuleType\r
+            if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification:
+                self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION']\r
             self.VersionString = Inf.Version\r
             self.BinFileList = Inf.Binaries\r
             self.SourceFileList = Inf.Sources\r
@@ -113,6 +118,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if len(self.SourceFileList) != 0 and not self.InDsc:\r
             EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))\r
 \r
+        if self.ModuleType == 'SMM_CORE' and self.PiSpecVersion < 0x0001000A:
+            EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)      \r
+\r
         if Inf._Defs != None and len(Inf._Defs) > 0:\r
             self.OptRomDefs.update(Inf._Defs)\r
             \r
@@ -153,7 +161,18 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         Rule = self.__GetRule__()\r
         GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf file : %s" %self.InfFileName)\r
-        #FileType = Ffs.Ffs.ModuleTypeToFileType[Rule.ModuleType]\r
+        #\r
+        # Convert Fv File Type for PI1.1 SMM driver.\r
+        #\r
+        if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:\r
+            if Rule.FvFileType == 'DRIVER':\r
+                Rule.FvFileType = 'SMM'\r
+        #\r
+        # Framework SMM Driver has no SMM FV file type\r
+        #\r
+        if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:\r
+            if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':\r
+                EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)\r
         #\r
         # For the rule only has simpleFile\r
         #\r
@@ -380,7 +399,19 @@ class FfsInfStatement(FfsInfStatementClassObject):
             FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)\r
 \r
         Index = 1\r
-        SectionType     = Rule.SectionType\r
+        SectionType = Rule.SectionType\r
+        #\r
+        # Convert Fv Section Type for PI1.1 SMM driver.\r
+        #\r
+        if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:\r
+            if SectionType == 'DXE_DEPEX':\r
+                SectionType = 'SMM_DEPEX'\r
+        #\r
+        # Framework SMM Driver has no SMM_DEPEX section type\r
+        #\r
+        if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:\r
+            if SectionType == 'SMM_DEPEX':\r
+                EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
         NoStrip = True\r
         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
             if self.KeepReloc != None:\r
@@ -517,6 +548,18 @@ class FfsInfStatement(FfsInfStatementClassObject):
         for Sect in Rule.SectionList:\r
             SecIndex = '%d' %Index\r
             SectList  = []\r
+            #\r
+            # Convert Fv Section Type for PI1.1 SMM driver.\r
+            #\r
+            if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:\r
+                if Sect.SectionType == 'DXE_DEPEX':\r
+                    Sect.SectionType = 'SMM_DEPEX'\r
+            #\r
+            # Framework SMM Driver has no SMM_DEPEX section type\r
+            #\r
+            if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:\r
+                if Sect.SectionType == 'SMM_DEPEX':\r
+                    EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
             if Rule.KeyStringList != []:\r
                 SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)\r
             else :\r
index 23ec582..a9ff26e 100644 (file)
@@ -19,6 +19,7 @@ import os
 import shutil\r
 import subprocess\r
 import StringIO\r
+from struct import *\r
 \r
 import Ffs\r
 import AprioriSection\r
@@ -70,8 +71,8 @@ class FV (FvClassObject):
         # 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 FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
+                FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]\r
                 for RegionObj in FdObj.RegionList:\r
                     if RegionObj.RegionType == 'FV':\r
                         for RegionData in RegionObj.RegionDataList:\r
@@ -215,19 +216,81 @@ class FV (FvClassObject):
                                        self.FvAlignment.strip() + \\r
                                        " = TRUE"                + \\r
                                        T_CHAR_LF)\r
-            \r
-        if self.FvNameGuid != None:\r
-            self.FvInfFile.writelines("EFI_FVNAME_GUID"     + \\r
-                                       " = %s" % self.FvNameGuid + \\r
-                                       T_CHAR_LF)\r
+                                       \r
         #\r
-        # Add [Files]\r
+        # Generate FV extension header file\r
         #\r
+        if self.FvNameGuid == None or self.FvNameGuid == '':\r
+            if len(self.FvExtEntryType) > 0:\r
+                GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))\r
+        \r
+        if self.FvNameGuid <> None and self.FvNameGuid <> '':\r
+            TotalSize = 16 + 4\r
+            Buffer = ''\r
+            for Index in range (0, len(self.FvExtEntryType)):\r
+                if self.FvExtEntryType[Index] == 'FILE':\r
+                    # check if the path is absolute or relative
+                    if os.path.isabs(self.FvExtEntryData[Index]):
+                        FileFullPath = os.path.normpath(self.FvExtEntryData[Index])
+                    else:
+                        FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index]))
+                    # check if the file path exists or not
+                    if not os.path.isfile(FileFullPath):
+                        GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))\r
+                    FvExtFile = open (FileFullPath,'rb')\r
+                    FvExtFile.seek(0,2)\r
+                    Size = FvExtFile.tell()\r
+                    if Size >= 0x10000:\r
+                        GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry file %s exceeds 0x10000." % (self.FvExtEntryData[Index]))\r
+                    TotalSize += (Size + 4)\r
+                    FvExtFile.seek(0)\r
+                    Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))\r
+                    Buffer += FvExtFile.read() \r
+                    FvExtFile.close()\r
+                if self.FvExtEntryType[Index] == 'DATA':\r
+                    ByteList = self.FvExtEntryData[Index].split(',')\r
+                    Size = len (ByteList)\r
+                    if Size >= 0x10000:\r
+                        GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry data %s exceeds 0x10000." % (self.FvExtEntryData[Index]))\r
+                    TotalSize += (Size + 4)\r
+                    Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))\r
+                    for Index1 in range (0, Size):\r
+                        Buffer += pack('B', int(ByteList[Index1], 16))\r
+\r
+            Guid = self.FvNameGuid.split('-')\r
+            Buffer = pack('LHHBBBBBBBBL', \r
+                        int(Guid[0], 16), \r
+                        int(Guid[1], 16), \r
+                        int(Guid[2], 16), \r
+                        int(Guid[3][-4:-2], 16), \r
+                        int(Guid[3][-2:], 16),  \r
+                        int(Guid[4][-12:-10], 16),\r
+                        int(Guid[4][-10:-8], 16),\r
+                        int(Guid[4][-8:-6], 16),\r
+                        int(Guid[4][-6:-4], 16),\r
+                        int(Guid[4][-4:-2], 16),\r
+                        int(Guid[4][-2:], 16),\r
+                        TotalSize\r
+                        ) + Buffer\r
+\r
+            #\r
+            # Generate FV extension header file if the total size is not zero\r
+            #\r
+            if TotalSize > 0:\r
+                FvExtHeaderFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName + '.ext')\r
+                FvExtHeaderFile = open (FvExtHeaderFileName,'wb')\r
+                FvExtHeaderFile.write(Buffer)\r
+                FvExtHeaderFile.close()\r
+                self.FvInfFile.writelines("EFI_FV_EXT_HEADER_FILE_NAME = "      + \\r
+                                           FvExtHeaderFileName                  + \\r
+                                           T_CHAR_LF)\r
 \r
+         \r
+        #\r
+        # Add [Files]\r
+        #\r
         self.FvInfFile.writelines("[files]" + T_CHAR_LF)\r
         if VtfDict != None and self.UiFvName in VtfDict.keys():\r
             self.FvInfFile.writelines("EFI_FILE_NAME = "                   + \\r
                                        VtfDict.get(self.UiFvName)          + \\r
                                        T_CHAR_LF)\r
-\r
-\r
index 77c8821..b54e8c8 100644 (file)
@@ -294,10 +294,7 @@ class GenFdsGlobalVariable:
     @staticmethod
     def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,
                         Revision=None, DeviceId=None, VendorId=None):
-#        if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
-#            return
-#        GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
-
+        InputList = []   
         Cmd = ["EfiRom"]
         if len(EfiInput) > 0:
             
@@ -308,11 +305,18 @@ class GenFdsGlobalVariable:
                 
             for EfiFile in EfiInput:
                 Cmd += [EfiFile]
+                InputList.append (EfiFile)
         
         if len(BinaryInput) > 0:
             Cmd += ["-b"]
             for BinFile in BinaryInput:
                 Cmd += [BinFile]
+                InputList.append (BinFile)
+
+        # Check List
+        if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList):
+            return
+        GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
                         
         if ClassCode != None:
             Cmd += ["-l", ClassCode]
index ffca3a1..1905935 100644 (file)
@@ -129,7 +129,7 @@ class Section (SectionClassObject):
         if FileType != None:\r
             for File in FfsInf.BinFileList:\r
                 if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:\r
-                    if File.Type == FileType:\r
+                    if File.Type == FileType or (FfsInf.PiSpecVersion >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):\r
                         if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:\r
                             FileList.append(File.Path)\r
                         else:\r
index 40eb826..cf165ff 100644 (file)
@@ -824,7 +824,7 @@ class DscParser(MetaFileParser):
     #   [PcdsDynamicHii]
     #
     def _PcdParser(self):
-        TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+        TokenList = GetSplitValueList(ReplaceMacro(self._CurrentLine, self._Macros), TAB_VALUE_SPLIT, 1)
         self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
         if len(TokenList) == 2:
             self._ValueList[2] = TokenList[1]
@@ -1109,7 +1109,8 @@ class DecParser(MetaFileParser):
         if not IsValid:
             EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,
                             File=self.MetaFile, Line=self._LineIndex+1)
-        self._ValueList[2] = TokenList[1]
+
+        self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
 
     _SectionParser = {
         MODEL_META_DATA_HEADER          :   MetaFileParser._DefineParser,
index 348d219..2f2e812 100644 (file)
@@ -1111,7 +1111,7 @@ class InfBuildData(ModuleBuildClassObject):
         "BS_DRIVER"             :   "DXE_DRIVER",
         "RT_DRIVER"             :   "DXE_RUNTIME_DRIVER",
         "SAL_RT_DRIVER"         :   "DXE_SAL_DRIVER",
-        "SMM_DRIVER"            :   "SMM_DRIVER",
+    #    "SMM_DRIVER"            :   "DXE_SMM_DRIVER",
     #    "BS_DRIVER"             :   "DXE_SMM_DRIVER",
     #    "BS_DRIVER"             :   "UEFI_DRIVER",
         "APPLICATION"           :   "UEFI_APPLICATION",
@@ -1198,6 +1198,7 @@ class InfBuildData(ModuleBuildClassObject):
         self._Pcds                  = None
         self._BuildOptions          = None
         self._Depex                 = None
+        self._DepexExpression       = None
         #self._SourceOverridePath    = None
 
     ## Get architecture
@@ -1317,9 +1318,15 @@ class InfBuildData(ModuleBuildClassObject):
             if not self._ModuleType:
                 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
                                 "MODULE_TYPE is not given", File=self.MetaFile)
+            if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (self._Specification['PI_SPECIFICATION_VERSION'] < 0x0001000A):
+                if self._ModuleType == SUP_MODULE_SMM_CORE:
+                    EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)                
             if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
                and 'PCI_CLASS_CODE' in self._Defs:
                 self._BuildType = 'UEFI_OPTIONROM'
+            elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \
+               and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
+                self._BuildType = 'UEFI_HII'
             else:
                 self._BuildType = self._ModuleType.upper()
         else:
@@ -1824,6 +1831,25 @@ class InfBuildData(ModuleBuildClassObject):
                 self._Depex[Arch, ModuleType] = Depex[Arch, ModuleType]
         return self._Depex
 
+    ## Retrieve depedency expression
+    def _GetDepexExpression(self):
+        if self._DepexExpression == None:
+            self._DepexExpression = tdict(False, 2)
+            RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
+            DepexExpression = {}
+            for Record in RecordList:
+                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)
+                Arch = Record[3]
+                ModuleType = Record[4]
+                TokenList = Record[0].split()
+                if (Arch, ModuleType) not in DepexExpression:
+                    DepexExpression[Arch, ModuleType] = ''
+                for Token in TokenList:
+                    DepexExpression[Arch, ModuleType] = DepexExpression[Arch, ModuleType] + Token.strip() + ' '
+            for Arch, ModuleType in DepexExpression:
+                self._DepexExpression[Arch, ModuleType] = DepexExpression[Arch, ModuleType]
+        return self._DepexExpression
+
     ## Retrieve PCD for given type
     def _GetPcd(self, Type):
         Pcds = {}
@@ -1889,6 +1915,7 @@ class InfBuildData(ModuleBuildClassObject):
                     Pcd.TokenValue = PcdInPackage.TokenValue
                     Pcd.DatumType = PcdInPackage.DatumType
                     Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize
+                    Pcd.InfDefaultValue = Pcd.DefaultValue
                     if Pcd.DefaultValue in [None, '']:
                         Pcd.DefaultValue = PcdInPackage.DefaultValue
                     break
@@ -1936,6 +1963,7 @@ class InfBuildData(ModuleBuildClassObject):
     Pcds                    = property(_GetPcds)
     BuildOptions            = property(_GetBuildOptions)
     Depex                   = property(_GetDepex)
+    DepexExpression         = property(_GetDepexExpression)
 
 ## Database
 #
index 7d14e15..5f470de 100644 (file)
@@ -676,7 +676,8 @@ class Build():
     def __init__(self, Target, WorkspaceDir, Platform, Module, Arch, ToolChain,
                  BuildTarget, FlashDefinition, FdList=[], FvList=[],
                  MakefileType="nmake", SilentMode=False, ThreadNumber=2,
-                 SkipAutoGen=False, Reparse=False, SkuId=None):
+                 SkipAutoGen=False, Reparse=False, SkuId=None, 
+                 ReportFile=None, ReportType=None):
 
         self.WorkspaceDir = WorkspaceDir
         self.Target         = Target
@@ -695,6 +696,11 @@ class Build():
         self.Reparse        = Reparse
         self.SkuId          = SkuId
         self.SpawnMode      = True
+        self.ReportFile     = ReportFile
+        if ReportType == None:
+          self.ReportType   = ['ALL']
+        else:
+          self.ReportType   = ReportType
 
         self.TargetTxt      = TargetTxtClassObject()
         self.ToolDef        = ToolDefClassObject()
@@ -954,7 +960,9 @@ class Build():
                         self.Fdf,
                         self.FdList,
                         self.FvList,
-                        self.SkuId
+                        self.SkuId,
+                        self.ReportFile,
+                        self.ReportType
                         )
                 self.Progress.Stop("done!")
                 self._Build(self.Target, Wa)
@@ -980,7 +988,9 @@ class Build():
                         self.Fdf,
                         self.FdList,
                         self.FvList,
-                        self.SkuId
+                        self.SkuId,
+                        self.ReportFile,
+                        self.ReportType
                         )
                 Wa.CreateMakeFile(False)
                 self.Progress.Stop("done!")
@@ -1018,7 +1028,9 @@ class Build():
                         self.Fdf,
                         self.FdList,
                         self.FvList,
-                        self.SkuId
+                        self.SkuId,
+                        self.ReportFile,
+                        self.ReportType
                         )
                 Wa.CreateMakeFile(False)
 
@@ -1253,6 +1265,10 @@ def MyOptionParser():
     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]\".")
 
+    Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Put build report in specified file.")
+    Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['ALL','PCD',], dest="ReportType",
+        help="Flags that control the type of build report to generate.  Must be one of [ALL, PCD].  To specify more flags, please repeat this option.")
+
     (Opt, Args)=Parser.parse_args()
     return (Opt, Args)
 
@@ -1358,7 +1374,8 @@ def Main():
                         Option.TargetArch, Option.ToolChain, Option.BuildTarget,
                         Option.FdfFile, Option.RomImage, Option.FvImage,
                         None, Option.SilentMode, Option.ThreadNumber,
-                        Option.SkipAutoGen, Option.Reparse, Option.SkuId)
+                        Option.SkipAutoGen, Option.Reparse, Option.SkuId, 
+                        Option.ReportFile, Option.ReportType)
         MyBuild.Launch()
         #MyBuild.DumpBuildData()
     except FatalError, X: