]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Sync BaseTools Trunk (version r2387) to EDKII main trunk.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 29 Oct 2011 06:59:30 +0000 (06:59 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 29 Oct 2011 06:59:30 +0000 (06:59 +0000)
Signed-off-by: lgao4
Reviewed-by: gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12602 6f19259b-4bc3-4df7-8a09-765794883524

80 files changed:
BaseTools/Bin/Win32/BPDG.exe
BaseTools/Bin/Win32/BootSectImage.exe
BaseTools/Bin/Win32/EfiLdrImage.exe
BaseTools/Bin/Win32/EfiRom.exe
BaseTools/Bin/Win32/Fpd2Dsc.exe
BaseTools/Bin/Win32/GenBootSector.exe
BaseTools/Bin/Win32/GenCrc32.exe
BaseTools/Bin/Win32/GenDepex.exe
BaseTools/Bin/Win32/GenFds.exe
BaseTools/Bin/Win32/GenFfs.exe
BaseTools/Bin/Win32/GenFv.exe
BaseTools/Bin/Win32/GenFw.exe
BaseTools/Bin/Win32/GenPage.exe
BaseTools/Bin/Win32/GenPatchPcdTable.exe
BaseTools/Bin/Win32/GenSec.exe
BaseTools/Bin/Win32/GenVtf.exe
BaseTools/Bin/Win32/LzmaCompress.exe
BaseTools/Bin/Win32/MigrationMsa2Inf.exe
BaseTools/Bin/Win32/PatchPcdValue.exe
BaseTools/Bin/Win32/Spd2Dec.exe
BaseTools/Bin/Win32/Split.exe
BaseTools/Bin/Win32/TargetTool.exe
BaseTools/Bin/Win32/TianoCompress.exe
BaseTools/Bin/Win32/Trim.exe
BaseTools/Bin/Win32/UPT.exe
BaseTools/Bin/Win32/VfrCompile.exe
BaseTools/Bin/Win32/VolInfo.exe
BaseTools/Bin/Win32/build.exe
BaseTools/Conf/XMLSchema/DistributionPackage.xsd
BaseTools/Conf/build_rule.template
BaseTools/Conf/tools_def.template
BaseTools/ReadMe.txt
BaseTools/Source/C/Common/BasePeCoff.c
BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
BaseTools/Source/C/GenFv/GenFvInternalLib.c
BaseTools/Source/C/GenFw/Elf32Convert.c
BaseTools/Source/C/GenFw/Elf64Convert.c
BaseTools/Source/C/GenSec/GenSec.c
BaseTools/Source/C/GenVtf/GenVtf.c
BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
BaseTools/Source/C/Include/Common/BuildVersion.h
BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
BaseTools/Source/C/Makefiles/ms.app
BaseTools/Source/C/Split/Split.c
BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
BaseTools/Source/C/VfrCompile/VfrFormPkg.h
BaseTools/Source/C/VfrCompile/VfrSyntax.g
BaseTools/Source/C/VolInfo/VolInfo.c
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/BuildEngine.py
BaseTools/Source/Python/AutoGen/GenC.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/Common/BuildVersion.py
BaseTools/Source/Python/Common/DataType.py
BaseTools/Source/Python/Common/Expression.py [new file with mode: 0644]
BaseTools/Source/Python/Common/GlobalData.py
BaseTools/Source/Python/Common/Misc.py
BaseTools/Source/Python/Common/String.py
BaseTools/Source/Python/CommonDataClass/DataClass.py
BaseTools/Source/Python/CommonDataClass/Exceptions.py [new file with mode: 0644]
BaseTools/Source/Python/GenFds/AprioriSection.py
BaseTools/Source/Python/GenFds/DepexSection.py
BaseTools/Source/Python/GenFds/Fd.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/FfsFileStatement.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/GenFds/GenFds.py
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
BaseTools/Source/Python/GenFds/Section.py
BaseTools/Source/Python/PatchPcdValue/PatchPcdValue.py
BaseTools/Source/Python/UPT/Library/ParserValidate.py
BaseTools/Source/Python/Workspace/MetaDataTable.py
BaseTools/Source/Python/Workspace/MetaFileParser.py
BaseTools/Source/Python/Workspace/MetaFileTable.py
BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
BaseTools/Source/Python/build/BuildReport.py
BaseTools/Source/Python/build/build.py
BaseTools/UserManuals/Intel_UEFI_Packaging_Tool_Man_Page.rtf
BaseTools/UserManuals/Trim_Utility_Man_Page.rtf

index 016bee5d840c122adec6de0bc305dae8381edde1..1628a4f4536593be33f015fc1a5db048718f54f4 100644 (file)
Binary files a/BaseTools/Bin/Win32/BPDG.exe and b/BaseTools/Bin/Win32/BPDG.exe differ
index 313bc717562aaa5cfba136becc04bfb2e2a3e7c0..096048f812960588aab9d5fe6ad325c150b2e3bd 100755 (executable)
Binary files a/BaseTools/Bin/Win32/BootSectImage.exe and b/BaseTools/Bin/Win32/BootSectImage.exe differ
index e06cbedc51ca47a95828ab41b6d4278a83763979..574713ff1ca37c003f21c5e6a8707f6d5715cfc7 100755 (executable)
Binary files a/BaseTools/Bin/Win32/EfiLdrImage.exe and b/BaseTools/Bin/Win32/EfiLdrImage.exe differ
index 01ad3703d0114ccdfc4f2b042c4c90c5b8d3c8c3..1b5831ff2b4a89e5080d2cd12639e4e5d619dac8 100755 (executable)
Binary files a/BaseTools/Bin/Win32/EfiRom.exe and b/BaseTools/Bin/Win32/EfiRom.exe differ
index fd41b60624b4d57b6783f36bdedec45feefe60f9..d2d509c7609aa6d695bdc48b88ba488d67b41fa8 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Fpd2Dsc.exe and b/BaseTools/Bin/Win32/Fpd2Dsc.exe differ
index 25f50e5e7ef74fcdad84359a4d80ea48cd667a4c..2ed07e3964c3c7adc01fbcbfffcdf4f23f5c86cf 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenBootSector.exe and b/BaseTools/Bin/Win32/GenBootSector.exe differ
index d20d15a950896f6bf507ee34cf92bdd60df9c357..f76616f1d8a7804471c13edbaa28744bb7b9f6fa 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenCrc32.exe and b/BaseTools/Bin/Win32/GenCrc32.exe differ
index cf6ff7fed94ff3d1d04318a6f3eb989d4bef45bc..4ffd690528221a099e4411c204655578a09bfbda 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenDepex.exe and b/BaseTools/Bin/Win32/GenDepex.exe differ
index 9209a7dd863814e33d899f6d58a6bf28624eb6ce..d32f23963e2a8bd657e1f88102a4a6b57013791e 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFds.exe and b/BaseTools/Bin/Win32/GenFds.exe differ
index 434f8890f043c2f26ceecbb07fec05a83802fe41..fe7f993d44c01906c7f82fa8b38f8cdcfb1977dc 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFfs.exe and b/BaseTools/Bin/Win32/GenFfs.exe differ
index 6d1096efc9883077c00313692a6149e59e6c587e..abf5cbd2238a4119130d6587ecb2b2a15bb41899 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFv.exe and b/BaseTools/Bin/Win32/GenFv.exe differ
index f4331d3eeaeb8f61cac14cf50ff4e691da676f21..4c0fb41170746b5d7f675a62ccca7cd293ee91d8 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenFw.exe and b/BaseTools/Bin/Win32/GenFw.exe differ
index 2cdca2ad6c220701a854d11dad80cc4ca62d76d5..639b88ad21c1a59279a9e17b5b61ed3a213117a3 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenPage.exe and b/BaseTools/Bin/Win32/GenPage.exe differ
index 4a506e4858ed2e5ec1c85e94768bb6a58b0ec3a3..01824c531e36ff53252cea2fe10323424422462d 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenPatchPcdTable.exe and b/BaseTools/Bin/Win32/GenPatchPcdTable.exe differ
index 64730c5fa5c66c88a90962bbfb300f43e49a607c..035dcc6ae58827f7c5592d27fe8be64ddce0326b 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenSec.exe and b/BaseTools/Bin/Win32/GenSec.exe differ
index e15f567a31abedfd35e5f9c78f58dd79b7c0586a..ea7ccf135068c55a500125e9ed31c5bd83e0036f 100755 (executable)
Binary files a/BaseTools/Bin/Win32/GenVtf.exe and b/BaseTools/Bin/Win32/GenVtf.exe differ
index 2652a7b5bdc6bd747097292e233cbf9b14bb2a09..506ecb19afba5534c5894d4fb9ac1c5c2c9e3e91 100755 (executable)
Binary files a/BaseTools/Bin/Win32/LzmaCompress.exe and b/BaseTools/Bin/Win32/LzmaCompress.exe differ
index 2c7b28d59c5c01d03fdcad22edc826f69a047ee2..65ecae11ebd5ae37fdc4e7e8ba294a250d7a7e3c 100755 (executable)
Binary files a/BaseTools/Bin/Win32/MigrationMsa2Inf.exe and b/BaseTools/Bin/Win32/MigrationMsa2Inf.exe differ
index 4500f21a84fb022d0f41f89714048795dac7babb..ed1a92e77464d8915e79b5b3785eebd89aee386a 100755 (executable)
Binary files a/BaseTools/Bin/Win32/PatchPcdValue.exe and b/BaseTools/Bin/Win32/PatchPcdValue.exe differ
index 5a5bb7b59c11148323ee58278d7882df8199fbbd..31b0aae270d192952915454bb8ea2040b218cc35 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Spd2Dec.exe and b/BaseTools/Bin/Win32/Spd2Dec.exe differ
index 250cedba6e5ebe0bada516f9061c846a8ca20e86..9ef3e122818d3717ab0d92350b4fb75f8f8dfc51 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Split.exe and b/BaseTools/Bin/Win32/Split.exe differ
index 14b2680005be9a2d58767fe35f0890b3446556b4..36b1c3e8d26f6359392ffe88d292fe308e17c6fd 100755 (executable)
Binary files a/BaseTools/Bin/Win32/TargetTool.exe and b/BaseTools/Bin/Win32/TargetTool.exe differ
index 7bf2896f70be72b8620536537d5f0b4b45bf1698..020ed1e50a3085b1d0f3a2eb4a1ffdd4fb9cf807 100755 (executable)
Binary files a/BaseTools/Bin/Win32/TianoCompress.exe and b/BaseTools/Bin/Win32/TianoCompress.exe differ
index a094bb11027dd00b035dc197ea85d9ea805b2945..8684aa46b80a68bb943e4f191b200bb45c98bb6d 100755 (executable)
Binary files a/BaseTools/Bin/Win32/Trim.exe and b/BaseTools/Bin/Win32/Trim.exe differ
index a1cf4d889f1122931ad60dac7e51c745dd132821..ad67a6a8ccd7e77772b7cff1caa3bfa741a69ed8 100644 (file)
Binary files a/BaseTools/Bin/Win32/UPT.exe and b/BaseTools/Bin/Win32/UPT.exe differ
index 03d35d7b2dc6e176ad1ae090e51b2ec55df7ba5d..5647e50a4d348dd8e95db6e8333be088cf9b1a96 100755 (executable)
Binary files a/BaseTools/Bin/Win32/VfrCompile.exe and b/BaseTools/Bin/Win32/VfrCompile.exe differ
index 754857cc1e98a723a879f272a7e94e5885100597..ef33d1e1d90b1240084a1becc0f8e40e8054eea0 100755 (executable)
Binary files a/BaseTools/Bin/Win32/VolInfo.exe and b/BaseTools/Bin/Win32/VolInfo.exe differ
index 8536c7249bdbca0d2dec914051f1603231ebe285..16404a22521a6baad48c6e785b7482a662e28978 100755 (executable)
Binary files a/BaseTools/Bin/Win32/build.exe and b/BaseTools/Bin/Win32/build.exe differ
index 1d3c6904411fb6e02d97feffd4621c87782318bb..8f136ae04e3c8d72b0a8b0ec68197624b0804d41 100644 (file)
@@ -12,2876 +12,2876 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-       elementFormDefault="qualified" targetNamespace="http://www.uefi.org/2011/1.1"
-       xmlns="http://www.uefi.org/2011/1.1">
-       <xs:element name="DistributionPackage">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> This schema defines the UEFI/PI
-                               Distribution Package description (PKG) file. It describes the content
-                               of:</xs:documentation>
-                       <xs:documentation xml:lang="en-us"> 1) Package descriptions with
-                               definitions and headers.</xs:documentation>
-                       <xs:documentation xml:lang="en-us"> 2) Modules in either source or binary
-                               format. (Note that Binary format is for FFS leaf section file types
-                               only, complete FFS files cannot be distributed using this distribution
-                               format.) </xs:documentation>
-                       <xs:documentation xml:lang="en-us"> 3) The distribution of custom tools
-                               used to modify the binary images to create UEFI/PI compliant images. </xs:documentation>
-                       <xs:documentation xml:lang="en-us"> 4) Finally, it can be used to
-                               distribute other miscellaneous content that is not specific to UEFI/PI
-                               images. </xs:documentation>
-                       <xs:documentation xml:lang="en-us"> The Package Surface Area describes the
-                               content of packages, while the Module Surface Area provides information
-                               relevant to source and/or binary distributions. </xs:documentation>
-               </xs:annotation>
-               <xs:complexType>
-                       <xs:sequence>
-                               <xs:element ref="DistributionHeader" minOccurs="1" maxOccurs="1">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This header contains (legal)
-                                                       information usually required for distributing both binary and/or
-                                                       source code. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element ref="PackageSurfaceArea" minOccurs="0" maxOccurs="unbounded">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The list of packages in this
-                                                       distribution. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Packages are groups of files
-                                                       and/or modules that are similar in nature.</xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Packages are uniquely identified
-                                                       by a package GUID and a package version. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> A package can declare public
-                                                       mappings of C names to GUID values. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> A package can provide header
-                                                       files for library classes and/or other industry standard
-                                                       definitions. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> A package can also declare
-                                                       public mappings of platform configuration database (PCD)
-                                                       &quot;knobs&quot; to control features and operation of
-                                                       modules within a platform. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Finally, a package lists the
-                                                       library instances and/or modules that are provided in a
-                                                       distribution package. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element ref="ModuleSurfaceArea" minOccurs="0" maxOccurs="unbounded">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The listing of UEFI/PI compliant
-                                                       modules in this distribution that are NOT part of a Package. Every
-                                                       module that is provided as part of a package needs to be described
-                                                       in a PackageSurfaceArea.Modules section. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> The ModuleSurfaceArea section
-                                                       describes how each module in a distribution is coded, or, in the
-                                                       case of a binary module distribution, how it was built. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> UEFI/PI compliant libraries and
-                                                       modules are uniquely identified by the Module's GUID and version
-                                                       number. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> This section will typically be
-                                                       used for modules that don't require any additional files that
-                                                       would be included in a package. For example, the Enhanced FAT
-                                                       driver binary does not need to have a package description, as no
-                                                       additional files are provided. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element ref="Tools" minOccurs="0" maxOccurs="unbounded">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is for distributing
-                                                       vendor specific executable tools, tool source code and/or
-                                                       configuration files. These tools are primarily for manipulating
-                                                       code and/or binary images. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Tools in this section
-                                                       can:</xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 1) Parse build meta-data files
-                                                       to create source code files and build scripts. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 2) Modify image files to conform
-                                                       to UEFI/PI specifications. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 3) Generate binary files from
-                                                       certain types of text/unicode files. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 4) Generate PCI Option Roms or
-                                                       Firmware Device images. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 5) Implement external
-                                                       encoding/decoding/signature/GUIDed tools. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 6) Distribution Package
-                                                       create/install/remove tools. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element ref="MiscellaneousFiles" minOccurs="0" maxOccurs="unbounded">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The list of miscellaneous files
-                                                       in this distribution. Any files that are not listed in either the
-                                                       Package, Module or Tools sections can be listed here. This section
-                                                       can be used to distribute specifications for packages and modules
-                                                       that are not &quot;industry standards&quot; such as a
-                                                       specification for a chipset or a video device. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element ref="UserExtensions" minOccurs="0" maxOccurs="unbounded">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The UserExtensions section is
-                                                       used to disseminate processing instructions that may be custom to
-                                                       the content provided by the distribution. This section contains
-                                                       information that is common to all aspects of this disribution.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                       </xs:sequence>
-
-               </xs:complexType>
-       </xs:element>
-       <!-- End of the DistributionPackage Description  -->
-
-       <xs:element name="DistributionHeader">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> This section defines the content of
-                               the UEIF/PI compliant Distribution Package Header. This is the only
-                               required element of a UEFI/PI compliant distribution package.
-                       </xs:documentation>
-               </xs:annotation>
-               <xs:complexType>
-                       <xs:sequence>
-                               <xs:element minOccurs="1" maxOccurs="1" name="Name">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This is the User Interface Name
-                                                       for this Distribution Package. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Each Distribution Package is
-                                                       uniquely identified by it's GUID and Version number.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:simpleContent>
-                                                       <xs:extension base="xs:normalizedString">
-                                                               <xs:attribute name="BaseName" type="xs:NCName" use="optional">
-                                                                       <xs:annotation>
-                                                                               <xs:documentation xml:lang="en-us"> The reference name of
-                                                                                       the Distribution Package file. This single word name can
-                                                                                       be used by tools as a keyword or for directory and/or file
-                                                                                       creation. </xs:documentation>
-                                                                               <xs:documentation xml:lang="en-us"> White space and special
-                                                                                       characters (dash and underscore characters may be used)
-                                                                                       are not permitted in this name. </xs:documentation>
-                                                                       </xs:annotation>
-                                                               </xs:attribute>
-                                                       </xs:extension>
-                                               </xs:simpleContent>
-                                       </xs:complexType>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This 128-bit GUID and the
-                                                       Version attribute uniquely identify this Distribution Package. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Backward compatible releases of
-                                                       a distribution package need only change the version number, while
-                                                       non-backward compatible changes require the GUID to change
-                                                       (resetting the version number to 1.0 is optional.)
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:simpleContent>
-                                                       <xs:extension base="RegistryFormatGuid">
-                                                               <xs:attribute name="Version" type="xs:decimal" use="required">
-                                                                       <xs:annotation>
-                                                                               <xs:documentation xml:lang="en-us"> This value, along with
-                                                                                       the GUID, is used to uniquely identify this object. The
-                                                                                       higher the number, the more recent the content.
-                                                                               </xs:documentation>
-                                                                       </xs:annotation>
-                                                               </xs:attribute>
-                                                       </xs:extension>
-                                               </xs:simpleContent>
-                                       </xs:complexType>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="Vendor"
-                                       type="xs:normalizedString">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A string identifying who created
-                                                       this distribution package. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="Date" type="xs:dateTime">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The date and time this
-                                                       distribution was created. The format is: YYYY-MM-DDThh:mm:ss, for
-                                                       example: 2001-01-31T13:30:00 (note the T character separator
-                                                       between the calendar date and the time. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="Copyright"
-                                       type="xs:string">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The copyright for this file that
-                                                       is generated by the creator of the distribution. If a derivative
-                                                       work is generated from an existing distribution, then the existing
-                                                       copyright must be maintained, and additional copyrights may be
-                                                       appended to the end of this element. It may also be the primary
-                                                       copyright for all code provided in the Distribution Package.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="License" type="xs:string">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A license that describes any
-                                                       restrictions on the use of this distribution. If a derivative work
-                                                       is allowed by the original license and a derivative work is
-                                                       generated from an existing distribution, then the existing license
-                                                       must be maintained, and additional licenses may be appended to the
-                                                       end of this element. It may also be the primary license for all
-                                                       code provided in the distribution file. Alternatively, this may
-                                                       point to a filename that contains the License. The file (included
-                                                       in the content zip file) will be stored in the same location as
-                                                       the distribution package's .pkg file. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="Abstract"
-                                       type="xs:normalizedString">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A one line description of the
-                                                       Distribution Package. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="0" maxOccurs="1" name="Description"
-                                       type="xs:string">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A complete description of the
-                                                       Distribution Package. This description may include the release
-                                                       name of the file, the version of the file, and a complete
-                                                       description of the file contents and/or features including a
-                                                       description of the updates since the previous file release.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="0" maxOccurs="1" name="Signature" type="Md5Sum">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The packaging utilities will use this
-                                                       MD5 sum value of the included ZIP file containing files and/or code. If
-                                                       this element is not present, then installation tools should assume that
-                                                       the content is correct, or that other methods may be needed to verify
-                                                       content. </xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="1" name="XmlSpecification" type="xs:decimal"
-                                       default="1.1">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This version of this XML Schema is 1.1 </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Changes to 1.1 from 1.0 </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> #1 Updated to present date and new
-                                                       version which is important to reflect the present state of the
-                                                       matter</xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> #2 Added definition/enumeration of
-                                                       UNDEFIND type 2 is important since there is a large body of legacy code
-                                                       for which the GUID’s and other code/data objects were not decorated with
-                                                       their usage. This document will allow for importing today’s source
-                                                       artifacts and producing decorations using the â€˜Undefined’ versus having
-                                                       an error</xs:documentation>
-                                               <xs:documentation xml:lang="en-us">#3 Allow for inclusion of ARM and future
-                                                       architecture types</xs:documentation>
-                                       </xs:annotation>
-                               </xs:element>
-                       </xs:sequence>
-                       <xs:attribute name="ReadOnly" type="xs:boolean" default="false"
-                               use="optional">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> If set to true, all content within
-                                               this Distribution Package should NOT be modified. The default
-                                               permits modification of all content. </xs:documentation>
-                               </xs:annotation>
-                       </xs:attribute>
-                       <xs:attribute name="RePackage" type="xs:boolean" default="false"
-                               use="optional">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> If set to true, then the content
-                                               can be repackaged into another distribution package. The default
-                                               prohibits repackaging the Distribution content. </xs:documentation>
-                               </xs:annotation>
-                       </xs:attribute>
-               </xs:complexType>
-       </xs:element>
-       <!-- End of the DistributionHeader element. -->
-
-       <xs:element name="PackageSurfaceArea">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> A package is a collection of related
-                               objects - Includes, Libraries and Modules. </xs:documentation>
-                       <xs:documentation xml:lang="en-us"> Each package is uniquely identified by
-                               it's GUID and Version number. Backward compatible releases of a package
-                               need only change the version number, while non-backward compatible
-                               changes require the GUID to change (resetting the version number to 1.0
-                               is optional.) </xs:documentation>
-               </xs:annotation>
-               <xs:complexType>
-                       <xs:sequence>
-
-                               <xs:element minOccurs="1" maxOccurs="1" name="Header">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="Name">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is the User Interface
-                                                                               Name for this package. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="xs:normalizedString">
-                                                                                       <xs:attribute name="BaseName" type="xs:NCName"
-                                                                                               use="required">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This is a single
-                                                                                                               word BaseName of the package. This BaseName can be
-                                                                                                               used by tools as a keyword and for directory/file
-                                                                                                               creation. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This GUID and the Version
-                                                                               attribute uniquely identify a given package.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="RegistryFormatGuid">
-                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                               use="required">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This value, along
-                                                                                                               with the GUID, is used to uniquely identify this
-                                                                                                               object. </xs:documentation>
-                                                                                                       <xs:documentation xml:lang="en-us"> Backward
-                                                                                                               compatible changes must make sure this number is
-                                                                                                               incremented from the most recent version.
-                                                                                                               Non-backward compatible changes require a new GUID,
-                                                                                                               and the version can be reset. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> If the package requires a
-                                                                               different copyright than the distribution package, this
-                                                                               element can list one or more copyright lines.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="License"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> If the package requires
-                                                                               licenses that are different from the distribution package
-                                                                               license, this element can contain one or more license text
-                                                                               paragraphs (or license filenames.) </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
-                                                               type="xs:normalizedString">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> A one line description of
-                                                                               this package. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Description"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> A complete description of
-                                                                               a package. This description may include the release name of
-                                                                               the package, the version of the package, and a complete
-                                                                               description of the package contents and/or features
-                                                                               including a description of the updates since the previous
-                                                                               package’s release. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="PackagePath"
-                                                               type="xs:anyURI">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This element is the
-                                                                               location (in the ZIP file) for the root directory of a
-                                                                               package. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea Header element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> The term cloned is used here to
-                                                       indicate that this package as been copied and modified to a
-                                                       completely different package. An example might be for a new
-                                                       generation of chipsets that have few or no elements in common with
-                                                       the original. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This GUID and the Version
-                                                                               attribute uniquely identify the Package that this Package
-                                                                               was copied from. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="RegistryFormatGuid">
-                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                               use="required">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This value, along
-                                                                                                               with the GUID, is used to uniquely identify the
-                                                                                                               package that this package was cloned from.
-                                                                                                       </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea ClonedFrom element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="LibraryClassDeclarations">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> Library Classes are public
-                                                       interfaces that can be used by modules. One or more library
-                                                       instances can implement a library class, however only one library
-                                                       instance can be linked to an individual module. This provides the
-                                                       platform integrator with the flexibility of choosing one library
-                                                       instance's implementation over a different library instance.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                               name="LibraryClass">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile"
-                                                                                       type="xs:anyURI">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> The header file
-                                                                                                       provides definitions and function prototypes for a
-                                                                                                       library class. Modules can be coded against these
-                                                                                                       functions, using the definitions in this header,
-                                                                                                       without concerning themselves about the libraries'
-                                                                                                       implementation details. This is a PackagePath relative
-                                                                                                       path and filename for the include file.
-                                                                                               </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                       name="RecommendedInstance">
-                                                                                       <xs:complexType>
-                                                                                               <xs:sequence>
-                                                                                                       <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> This GUID and
-                                                                                                                               the Version attribute uniquely identify the
-                                                                                                                               Recommended Library Instance.
-                                                                                                                       </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:complexType>
-                                                                                                                       <xs:simpleContent>
-                                                                                                                               <xs:extension base="RegistryFormatGuid">
-                                                                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                                                                               use="optional">
-                                                                                                                                               <xs:annotation>
-                                                                                                                                                       <xs:documentation xml:lang="en-us"> This
-                                                                                                                                                               value, along with the GUID, is used to
-                                                                                                                                                               uniquely identify this object. If this
-                                                                                                                                                               value is not specified, then any version
-                                                                                                                                                               of the library instance is recommended.
-                                                                                                                                                       </xs:documentation>
-                                                                                                                                               </xs:annotation>
-                                                                                                                                       </xs:attribute>
-                                                                                                                               </xs:extension>
-                                                                                                                       </xs:simpleContent>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-                                                                                               </xs:sequence>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Keyword" type="xs:NCName" use="required">
-                                                                               <xs:annotation>
-                                                                                       <xs:documentation xml:lang="en-us"> The single word name
-                                                                                               of the Library Class that module developers will use to
-                                                                                               identify a library class dependency. </xs:documentation>
-                                                                               </xs:annotation>
-                                                                       </xs:attribute>
-                                                                       <xs:attributeGroup ref="SupportedArchMod" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea LibraryClassDeclarations element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="IndustryStandardIncludes">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is used to list
-                                                       header files for industry standards not under the auspices of
-                                                       UEFI.org. For example, headers that contain definitions and data
-                                                       structures for the USB specifications. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                               name="IndustryStandardHeader">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile"
-                                                                                       type="xs:anyURI">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> The package relative
-                                                                                                       path and filename (in the content zip file) of the
-                                                                                                       industry standard include file. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea IndustryStdIncludes element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PackageIncludes">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> All top level header files that
-                                                       are included by a package that are not listed above. They cannot
-                                                       be:</xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 1) Local to a module (module
-                                                       specific.) </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 2) An industry standard header. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> 3) A library class header.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                               name="PackageHeader">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> This is the Package
-                                                                                                       relative path and filename location within the content
-                                                                                                       ZIP file. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:complexType>
-                                                                                               <xs:simpleContent>
-                                                                                                       <xs:extension base="xs:anyURI">
-                                                                                                               <xs:attributeGroup ref="SupportedArchMod" />
-                                                                                                       </xs:extension>
-                                                                                               </xs:simpleContent>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea PackageIncluces element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="Modules">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element ref="ModuleSurfaceArea" minOccurs="1"
-                                                               maxOccurs="unbounded">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This section lists the
-                                                                               Module Surface Area for all modules provided with this
-                                                                               package. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea Modules element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="GuidDeclarations">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section defines the mapping
-                                                       of GUID C names to GUID values as a Registry Format GUID. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Modules that use these GUIDs
-                                                       must specify their dependency on this package. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> Individual GUID
-                                                                               Declarations </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
-                                                                                       type="RegistryFormatGuid" />
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="UiName" type="xs:normalizedString" use="optional" />
-                                                                       <xs:attribute name="GuidTypes" type="GuidListType"
-                                                                               use="optional" />
-                                                                       <xs:attributeGroup ref="SupportedArchMod" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea GuidDeclarations element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="ProtocolDeclarations">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section defines the mapping
-                                                       of Protocol C names to GUID values as a Registry Format GUID. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Modules that use these Protocols
-                                                       must specify their dependency on this package. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> Individual Protocol
-                                                                               Declarations </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
-                                                                                       type="RegistryFormatGuid" />
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="UiName" type="xs:normalizedString" use="optional" />
-                                                                       <xs:attributeGroup ref="SupportedArchMod" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea ProtocolDeclarations element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PpiDeclarations">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section defines the mapping
-                                                       of Ppi C names to GUID values as a Registry Format GUID. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Modules that use these Ppis must
-                                                       specify their dependency on this package. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> Individual PPI
-                                                                               Declarations </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
-                                                                                       type="RegistryFormatGuid" />
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="UiName" type="xs:normalizedString" use="optional" />
-                                                                       <xs:attributeGroup ref="SupportedArchMod" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea PpiDeclarations element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PcdDeclarations">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is used to declare
-                                                       platform configuration knobs that are defined by this package. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> Modules that use these PCD
-                                                       values must specify their dependency on this package.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdEntry">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                       name="TokenSpaceGuidCname" type="xs:NCName">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> Specifies the C name
-                                                                                                       of the Token Space GUID of which this PCD Entry is a
-                                                                                                       member. This C name should also be listed in the GUIDs
-                                                                                                       section, (specified above,) where the C name is
-                                                                                                       assigned to a GUID value. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="Token">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> Specifies the 32-bit
-                                                                                                       token value for this PCD Entry. The Token number must
-                                                                                                       be unique to the Token Space that declares the PCD. </xs:documentation>
-                                                                                               <xs:documentation xml:lang="en-us"> The minLength of 3
-                                                                                                       is required to handle the "0x" prefix to the hex
-                                                                                                       number. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:simpleType>
-                                                                                               <xs:restriction base="HexNumber">
-                                                                                                       <xs:minLength value="3" />
-                                                                                                       <xs:maxLength value="10" />
-                                                                                               </xs:restriction>
-                                                                                       </xs:simpleType>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="DatumType"
-                                                                                       type="PcdDatumTypes">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> A string that
-                                                                                                       contains the data type of this PCD Entry. PCD data
-                                                                                                       types are restricted to the following set:UINT8,
-                                                                                                       UINT16, UINT32, UINT64, VOID*, BOOLEAN.
-                                                                                               </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="ValidUsage"
-                                                                                       type="PcdItemListType">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> A string that
-                                                                                                       contains one or more PCD Item types separated by
-                                                                                                       spaces. The PCD Item types are restricted to
-                                                                                                       FeaturePcd, FixedPcd, PatchPcd, Pcd and/or PcdEx.
-                                                                                               </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="DefaultValue"
-                                                                                       type="xs:normalizedString" />
-                                                                               <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> This is a
-                                                                                                       recommended maximum data size for VOID* data types,
-                                                                                                       the actual value should be defined by the Platform
-                                                                                                       Integrator. It is not required for the other data
-                                                                                                       types. </xs:documentation>
-                                                                                               <xs:documentation xml:lang="en-us"> The minLength of 3
-                                                                                                       is required to handle the "0x" prefix to the hex
-                                                                                                       number. </xs:documentation>
-
-                                                                                       </xs:annotation>
-                                                                                       <xs:simpleType>
-                                                                                               <xs:restriction base="HexNumber">
-                                                                                                       <xs:minLength value="3" />
-                                                                                               </xs:restriction>
-                                                                                       </xs:simpleType>
-                                                                               </xs:element>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-
-                                                                               <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                       name="PcdError">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> Valid Error messages
-                                                                                                       that may be implemented in a module for the PCD Entry.
-                                                                                                       Only One Error Number per PcdError, (multiple
-                                                                                                       ErrorMessage entries are permitted) and multiple
-                                                                                                       PcdError elements are permitted. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:complexType>
-                                                                                               <xs:sequence>
-                                                                                                       <xs:choice minOccurs="1" maxOccurs="1">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> One of the
-                                                                                                                               following types of comparisons, which must be
-                                                                                                                               able to evaluate to either true or false.
-                                                                                                                       </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                                       name="ValidValueList">
-                                                                                                                       <xs:annotation>
-                                                                                                                               <xs:documentation xml:lang="en-us"> The PCD
-                                                                                                                                       Value must be space separated list of values.
-                                                                                                                                       Values are restricted to the data type of this
-                                                                                                                                       PCD. </xs:documentation>
-                                                                                                                       </xs:annotation>
-                                                                                                                       <xs:complexType>
-                                                                                                                               <xs:simpleContent>
-                                                                                                                                       <xs:extension base="xs:normalizedString">
-                                                                                                                                               <xs:attribute name="Lang" type="xs:language"
-                                                                                                                                                       use="optional" />
-                                                                                                                                       </xs:extension>
-                                                                                                                               </xs:simpleContent>
-                                                                                                                       </xs:complexType>
-                                                                                                               </xs:element>
-                                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                                       name="ValidValueRange" type="xs:normalizedString">
-                                                                                                                       <xs:annotation>
-                                                                                                                               <xs:documentation xml:lang="en-us"> The PCD must
-                                                                                                                                       be within a specifed range of numeric values.
-                                                                                                                                       Restricted to C style Relational, Equality and
-                                                                                                                                       Logicial Operators and parenthesis are valid.
-                                                                                                                                       Only the CName for this PCD is permitted in
-                                                                                                                                       the ValidValueRange expression. All other
-                                                                                                                                       values must be numeric.</xs:documentation>
-                                                                                                                               <xs:documentation xml:lang="en-us"> LValue (op
-                                                                                                                                       RValue)+ </xs:documentation>
-                                                                                                                       </xs:annotation>
-                                                                                                               </xs:element>
-                                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                                       name="Expression" type="xs:normalizedString">
-                                                                                                                       <xs:annotation>
-                                                                                                                               <xs:documentation xml:lang="en-us"> A in-fix
-                                                                                                                                       logical expression using C style logical
-                                                                                                                                       operators. </xs:documentation>
-                                                                                                                       </xs:annotation>
-                                                                                                               </xs:element>
-                                                                                                       </xs:choice>
-                                                                                                       <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                               name="ErrorNumber">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> A hexadecimal
-                                                                                                                               value for the error message as defined by
-                                                                                                                               specifications. </xs:documentation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> The minLength
-                                                                                                                               of 3 is required to handle the "0x" prefix to
-                                                                                                                               the hex number. </xs:documentation>
-
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:simpleType>
-                                                                                                                       <xs:restriction base="HexNumber">
-                                                                                                                               <xs:minLength value="3" />
-                                                                                                                       </xs:restriction>
-                                                                                                               </xs:simpleType>
-                                                                                                       </xs:element>
-                                                                                                       <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                                                                               name="ErrorMessage">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> This string
-                                                                                                                               should be defined by specifications. There are
-                                                                                                                               pre-defined error number ranges in the UEFI/PI
-                                                                                                                               specificaiton. </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:complexType>
-                                                                                                                       <xs:simpleContent>
-                                                                                                                               <xs:extension base="xs:string">
-                                                                                                                                       <xs:attribute name="Lang" type="xs:language"
-                                                                                                                                               default="en-us" use="optional" />
-                                                                                                                               </xs:extension>
-                                                                                                                       </xs:simpleContent>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-                                                                                               </xs:sequence>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                       </xs:sequence>
-                                                                       <xs:attributeGroup ref="SupportedArchMod" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea PcdDeclarations element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PcdRelationshipChecks">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is used to describe
-                                                       any PCD interdependencies or relationships. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdCheck"
-                                                               type="xs:normalizedString">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This entry must used
-                                                                               TokenSpaceGuidCName.PcdCname for every named PCD. Restricted
-                                                                               to Relational, Equality and Logical Operators (NOT, AND, OR,
-                                                                               GT, GE, EQ, LE, LT and XOR) and parenthesis are valid. Only
-                                                                               the TokenSpaceGuidCName.PcdCname us permitted to name PCDs
-                                                                               in the expression. All other values must be numeric. </xs:documentation>
-                                                                       <xs:documentation xml:lang="en-us"> LValue (op RValue)+
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-
-                               <xs:element minOccurs="0" maxOccurs="unbounded"
-                                       name="MiscellaneousFiles">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section contains files that
-                                                       are not part of the code distributed with this package.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> Only required if different
-                                                                               from the Package Copyright. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="License"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> Only required if different
-                                                                               from the Package License. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> A one line description of
-                                                                               this section's content. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="unbounded" name="Description"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> A complete description of
-                                                                               the files in this section. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is the PackagePath
-                                                                               relative path and filename location within the ZIP file.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="xs:anyURI">
-                                                                                       <xs:attribute name="Executable" type="xs:boolean"
-                                                                                               default="false" use="optional">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> If true, used by
-                                                                                                               installation tools to ensure that a file that must
-                                                                                                               be executable has the correct properties to permit
-                                                                                                               execution. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea Misc element.  -->
-
-                               <xs:element minOccurs="0" maxOccurs="unbounded" name="UserExtensions">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is used for any
-                                                       processing instructions that may be custom to the content provided
-                                                       by this package that are common to this package.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType mixed="true">
-                                               <xs:sequence>
-                                                       <xs:any processContents="lax" minOccurs="0" maxOccurs="1" />
-                                               </xs:sequence>
-                                               <xs:attribute name="UserId" type="xs:NCName" use="required">
-                                                       <xs:annotation>
-                                                               <xs:documentation xml:lang="en-us"> This is a single word
-                                                                       identifier for grouping similar content that does not fit into
-                                                                       previously defined sections or other sections of the
-                                                                       Distribution. </xs:documentation>
-                                                       </xs:annotation>
-                                               </xs:attribute>
-                                               <xs:attribute name="Identifier" type="xs:string" use="optional">
-                                                       <xs:annotation>
-                                                               <xs:documentation xml:lang="en-us"> This can be used to
-                                                                       differentiate multiple sections with a grouping. </xs:documentation>
-                                                               <xs:documentation xml:lang="en-us"> For example, a PRE_PROCESS
-                                                                       Identifier might indicate specific steps and tools required
-                                                                       before processing module content, while a different
-                                                                       UserExtensions section with a POST_PROCESS Identifier might
-                                                                       describe steps that need to be executed after operations on
-                                                                       the modules in this package. </xs:documentation>
-                                                       </xs:annotation>
-                                               </xs:attribute>
-                                               <xs:anyAttribute processContents="lax" />
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageSurfaceArea UserExtensions element. -->
-
-                       </xs:sequence>
-               </xs:complexType>
-       </xs:element>
-       <!-- End of the PackageSurfaceArea element. -->
-
-       <xs:element name="ModuleSurfaceArea">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> Each module is uniquely identified by
-                               it's GUID and Version number. Backward compatible releases of a module
-                               need only change the version number, while non-backward compatible
-                               changes require the GUID to change (resetting the version number to 1.0
-                               is optional.) </xs:documentation>
-               </xs:annotation>
-               <xs:complexType>
-                       <xs:sequence>
-
-                               <xs:element minOccurs="1" maxOccurs="1" name="Header">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="Name">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is the User Interface
-                                                                               Name for this Module. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="xs:normalizedString">
-                                                                                       <xs:attribute name="BaseName" type="xs:NCName"
-                                                                                               use="required">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This is a single
-                                                                                                               word BaseName that will be used to create a module
-                                                                                                               meta-data file. </xs:documentation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This name should
-                                                                                                               also be used to create output file names and
-                                                                                                               directories. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This GUID and the Version
-                                                                               attribute uniquely identify a given Module.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="RegistryFormatGuid">
-                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                               use="required">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This value, along
-                                                                                                               with the GUID, is used to uniquely identify this
-                                                                                                               object. </xs:documentation>
-                                                                                                       <xs:documentation xml:lang="en-us"> Backward
-                                                                                                               compatible changes must make sure this number is
-                                                                                                               incremented from the most recent version.
-                                                                                                               Non-backward compatible changes require a new GUID,
-                                                                                                               and the version can be reset. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the Copyright is different from either the Package or
-                                                                               Distribution copyright. Multiple copyright lines are 
-                                                                               permitted within this section. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="License"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the license is different from either the Package or
-                                                                               Distribution license. Multiple licenses are permitted
-                                                                               within this section. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
-                                                               type="xs:normalizedString">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> A brief text description
-                                                                               of the module. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Description"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> A complete description of
-                                                                               the module contents and/or features including a description
-                                                                               of the updates since the previous module release.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of Module Surface Area Header Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="ModuleProperties">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> List general information about a
-                                                       module, including the Supported Architectures, this module's type,
-                                                       specifications the module is coded against, and other
-                                                       informational content. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="ModuleType"
-                                                               type="ModuleTypes">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> One of the Enumerated
-                                                                               module types that limit the use of a module.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="Path"
-                                                               type="xs:anyURI">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> For stand-alone modules
-                                                                               that are NOT part of any package, this is the path to the
-                                                                               root of the module as listed in the ZIP file. For modules
-                                                                               included in a package, this is the location, relative to the
-                                                                               root of the package (PackagePath) this module belongs to.
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="PcdIsDriver">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This element is only
-                                                                               required for the PEIM that produces the PCD PPI or the DXE
-                                                                               Driver that produces the PCD Protocol. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:simpleType>
-                                                                       <xs:restriction base="xs:NCName">
-                                                                               <xs:enumeration value="PEI_PCD_DRIVER" />
-                                                                               <xs:enumeration value="DXE_PCD_DRIVER" />
-                                                                       </xs:restriction>
-                                                               </xs:simpleType>
-                                                       </xs:element>
-
-                                                       <xs:element minOccurs="0" maxOccurs="1"
-                                                               name="UefiSpecificationVersion" type="xs:decimal" />
-
-                                                       <xs:element minOccurs="0" maxOccurs="1"
-                                                               name="PiSpecificationVersion" type="xs:decimal" />
-
-                                                       <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                               name="Specification">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is a list of other
-                                                                               specifications that this module is written against. These
-                                                                               entries can be used in #define statements (depending on the
-                                                                               build system implementation, they may be autogenerated.)
-                                                                       </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="xs:NCName">
-                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                               use="required" />
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-
-                                                       <xs:element minOccurs="0" maxOccurs="unbounded" name="BootMode">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> Different firmware
-                                                                               execution paths may be taken based on a given state of the
-                                                                               hardware, firmware, or through feature settings. A BootMode
-                                                                               may be declared (PRODUCES) or discovered (CONSUMES) based on
-                                                                               these states and feature settings. The supported boot modes
-                                                                               map to the PI specification Boot Modes. The boot modes
-                                                                               listed with Recovery are to indicate that the BootMode is
-                                                                               valid during a recovery boot. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:sequence minOccurs="0">
-                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                       name="SupportedBootModes">
-                                                                                       <xs:simpleType>
-                                                                                               <xs:list>
-                                                                                                       <xs:simpleType>
-                                                                                                               <xs:restriction base="xs:NCName">
-                                                                                                                       <xs:enumeration value="FULL" />
-                                                                                                                       <xs:enumeration value="MINIMAL" />
-                                                                                                                       <xs:enumeration value="NO_CHANGE" />
-                                                                                                                       <xs:enumeration value="DIAGNOSTICS" />
-                                                                                                                       <xs:enumeration value="DEFAULT" />
-                                                                                                                       <xs:enumeration value="S2_RESUME" />
-                                                                                                                       <xs:enumeration value="S3_RESUME" />
-                                                                                                                       <xs:enumeration value="S4_RESUME" />
-                                                                                                                       <xs:enumeration value="S5_RESUME" />
-                                                                                                                       <xs:enumeration value="FLASH_UPDATE" />
-                                                                                                                       <xs:enumeration value="RECOVERY_FULL" />
-                                                                                                                       <xs:enumeration value="RECOVERY_MINIMAL" />
-                                                                                                                       <xs:enumeration value="RECOVERY_NO_CHANGE" />
-                                                                                                                       <xs:enumeration value="RECOVERY_DIAGNOSTICS" />
-                                                                                                                       <xs:enumeration value="RECOVERY_DEFAULT" />
-                                                                                                                       <xs:enumeration value="RECOVERY_S2_RESUME" />
-                                                                                                                       <xs:enumeration value="RECOVERY_S3_RESUME" />
-                                                                                                                       <xs:enumeration value="RECOVERY_S4_RESUME" />
-                                                                                                                       <xs:enumeration value="RECOVERY_S5_RESUME" />
-                                                                                                                       <xs:enumeration value="RECOVERY_FLASH_UPDATE" />
-                                                            <xs:enumeration value="UNDEFINED" />
-                                                                                                               </xs:restriction>
-                                                                                                       </xs:simpleType>
-                                                                                               </xs:list>
-                                                                                       </xs:simpleType>
-                                                                               </xs:element>
-
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module
-                                                                                                                       always supports the given boot modes.
-                                                                                                               </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module may
-                                                                                                                       support a given mode on some execution paths.
-                                                                                                               </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module will
-                                                                                                                       change the boot mode. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIME_PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module will
-                                                                                                                       change the boot mode on some exection paths.
-                                                                                                               </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="UNDEFINED">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The package
-                                                                                                                       creator does not know how the boot mode is used.
-                                                                                                               </xs:documentation>
-                                                                                                       <xs:/annotation>
-                                                                                               </xs:enumeration>
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-
-                                                       <xs:element minOccurs="0" maxOccurs="unbounded" name="Event"
-                                                               nillable="true">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> The functions that make up
-                                                                               the Event, Timer, and Task Priority Services are used during
-                                                                               preboot to create, close, signal, and wait for events; to
-                                                                               set timers; and to raise and restore task priority levels as
-                                                                               defined in the UEFI specification. GUIDed events should be
-                                                                               listed in the Guids section. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module will
-                                                                                                                       register a notification function and calls the
-                                                                                                                       function when it is signaled. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module will
-                                                                                                                       register a notification function and calls the
-                                                                                                                       function when it is signaled on some execution
-                                                                                                                       paths. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module will
-                                                                                                                       signal all events in an event group.
-                                                                                                               </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module will
-                                                                                                                       signal all events in an event group under some
-                                                                                                                       execution paths. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="UNDEFINED">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The package
-                                                                                                                       creator does not know how an event is used.
-                                                                                                               </xs:documentation>
-                                                                                                       <xs:/annotation>
-                                                                                               </xs:enumeration>
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="EventType" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="EVENT_TYPE_PERIODIC_TIMER" />
-                                                                                               <xs:enumeration value="EVENT_TYPE_RELATIVE_TIMER" />
-                                                                                               <xs:enumeration value="UNDEFINED"/>
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-
-
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-
-                                                       <xs:element minOccurs="0" maxOccurs="unbounded" name="HOB"
-                                                               nillable="false">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is a list of
-                                                                               non-GUIDed Hand Off Blocks (HOBs) produced or consumed by
-                                                                               this module. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="HobType" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="PHIT" />
-                                                                                               <xs:enumeration value="MEMORY_ALLOCATION" />
-                                                                                               <xs:enumeration value="RESOURCE_DESCRIPTOR" />
-                                                                                               <xs:enumeration value="FIRMWARE_VOLUME" />
-                                                                                               <xs:enumeration value="LOAD_PEIM" />
-                                                                                               <xs:enumeratino value="UNDEFINED" />
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> A HOB must be
-                                                                                                                       present in the system. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> If present, the
-                                                                                                                       HOB will be used. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The HOB is
-                                                                                                                       always produced by the module. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The HOB may be
-                                                                                                                       produced by the module under some execution paths.
-                                                                                                               </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="UNDEFINED">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The package
-                                                                                                                       creator knows that a HOB is used, but does not 
-                                                            know how it is used.
-                                                                                                               </xs:documentation>
-                                                                                                       <xs:/annotation>
-                                                                                               </xs:enumeration>
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-
-                                               </xs:sequence>
-                                               <xs:attributeGroup ref="SupportedArchMod" />
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of ModuleProperties Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section may be included for
-                                                       Modules that are copied from a different module.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This GUID and the Version
-                                                                               attribute uniquely identify the Module that this Module was
-                                                                               copied from. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="RegistryFormatGuid">
-                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                               use="required">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> This value, along
-                                                                                                               with the GUID, is used to uniquely identify this
-                                                                                                               object. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!--  End of ClonedFrom Section. -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="LibraryClassDefinitions">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A list of the different Library
-                                                       Classes consumed by a driver, core and/or application module, or
-                                                       produced by a Library module. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                               name="LibraryClass">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="Keyword"
-                                                                                       type="xs:NCName">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us "> Used by tools to
-                                                                                                       identify different instances of libraries that provide
-                                                                                                       the library class. This keyword identifies the library
-                                                                                                       class this module needs to be linked against.
-                                                                                               </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                       name="RecommendedInstance">
-                                                                                       <xs:complexType>
-                                                                                               <xs:all>
-                                                                                                       <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> This GUID and
-                                                                                                                               the Version attribute uniquely identify the
-                                                                                                                               recommended Library Instance for this module .
-                                                                                                                       </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:complexType>
-                                                                                                                       <xs:simpleContent>
-                                                                                                                               <xs:extension base="RegistryFormatGuid">
-                                                                                                                                       <xs:attribute name="Version" type="xs:decimal"
-                                                                                                                                               use="optional">
-                                                                                                                                               <xs:annotation>
-                                                                                                                                                       <xs:documentation xml:lang="en-us"> This
-                                                                                                                                                               value, along with the GUID, is used to
-                                                                                                                                                               uniquely identify this object.
-                                                                                                                                                       </xs:documentation>
-                                                                                                                                               </xs:annotation>
-                                                                                                                                       </xs:attribute>
-                                                                                                                               </xs:extension>
-                                                                                                                       </xs:simpleContent>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-                                                                                               </xs:all>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> Library instances
-                                                                                                       can provide code for a library class, or may require
-                                                                                                       other library instances themselves. Since different
-                                                                                                       execution paths in a library (or module) may need
-                                                                                                       different library classes based on some setting,
-                                                                                                       library classes may not alway be required.
-                                                                                               </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="PRODUCES" />
-                                                                                               <xs:enumeration value="CONSUMES" />
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES" />
-                                                <xs:enumeration value="UNDEFINED" />
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-
-                                                                       <xs:attributeGroup ref="SupportedArchMod" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional">
-                                                                               <xs:annotation>
-                                                                                       <xs:documentation xml:lang="en-us"> A FeatureFlag
-                                                                                               attribute must evaluate to either true or false - it may
-                                                                                               be a fixed value of true or false, a C name or an in-fix
-                                                                                               expression. </xs:documentation>
-                                                                               </xs:annotation>
-                                                                       </xs:attribute>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of LibraryClassDefinitions Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="SourceFiles">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is the module
-                                                                               relative (ModuleProperties.Path) path and filename location
-                                                                               within the ZIP file. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="xs:anyURI">
-                                                                                       <xs:attribute name="Family" type="FamilyTypes"
-                                                                                               use="optional">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> The Family
-                                                                                                               attribute is used to restrict usage to a given
-                                                                                                               family of compilers, such as GCC or MSFT. Since not
-                                                                                                               all code processing tools use the same syntax,
-                                                                                                               especially for assembly, this field can be used to
-                                                                                                               identify different syntax. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                                               use="optional" />
-                                                                                       <xs:attribute name="FeatureFlag"
-                                                                                               type="xs:normalizedString" use="optional" />
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of SourceFiles Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="BinaryFiles">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="BinaryFile">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                                                       name="Filename">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> This is the module
-                                                                                                       relative (ModuleProperties.Path) path and filename
-                                                                                                       location within the ZIP file. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:complexType>
-                                                                                               <xs:simpleContent>
-                                                                                                       <xs:extension base="xs:anyURI">
-                                                                                                               <xs:attribute name="FileType" use="optional">
-                                                                                                                       <xs:simpleType>
-                                                                                                                               <xs:restriction base="xs:NCName">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> Binary
-                                                                                                                                                       file distribution is limited to UEFI/PI
-                                                                                                                                                       FFS leaf section file types.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:enumeration value="GUID" />
-                                                                                                                                       <xs:enumeration value="FREEFORM" />
-                                                                                                                                       <xs:enumeration value="UEFI_IMAGE" />
-                                                                                                                                       <xs:enumeration value="PE32">
-                                                                                                                                               <xs:annotation>
-                                                                                                                                                       <xs:documentation xml:lang="en-us"> A
-                                                                                                                                                               UEFI/PI FFS Leaf section file type, not
-                                                                                                                                                               a raw PE32 file. </xs:documentation>
-                                                                                                                                               </xs:annotation>
-                                                                                                                                       </xs:enumeration>
-                                                                                                                                       <xs:enumeration value="PIC" />
-                                                                                                                                       <xs:enumeration value="PEI_DEPEX" />
-                                                                                                                                       <xs:enumeration value="DXE_DEPEX" />
-                                                                                                                                       <xs:enumeration value="TE" />
-                                                                                                                                       <xs:enumeration value="VER" />
-                                                                                                                                       <xs:enumeration value="UI" />
-                                                                                                                                       <xs:enumeration value="BIN" />
-                                                                                                                                       <xs:enumeration value="FV" />
-                                                                                                                               </xs:restriction>
-                                                                                                                       </xs:simpleType>
-                                                                                                               </xs:attribute>
-                                                                                                               <xs:attribute name="SupArchList" type="ArchListType"
-                                                                                                                       use="optional" />
-                                                                                                               <xs:attribute name="FeatureFlag"
-                                                                                                                       type="xs:normalizedString" use="optional" />
-                                                                                                       </xs:extension>
-                                                                                               </xs:simpleContent>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                               <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                       name="AsBuilt">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> This section
-                                                                                                       contains information about how the module was coded,
-                                                                                                       such as Compiler Tools, Flags, PCDs (only PatchPcd
-                                                                                                       and/or PcdEx) and Library Class Instances used to
-                                                                                                       build the binary. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:complexType>
-                                                                                               <xs:sequence>
-
-                                                                                                       <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                                               name="PatchPcdValue">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> The element is
-                                                                                                                               the Patchable PCD Value that was used during the
-                                                                                                                               build. </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:complexType>
-                                                                                                                       <xs:sequence>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="TokenSpaceGuidValue"
-                                                                                                                                       type="RegistryFormatGuid" />
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="PcdCName" type="xs:NCName" />
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="Token">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> The
-                                                                                                                                                       minLength of 3 is required to handle the
-                                                                                                                                                       "0x" prefix to the hex number.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:simpleType>
-                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                       <xs:minLength value="3" />
-                                                                                                                                                       <xs:maxLength value="10" />
-                                                                                                                                               </xs:restriction>
-                                                                                                                                       </xs:simpleType>
-                                                                                                                               </xs:element>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="DatumType" type="PcdDatumTypes" />
-                                                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                                                       name="MaxDatumSize">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> This
-                                                                                                                                                       field is required if the Pcd Datum Type is
-                                                                                                                                                       VOID* </xs:documentation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> The
-                                                                                                                                                       minLength of 3 is required to handle the
-                                                                                                                                                       "0x" prefix to the hex number.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:simpleType>
-                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                       <xs:minLength value="3" />
-                                                                                                                                               </xs:restriction>
-                                                                                                                                       </xs:simpleType>
-                                                                                                                               </xs:element>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="Value" type="xs:normalizedString" />
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="Offset">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> The
-                                                                                                                                                       minLength of 3 is required to handle the
-                                                                                                                                                       "0x" prefix to the hex number.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:simpleType>
-                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                       <xs:minLength value="3" />
-                                                                                                                                               </xs:restriction>
-                                                                                                                                       </xs:simpleType>
-                                                                                                                               </xs:element>
-                                                                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                                                                       maxOccurs="unbounded" />
-                                                                                                                               <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                                                                       name="PcdError">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> Error
-                                                                                                                                                       information implemented by the module.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:complexType>
-                                                                                                                                               <xs:sequence>
-                                                                                                                                                       <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                                               name="ErrorNumber">
-                                                                                                                                                               <xs:annotation>
-                                                                                                                                                               <xs:documentation xml:lang="en-us"> The
-                                                                                                                                                               minLength of 3 is required to handle the
-                                                                                                                                                               "0x" prefix to the hex number.
-                                                                                                                                                               </xs:documentation>
-                                                                                                                                                               </xs:annotation>
-                                                                                                                                                               <xs:simpleType>
-                                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                               <xs:minLength value="3" />
-                                                                                                                                                               </xs:restriction>
-                                                                                                                                                               </xs:simpleType>
-                                                                                                                                                       </xs:element>
-                                                                                                                                                       <xs:element minOccurs="0"
-                                                                                                                                                               maxOccurs="unbounded"
-                                                                                                                                                               name="ErrorMessage">
-                                                                                                                                                               <xs:complexType>
-                                                                                                                                                               <xs:simpleContent>
-                                                                                                                                                               <xs:extension base="xs:string">
-                                                                                                                                                               <xs:attribute name="Lang"
-                                                                                                                                                               type="xs:language" default="en-us"
-                                                                                                                                                               use="optional" />
-                                                                                                                                                               </xs:extension>
-                                                                                                                                                               </xs:simpleContent>
-                                                                                                                                                               </xs:complexType>
-                                                                                                                                                       </xs:element>
-                                                                                                                                               </xs:sequence>
-                                                                                                                                       </xs:complexType>
-                                                                                                                               </xs:element>
-                                                                                                                       </xs:sequence>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-
-                                                                                                       <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                                               name="PcdExValue">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> The element is
-                                                                                                                               the DynamicEx PCD Value that was used during the
-                                                                                                                               build. </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:complexType>
-                                                                                                                       <xs:sequence>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="TokenSpaceGuidValue"
-                                                                                                                                       type="RegistryFormatGuid" />
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="Token">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> The
-                                                                                                                                                       minLength of 3 is required to handle the
-                                                                                                                                                       "0x" prefix to the hex number.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:simpleType>
-                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                       <xs:minLength value="3" />
-                                                                                                                                                       <xs:maxLength value="10" />
-                                                                                                                                               </xs:restriction>
-                                                                                                                                       </xs:simpleType>
-                                                                                                                               </xs:element>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="DatumType" type="PcdDatumTypes" />
-                                                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                                                       name="MaxDatumSize">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> This
-                                                                                                                                                       field is required if the Pcd Datum Type is
-                                                                                                                                                       VOID* </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:simpleType>
-                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                       <xs:minLength value="3" />
-                                                                                                                                               </xs:restriction>
-                                                                                                                                       </xs:simpleType>
-                                                                                                                               </xs:element>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                       name="Value" type="xs:normalizedString" />
-                                                                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                                                                       maxOccurs="unbounded" />
-                                                                                                                               <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                                                                       name="PcdError">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> Error
-                                                                                                                                                       information implemented by the module.
-                                                                                                                                               </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:complexType>
-                                                                                                                                               <xs:sequence>
-                                                                                                                                                       <xs:element minOccurs="1" maxOccurs="1"
-                                                                                                                                                               name="ErrorNumber">
-                                                                                                                                                               <xs:annotation>
-                                                                                                                                                               <xs:documentation xml:lang="en-us"> The
-                                                                                                                                                               minLength of 3 is required to handle the
-                                                                                                                                                               "0x" prefix to the hex number.
-                                                                                                                                                               </xs:documentation>
-                                                                                                                                                               </xs:annotation>
-                                                                                                                                                               <xs:simpleType>
-                                                                                                                                                               <xs:restriction base="HexNumber">
-                                                                                                                                                               <xs:minLength value="3" />
-                                                                                                                                                               </xs:restriction>
-                                                                                                                                                               </xs:simpleType>
-                                                                                                                                                       </xs:element>
-                                                                                                                                                       <xs:element minOccurs="0"
-                                                                                                                                                               maxOccurs="unbounded"
-                                                                                                                                                               name="ErrorMessage">
-                                                                                                                                                               <xs:complexType>
-                                                                                                                                                               <xs:simpleContent>
-                                                                                                                                                               <xs:extension base="xs:string">
-                                                                                                                                                               <xs:attribute name="Lang"
-                                                                                                                                                               type="xs:language" default="en-us"
-                                                                                                                                                               use="optional" />
-                                                                                                                                                               </xs:extension>
-                                                                                                                                                               </xs:simpleContent>
-                                                                                                                                                               </xs:complexType>
-                                                                                                                                                       </xs:element>
-                                                                                                                                               </xs:sequence>
-                                                                                                                                       </xs:complexType>
-                                                                                                                               </xs:element>
-                                                                                                                       </xs:sequence>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-
-                                                                                                       <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                               name="LibraryInstances">
-                                                                                                               <xs:annotation>
-                                                                                                                       <xs:documentation xml:lang="en-us"> This is the
-                                                                                                                               actual library instance that was used to link
-                                                                                                                               against the module. </xs:documentation>
-                                                                                                               </xs:annotation>
-                                                                                                               <xs:complexType>
-                                                                                                                       <xs:sequence>
-                                                                                                                               <xs:element minOccurs="1" maxOccurs="unbounded"
-                                                                                                                                       name="GUID">
-                                                                                                                                       <xs:annotation>
-                                                                                                                                               <xs:documentation xml:lang="en-us"> This
-                                                                                                                                                       GUID and the Version attribute uniquely
-                                                                                                                                                       identify the actual Library Instance
-                                                                                                                                                       linked in this module. </xs:documentation>
-                                                                                                                                       </xs:annotation>
-                                                                                                                                       <xs:complexType>
-                                                                                                                                               <xs:simpleContent>
-                                                                                                                                                       <xs:extension base="RegistryFormatGuid">
-                                                                                                                                                               <xs:attribute name="Version"
-                                                                                                                                                               type="xs:decimal" use="required">
-                                                                                                                                                               <xs:annotation>
-                                                                                                                                                               <xs:documentation xml:lang="en-us"> This
-                                                                                                                                                               value, along with the GUID, is used to
-                                                                                                                                                               uniquely identify this object.
-                                                                                                                                                               </xs:documentation>
-                                                                                                                                                               </xs:annotation>
-                                                                                                                                                               </xs:attribute>
-                                                                                                                                                       </xs:extension>
-                                                                                                                                               </xs:simpleContent>
-                                                                                                                                       </xs:complexType>
-                                                                                                                               </xs:element>
-                                                                                                                       </xs:sequence>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-
-                                                                                                       <xs:element minOccurs="0" maxOccurs="unbounded"
-                                                                                                               name="BuildFlags">
-                                                                                                               <xs:complexType mixed="true">
-                                                                                                                       <xs:simpleContent>
-                                                                                                                               <xs:annotation>
-                                                                                                                                       <xs:documentation xml:lang="en-us"> Any
-                                                                                                                                               description of OS, Tool, and flags for the
-                                                                                                                                               individual tool can go in this section.
-                                                                                                                                       </xs:documentation>
-                                                                                                                               </xs:annotation>
-                                                                                                                               <xs:extension base="xs:string">
-                                                                                                                                       <xs:anyAttribute processContents="lax" />
-                                                                                                                               </xs:extension>
-                                                                                                                       </xs:simpleContent>
-                                                                                                               </xs:complexType>
-                                                                                                       </xs:element>
-                                                                                               </xs:sequence>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                               <!-- End of AsBuilt -->
-                                                                       </xs:sequence>
-                                                               </xs:complexType>
-                                                       </xs:element>
-
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of BinaryFiles Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PackageDependencies">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Package">
-                                                               <xs:complexType>
-                                                                       <xs:all>
-                                                                               <xs:element minOccurs="0" maxOccurs="1" name="Description"
-                                                                                       type="xs:string" />
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="GUID">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> This GUID and the
-                                                                                                       Version attribute uniquely identify Package that this
-                                                                                                       Module depends on. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                                       <xs:complexType>
-                                                                                               <xs:simpleContent>
-                                                                                                       <xs:extension base="RegistryFormatGuid">
-                                                                                                               <xs:attribute name="Version" type="xs:decimal"
-                                                                                                                       use="optional">
-                                                                                                                       <xs:annotation>
-                                                                                                                               <xs:documentation xml:lang="en-us"> This value,
-                                                                                                                                       along with the GUID, is used to uniquely
-                                                                                                                                       identify this object. If the version attribute
-                                                                                                                                       is not specified, the most recent version of
-                                                                                                                                       the package can be used. </xs:documentation>
-                                                                                                                       </xs:annotation>
-                                                                                                               </xs:attribute>
-                                                                                                       </xs:extension>
-                                                                                               </xs:simpleContent>
-                                                                                       </xs:complexType>
-                                                                               </xs:element>
-                                                                       </xs:all>
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PackageDependencies -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="Guids">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="GuidCName">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element minOccurs="0" maxOccurs="1" name="VariableName"
-                                                                                       type="xs:normalizedString">
-                                                                                       <xs:annotation>
-                                                                                               <xs:documentation xml:lang="en-us"> Only valid for
-                                                                                                       Variable GUID types. </xs:documentation>
-                                                                                               <xs:documentation> This can be either a Hex Array or
-                                                                                                       Unicode Data. </xs:documentation>
-                                                                                       </xs:annotation>
-                                                                               </xs:element>
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us">The module does
-                                                                                                                       not install the GUID, and the GUID must be present
-                                                                                                                       for the module to execute. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module does
-                                                                                                                       not install the GUID, however, the GUID will be
-                                                                                                                       used if it is present. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The module
-                                                                                                                       always installs the GUID. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="SOMETIMES_PRODUCES">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The Module will
-                                                                                                                       install the GUID under certain execution paths.
-                                                                                                               </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                               <xs:enumeration value="UNDEFINED">
-                                                                                                       <xs:annotation>
-                                                                                                               <xs:documentation xml:lang="en-us"> The package
-                                                                                                                       creator knows that a GUID is used, but does not
-                                                                                                                       know how it is used. </xs:documentation>
-                                                                                                       </xs:annotation>
-                                                                                               </xs:enumeration>
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="GuidType" type="GuidListType"
-                                                                               use="required" />
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of Guids Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="Protocols">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A listing of protocols required
-                                                       or produced by this module. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Protocol"
-                                                               nillable="true">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="PRODUCES" />
-                                                                                               <xs:enumeration value="SOMETIMES_PRODUCES" />
-                                                                                               <xs:enumeration value="CONSUMES" />
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES" />
-                                                                                               <xs:enumeration value="TO_START" />
-                                                                                               <xs:enumeration value="BY_START" />
-                                                <xs:enumeration value="UNDEFINED" />
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="Notify" type="xs:boolean" use="optional" />
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of Protocols Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PPIs">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> A listing of PPIs required or
-                                                       produced by this module. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Ppi"
-                                                               nillable="true">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="Usage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="PRODUCES" />
-                                                                                               <xs:enumeration value="SOMETIMES_PRODUCES" />
-                                                                                               <xs:enumeration value="CONSUMES" />
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES" />
-                                                <xs:enumeration value="UNDEFINED" />
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="Notify" type="xs:boolean" use="optional" />
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PPIs Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="Externs">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> These elements specify
-                                                       additional information about the module. This area may be used by
-                                                       tools to generate code. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Extern">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:choice minOccurs="1">
-                                                                                       <xs:sequence>
-                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                       name="EntryPoint" type="xs:NCName" />
-                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                       name="UnloadImage" type="xs:NCName" />
-                                                                                       </xs:sequence>
-                                                                                       <xs:sequence>
-                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                       name="Constructor" type="xs:NCName" />
-                                                                                               <xs:element minOccurs="0" maxOccurs="1"
-                                                                                                       name="Destructor" type="xs:NCName" />
-                                                                                       </xs:sequence>
-                                                                               </xs:choice>
-                                                                               <xs:element ref="HelpText" minOccurs="0" maxOccurs="1" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of Externs Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PcdCoded">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section describes how a
-                                                       platform is coded with respect to the platform configuration
-                                                       knobs. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdEntry">
-                                                               <xs:complexType>
-                                                                       <xs:sequence>
-                                                                               <xs:element minOccurs="1" maxOccurs="1" name="CName"
-                                                                                       type="xs:NCName" />
-                                                                               <xs:element minOccurs="1" maxOccurs="1"
-                                                                                       name="TokenSpaceGuidCName" type="xs:NCName" />
-                                                                               <xs:element minOccurs="0" maxOccurs="1" name="DefaultValue"
-                                                                                       type="xs:normalizedString" />
-                                                                               <xs:element ref="HelpText" minOccurs="0"
-                                                                                       maxOccurs="unbounded" />
-                                                                       </xs:sequence>
-                                                                       <xs:attribute name="PcdItemType" type="PcdItemTypes"
-                                                                               use="required" />
-                                                                       <xs:attribute name="PcdUsage" use="required">
-                                                                               <xs:simpleType>
-                                                                                       <xs:restriction base="xs:NCName">
-                                                                                               <xs:enumeration value="PRODUCES" />
-                                                                                               <xs:enumeration value="SOMETIMES_PRODUCES" />
-                                                                                               <xs:enumeration value="CONSUMES" />
-                                                                                               <xs:enumeration value="SOMETIMES_CONSUMES" />
-                                                <xs:enumeration value="UNDEFINED" />
-                                                                                       </xs:restriction>
-                                                                               </xs:simpleType>
-
-
-                                                                       </xs:attribute>
-                                                                       <xs:attribute name="SupArchList" type="ArchListType"
-                                                                               use="optional" />
-                                                                       <xs:attribute name="FeatureFlag" type="xs:normalizedString"
-                                                                               use="optional" />
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PcdCoded Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="PeiDepex">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This is the PEI dependency
-                                                       expression for a Dependency Section. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element name="Expression" type="xs:string" minOccurs="1"
-                                                               maxOccurs="1">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> An in-fix expression, of C
-                                                                               identifiers and TRUE, FALSE, AND, OR, NOT, BEFORE, and AFTER
-                                                                               as well as parenthesis () in the in-fix notation. The
-                                                                               operators are restricted to grammar defined in the PI
-                                                                               specification. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element ref="HelpText" minOccurs="0" maxOccurs="1" />
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of PeiDepex Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="DxeDepex">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This is the DXE dependency
-                                                       expression for a Dependency Section. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element name="Expression" type=" xs:string " minOccurs="1"
-                                                               maxOccurs="1">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> An in-fix expression, of C
-                                                                               identifiers and TRUE, FALSE, AND, OR, NOT, BEFORE, and AFTER
-                                                                               as well as parenthesis () in the in-fix notation. The
-                                                                               operators are restricted to grammar defined in the PI
-                                                                               specification. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element ref="HelpText" minOccurs="0" maxOccurs="1" />
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of DxeDepex Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="SmmDepex">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This is the SMM dependency
-                                                       expression for a Dependency Section. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element name="Expression" type=" xs:string " minOccurs="1"
-                                                               maxOccurs="1">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> An in-fix expression, of C
-                                                                               identifiers and TRUE, FALSE, AND, OR, NOT, BEFORE, and AFTER
-                                                                               as well as parenthesis () in the in-fix notation. The
-                                                                               operators are restricted to grammar defined in the PI
-                                                                               specification. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element ref="HelpText" minOccurs="0" maxOccurs="1" />
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of SmmDepex Section -->
-
-
-                               <xs:element minOccurs="0" maxOccurs="1" name="MiscellaneousFiles">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is used to provide
-                                                       comments and/or list auxiliary files, such as pdb or map files.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Description"
-                                                               type="xs:string" />
-                                                       <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is the path and
-                                                                               filename location within the ZIP file. </xs:documentation>
-                                                               </xs:annotation>
-                                                               <xs:complexType>
-                                                                       <xs:simpleContent>
-                                                                               <xs:extension base="xs:anyURI">
-                                                                                       <xs:attribute name="Executable" type="xs:boolean"
-                                                                                               default="false" use="optional">
-                                                                                               <xs:annotation>
-                                                                                                       <xs:documentation xml:lang="en-us"> If true, used by
-                                                                                                               installation tools to ensure that a file that must
-                                                                                                               be executable has the correct properties to permit
-                                                                                                               execution. </xs:documentation>
-                                                                                               </xs:annotation>
-                                                                                       </xs:attribute>
-                                                                               </xs:extension>
-                                                                       </xs:simpleContent>
-                                                               </xs:complexType>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of Module Surface Area Misc Section -->
-
-                               <xs:element minOccurs="0" maxOccurs="unbounded" name="UserExtensions">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This section is used for any
-                                                       processing instructions that may be custom to the content provided
-                                                       by the distribution that are common to module. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> The content is vendor specific. </xs:documentation>
-                                               <xs:documentation xml:lang="en-us"> The content can be plain text as
-                                                       well as any user-defined, properly formatted XML structure.
-                                               </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType mixed="true">
-                                               <xs:attribute name="UserId" type="xs:NCName" use="required">
-                                                       <xs:annotation>
-                                                               <xs:documentation xml:lang="en-us"> This is a single word
-                                                                       identifier for grouping similar content. For example,
-                                                                       ReferenceBuild might be used to identify non-PI compliant
-                                                                       build steps, with two different UserExtensions sections, one
-                                                                       with an Identifier of Prebuild, and another of PostBuild. Both
-                                                                       UserExtensions sections would use the same UserId.
-                                                               </xs:documentation>
-                                                       </xs:annotation>
-                                               </xs:attribute>
-                                               <xs:attribute name="Identifier" type="xs:string" use="optional">
-                                                       <xs:annotation>
-                                                               <xs:documentation xml:lang="en-us"> This can be any string used
-                                                                       to differentiate or identify this section from other
-                                                                       UserExtensions sections. </xs:documentation>
-                                                               <xs:documentation xml:lang="en-us"> For example, a PRE_PROCESS
-                                                                       Identifier might indicate specific steps and tools required
-                                                                       before processing module content, while a different
-                                                                       UserExtensions section with a POST_PROCESS Identifier might
-                                                                       describe steps that need to be executed after operations on
-                                                                       this module. </xs:documentation>
-                                                       </xs:annotation>
-                                               </xs:attribute>
-                                               <xs:anyAttribute processContents="lax" />
-                                       </xs:complexType>
-                               </xs:element>
-                               <!-- End of Module Surface Area UserExtensions Section -->
-
-                       </xs:sequence>
-                       <xs:attribute name="BinaryModule" type="xs:boolean" default="false"
-                               use="optional">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This attribute is used when the
-                                               binaries are distributed for this module and no code generation from
-                                               source files is required. If set, then the BinaryFiles section
-                                               should be used, and any files listed in the SourceFiles section do
-                                               not have to be built. Additionally, the AsBuilt section for each
-                                               binary file must be included. </xs:documentation>
-                               </xs:annotation>
-                       </xs:attribute>
-               </xs:complexType>
-
-       </xs:element>
-       <!-- End of the ModuleSurfaceArea element. -->
-
-       <xs:element name="Tools">
-               <xs:complexType>
-                       <xs:sequence>
-                               <xs:element minOccurs="0" maxOccurs="1" name="Header">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="1" maxOccurs="1" name="Name"
-                                                               type="xs:normalizedString">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us">This is the User Interface
-                                                                               Name for this Tools Distribution.</xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the Copyright is different from the Distribution Package
-                                                                               copyright. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="License"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the License is different from the Distribution Package
-                                                                               license. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
-                                                               type="xs:normalizedString">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the Abstract is different from the Distribution Package
-                                                                               Abstract. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Description"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the Description is different from the Distribution Package
-                                                                               Description. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This is the path and filename
-                                                       location within the ZIP file. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:simpleContent>
-                                                       <xs:extension base="xs:anyURI">
-                                                               <xs:attribute name="OS" type="SupportedOs" use="optional">
-                                                                       <xs:annotation>
-                                                                               <xs:documentation xml:lang="en-us"> This is required for
-                                                                                       tools that execute; it should not be used for
-                                                                                       configuration files. </xs:documentation>
-                                                                       </xs:annotation>
-                                                               </xs:attribute>
-                                                               <xs:attribute name="Executable" type="xs:boolean"
-                                                                       default="false" use="optional">
-                                                                       <xs:annotation>
-                                                                               <xs:documentation xml:lang="en-us"> If true, used by
-                                                                                       installation tools to ensure that a file that must be
-                                                                                       executable has the correct properties to permit execution.
-                                                                               </xs:documentation>
-                                                                       </xs:annotation>
-                                                               </xs:attribute>
-                                                       </xs:extension>
-                                               </xs:simpleContent>
-                                       </xs:complexType>
-                               </xs:element>
-                       </xs:sequence>
-               </xs:complexType>
-       </xs:element>
-       <!-- End of the Tools element. -->
-
-       <xs:element name="MiscellaneousFiles">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> This section contains a list of files
-                               that are not part of the code distributed with modules, packages or
-                               tools. </xs:documentation>
-               </xs:annotation>
-               <xs:complexType>
-                       <xs:sequence>
-                               <xs:element minOccurs="0" maxOccurs="1" name="Header">
-                                       <xs:complexType>
-                                               <xs:sequence>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Name"
-                                                               type="xs:normalizedString">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> The User interface name
-                                                                               for this content. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the Copyright is different from the Distribution Package
-                                                                               Copyright. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="License"
-                                                               type="xs:string">
-                                                               <xs:annotation>
-                                                                       <xs:documentation xml:lang="en-us"> This is only required if
-                                                                               the License is different from the Distribution Package
-                                                                               License. </xs:documentation>
-                                                               </xs:annotation>
-                                                       </xs:element>
-                                                       <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
-                                                               type="xs:normalizedString" />
-                                                       <xs:element minOccurs="0" maxOccurs="unbounded" name="Description"
-                                                               type="xs:string" />
-                                               </xs:sequence>
-                                       </xs:complexType>
-                               </xs:element>
-                               <xs:element minOccurs="0" maxOccurs="unbounded" name="Filename">
-                                       <xs:annotation>
-                                               <xs:documentation xml:lang="en-us"> This is the path and filename
-                                                       location within the ZIP file. </xs:documentation>
-                                       </xs:annotation>
-                                       <xs:complexType>
-                                               <xs:simpleContent>
-                                                       <xs:extension base="xs:anyURI">
-                                                               <xs:attribute name="Executable" type="xs:boolean"
-                                                                       default="false" use="optional">
-                                                                       <xs:annotation>
-                                                                               <xs:documentation xml:lang="en-us"> If true, used by
-                                                                                       installation tools to ensure that a file that must be
-                                                                                       executable has the correct properties to permit execution.
-                                                                               </xs:documentation>
-                                                                       </xs:annotation>
-                                                               </xs:attribute>
-                                                       </xs:extension>
-                                               </xs:simpleContent>
-                                       </xs:complexType>
-                               </xs:element>
-                       </xs:sequence>
-               </xs:complexType>
-       </xs:element>
-       <!-- End of the Misc element. -->
-
-       <xs:element name="UserExtensions">
-               <xs:complexType mixed="true">
-                       <xs:sequence>
-                               <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
-                       </xs:sequence>
-                       <xs:attribute name="UserId" type="xs:NCName" use="required">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This is a single word identifier
-                                               for grouping similar content. For example, ReferenceBuild might be
-                                               used to identify non-PI compliant build steps, with two different
-                                               UserExtensions sections, one with an Identifier of Prebuild, and
-                                               another of PostBuild. Both UserExtensions sections would use the
-                                               same UserId. </xs:documentation>
-                               </xs:annotation>
-                       </xs:attribute>
-                       <xs:attribute name="Identifier" type="xs:string" use="optional">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This can be any string used to
-                                               differentiate or identify this section from other UserExtensions
-                                               sections. </xs:documentation>
-                                       <xs:documentation xml:lang="en-us"> For example, a PRE_PROCESS
-                                               Identifier might indicate specific steps and tools required before
-                                               processing distribution package content, while a different
-                                               UserExtensions section with a POST_PROCESS Identifier might describe
-                                               steps that need to be executed after operations on this content.
-                                       </xs:documentation>
-                               </xs:annotation>
-                       </xs:attribute>
-                       <xs:anyAttribute processContents="lax" />
-               </xs:complexType>
-       </xs:element>
-       <!-- The following elsements are common definitions used with the ref attribute for elements. -->
-
-       <xs:element name="HelpText">
-               <xs:complexType>
-                       <xs:simpleContent>
-                               <xs:extension base="xs:string">
-                                       <xs:attribute name="Lang" type="xs:language" default="en-us"
-                                               use="optional" />
-                               </xs:extension>
-                       </xs:simpleContent>
-               </xs:complexType>
-       </xs:element>
-
-       <!-- The following attribute groups are used in various elements above. -->
-
-       <xs:attributeGroup name="SupportedArchMod">
-               <xs:attribute name="SupArchList" type="ArchListType" use="optional" />
-               <xs:attribute name="SupModList" type="ModuleListType" use="optional" />
-       </xs:attributeGroup>
-
-       <!-- The following data types are used to restrict content. -->
-
-       <xs:simpleType name="ArchListType">
-               <xs:list itemType="ArchTypes" />
-       </xs:simpleType>
-
-       <xs:simpleType name="ArchTypes">
-               <xs:restriction base="xs:NCName">
-                       <xs:enumeration value="IA32" />
-                       <xs:enumeration value="X64" />
-                       <xs:enumeration value="IPF" />
-                       <xs:enumeration value="EBC" />
-                       <xs:pattern value="([A-Z])([a-zA-Z0-9])*">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> Any processor architecture not
-                                               listed above. The Architecture must be a target architecture of one
-                                               or more compiler tool chains. </xs:documentation>
-                               </xs:annotation>
-                       </xs:pattern>
-               </xs:restriction>
-       </xs:simpleType>
-
-
-       <xs:simpleType name="FamilyTypes">
-               <xs:restriction base="xs:NCName">
-                       <xs:enumeration value="MSFT" />
-                       <xs:enumeration value="GCC" />
-                       <xs:pattern value="[A-Z][a-zA-Z0-9]*">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> Any other family of build
-                                               utilities for which compiler tools exist. </xs:documentation>
-                               </xs:annotation>
-                       </xs:pattern>
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="GuidListType">
-               <xs:list itemType="GuidTypes" />
-       </xs:simpleType>
-
-       <xs:simpleType name="GuidTypes">
-               <xs:restriction base="xs:NCName">
-                       <xs:enumeration value="Event" />
-                       <xs:enumeration value="File" />
-                       <xs:enumeration value="FV" />
-                       <xs:enumeration value="GUID" />
-                       <xs:enumeration value="Hii" />
-                       <xs:enumeration value="HOB" />
-                       <xs:enumeration value="SystemTable" />
-                       <xs:enumeration value="TokenSpaceGuid" />
-                       <xs:enumeration value="Variable" />
-            <xs:enumeration value="UNDEFINED" />
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="HexNumber">
-               <xs:restriction base="xs:hexBinary">
-                       <xs:pattern value="0x([a-fA-F0-9])+" />
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="Md5Sum">
-               <xs:restriction base="xs:normalizedString">
-                       <xs:pattern value="[a-zA-Z0-9]{32}" />
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="ModuleListType">
-               <xs:list itemType="ModuleTypes" />
-       </xs:simpleType>
-
-       <xs:simpleType name="ModuleTypes">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> The following module types are defined
-                               by specifications. </xs:documentation>
-                       <xs:documentation xml:lang="en-us"> Module types for components and
-                               libraries defined for this distribution mechanism. </xs:documentation>
-               </xs:annotation>
-               <xs:restriction base="xs:NCName">
-                       <xs:enumeration value="BASE ">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> Use of this module is not
-                                               restricted. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="DXE_CORE">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               the DXE core. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="DXE_DRIVER">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               a DXE driver. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="DXE_RUNTIME_DRIVER">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               a DXE runtime driver. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="DXE_SAL_DRIVER">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               an IPF DXE runtime driver. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="DXE_SMM_DRIVER">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               a DXE SMM driver. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="PEI_CORE">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               the PEI core. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="PEIM">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only valid for PEI
-                                               modules. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="SEC">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to
-                                               Security phase. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="UEFI_DRIVER">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only valid for UEFI
-                                               drivers. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="UEFI_RUNTIME_DRIVER">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only valid for UEFI
-                                               runtime drivers.</xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="UEFI_APPLICATION">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only valid for UEFI
-                                               applications. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="SMM_CORE">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This module is only applicable to the SMM
-                                               core.</xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="USER_DEFINED">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This content is restricted to a specific
-                                               implementation. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="UNDEFINED">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This enumeration is for use in a list that
-                                               where the package creator does not know the what module types are supported
-                                               by a module. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:pattern value="([A-Z])([a-zA-Z0-9])*">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This pattern has been added for use in a
-                                               module lists - for future expansion. </xs:documentation>
-                               </xs:annotation>
-                       </xs:pattern>
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="PcdDatumTypes">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> The following data types are defined
-                               by the PCD specification (or PCD section of the UEFI/PI specifications.)
-                       </xs:documentation>
-               </xs:annotation>
-               <xs:restriction base="xs:normalizedString">
-                       <xs:enumeration value="UINT8" />
-                       <xs:enumeration value="UINT16" />
-                       <xs:enumeration value="UINT32" />
-                       <xs:enumeration value="UINT64" />
-                       <xs:enumeration value="BOOLEAN" />
-                       <xs:enumeration value="VOID*" />
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="PcdItemListType">
-               <xs:list itemType="PcdItemTypes" />
-       </xs:simpleType>
-
-       <xs:simpleType name="PcdItemTypes">
-               <xs:restriction base="xs:NCName">
-                       <xs:enumeration value="FeaturePcd">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> The Feature PCD is a binary,
-                                               evaluating to either true or false. This is used during build to
-                                               include/exclude content. It can also be used during execution to
-                                               force execution paths within drivers, or to enable/disable features
-                                               within a driver for a given platform. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="FixedPcd">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> The Fixed PCD is a #define value
-                                               that is set at build time. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="PatchPcd">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> The Patch PCD is a #define that is
-                                               set at build time, and that can be modified within a binary file.
-                                               Additional information, such as the offset location of the value,
-                                               along with it's length may need to be provided.</xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="Pcd">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> This PCD type has an overloaded
-                                               definition. Prior to build, the platform integrator may choose to
-                                               implement a PCD as Fixed, Patchable or a Dynamic PCD. If the
-                                               platform integrator choose to use the PCD as dynamic, then a PCD
-                                               driver is required in the platform (PEI/DXE/both) to track the PCD
-                                               in some sort of 'database' of these items. For Dynamic PCDs, the
-                                               PcdGet* must pass in the token space guid and the token number to
-                                               retrieve data (PcdSet* also needs these values.) </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="PcdEx">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> The PCD can only be used as
-                                               Dynamic, and the platform firmware must contain a driver to maintain
-                                               a 'database' of these items. For Dynamic PCDs, the PcdGet* must pass
-                                               in the token space guid and the token number to retrieve data
-                                               (PcdSet* also needs these values.) </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-               </xs:restriction>
-       </xs:simpleType>
-
-
-
-       <xs:simpleType name="RegistryFormatGuid">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> A GUID must contain five different
-                               Hexadecimal character sets that are separated by a dash (-) character.
-                       </xs:documentation>
-               </xs:annotation>
-               <xs:restriction base="xs:string">
-                       <xs:pattern
-                               value="\s*[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\s*"
-                        />
-               </xs:restriction>
-       </xs:simpleType>
-
-       <xs:simpleType name="SupportedOs">
-               <xs:annotation>
-                       <xs:documentation xml:lang="en-us"> The EDK II build system supports
-                               workstations running one of the following supported operating systems.
-                               This is the OS for the developer's workstation, not the target platform.
-                       </xs:documentation>
-               </xs:annotation>
-               <xs:restriction base="xs:string">
-                       <xs:enumeration value="Win32">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> For Windows 2003, Windows XP and
-                                               Windows Vista. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="Win64">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> For Windows 2003, Windows XP and
-                                               Windows Vista. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="Linux32" />
-                       <xs:enumeration value="Linux64" />
-                       <xs:enumeration value="OS/X32" />
-                       <xs:enumeration value="OS/X64" />
-                       <xs:enumeration value="GenericWin">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> Typically, this is used for
-                                               Windows Batch files. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:enumeration value="GenericNix">
-                               <xs:annotation>
-                                       <xs:documentation xml:lang="en-us"> Typically use for shell scripts -
-                                               valid for any Linux and Mac OS/X. </xs:documentation>
-                               </xs:annotation>
-                       </xs:enumeration>
-                       <xs:pattern value="[a-zA-Z]([a-zA-Z0-9])*" />
-               </xs:restriction>
-       </xs:simpleType>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+    targetNamespace="http://www.uefi.org/2011/1.1" xmlns="http://www.uefi.org/2011/1.1">
+    <xs:element name="DistributionPackage">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> This schema defines the UEFI/PI Distribution Package
+                description (PKG) file. It describes the content of:</xs:documentation>
+            <xs:documentation xml:lang="en-us"> 1) Package descriptions with definitions and
+                headers.</xs:documentation>
+            <xs:documentation xml:lang="en-us"> 2) Modules in either source or binary format. (Note
+                that Binary format is for FFS leaf section file types only, complete FFS files
+                cannot be distributed using this distribution format.) </xs:documentation>
+            <xs:documentation xml:lang="en-us"> 3) The distribution of custom tools used to modify
+                the binary images to create UEFI/PI compliant images. </xs:documentation>
+            <xs:documentation xml:lang="en-us"> 4) Finally, it can be used to distribute other
+                miscellaneous content that is not specific to UEFI/PI images. </xs:documentation>
+            <xs:documentation xml:lang="en-us"> The Package Surface Area describes the content of
+                packages, while the Module Surface Area provides information relevant to source
+                and/or binary distributions. </xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="DistributionHeader" minOccurs="1" maxOccurs="1">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This header contains (legal) information
+                            usually required for distributing both binary and/or source code.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element ref="PackageSurfaceArea" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The list of packages in this
+                            distribution. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Packages are groups of files and/or
+                            modules that are similar in nature.</xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Packages are uniquely identified by a
+                            package GUID and a package version. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> A package can declare public mappings of
+                            C names to GUID values. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> A package can provide header files for
+                            library classes and/or other industry standard definitions. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> A package can also declare public
+                            mappings of platform configuration database (PCD) &quot;knobs&quot; to
+                            control features and operation of modules within a platform. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Finally, a package lists the library
+                            instances and/or modules that are provided in a distribution package.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element ref="ModuleSurfaceArea" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The listing of UEFI/PI compliant modules
+                            in this distribution that are NOT part of a Package. Every module that
+                            is provided as part of a package needs to be described in a
+                            PackageSurfaceArea.Modules section. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> The ModuleSurfaceArea section describes
+                            how each module in a distribution is coded, or, in the case of a binary
+                            module distribution, how it was built. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> UEFI/PI compliant libraries and modules
+                            are uniquely identified by the Module's GUID and version number. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> This section will typically be used for
+                            modules that don't require any additional files that would be included
+                            in a package. For example, the Enhanced FAT driver binary does not need
+                            to have a package description, as no additional files are provided.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element ref="Tools" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is for distributing vendor
+                            specific executable tools, tool source code and/or configuration files.
+                            These tools are primarily for manipulating code and/or binary images. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Tools in this section
+                            can:</xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 1) Parse build meta-data files to create
+                            source code files and build scripts. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 2) Modify image files to conform to
+                            UEFI/PI specifications. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 3) Generate binary files from certain
+                            types of text/unicode files. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 4) Generate PCI Option Roms or Firmware
+                            Device images. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 5) Implement external
+                            encoding/decoding/signature/GUIDed tools. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 6) Distribution Package
+                            create/install/remove tools. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element ref="MiscellaneousFiles" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The list of miscellaneous files in this
+                            distribution. Any files that are not listed in either the Package,
+                            Module or Tools sections can be listed here. This section can be used to
+                            distribute specifications for packages and modules that are not
+                            &quot;industry standards&quot; such as a specification for a chipset or
+                            a video device. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element ref="UserExtensions" minOccurs="0" maxOccurs="unbounded">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The UserExtensions section is used to
+                            disseminate processing instructions that may be custom to the content
+                            provided by the distribution. This section contains information that is
+                            common to all aspects of this disribution. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+
+        </xs:complexType>
+    </xs:element>
+    <!-- End of the DistributionPackage Description  -->
+
+    <xs:element name="DistributionHeader">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> This section defines the content of the UEIF/PI
+                compliant Distribution Package Header. This is the only required element of a
+                UEFI/PI compliant distribution package. </xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="1" maxOccurs="1" name="Name">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This is the User Interface Name for this
+                            Distribution Package. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Each Distribution Package is uniquely
+                            identified by it's GUID and Version number. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:simpleContent>
+                            <xs:extension base="xs:normalizedString">
+                                <xs:attribute name="BaseName" type="xs:NMTOKEN" use="optional">
+                                    <xs:annotation>
+                                        <xs:documentation xml:lang="en-us"> The reference name of
+                                            the Distribution Package file. This single word name can
+                                            be used by tools as a keyword or for directory and/or
+                                            file creation. </xs:documentation>
+                                        <xs:documentation xml:lang="en-us"> White space and special
+                                            characters (dash and underscore characters may be used)
+                                            are not permitted in this name. </xs:documentation>
+                                    </xs:annotation>
+                                </xs:attribute>
+                            </xs:extension>
+                        </xs:simpleContent>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This 128-bit GUID and the Version
+                            attribute uniquely identify this Distribution Package. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Backward compatible releases of a
+                            distribution package need only change the version number, while
+                            non-backward compatible changes require the GUID to change (resetting
+                            the version number to 1.0 is optional.) </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:simpleContent>
+                            <xs:extension base="RegistryFormatGuid">
+                                <xs:attribute name="Version" type="xs:decimal" use="required">
+                                    <xs:annotation>
+                                        <xs:documentation xml:lang="en-us"> This value, along with
+                                            the GUID, is used to uniquely identify this object. The
+                                            higher the number, the more recent the content.
+                                        </xs:documentation>
+                                    </xs:annotation>
+                                </xs:attribute>
+                            </xs:extension>
+                        </xs:simpleContent>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="Vendor" type="xs:normalizedString">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A string identifying who created this
+                            distribution package. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="Date" type="xs:dateTime">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The date and time this distribution was
+                            created. The format is: YYYY-MM-DDThh:mm:ss, for example:
+                            2001-01-31T13:30:00 (note the T character separator between the calendar
+                            date and the time. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="Copyright" type="xs:string">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The copyright for this file that is
+                            generated by the creator of the distribution. If a derivative work is
+                            generated from an existing distribution, then the existing copyright
+                            must be maintained, and additional copyrights may be appended to the end
+                            of this element. It may also be the primary copyright for all code
+                            provided in the Distribution Package. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="License" type="xs:string">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A license that describes any
+                            restrictions on the use of this distribution. If a derivative work is
+                            allowed by the original license and a derivative work is generated from
+                            an existing distribution, then the existing license must be maintained,
+                            and additional licenses may be appended to the end of this element. It
+                            may also be the primary license for all code provided in the
+                            distribution file. Alternatively, this may point to a filename that
+                            contains the License. The file (included in the content zip file) will
+                            be stored in the same location as the distribution package's .pkg file.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="Abstract" type="xs:normalizedString">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A one line description of the
+                            Distribution Package. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="0" maxOccurs="1" name="Description" type="xs:string">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A complete description of the
+                            Distribution Package. This description may include the release name of
+                            the file, the version of the file, and a complete description of the
+                            file contents and/or features including a description of the updates
+                            since the previous file release. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="0" maxOccurs="1" name="Signature" type="Md5Sum">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The packaging utilities will use this
+                            MD5 sum value of the included ZIP file containing files and/or code. If
+                            this element is not present, then installation tools should assume that
+                            the content is correct, or that other methods may be needed to verify
+                            content. </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="1" name="XmlSpecification" type="xs:decimal"
+                    default="1.1">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This version of this XML Schema is 1.1 </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Changes to 1.1 from 1.0 </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> #1 Updated to present date and new
+                            version which is important to reflect the present state of the
+                            matter</xs:documentation>
+                        <xs:documentation xml:lang="en-us"> #2 Added definition/enumeration of
+                            UNDEFIND type 2 is important since there is a large body of legacy code
+                            for which the GUID’s and other code/data objects were not decorated with
+                            their usage. This document will allow for importing today’s source
+                            artifacts and producing decorations using the â€˜Undefined’ versus having
+                            an error</xs:documentation>
+                        <xs:documentation xml:lang="en-us">#3 Allow for inclusion of ARM and future
+                            architecture types</xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+            </xs:sequence>
+            <xs:attribute name="ReadOnly" type="xs:boolean" default="false" use="optional">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> If set to true, all content within this
+                        Distribution Package should NOT be modified. The default permits
+                        modification of all content. </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute name="RePackage" type="xs:boolean" default="false" use="optional">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> If set to true, then the content can be
+                        repackaged into another distribution package. The default prohibits
+                        repackaging the Distribution content. </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+        </xs:complexType>
+    </xs:element>
+    <!-- End of the DistributionHeader element. -->
+
+    <xs:element name="PackageSurfaceArea">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> A package is a collection of related objects -
+                Includes, Libraries and Modules. </xs:documentation>
+            <xs:documentation xml:lang="en-us"> Each package is uniquely identified by it's GUID and
+                Version number. Backward compatible releases of a package need only change the
+                version number, while non-backward compatible changes require the GUID to change
+                (resetting the version number to 1.0 is optional.) </xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+
+                <xs:element minOccurs="1" maxOccurs="1" name="Header">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="1" name="Name">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is the User Interface
+                                        Name for this package. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:normalizedString">
+                                            <xs:attribute name="BaseName" type="xs:NMTOKEN"
+                                                use="required">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This is a
+                                                  single word BaseName of the package. This BaseName
+                                                  can be used by tools as a keyword and for
+                                                  directory/file creation. </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This GUID and the Version
+                                        attribute uniquely identify a given package.
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="RegistryFormatGuid">
+                                            <xs:attribute name="Version" type="xs:decimal"
+                                                use="required">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. </xs:documentation>
+                                                  <xs:documentation xml:lang="en-us"> Backward
+                                                  compatible changes must make sure this number is
+                                                  incremented from the most recent version.
+                                                  Non-backward compatible changes require a new
+                                                  GUID, and the version can be reset.
+                                                  </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> If the package requires a
+                                        different copyright than the distribution package, this
+                                        element can list one or more copyright lines.
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> If the package requires
+                                        licenses that are different from the distribution package
+                                        license, this element can contain one or more license text
+                                        paragraphs (or license filenames.) </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
+                                type="xs:normalizedString">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> A one line description of
+                                        this package. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Description"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> A complete description of a
+                                        package. This description may include the release name of
+                                        the package, the version of the package, and a complete
+                                        description of the package contents and/or features
+                                        including a description of the updates since the previous
+                                        package’s release. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="1" maxOccurs="1" name="PackagePath"
+                                type="xs:anyURI">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This element is the location
+                                        (in the ZIP file) for the root directory of a package.
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea Header element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> The term cloned is used here to indicate
+                            that this package as been copied and modified to a completely different
+                            package. An example might be for a new generation of chipsets that have
+                            few or no elements in common with the original. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This GUID and the Version
+                                        attribute uniquely identify the Package that this Package
+                                        was copied from. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="RegistryFormatGuid">
+                                            <xs:attribute name="Version" type="xs:decimal"
+                                                use="required">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  the package that this package was cloned from.
+                                                  </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea ClonedFrom element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="LibraryClassDeclarations">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> Library Classes are public interfaces
+                            that can be used by modules. One or more library instances can implement
+                            a library class, however only one library instance can be linked to an
+                            individual module. This provides the platform integrator with the
+                            flexibility of choosing one library instance's implementation over a
+                            different library instance. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="LibraryClass">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile"
+                                            type="xs:anyURI">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> The header file
+                                                  provides definitions and function prototypes for a
+                                                  library class. Modules can be coded against these
+                                                  functions, using the definitions in this header,
+                                                  without concerning themselves about the libraries'
+                                                  implementation details. This is a PackagePath
+                                                  relative path and filename for the include file.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element minOccurs="0" maxOccurs="1"
+                                            name="RecommendedInstance">
+                                            <xs:complexType>
+                                                <xs:sequence>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="GUID">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This GUID and
+                                                  the Version attribute uniquely identify the
+                                                  Recommended Library Instance. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="RegistryFormatGuid">
+                                                  <xs:attribute name="Version" type="xs:decimal"
+                                                  use="optional">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. If this value is not specified, then
+                                                  any version of the library instance is
+                                                  recommended. </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:attribute>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                </xs:sequence>
+                                            </xs:complexType>
+                                        </xs:element>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Keyword" type="xs:NCName" use="required">
+                                        <xs:annotation>
+                                            <xs:documentation xml:lang="en-us"> The single word name
+                                                of the Library Class that module developers will use
+                                                to identify a library class dependency.
+                                            </xs:documentation>
+                                        </xs:annotation>
+                                    </xs:attribute>
+                                    <xs:attributeGroup ref="SupportedArchMod"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea LibraryClassDeclarations element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="IndustryStandardIncludes">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is used to list header
+                            files for industry standards not under the auspices of UEFI.org. For
+                            example, headers that contain definitions and data structures for the
+                            USB specifications. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded"
+                                name="IndustryStandardHeader">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile"
+                                            type="xs:anyURI">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> The package
+                                                  relative path and filename (in the content zip
+                                                  file) of the industry standard include file.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea IndustryStdIncludes element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PackageIncludes">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> All top level header files that are
+                            included by a package that are not listed above. They cannot
+                            be:</xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 1) Local to a module (module specific.) </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 2) An industry standard header. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> 3) A library class header.
+                        </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="PackageHeader">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="HeaderFile">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> This is the
+                                                  Package relative path and filename location within
+                                                  the content ZIP file. </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:complexType>
+                                                <xs:simpleContent>
+                                                  <xs:extension base="xs:anyURI">
+                                                  <xs:attributeGroup ref="SupportedArchMod"/>
+                                                  </xs:extension>
+                                                </xs:simpleContent>
+                                            </xs:complexType>
+                                        </xs:element>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea PackageIncluces element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="Modules">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element ref="ModuleSurfaceArea" minOccurs="1" maxOccurs="unbounded">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This section lists the
+                                        Module Surface Area for all modules provided with this
+                                        package. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea Modules element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="GuidDeclarations">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section defines the mapping of GUID
+                            C names to GUID values as a Registry Format GUID. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Modules that use these GUIDs must
+                            specify their dependency on this package. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> Individual GUID Declarations
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
+                                            type="RegistryFormatGuid"/>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="UiName" type="xs:normalizedString"
+                                        use="optional"/>
+                                    <xs:attribute name="GuidTypes" type="GuidListType"
+                                        use="optional"/>
+                                    <xs:attributeGroup ref="SupportedArchMod"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea GuidDeclarations element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="ProtocolDeclarations">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section defines the mapping of
+                            Protocol C names to GUID values as a Registry Format GUID. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Modules that use these Protocols must
+                            specify their dependency on this package. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> Individual Protocol
+                                        Declarations </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
+                                            type="RegistryFormatGuid"/>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="UiName" type="xs:normalizedString"
+                                        use="optional"/>
+                                    <xs:attributeGroup ref="SupportedArchMod"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea ProtocolDeclarations element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PpiDeclarations">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section defines the mapping of Ppi
+                            C names to GUID values as a Registry Format GUID. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Modules that use these Ppis must specify
+                            their dependency on this package. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Entry">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> Individual PPI Declarations
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="GuidValue"
+                                            type="RegistryFormatGuid"/>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="UiName" type="xs:normalizedString"
+                                        use="optional"/>
+                                    <xs:attributeGroup ref="SupportedArchMod"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea PpiDeclarations element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PcdDeclarations">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is used to declare platform
+                            configuration knobs that are defined by this package. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> Modules that use these PCD values must
+                            specify their dependency on this package. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdEntry">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1"
+                                            name="TokenSpaceGuidCname" type="xs:NCName">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> Specifies the C
+                                                  name of the Token Space GUID of which this PCD
+                                                  Entry is a member. This C name should also be
+                                                  listed in the GUIDs section, (specified above,)
+                                                  where the C name is assigned to a GUID value.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="Token">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> Specifies the
+                                                  32-bit token value for this PCD Entry. The Token
+                                                  number must be unique to the Token Space that
+                                                  declares the PCD. </xs:documentation>
+                                                <xs:documentation xml:lang="en-us"> The minLength of
+                                                  3 is required to handle the "0x" prefix to the hex
+                                                  number. </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:simpleType>
+                                                <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  <xs:maxLength value="10"/>
+                                                </xs:restriction>
+                                            </xs:simpleType>
+                                        </xs:element>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="DatumType"
+                                            type="PcdDatumTypes">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> A string that
+                                                  contains the data type of this PCD Entry. PCD data
+                                                  types are restricted to the following set:UINT8,
+                                                  UINT16, UINT32, UINT64, VOID*, BOOLEAN.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="ValidUsage"
+                                            type="PcdItemListType">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> A string that
+                                                  contains one or more PCD Item types separated by
+                                                  spaces. The PCD Item types are restricted to
+                                                  FeaturePcd, FixedPcd, PatchPcd, Pcd and/or PcdEx.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="DefaultValue"
+                                            type="xs:normalizedString"/>
+                                        <xs:element minOccurs="0" maxOccurs="1" name="MaxDatumSize">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> This is a
+                                                  recommended maximum data size for VOID* data
+                                                  types, the actual value should be defined by the
+                                                  Platform Integrator. It is not required for the
+                                                  other data types. </xs:documentation>
+                                                <xs:documentation xml:lang="en-us"> The minLength of
+                                                  3 is required to handle the "0x" prefix to the hex
+                                                  number. </xs:documentation>
+
+                                            </xs:annotation>
+                                            <xs:simpleType>
+                                                <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                </xs:restriction>
+                                            </xs:simpleType>
+                                        </xs:element>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+
+                                        <xs:element minOccurs="0" maxOccurs="unbounded"
+                                            name="PcdError">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> Valid Error
+                                                  messages that may be implemented in a module for
+                                                  the PCD Entry. Only One Error Number per PcdError,
+                                                  (multiple ErrorMessage entries are permitted) and
+                                                  multiple PcdError elements are permitted.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:complexType>
+                                                <xs:sequence>
+                                                  <xs:choice minOccurs="1" maxOccurs="1">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> One of the
+                                                  following types of comparisons, which must be able
+                                                  to evaluate to either true or false.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="ValidValueList">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The PCD Value
+                                                  must be space separated list of values. Values are
+                                                  restricted to the data type of this PCD.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="xs:normalizedString">
+                                                  <xs:attribute name="Lang" type="xs:language"
+                                                  use="optional"/>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="ValidValueRange" type="xs:normalizedString">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The PCD must
+                                                  be within a specifed range of numeric values.
+                                                  Restricted to C style Relational, Equality and
+                                                  Logicial Operators and parenthesis are valid. Only
+                                                  the CName for this PCD is permitted in the
+                                                  ValidValueRange expression. All other values must
+                                                  be numeric.</xs:documentation>
+                                                  <xs:documentation xml:lang="en-us"> LValue (op
+                                                  RValue)+ </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="Expression" type="xs:normalizedString">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> A in-fix
+                                                  logical expression using C style logical
+                                                  operators. </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:element>
+                                                  </xs:choice>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="ErrorNumber">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> A hexadecimal
+                                                  value for the error message as defined by
+                                                  specifications. </xs:documentation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="1" maxOccurs="unbounded"
+                                                  name="ErrorMessage">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This string
+                                                  should be defined by specifications. There are
+                                                  pre-defined error number ranges in the UEFI/PI
+                                                  specificaiton. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="xs:string">
+                                                  <xs:attribute name="Lang" type="xs:language"
+                                                  default="en-us" use="optional"/>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                </xs:sequence>
+                                            </xs:complexType>
+                                        </xs:element>
+                                    </xs:sequence>
+                                    <xs:attributeGroup ref="SupportedArchMod"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea PcdDeclarations element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PcdRelationshipChecks">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is used to describe any PCD
+                            interdependencies or relationships. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdCheck"
+                                type="xs:normalizedString">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This entry must used
+                                        TokenSpaceGuidCName.PcdCname for every named PCD. Restricted
+                                        to Relational, Equality and Logical Operators (NOT, AND, OR,
+                                        GT, GE, EQ, LE, LT and XOR) and parenthesis are valid. Only
+                                        the TokenSpaceGuidCName.PcdCname us permitted to name PCDs
+                                        in the expression. All other values must be numeric. </xs:documentation>
+                                    <xs:documentation xml:lang="en-us"> LValue (op RValue)+
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="MiscellaneousFiles">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section contains files that are not
+                            part of the code distributed with this package. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> Only required if different
+                                        from the Package Copyright. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> Only required if different
+                                        from the Package License. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Abstract" type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> A one line description of
+                                        this section's content. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="Description"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> A complete description of
+                                        the files in this section. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is the PackagePath
+                                        relative path and filename location within the ZIP file.
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:anyURI">
+                                            <xs:attribute name="Executable" type="xs:boolean"
+                                                default="false" use="optional">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> If true, used
+                                                  by installation tools to ensure that a file that
+                                                  must be executable has the correct properties to
+                                                  permit execution. </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea Misc element.  -->
+
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="UserExtensions">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is used for any processing
+                            instructions that may be custom to the content provided by this package
+                            that are common to this package. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType mixed="true">
+                        <xs:sequence>
+                            <xs:any processContents="lax" minOccurs="0" maxOccurs="1"/>
+                        </xs:sequence>
+                        <xs:attribute name="UserId" type="xs:NCName" use="required">
+                            <xs:annotation>
+                                <xs:documentation xml:lang="en-us"> This is a single word identifier
+                                    for grouping similar content that does not fit into previously
+                                    defined sections or other sections of the Distribution.
+                                </xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:attribute name="Identifier" type="xs:string" use="required">
+                            <xs:annotation>
+                                <xs:documentation xml:lang="en-us"> This can be used to
+                                    differentiate multiple sections with a grouping. </xs:documentation>
+                                <xs:documentation xml:lang="en-us"> For example, a PRE_PROCESS
+                                    Identifier might indicate specific steps and tools required
+                                    before processing module content, while a different
+                                    UserExtensions section with a POST_PROCESS Identifier might
+                                    describe steps that need to be executed after operations on the
+                                    modules in this package. </xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:anyAttribute processContents="lax"/>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageSurfaceArea UserExtensions element. -->
+
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <!-- End of the PackageSurfaceArea element. -->
+
+    <xs:element name="ModuleSurfaceArea">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> Each module is uniquely identified by it's GUID and
+                Version number. Backward compatible releases of a module need only change the
+                version number, while non-backward compatible changes require the GUID to change
+                (resetting the version number to 1.0 is optional.) </xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+
+                <xs:element minOccurs="1" maxOccurs="1" name="Header">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="1" name="Name">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is the User Interface
+                                        Name for this Module. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:normalizedString">
+                                            <xs:attribute name="BaseName" type="xs:NMTOKEN"
+                                                use="required">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This is a
+                                                  single word BaseName that will be used to create a
+                                                  module meta-data file. </xs:documentation>
+                                                  <xs:documentation xml:lang="en-us"> This name
+                                                  should also be used to create output file names
+                                                  and directories. </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This GUID and the Version
+                                        attribute uniquely identify a given Module.
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="RegistryFormatGuid">
+                                            <xs:attribute name="Version" type="xs:decimal"
+                                                use="required">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. </xs:documentation>
+                                                  <xs:documentation xml:lang="en-us"> Backward
+                                                  compatible changes must make sure this number is
+                                                  incremented from the most recent version.
+                                                  Non-backward compatible changes require a new
+                                                  GUID, and the version can be reset.
+                                                  </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        Copyright is different from either the Package or
+                                        Distribution copyright. Multiple copyright lines are
+                                        permitted within this section. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        license is different from either the Package or Distribution
+                                        license. Multiple licenses are permitted within this
+                                        section. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
+                                type="xs:normalizedString">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> A brief text description of
+                                        the module. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Description"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> A complete description of
+                                        the module contents and/or features including a description
+                                        of the updates since the previous module release.
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of Module Surface Area Header Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="ModuleProperties">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> List general information about a module,
+                            including the Supported Architectures, this module's type,
+                            specifications the module is coded against, and other informational
+                            content. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="1" name="ModuleType"
+                                type="ModuleTypes">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> One of the Enumerated module
+                                        types that limit the use of a module. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="1" maxOccurs="1" name="Path" type="xs:anyURI">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> For stand-alone modules that
+                                        are NOT part of any package, this is the path to the root of
+                                        the module as listed in the ZIP file. For modules included
+                                        in a package, this is the location, relative to the root of
+                                        the package (PackagePath) this module belongs to.
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="PcdIsDriver">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This element is only
+                                        required for the PEIM that produces the PCD PPI or the DXE
+                                        Driver that produces the PCD Protocol. </xs:documentation>
+                                </xs:annotation>
+                                <xs:simpleType>
+                                    <xs:restriction base="xs:NCName">
+                                        <xs:enumeration value="PEI_PCD_DRIVER"/>
+                                        <xs:enumeration value="DXE_PCD_DRIVER"/>
+                                    </xs:restriction>
+                                </xs:simpleType>
+                            </xs:element>
+
+                            <xs:element minOccurs="0" maxOccurs="1" name="UefiSpecificationVersion"
+                                type="xs:decimal"/>
+
+                            <xs:element minOccurs="0" maxOccurs="1" name="PiSpecificationVersion"
+                                type="xs:decimal"/>
+
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="Specification">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is a list of other
+                                        specifications that this module is written against. These
+                                        entries can be used in #define statements (depending on the
+                                        build system implementation, they may be autogenerated.)
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:NCName">
+                                            <xs:attribute name="Version" type="xs:decimal"
+                                                use="required"/>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="BootMode">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> Different firmware execution
+                                        paths may be taken based on a given state of the hardware,
+                                        firmware, or through feature settings. A BootMode may be
+                                        declared (PRODUCES) or discovered (CONSUMES) based on these
+                                        states and feature settings. If the usage is UNDEFINE, it
+                                        implies that a Boot Mode is used, but the package creator
+                                        does not know how it is used. The supported boot modes map
+                                        to the PI specification Boot Modes. The boot modes listed
+                                        with Recovery are to indicate that the BootMode is valid
+                                        during a recovery boot. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:sequence minOccurs="0">
+                                        <xs:element minOccurs="1" maxOccurs="1"
+                                            name="SupportedBootModes">
+                                            <xs:simpleType>
+                                                <xs:list>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="xs:NCName">
+                                                  <xs:enumeration value="FULL"/>
+                                                  <xs:enumeration value="MINIMAL"/>
+                                                  <xs:enumeration value="NO_CHANGE"/>
+                                                  <xs:enumeration value="DIAGNOSTICS"/>
+                                                  <xs:enumeration value="DEFAULT"/>
+                                                  <xs:enumeration value="S2_RESUME"/>
+                                                  <xs:enumeration value="S3_RESUME"/>
+                                                  <xs:enumeration value="S4_RESUME"/>
+                                                  <xs:enumeration value="S5_RESUME"/>
+                                                  <xs:enumeration value="FLASH_UPDATE"/>
+                                                  <xs:enumeration value="RECOVERY_FULL"/>
+                                                  <xs:enumeration value="RECOVERY_MINIMAL"/>
+                                                  <xs:enumeration value="RECOVERY_NO_CHANGE"/>
+                                                  <xs:enumeration value="RECOVERY_DIAGNOSTICS"/>
+                                                  <xs:enumeration value="RECOVERY_DEFAULT"/>
+                                                  <xs:enumeration value="RECOVERY_S2_RESUME"/>
+                                                  <xs:enumeration value="RECOVERY_S3_RESUME"/>
+                                                  <xs:enumeration value="RECOVERY_S4_RESUME"/>
+                                                  <xs:enumeration value="RECOVERY_S5_RESUME"/>
+                                                  <xs:enumeration value="RECOVERY_FLASH_UPDATE"/>
+                                                  <xs:enumeration value="UNDEFINED"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                </xs:list>
+                                            </xs:simpleType>
+                                        </xs:element>
+
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  always supports the given boot modes.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module may
+                                                  support a given mode on some execution paths.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  will change the boot mode. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIME_PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  will change the boot mode on some exection paths.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="UNDEFINED">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The package
+                                                  creator does not know how the boot mode is used.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="Event"
+                                nillable="true">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> The functions that make up
+                                        the Event, Timer, and Task Priority Services are used during
+                                        preboot to create, close, signal, and wait for events; to
+                                        set timers; and to raise and restore task priority levels as
+                                        defined in the UEFI specification. GUIDed events should be
+                                        listed in the Guids section. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  will register a notification function and calls
+                                                  the function when it is signaled.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  will register a notification function and calls
+                                                  the function when it is signaled on some execution
+                                                  paths. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  will signal all events in an event group.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  will signal all events in an event group under
+                                                  some execution paths. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="UNDEFINED">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The package
+                                                  creator does not know how an event is used.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="EventType" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="EVENT_TYPE_PERIODIC_TIMER"/>
+                                                <xs:enumeration value="EVENT_TYPE_RELATIVE_TIMER"/>
+                                                <xs:enumeration value="UNDEFINED"/>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+
+
+                                    </xs:attribute>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="HOB"
+                                nillable="false">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is a list of non-GUIDed
+                                        Hand Off Blocks (HOBs) produced or consumed by this module.
+                                    </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="HobType" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="PHIT"/>
+                                                <xs:enumeration value="MEMORY_ALLOCATION"/>
+                                                <xs:enumeration value="RESOURCE_DESCRIPTOR"/>
+                                                <xs:enumeration value="FIRMWARE_VOLUME"/>
+                                                <xs:enumeration value="LOAD_PEIM"/>
+                                                <xs:enumeration value="UNDEFINED"/>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> A HOB must be
+                                                  present in the system. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> If present,
+                                                  the HOB will be used. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The HOB is
+                                                  always produced by the module. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The HOB may be
+                                                  produced by the module under some execution paths.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="UNDEFINED">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The package
+                                                  creator knows that a HOB is used, but does not
+                                                  know how it is used. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+
+                        </xs:sequence>
+                        <xs:attributeGroup ref="SupportedArchMod"/>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of ModuleProperties Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="ClonedFrom">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section may be included for Modules
+                            that are copied from a different module. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This GUID and the Version
+                                        attribute uniquely identify the Module that this Module was
+                                        copied from. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="RegistryFormatGuid">
+                                            <xs:attribute name="Version" type="xs:decimal"
+                                                use="required">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!--  End of ClonedFrom Section. -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="LibraryClassDefinitions">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A list of the different Library Classes
+                            consumed by a driver, core and/or application module, or produced by a
+                            Library module. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="LibraryClass">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="Keyword"
+                                            type="xs:NCName">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us "> Used by tools
+                                                  to identify different instances of libraries that
+                                                  provide the library class. This keyword identifies
+                                                  the library class this module needs to be linked
+                                                  against. </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element minOccurs="0" maxOccurs="1"
+                                            name="RecommendedInstance">
+                                            <xs:complexType>
+                                                <xs:all>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="GUID">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This GUID and
+                                                  the Version attribute uniquely identify the
+                                                  recommended Library Instance for this module .
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="RegistryFormatGuid">
+                                                  <xs:attribute name="Version" type="xs:decimal"
+                                                  use="optional">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:attribute>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                </xs:all>
+                                            </xs:complexType>
+                                        </xs:element>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> Library
+                                                  instances can provide code for a library class, or
+                                                  may require other library instances themselves.
+                                                  Since different execution paths in a library (or
+                                                  module) may need different library classes based
+                                                  on some setting, library classes may not alway be
+                                                  required. </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="PRODUCES"/>
+                                                <xs:enumeration value="CONSUMES"/>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES"/>
+                                                <xs:enumeration value="UNDEFINED"/>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+
+                                    <xs:attributeGroup ref="SupportedArchMod"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional">
+                                        <xs:annotation>
+                                            <xs:documentation xml:lang="en-us"> A FeatureFlag
+                                                attribute must evaluate to either true or false - it
+                                                may be a fixed value of true or false, a C name or
+                                                an in-fix expression. </xs:documentation>
+                                        </xs:annotation>
+                                    </xs:attribute>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of LibraryClassDefinitions Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="SourceFiles">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is the module relative
+                                        (ModuleProperties.Path) path and filename location within
+                                        the ZIP file. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:anyURI">
+                                            <xs:attribute name="Family" type="FamilyTypes"
+                                                use="optional">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The Family
+                                                  attribute is used to restrict usage to a given
+                                                  family of compilers, such as GCC or MSFT. Since
+                                                  not all code processing tools use the same syntax,
+                                                  especially for assembly, this field can be used to
+                                                  identify different syntax. </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                            <xs:attribute name="SupArchList" type="ArchListType"
+                                                use="optional"/>
+                                            <xs:attribute name="SupModList" type="ModuleListType"
+                                                use="optional"/>
+                                            <xs:attribute name="FeatureFlag"
+                                                type="xs:normalizedString" use="optional"/>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element ref="HelpText" minOccurs="0" maxOccurs="unbounded"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of SourceFiles Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="BinaryFiles">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="BinaryFile">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="unbounded"
+                                            name="Filename">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> This is the
+                                                  module relative (ModuleProperties.Path) path and
+                                                  filename location within the ZIP file.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:complexType>
+                                                <xs:simpleContent>
+                                                  <xs:extension base="xs:anyURI">
+                                                  <xs:attribute name="FileType" use="optional">
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="xs:NCName">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> Binary file
+                                                  distribution is limited to UEFI/PI FFS leaf
+                                                  section file types. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:enumeration value="GUID"/>
+                                                  <xs:enumeration value="FREEFORM"/>
+                                                  <xs:enumeration value="UEFI_IMAGE"/>
+                                                  <xs:enumeration value="PE32">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> A UEFI/PI FFS
+                                                  Leaf section file type, not a raw PE32 file.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:enumeration>
+                                                  <xs:enumeration value="PIC"/>
+                                                  <xs:enumeration value="PEI_DEPEX"/>
+                                                  <xs:enumeration value="DXE_DEPEX"/>
+                                                  <xs:enumeration value="SMM_DEPEX"/>
+                                                  <xs:enumeration value="COMPAT16"/>
+                                                  <xs:enumeration value="DISPOSABLE"/>
+                                                  <xs:enumeration value="TE"/>
+                                                  <xs:enumeration value="VER"/>
+                                                  <xs:enumeration value="UI"/>
+                                                  <xs:enumeration value="BIN"/>
+                                                  <xs:enumeration value="FV"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:attribute>
+                                                  <xs:attribute name="SupArchList"
+                                                  type="ArchListType" use="optional"/>
+                                                  <xs:attribute name="SupModList"
+                                                  type="ModuleListType" use="optional"/>
+                                                  <xs:attribute name="FeatureFlag"
+                                                  type="xs:normalizedString" use="optional"/>
+                                                  </xs:extension>
+                                                </xs:simpleContent>
+                                            </xs:complexType>
+                                        </xs:element>
+                                        <xs:element minOccurs="0" maxOccurs="unbounded"
+                                            name="AsBuilt">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> This section
+                                                  contains information about how the module was
+                                                  coded, such as Compiler Tools, Flags, PCDs (only
+                                                  PatchPcd and/or PcdEx) and Library Class Instances
+                                                  used to build the binary. </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:complexType>
+                                                <xs:sequence>
+
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="PatchPcdValue">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The element is
+                                                  the Patchable PCD Value that was used during the
+                                                  build. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:sequence>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="TokenSpaceGuidValue"
+                                                  type="RegistryFormatGuid"/>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="PcdCName" type="xs:NCName"/>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="Token">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  <xs:maxLength value="10"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="DatumType" type="PcdDatumTypes"/>
+                                                  <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="MaxDatumSize">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This field is
+                                                  required if the Pcd Datum Type is VOID* </xs:documentation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="Value" type="xs:normalizedString"/>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="Offset">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element ref="HelpText" minOccurs="0"
+                                                  maxOccurs="unbounded"/>
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="PcdError">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> Error
+                                                  information implemented by the module.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:sequence>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="ErrorNumber">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="ErrorMessage">
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="xs:string">
+                                                  <xs:attribute name="Lang" type="xs:language"
+                                                  default="en-us" use="optional"/>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                  </xs:sequence>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                  </xs:sequence>
+                                                  </xs:complexType>
+                                                  </xs:element>
+
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="PcdExValue">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The element is
+                                                  the DynamicEx PCD Value that was used during the
+                                                  build. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:sequence>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="TokenSpaceGuidValue"
+                                                  type="RegistryFormatGuid"/>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="Token">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  <xs:maxLength value="10"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="DatumType" type="PcdDatumTypes"/>
+                                                  <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="MaxDatumSize">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This field is
+                                                  required if the Pcd Datum Type is VOID*
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="Value" type="xs:normalizedString"/>
+                                                  <xs:element ref="HelpText" minOccurs="0"
+                                                  maxOccurs="unbounded"/>
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="PcdError">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> Error
+                                                  information implemented by the module.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:sequence>
+                                                  <xs:element minOccurs="1" maxOccurs="1"
+                                                  name="ErrorNumber">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The minLength
+                                                  of 3 is required to handle the "0x" prefix to the
+                                                  hex number. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:simpleType>
+                                                  <xs:restriction base="HexNumber">
+                                                  <xs:minLength value="3"/>
+                                                  </xs:restriction>
+                                                  </xs:simpleType>
+                                                  </xs:element>
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="ErrorMessage">
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="xs:string">
+                                                  <xs:attribute name="Lang" type="xs:language"
+                                                  default="en-us" use="optional"/>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                  </xs:sequence>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                  </xs:sequence>
+                                                  </xs:complexType>
+                                                  </xs:element>
+
+                                                  <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="LibraryInstances">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This is the
+                                                  actual library instance that was used to link
+                                                  against the module. </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:sequence>
+                                                  <xs:element minOccurs="1" maxOccurs="unbounded"
+                                                  name="GUID">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This GUID and
+                                                  the Version attribute uniquely identify the actual
+                                                  Library Instance linked in this module.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:complexType>
+                                                  <xs:simpleContent>
+                                                  <xs:extension base="RegistryFormatGuid">
+                                                  <xs:attribute name="Version" type="xs:decimal"
+                                                  use="required">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:attribute>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                  </xs:sequence>
+                                                  </xs:complexType>
+                                                  </xs:element>
+
+                                                  <xs:element minOccurs="0" maxOccurs="unbounded"
+                                                  name="BuildFlags">
+                                                  <xs:complexType mixed="true">
+                                                  <xs:simpleContent>
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> Any
+                                                  description of OS, Tool, and flags for the
+                                                  individual tool can go in this section.
+                                                  </xs:documentation>
+                                                  </xs:annotation>
+                                                  <xs:extension base="xs:string">
+                                                  <xs:anyAttribute processContents="lax"/>
+                                                  </xs:extension>
+                                                  </xs:simpleContent>
+                                                  </xs:complexType>
+                                                  </xs:element>
+                                                </xs:sequence>
+                                            </xs:complexType>
+                                        </xs:element>
+                                        <!-- End of AsBuilt -->
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                </xs:complexType>
+                            </xs:element>
+
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of BinaryFiles Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PackageDependencies">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Package">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="0" maxOccurs="unbounded"
+                                            name="Description">
+                                            <xs:complexType>
+                                                <xs:simpleContent>
+                                                  <xs:extension base="xs:string">
+                                                  <xs:attribute name="Lang" type="xs:language"
+                                                  default="en-us" use="optional"/>
+                                                  </xs:extension>
+                                                </xs:simpleContent>
+                                            </xs:complexType>
+                                        </xs:element>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="GUID">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> This GUID and
+                                                  the Version attribute uniquely identify Package
+                                                  that this Module depends on. </xs:documentation>
+                                            </xs:annotation>
+                                            <xs:complexType>
+                                                <xs:simpleContent>
+                                                  <xs:extension base="RegistryFormatGuid">
+                                                  <xs:attribute name="Version" type="xs:decimal"
+                                                  use="optional">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> This value,
+                                                  along with the GUID, is used to uniquely identify
+                                                  this object. If the version attribute is not
+                                                  specified, the most recent version of the package
+                                                  can be used. </xs:documentation>
+                                                  </xs:annotation>
+                                                  </xs:attribute>
+                                                  </xs:extension>
+                                                </xs:simpleContent>
+                                            </xs:complexType>
+                                        </xs:element>
+                                    </xs:sequence>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="SupModList" type="ModuleListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PackageDependencies -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="Guids">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="GuidCName">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element minOccurs="0" maxOccurs="1" name="VariableName"
+                                            type="xs:normalizedString">
+                                            <xs:annotation>
+                                                <xs:documentation xml:lang="en-us"> Only valid for
+                                                  Variable GUID types. </xs:documentation>
+                                                <xs:documentation> This can be either a Hex Array or
+                                                  C string in unicode format: L"string" Data.
+                                                </xs:documentation>
+                                            </xs:annotation>
+                                        </xs:element>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us">The module does
+                                                  not install the GUID, and the GUID must be present
+                                                  for the module to execute. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  does not install the GUID, however, the GUID will
+                                                  be used if it is present. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The module
+                                                  always installs the GUID. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="SOMETIMES_PRODUCES">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The Module
+                                                  will install the GUID under certain execution
+                                                  paths. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                                <xs:enumeration value="UNDEFINED">
+                                                  <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> The package
+                                                  creator knows that a GUID is used, but does not
+                                                  know how it is used. </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:enumeration>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="GuidType" type="GuidListType" use="required"/>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="SupModList" type="ModuleListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of Guids Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="Protocols">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A listing of protocols required or
+                            produced by this module. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Protocol"
+                                nillable="true">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="PRODUCES"/>
+                                                <xs:enumeration value="SOMETIMES_PRODUCES"/>
+                                                <xs:enumeration value="CONSUMES"/>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES"/>
+                                                <xs:enumeration value="TO_START"/>
+                                                <xs:enumeration value="BY_START"/>
+                                                <xs:enumeration value="UNDEFINED"/>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="Notify" type="xs:boolean" use="optional"/>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="SupModList" type="ModuleListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of Protocols Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PPIs">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> A listing of PPIs required or produced
+                            by this module. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Ppi"
+                                nillable="true">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="Usage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="PRODUCES"/>
+                                                <xs:enumeration value="SOMETIMES_PRODUCES"/>
+                                                <xs:enumeration value="CONSUMES"/>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES"/>
+                                                <xs:enumeration value="UNDEFINED"/>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+                                    </xs:attribute>
+                                    <xs:attribute name="Notify" type="xs:boolean" use="optional"/>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="SupModList" type="ModuleListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PPIs Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="Externs">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> These elements specify additional
+                            information about the module. This area may be used by tools to generate
+                            code. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Extern">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:choice minOccurs="1">
+                                            <xs:sequence>
+                                                <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="EntryPoint" type="xs:NCName"/>
+                                                <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="UnloadImage" type="xs:NCName"/>
+                                            </xs:sequence>
+                                            <xs:sequence>
+                                                <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="Constructor" type="xs:NCName"/>
+                                                <xs:element minOccurs="0" maxOccurs="1"
+                                                  name="Destructor" type="xs:NCName"/>
+                                            </xs:sequence>
+                                        </xs:choice>
+                                        <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="SupModList" type="ModuleListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of Externs Section -->
+
+                <xs:element minOccurs="0" maxOccurs="1" name="PcdCoded">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section describes how a platform is
+                            coded with respect to the platform configuration knobs.
+                        </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="PcdEntry">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element minOccurs="1" maxOccurs="1" name="CName"
+                                            type="xs:NCName"/>
+                                        <xs:element minOccurs="1" maxOccurs="1"
+                                            name="TokenSpaceGuidCName" type="xs:NCName"/>
+                                        <xs:element minOccurs="0" maxOccurs="1" name="DefaultValue"
+                                            type="xs:normalizedString"/>
+                                        <xs:element ref="HelpText" minOccurs="0"
+                                            maxOccurs="unbounded"/>
+                                    </xs:sequence>
+                                    <xs:attribute name="PcdItemType" type="PcdItemTypes"
+                                        use="required"/>
+                                    <xs:attribute name="PcdUsage" use="required">
+                                        <xs:simpleType>
+                                            <xs:restriction base="xs:NCName">
+                                                <xs:enumeration value="PRODUCES"/>
+                                                <xs:enumeration value="SOMETIMES_PRODUCES"/>
+                                                <xs:enumeration value="CONSUMES"/>
+                                                <xs:enumeration value="SOMETIMES_CONSUMES"/>
+                                                <xs:enumeration value="UNDEFINED"/>
+                                            </xs:restriction>
+                                        </xs:simpleType>
+
+
+                                    </xs:attribute>
+                                    <xs:attribute name="SupArchList" type="ArchListType"
+                                        use="optional"/>
+                                    <xs:attribute name="SupModList" type="ModuleListType"
+                                        use="optional"/>
+                                    <xs:attribute name="FeatureFlag" type="xs:normalizedString"
+                                        use="optional"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PcdCoded Section -->
+
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="PeiDepex">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This is the PEI dependency expression
+                            for a Dependency Section. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="Expression" type="xs:string" minOccurs="1"
+                                maxOccurs="1">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> An in-fix expression, of C
+                                        identifiers and TRUE, FALSE, AND, OR, NOT, BEFORE, and AFTER
+                                        as well as parenthesis () in the in-fix notation. The
+                                        operators are restricted to grammar defined in the PI
+                                        specification. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+                        </xs:sequence>
+                        <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+                        <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+                        <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of PeiDepex Section -->
+
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="DxeDepex">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This is the DXE dependency expression
+                            for a Dependency Section. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="Expression" type=" xs:string " minOccurs="1"
+                                maxOccurs="1">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> An in-fix expression, of C
+                                        identifiers and TRUE, FALSE, AND, OR, NOT, BEFORE, and AFTER
+                                        as well as parenthesis () in the in-fix notation. The
+                                        operators are restricted to grammar defined in the PI
+                                        specification. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+                        </xs:sequence>
+                        <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+                        <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+                        <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of DxeDepex Section -->
+
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="SmmDepex">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This is the SMM dependency expression
+                            for a Dependency Section. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="Expression" type=" xs:string " minOccurs="1"
+                                maxOccurs="1">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> An in-fix expression, of C
+                                        identifiers and TRUE, FALSE, AND, OR, NOT, BEFORE, and AFTER
+                                        as well as parenthesis () in the in-fix notation. The
+                                        operators are restricted to grammar defined in the PI
+                                        specification. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element ref="HelpText" minOccurs="0" maxOccurs="1"/>
+                        </xs:sequence>
+                        <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+                        <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+                        <xs:attribute name="FeatureFlag" type="xs:normalizedString" use="optional"/>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of SmmDepex Section -->
+
+
+                <xs:element minOccurs="0" maxOccurs="1" name="MiscellaneousFiles">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is used to provide comments
+                            and/or list auxiliary files, such as pdb or map files.
+                        </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:string">
+                                            <xs:attribute name="Lang" type="xs:language"
+                                                default="en-us" use="optional"/>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is the path and
+                                        filename location within the ZIP file. </xs:documentation>
+                                </xs:annotation>
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:anyURI">
+                                            <xs:attribute name="Executable" type="xs:boolean"
+                                                default="false" use="optional">
+                                                <xs:annotation>
+                                                  <xs:documentation xml:lang="en-us"> If true, used
+                                                  by installation tools to ensure that a file that
+                                                  must be executable has the correct properties to
+                                                  permit execution. </xs:documentation>
+                                                </xs:annotation>
+                                            </xs:attribute>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of Module Surface Area Misc Section -->
+
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="UserExtensions">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This section is used for any processing
+                            instructions that may be custom to the content provided by the
+                            distribution that are common to module. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> The content is vendor specific. </xs:documentation>
+                        <xs:documentation xml:lang="en-us"> The content can be plain text as well as
+                            any user-defined, properly formatted XML structure. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType mixed="true">
+                        <xs:attribute name="UserId" type="xs:NCName" use="required">
+                            <xs:annotation>
+                                <xs:documentation xml:lang="en-us"> This is a single word identifier
+                                    for grouping similar content. For example, ReferenceBuild might
+                                    be used to identify non-PI compliant build steps, with two
+                                    different UserExtensions sections, one with an Identifier of
+                                    Prebuild, and another of PostBuild. Both UserExtensions sections
+                                    would use the same UserId. </xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:attribute name="Identifier" type="xs:string" use="required">
+                            <xs:annotation>
+                                <xs:documentation xml:lang="en-us"> This can be any string used to
+                                    differentiate or identify this section from other UserExtensions
+                                    sections. </xs:documentation>
+                                <xs:documentation xml:lang="en-us"> For example, a PRE_PROCESS
+                                    Identifier might indicate specific steps and tools required
+                                    before processing module content, while a different
+                                    UserExtensions section with a POST_PROCESS Identifier might
+                                    describe steps that need to be executed after operations on this
+                                    module. </xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:anyAttribute processContents="lax"/>
+                    </xs:complexType>
+                </xs:element>
+                <!-- End of Module Surface Area UserExtensions Section -->
+
+            </xs:sequence>
+            <xs:attribute name="BinaryModule" type="xs:boolean" default="false" use="optional">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This attribute is used when the binaries are
+                        distributed for this module and no code generation from source files is
+                        required. If set, then the BinaryFiles section should be used, and any files
+                        listed in the SourceFiles section do not have to be built. Additionally, the
+                        AsBuilt section for each binary file must be included. </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+        </xs:complexType>
+
+    </xs:element>
+    <!-- End of the ModuleSurfaceArea element. -->
+
+    <xs:element name="Tools">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="0" maxOccurs="1" name="Header">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="1" maxOccurs="1" name="Name"
+                                type="xs:normalizedString">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us">This is the User Interface
+                                        Name for this Tools Distribution.</xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        Copyright is different from the Distribution Package
+                                        copyright. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        License is different from the Distribution Package license.
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
+                                type="xs:normalizedString">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        Abstract is different from the Distribution Package
+                                        Abstract. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Description"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        Description is different from the Distribution Package
+                                        Description. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element minOccurs="1" maxOccurs="unbounded" name="Filename">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This is the path and filename location
+                            within the ZIP file. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:simpleContent>
+                            <xs:extension base="xs:anyURI">
+                                <xs:attribute name="OS" type="SupportedOs" use="optional">
+                                    <xs:annotation>
+                                        <xs:documentation xml:lang="en-us"> This is required for
+                                            tools that execute; it should not be used for
+                                            configuration files. </xs:documentation>
+                                    </xs:annotation>
+                                </xs:attribute>
+                                <xs:attribute name="Executable" type="xs:boolean" default="false"
+                                    use="optional">
+                                    <xs:annotation>
+                                        <xs:documentation xml:lang="en-us"> If true, used by
+                                            installation tools to ensure that a file that must be
+                                            executable has the correct properties to permit
+                                            execution. </xs:documentation>
+                                    </xs:annotation>
+                                </xs:attribute>
+                            </xs:extension>
+                        </xs:simpleContent>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <!-- End of the Tools element. -->
+
+    <xs:element name="MiscellaneousFiles">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> This section contains a list of files that are not
+                part of the code distributed with modules, packages or tools. </xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="0" maxOccurs="1" name="Header">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Name"
+                                type="xs:normalizedString">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> The User interface name for
+                                        this content. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Copyright"
+                                type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        Copyright is different from the Distribution Package
+                                        Copyright. </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="License" type="xs:string">
+                                <xs:annotation>
+                                    <xs:documentation xml:lang="en-us"> This is only required if the
+                                        License is different from the Distribution Package License.
+                                    </xs:documentation>
+                                </xs:annotation>
+                            </xs:element>
+                            <xs:element minOccurs="0" maxOccurs="1" name="Abstract"
+                                type="xs:normalizedString"/>
+                            <xs:element minOccurs="0" maxOccurs="unbounded" name="Description">
+                                <xs:complexType>
+                                    <xs:simpleContent>
+                                        <xs:extension base="xs:string">
+                                            <xs:attribute name="Lang" type="xs:language"
+                                                default="en-us" use="optional"/>
+                                        </xs:extension>
+                                    </xs:simpleContent>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element minOccurs="0" maxOccurs="unbounded" name="Filename">
+                    <xs:annotation>
+                        <xs:documentation xml:lang="en-us"> This is the path and filename location
+                            within the ZIP file. </xs:documentation>
+                    </xs:annotation>
+                    <xs:complexType>
+                        <xs:simpleContent>
+                            <xs:extension base="xs:anyURI">
+                                <xs:attribute name="Executable" type="xs:boolean" default="false"
+                                    use="optional">
+                                    <xs:annotation>
+                                        <xs:documentation xml:lang="en-us"> If true, used by
+                                            installation tools to ensure that a file that must be
+                                            executable has the correct properties to permit
+                                            execution. </xs:documentation>
+                                    </xs:annotation>
+                                </xs:attribute>
+                            </xs:extension>
+                        </xs:simpleContent>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <!-- End of the Misc element. -->
+
+    <xs:element name="UserExtensions">
+        <xs:complexType mixed="true">
+            <xs:sequence>
+                <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+            </xs:sequence>
+            <xs:attribute name="UserId" type="xs:NCName" use="required">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This is a single word identifier for
+                        grouping similar content. For example, ReferenceBuild might be used to
+                        identify non-PI compliant build steps, with two different UserExtensions
+                        sections, one with an Identifier of Prebuild, and another of PostBuild. Both
+                        UserExtensions sections would use the same UserId. </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute name="Identifier" type="xs:string" use="optional">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This can be any string used to differentiate
+                        or identify this section from other UserExtensions sections. </xs:documentation>
+                    <xs:documentation xml:lang="en-us"> For example, a PRE_PROCESS Identifier might
+                        indicate specific steps and tools required before processing distribution
+                        package content, while a different UserExtensions section with a
+                        POST_PROCESS Identifier might describe steps that need to be executed after
+                        operations on this content. </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:anyAttribute processContents="lax"/>
+        </xs:complexType>
+    </xs:element>
+    <!-- The following elsements are common definitions used with the ref attribute for elements. -->
+
+    <xs:element name="HelpText">
+        <xs:complexType>
+            <xs:simpleContent>
+                <xs:extension base="xs:string">
+                    <xs:attribute name="Lang" type="xs:language" default="en-us" use="optional"/>
+                </xs:extension>
+            </xs:simpleContent>
+        </xs:complexType>
+    </xs:element>
+
+    <!-- The following attribute groups are used in various elements above. -->
+
+    <xs:attributeGroup name="SupportedArchMod">
+        <xs:attribute name="SupArchList" type="ArchListType" use="optional"/>
+        <xs:attribute name="SupModList" type="ModuleListType" use="optional"/>
+    </xs:attributeGroup>
+
+    <!-- The following data types are used to restrict content. -->
+
+    <xs:simpleType name="ArchListType">
+        <xs:list itemType="ArchTypes"/>
+    </xs:simpleType>
+
+    <xs:simpleType name="ArchTypes">
+        <xs:restriction base="xs:NCName">
+            <xs:enumeration value="IA32"/>
+            <xs:enumeration value="X64"/>
+            <xs:enumeration value="IPF"/>
+            <xs:enumeration value="EBC"/>
+            <xs:pattern value="([A-Z])([a-zA-Z0-9])*">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> Any processor architecture not listed above.
+                        The Architecture must be a target architecture of one or more compiler tool
+                        chains. </xs:documentation>
+                </xs:annotation>
+            </xs:pattern>
+        </xs:restriction>
+    </xs:simpleType>
+
+
+    <xs:simpleType name="FamilyTypes">
+        <xs:restriction base="xs:NCName">
+            <xs:enumeration value="MSFT"/>
+            <xs:enumeration value="GCC"/>
+            <xs:pattern value="[A-Z][a-zA-Z0-9]*">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> Any other family of build utilities for
+                        which compiler tools exist. </xs:documentation>
+                </xs:annotation>
+            </xs:pattern>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="GuidListType">
+        <xs:list itemType="GuidTypes"/>
+    </xs:simpleType>
+
+    <xs:simpleType name="GuidTypes">
+        <xs:restriction base="xs:NCName">
+            <xs:enumeration value="Event"/>
+            <xs:enumeration value="File"/>
+            <xs:enumeration value="FV"/>
+            <xs:enumeration value="GUID"/>
+            <xs:enumeration value="Hii"/>
+            <xs:enumeration value="HOB"/>
+            <xs:enumeration value="SystemTable"/>
+            <xs:enumeration value="TokenSpaceGuid"/>
+            <xs:enumeration value="Variable"/>
+            <xs:enumeration value="UNDEFINED"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="HexNumber">
+        <xs:restriction base="xs:hexBinary">
+            <xs:pattern value="0x([a-fA-F0-9])+"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="Md5Sum">
+        <xs:restriction base="xs:normalizedString">
+            <xs:pattern value="[a-zA-Z0-9]{32}"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="ModuleListType">
+        <xs:list itemType="ModuleTypes"/>
+    </xs:simpleType>
+
+    <xs:simpleType name="ModuleTypes">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> The following module types are defined by
+                specifications. </xs:documentation>
+            <xs:documentation xml:lang="en-us"> Module types for components and libraries defined
+                for this distribution mechanism. </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:NCName">
+            <xs:enumeration value="BASE ">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> Use of this module is not restricted.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="DXE_CORE">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to the DXE
+                        core. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="DXE_DRIVER">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to a DXE
+                        driver. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="DXE_RUNTIME_DRIVER">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to a DXE
+                        runtime driver. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="DXE_SAL_DRIVER">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to an IPF DXE
+                        runtime driver. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="DXE_SMM_DRIVER">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to a DXE SMM
+                        driver. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="PEI_CORE">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to the PEI
+                        core. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="PEIM">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only valid for PEI modules.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="SEC">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to Security
+                        phase. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="UEFI_DRIVER">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only valid for UEFI drivers.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="UEFI_RUNTIME_DRIVER">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only valid for UEFI runtime
+                        drivers.</xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="UEFI_APPLICATION">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only valid for UEFI
+                        applications. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="SMM_CORE">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This module is only applicable to the SMM
+                        core.</xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="USER_DEFINED">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This content is restricted to a specific
+                        implementation. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="UNDEFINED">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This enumeration is for use in a list that
+                        where the package creator does not know the what module types are supported
+                        by a module. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:pattern value="([A-Z])([a-zA-Z0-9])*">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This pattern has been added for use in a
+                        module lists - for future expansion. </xs:documentation>
+                </xs:annotation>
+            </xs:pattern>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="PcdDatumTypes">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> The following data types are defined by the PCD
+                specification (or PCD section of the UEFI/PI specifications.) </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:normalizedString">
+            <xs:enumeration value="UINT8"/>
+            <xs:enumeration value="UINT16"/>
+            <xs:enumeration value="UINT32"/>
+            <xs:enumeration value="UINT64"/>
+            <xs:enumeration value="BOOLEAN"/>
+            <xs:enumeration value="VOID*"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="PcdItemListType">
+        <xs:list itemType="PcdItemTypes"/>
+    </xs:simpleType>
+
+    <xs:simpleType name="PcdItemTypes">
+        <xs:restriction base="xs:NCName">
+            <xs:enumeration value="FeaturePcd">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> The Feature PCD is a binary, evaluating to
+                        either true or false. This is used during build to include/exclude content.
+                        It can also be used during execution to force execution paths within
+                        drivers, or to enable/disable features within a driver for a given platform.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="FixedPcd">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> The Fixed PCD is a #define value that is set
+                        at build time. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="PatchPcd">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> The Patch PCD is a #define that is set at
+                        build time, and that can be modified within a binary file. Additional
+                        information, such as the offset location of the value, along with it's
+                        length may need to be provided.</xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="Pcd">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> This PCD type has an overloaded definition.
+                        Prior to build, the platform integrator may choose to implement a PCD as
+                        Fixed, Patchable or a Dynamic PCD. If the platform integrator choose to use
+                        the PCD as dynamic, then a PCD driver is required in the platform
+                        (PEI/DXE/both) to track the PCD in some sort of 'database' of these items.
+                        For Dynamic PCDs, the PcdGet* must pass in the token space guid and the
+                        token number to retrieve data (PcdSet* also needs these values.)
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="PcdEx">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> The PCD can only be used as Dynamic, and the
+                        platform firmware must contain a driver to maintain a 'database' of these
+                        items. For Dynamic PCDs, the PcdGet* must pass in the token space guid and
+                        the token number to retrieve data (PcdSet* also needs these values.)
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+        </xs:restriction>
+    </xs:simpleType>
+
+
+
+    <xs:simpleType name="RegistryFormatGuid">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> A GUID must contain five different Hexadecimal
+                character sets that are separated by a dash (-) character. </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:pattern
+                value="\s*[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\s*"
+            />
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="SupportedOs">
+        <xs:annotation>
+            <xs:documentation xml:lang="en-us"> The EDK II build system supports workstations
+                running one of the following supported operating systems. This is the OS for the
+                developer's workstation, not the target platform. </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="Win32">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> For Windows 2003, Windows XP and Windows
+                        Vista. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="Win64">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> For Windows 2003, Windows XP and Windows
+                        Vista. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="Linux32"/>
+            <xs:enumeration value="Linux64"/>
+            <xs:enumeration value="OS/X32"/>
+            <xs:enumeration value="OS/X64"/>
+            <xs:enumeration value="GenericWin">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> Typically, this is used for Windows Batch
+                        files. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:enumeration value="GenericNix">
+                <xs:annotation>
+                    <xs:documentation xml:lang="en-us"> Typically use for shell scripts - valid for
+                        any Linux and Mac OS/X. </xs:documentation>
+                </xs:annotation>
+            </xs:enumeration>
+            <xs:pattern value="[a-zA-Z]([a-zA-Z0-9])*"/>
+        </xs:restriction>
+    </xs:simpleType>
 
 </xs:schema>
index ff5af1ce783928769efbe6e583d20e5a5b430c35..652c9f3ee71835772562035341ea5038a96855fb 100644 (file)
         #\r
         #The below 2 lines are only needed for UNIXGCC tool chain, which genereates PE image directly\r
         #\r
-        -$(OBJCOPY) --add-gnu-debuglink=$(DEBUG_DIR)(+)$(MODULE_NAME).debug ${src}\r
+        -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}\r
         -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)\r
 \r
         "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)\r
index c8af70495d30acd6454385f8c1856593564de6ae..f1176d62146994e8b94328d2e9a3482fc1bdf8d3 100644 (file)
@@ -1969,6 +1969,8 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS    = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF
 *_*_*_OBJCOPY_FLAGS             = objcopy not needed for\r
 *_*_*_SYMRENAME_PATH            = echo\r
 *_*_*_SYMRENAME_FLAGS           = Symbol renaming not needed for\r
+DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)\$(MODULE_NAME).debug\r
+RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =\r
 \r
 DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h\r
 DEFINE GCC_IA32_CC_FLAGS           = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe\r
@@ -2473,7 +2475,7 @@ DEFINE GCC45_ASM_FLAGS               = DEF(GCC44_ASM_FLAGS)
 \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
-*_ELFGCC_IA32_DLINK_FLAGS           = -melf_i386 -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)\r
+*_ELFGCC_IA32_DLINK_FLAGS           = -melf_i386 -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
 #*_ELFGCC_IA32_DLINK_FLAGS          = -melf_i386 -nostdlib -n -q -Ttext 0x220 --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)\r
 *_ELFGCC_IA32_ASM_FLAGS             = -m32 -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
@@ -2496,7 +2498,7 @@ DEFINE GCC45_ASM_FLAGS               = DEF(GCC44_ASM_FLAGS)
 *_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
+*_ELFGCC_X64_DLINK_FLAGS           = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
 *_ELFGCC_X64_SLINK_FLAGS           =\r
 *_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
@@ -2518,7 +2520,7 @@ DEFINE GCC45_ASM_FLAGS               = DEF(GCC44_ASM_FLAGS)
 *_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
+*_ELFGCC_IPF_DLINK_FLAGS          = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map\r
 *_ELFGCC_IPF_SLINK_FLAGS          =\r
 *_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
index 37691e98fd985b01d06e72ccb5347a1238ddf8aa..beda3a81a61ce8d8977e21a94b14289fcf21efbb 100644 (file)
@@ -49,122 +49,4 @@ Current state of the tools is Proto-Type - not all tool functions have been impl
 and there may be bugs in these tools.  These tools are under constant development at\r
 this time.\r
 \r
-3. Tool usage introduction.\r
-BaseTools Simple Usage:\r
-1) Change the directory to the EDK2 root directory, where the edksetup.bat is\r
-2) Run "edksetup.bat NewBuild"\r
-3) Set the ACTIVE_PLATFORM to your desired platform description file \r
-   (%WORKSPACE%\Conf\target.txt)\r
-4) To build platform, run "build" command in non-module directory\r
-5) To build module individually, run "build" command in module directory, i.e. where the \r
-   *.inf file is\r
-\r
-Notes:\r
-1) The tree structure generated by build tools is similar to Ant build system.\r
-2) Makefile can be called directly by nmake for both top level platform and module. But\r
-   after you call "nmake cleanall", you have to call "build" command to rebuild platform\r
-        or modules because the AutoGen.* files have been be removed. The "makefile" itself\r
-        cannot generate AutoGen.* files. Only "build" command can.\r
-3) All .exe binary file including C and python tools are generated from:\r
-    r1911 <buildtools_project>\BaseTools\Source\.\r
-\r
-Brief usage for Migration Tool MigrationMsa2Inf.exe:\r
-1. Command line format:\r
-  MigrationMsa2Inf [options]\r
-2. Input Files:\r
-  A syntactically valid MSA file\r
-3. Output Files:\r
-  An extended INF file with possible auto-generated EntryPoint.c, CommonHeader.h/CommonHeader.txt, depending on options and module contents.\r
-4. Prerequisite:\r
-   a. The workspace directory must be specified either by environment variable or -w option.  \r
-   b. The Framework Database file must exist to specify the available packages in current workspace. \r
-      Two possible locations are: (The first location overrides the second)\r
-            $(WORKSPACE)\Tools\Conf\FrameworkDatabase.db\r
-            $(WORKSPACE)\Conf\FrameworkDatabase.db.  \r
-      The <PackageList> field in FrameworkDatabase.db lists all available packages in current workspace. \r
-      One example:\r
-      <PackageList>\r
-        <Filename>MdePkg/MdePkg.nspd</Filename>\r
-        <Filename>MdeModulePkg/MdeModulePkg.spd</Filename>\r
-        <Filename>IntelFrameworkPkg/IntelFrameworkPkg.spd</Filename>\r
-      </PackageList>\r
-      The package list in FrameworkDatabase.db is important to the final quality of migration:\r
-      (1) It suggests the new package location: Translate package dependency Guid in MSA to Workspace relative path. \r
-         If the package dependency Guid cannot be found in current workspace a warning message is raised. \r
-      (2) It collects the Protocol/Guid/Ppi GuidCName a package contains. \r
-         The GuidCName acts as "clue" to add e.g. #include <Protocol/DiskIo.h> in CommonHeader.h\r
-     \r
-5. Example:\r
-   WORKSAPCE has already been set: $(WORKSPACE) = c:\work\EdkII. \r
\r
-   a. MigrationMsa2Inf -f c:\work\EdkII\Nt32Pkg\WinNtThunkDxe\WinNtThunk.msa -o c:\work\EdkII\Nt32Pkg\WinNtThunkDxe\WinNtThunk.inf\r
-   b. MigrationMsa2Inf -f c:\work\EdkII\Nt32Pkg\WinNtThunkDxe\WinNtThunk.msa -a\r
-   Example a & b are equivalent to migrate WinNtThunk driver from EDKII to EDKII' code base.\r
-  \r
-   c. MigrationMsa2Inf -f c:\work\EdkII\Nt32Pkg\WinNtThunkDxe\WinNtThunk.msa -a -c\r
-   The extra "-c" option performs several hardcode mapping due to the naming change in EDKII': \r
-      OldMdePkg Guid -> MdePkgGuid, \r
-      EdkModulePkg Guid -> MdeModulePkgGuid, \r
-      EdkGraphicsLib -> GraphicsLib\r
-      HiiLib -> HiiLibFramework\r
-      ...\r
-   \r
-   d. MigrationMsa2Inf -f c:\work\EdkII\Nt32Pkg\WinNtThunkDxe\WinNtThunk.msa -m\r
-   The extra "-m" option suppresses the generation of "CommonHeader.h" and leave all C files intact. \r
-   Instead, it generates "CommonHeader.txt". Developers can manually copy its content to a local common header file in a module. \r
\r
-6. Known Limitations:\r
-   a. Tool does not handle Exit Boot Services Callback & Virtual Address Changed Event. Developers need  to handle it manually.\r
-   b. The #include <Library/AbcLib.h> is based on library class naming convention: The header filename for "AbcLib" class are "AbcLib.h" by convention.\r
-   c. The #include <Guid/Xyz.h>, <Protocol/Xyz.h> and <Ppi/Xyz.h> are added based on gGuidCName listed in MSA. \r
-      If a GuidCName cannot map to a package Guid/Protocol/Ppi header file, a warning message is raised.\r
-      If a module uses the definition in a pakcage Guid/Protocol/Ppi header file without list its associative GuidCName, the build will beak. Developer needs to       manually add the include statement.\r
-   d. The [Depex] sections are generated from DXS files with Guid Macro translated to Guid CName by naming convention, etc.\r
-    If tool fails to "guess" the Guid CName from Guid Macro, it will leave the GuidMacro in [Depex] section for manual resolution.\r
-   e. When tool generates [Sources] section, the modifiers for source files are lost. (Need to add proper tool chain, etc)\r
-   f. When tool generates [LibraryClasses] section, the recommended library instances are lost. (No impact to build)\r
\r
-7. Pyton Source\r
-   BaseTools\Source\Python\MigrationMsa2Inf\r
-\r
-Brief usage for Migration Tool Spd2Dec.exe:\r
-1. Command line format:\r
-  Spd2Dec [options] input_filename\r
-2. Input File:\r
-  A syntactically valid SPD file\r
-3. Output Files:\r
-  A DEC file whose syntax confirms to DEC spec.\r
-     \r
-4. Example:\r
-   a. Spd2Dec -o c:\work\EdkII\Nt32Pkg\Nt32.spd c:\work\EdkII\Nt32Pkg\Nt32.dec\r
-   b. Spd2Dec -a c:\work\EdkII\Nt32Pkg\Nt32.spd\r
-   Example a & b are equivalent to migrate Nt32 package SPD file from EDKII to EDKII' snytax.\r
-  \r
-6. Pyton Source\r
-   BaseTools\Source\Python\spd2dec\r
-\r
-Brief usage for Migration Tool Fpd2Dsc.exe:\r
-1. Command line format:\r
-  Fpd2Dsc [options] input_filename\r
-2. Input File:\r
-  A syntactically valid FPD file\r
-3. Output Files:\r
-  A DSC file which syntax confirms to DSC spec.\r
-4. Prerequisite:\r
-   a. The workspace directory must be specified either by environment variable or -w option.\r
-     \r
-5. Example:\r
-   WORKSAPCE has already been set: $(WORKSPACE) = c:\work\EdkII. \r
\r
-   a. Fpd2Dsc -o c:\work\EdkII\Nt32Pkg\Nt32.dsc c:\work\EdkII\Nt32Pkg\Nt32.fpd\r
-   b. Fpd2Dsc -a c:\work\EdkII\Nt32Pkg\Nt32.fpd\r
-   Example a & b are equivalent to migrate Nt32 platform description file from EDKII to EDKII' snytax.\r
-  \r
-6. Known Limitations:\r
-   a. Tool does not handle Libraries Section since no related info in original FPD file. Developers need  to handle it manually in the output DSC file.\r
-   b. If MSA file which is corresponds to module guid could not be found in currect workspace, tool will dump the module guid.\r
\r
-7. Pyton Source\r
-   BaseTools\Source\Python\fpd2dsc\r
-\r
-4-Mar-2010\r
+26-OCT-2011\r
index 54bd099e1d819e41fdfb102cc2d384e3b89bf038..816f309f66a7041462fded0b1ba444abd6177263 100644 (file)
@@ -979,6 +979,7 @@ Returns:
             ImageContext,\r
             Section->VirtualAddress + Section->Misc.VirtualSize - 1\r
             );\r
+\r
     //\r
     // If the base start or end address resolved to 0, then fail.\r
     //\r
@@ -987,6 +988,7 @@ Returns:
       return RETURN_LOAD_ERROR;\r
     }\r
 \r
+       \r
     if (ImageContext->IsTeImage) {\r
       Base  = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);\r
       End   = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);\r
index 01685964f19c60d8f815bd8070a3fe155e51db94..f83c532b25641461987c88f02924c0369085f3a0 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -181,7 +181,6 @@ Returns:
   CHAR8* OutputFileName = NULL;\r
   CHAR8* InputFileNames[MAX_PE_IMAGES + 1];\r
   UINT8 InputFileCount = 0;\r
-  BOOLEAN QuietFlag = FALSE;\r
   UINT64        DebugLevel = 0;\r
   UINT64        VerboseLevel = 0;\r
   EFI_STATUS Status = EFI_SUCCESS;\r
@@ -220,7 +219,6 @@ Returns:
     }\r
     \r
     if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {\r
-      QuietFlag = TRUE;\r
       argc --;\r
       argv ++;\r
       continue; \r
index 9fdcb47d6bba84dcc740463ce69d89fde108730b..45a2c8022d77db0b1c362990209a5425019bd647 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -2801,7 +2801,6 @@ Returns:
   PE_COFF_LOADER_IMAGE_CONTEXT          OrigImageContext;  \r
   EFI_PHYSICAL_ADDRESS                  XipBase;\r
   EFI_PHYSICAL_ADDRESS                  NewPe32BaseAddress;\r
-  EFI_PHYSICAL_ADDRESS                  *BaseToUpdate;\r
   UINTN                                 Index;\r
   EFI_FILE_SECTION_POINTER              CurrentPe32Section;\r
   EFI_FFS_FILE_STATE                    SavedState;\r
@@ -2818,7 +2817,6 @@ Returns:
 \r
   Index              = 0;  \r
   MemoryImagePointer = NULL;\r
-  BaseToUpdate       = NULL;\r
   TEImageHeader      = NULL;\r
   ImgHdr             = NULL;\r
   SectionHeader      = NULL;\r
@@ -2992,7 +2990,6 @@ Returns:
         }\r
 \r
         NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;\r
-        BaseToUpdate = &XipBase;\r
         break;\r
 \r
       case EFI_FV_FILETYPE_DRIVER:\r
@@ -3008,7 +3005,6 @@ Returns:
           return EFI_ABORTED;\r
         }\r
         NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;\r
-        BaseToUpdate = &XipBase;                       \r
         break;\r
 \r
       default:\r
index 42ae35bfef27a0553a65dbcbac4443a24d204957..ddb45acc8677c408e4aa770fb1b03283325586cc 100644 (file)
@@ -738,10 +738,6 @@ WriteRelocations32 (
   UINT8                            *Targ;
   Elf32_Phdr                       *DynamicSegment;
   Elf32_Phdr                       *TargetSegment;
-  Elf_Sym                          *Sym;
-  Elf_Shdr                         *SymtabShdr;
-  UINT8                            *Symtab;
-  
 
   for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) {
     Elf_Shdr *RelShdr = GetShdrByIndex(Index);
@@ -750,16 +746,10 @@ WriteRelocations32 (
       if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
         UINT32 RelIdx;
 
-        SymtabShdr = GetShdrByIndex (RelShdr->sh_link);
-        Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset;
         FoundRelocations = TRUE;
         for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
           Elf_Rel  *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
-          Elf_Shdr *SymShdr;
 
-          Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
-          SymShdr = GetShdrByIndex (Sym->st_shndx);
-          
           if (mEhdr->e_machine == EM_386) { 
             switch (ELF_R_TYPE(Rel->r_info)) {
             case R_386_NONE:
index fbe6ff8232e13c81239e18a3effdfb932566c82b..e7c5d4997a1dc971c37cc041016c2d093de98273 100644 (file)
@@ -637,28 +637,16 @@ WriteRelocations64 (
   UINT32                           Index;
   EFI_IMAGE_OPTIONAL_HEADER_UNION  *NtHdr;
   EFI_IMAGE_DATA_DIRECTORY         *Dir;
-  BOOLEAN                          FoundRelocations;
-  Elf_Sym                          *Sym;
-  Elf_Shdr                         *SymtabShdr;
-  UINT8                            *Symtab;
 
-
-  for (Index = 0, FoundRelocations = FALSE; Index < mEhdr->e_shnum; Index++) {
+  for (Index = 0; Index < mEhdr->e_shnum; Index++) {
     Elf_Shdr *RelShdr = GetShdrByIndex(Index);
     if ((RelShdr->sh_type == SHT_REL) || (RelShdr->sh_type == SHT_RELA)) {
       Elf_Shdr *SecShdr = GetShdrByIndex (RelShdr->sh_info);
       if (IsTextShdr(SecShdr) || IsDataShdr(SecShdr)) {
         UINT64 RelIdx;
 
-        SymtabShdr = GetShdrByIndex (RelShdr->sh_link);
-        Symtab = (UINT8*)mEhdr + SymtabShdr->sh_offset;
-        FoundRelocations = TRUE;
         for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
           Elf_Rela *Rel = (Elf_Rela *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
-          Elf_Shdr *SymShdr;
-
-          Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
-          SymShdr = GetShdrByIndex (Sym->st_shndx);
 
           if (mEhdr->e_machine == EM_X86_64) {
             switch (ELF_R_TYPE(Rel->r_info)) {
index ffa0ee62fb313980444a81a2ad6701a3d729aa30..79e8e1bebb0314b877735d0bbe515dab5cb0b3d1 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -915,7 +915,6 @@ Returns:
 {\r
   UINT32                    Index;\r
   UINT32                    InputFileNum;\r
-  FILE                      *InFile;\r
   FILE                      *OutFile;\r
   CHAR8                     **InputFileName;\r
   CHAR8                     *OutputFileName;\r
@@ -944,7 +943,6 @@ Returns:
   SectionName           = NULL;\r
   CompressionName       = NULL;\r
   StringBuffer          = "";\r
-  InFile                = NULL;\r
   OutFile               = NULL;\r
   VersionNumber         = 0;\r
   InputFileNum          = 0;\r
index e56544e5449e23624d2e418d93d7178202602264..eaf2f56fedfeaaadc463fb98cda4785f6b2beaa5 100644 (file)
@@ -1,6 +1,6 @@
 /**\r
 \r
-Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>\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
 distribution.  The full text of the license may be found at\r
@@ -1141,7 +1141,6 @@ Returns:
   EFI_STATUS  Status;\r
   UINT64      CompStartAddress;\r
   UINT64      FileSize;\r
-  UINT64      NumByteRead;\r
   UINT64      NumAdjustByte;\r
   UINT8       *Buffer;\r
   FILE        *Fp;\r
@@ -1189,7 +1188,7 @@ Returns:
     //\r
     // Read first 64 bytes of PAL header and use it to find version info\r
     //\r
-    NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);\r
+    fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);\r
 \r
     //\r
     // PAL header contains the version info. Currently, we will use the header\r
@@ -1200,7 +1199,7 @@ Returns:
     }\r
   }\r
 \r
-  NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);\r
+  fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);\r
   fclose (Fp);\r
 \r
   //\r
@@ -1329,7 +1328,6 @@ Returns:
   UINT64      AbsAddress;\r
   UINTN       RelativeAddress;\r
   UINT64      FileSize;\r
-  UINT64      NumByteRead;\r
   UINT8       *Buffer;\r
   FILE        *Fp;\r
   FIT_TABLE   *PalFitPtr;\r
@@ -1367,7 +1365,7 @@ Returns:
   //\r
   // Read, Get version Info and discard the PAL header.\r
   //\r
-  NumByteRead = fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);\r
+  fread (Buffer, sizeof (UINT8), SIZE_OF_PAL_HEADER, Fp);\r
 \r
   //\r
   // Extract the version info from header of PAL_A. Once done, discrad this buffer\r
@@ -1379,7 +1377,7 @@ Returns:
   //\r
   // Read PAL_A file in a buffer\r
   //\r
-  NumByteRead = fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);\r
+  fread (Buffer, sizeof (UINT8), (UINTN) FileSize, Fp);\r
   fclose (Fp);\r
 \r
   PalStartAddress       = Fv1EndAddress - (SIZE_TO_OFFSET_PAL_A_END + FileSize);\r
@@ -1759,7 +1757,6 @@ Returns:
   UINT8 *Buffer;\r
   UINT8 *LocalVtfBuffer;\r
   UINTN FileSize;\r
-  UINTN NumByteRead;\r
   FILE  *Fp;\r
 \r
   if (!strcmp (FileName, "")) {\r
@@ -1784,7 +1781,7 @@ Returns:
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  NumByteRead     = fread (Buffer, sizeof (UINT8), FileSize, Fp);\r
+  fread (Buffer, sizeof (UINT8), FileSize, Fp);\r
 \r
   LocalVtfBuffer  = (UINT8 *) Vtf1EndBuffer - SIZE_IA32_RESET_VECT;\r
   memcpy (LocalVtfBuffer, Buffer, FileSize);\r
@@ -2121,7 +2118,6 @@ Returns:
   FILE        *Fp;\r
   UINT64      *StartAddressPtr;\r
   UINTN       FirstFwVSize;\r
-  UINTN       NumByte;\r
 \r
   StartAddressPtr   = malloc (sizeof (UINT64));\r
   if (StartAddressPtr == NULL) {\r
@@ -2141,7 +2137,7 @@ Returns:
 \r
   FirstFwVSize = _filelength (fileno (Fp));\r
   fseek (Fp, (long) (FirstFwVSize - (UINTN) (SIZE_IA32_RESET_VECT + SIZE_SALE_ENTRY_POINT)), SEEK_SET);\r
-  NumByte = fwrite ((VOID *) StartAddressPtr, sizeof (UINT64), 1, Fp);\r
+  fwrite ((VOID *) StartAddressPtr, sizeof (UINT64), 1, Fp);\r
 \r
   if (Fp) {\r
     fclose (Fp);\r
index 1ce22fc8fa8e004ed9cbad051cafd12348ec6e3e..b0ec271b0522b90301fb4a7579b36d811e1abf7b 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -305,7 +305,6 @@ main (
   char *argv[]\r
   )\r
 {\r
-  CHAR8          *AppName;\r
   INTN           Index;\r
   BOOLEAN        ProcessMbr;\r
   ERROR_STATUS   Status;\r
@@ -319,7 +318,6 @@ main (
   ZeroMem(&InputPathInfo, sizeof(PATH_INFO));\r
   ZeroMem(&OutputPathInfo, sizeof(PATH_INFO));\r
   \r
-  AppName = *argv;\r
   argv ++;\r
   argc --;\r
   \r
index ec4acc338a204fc3f7104c9ca1a972e11168aa65..66197802392072e62e2b02c83d9a21f6164f3db1 100644 (file)
@@ -1,3 +1,3 @@
 //This file is for build version number auto generation\r
 //\r
-#define __BUILD_VERSION "Build 2361"\r
+#define __BUILD_VERSION "Build 2386"\r
index 529fd98f87e9e670cd6b25014341893eeda1cd53..72722727846f7b4ea55b08fb6ef53a566000ff2b 100644 (file)
@@ -1,5 +1,18 @@
-/* LzmaEnc.c -- LZMA Encoder\r
-2009-02-02 : Igor Pavlov : Public domain */\r
+/** @file\r
+  Based on LZMA SDK 4.65:\r
+    LzmaEnc.c -- LZMA Encoder\r
+    2009-02-02 : Igor Pavlov : Public domain\r
+\r
+  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
 \r
 #include <string.h>\r
 \r
@@ -1919,11 +1932,13 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
 static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)\r
 {\r
   UInt32 beforeSize = kNumOpts;\r
+  #ifdef COMPRESS_MF_MT\r
   Bool btMode;\r
+  #endif\r
   if (!RangeEnc_Alloc(&p->rc, alloc))\r
     return SZ_ERROR_MEM;\r
-  btMode = (p->matchFinderBase.btMode != 0);\r
   #ifdef COMPRESS_MF_MT\r
+  btMode = (p->matchFinderBase.btMode != 0);\r
   p->mtMode = (p->multiThread && !p->fastMode && btMode);\r
   #endif\r
 \r
index 84173e5da494cb76dadcabe05438704f5f2e744e..7812175e7f87f209c11e522ae7ecd1fc7018ac25 100644 (file)
@@ -1,12 +1,12 @@
-## @file
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution.    The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+## @file\r
+#\r
+# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.    The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 !INCLUDE ..\Makefiles\ms.common
@@ -19,8 +19,8 @@ $(APPLICATION) : $(OBJECTS)
        -@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
        $(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
 
-$(OBJECTS) : ..\Include\Common\BuildVersion.h
-
+$(OBJECTS) : ..\Include\Common\BuildVersion.h\r
+\r
 .PHONY:clean
 .PHONY:cleanall
 
index 9b81eeb76291807f1ecbc0299a8e68f804db6b91..544da91f4b039241978235872bf6775a404bd455 100644 (file)
@@ -2,7 +2,7 @@
 \r
   Split a file into two pieces at the request offset.\r
 \r
-Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>\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
 distribution.  The full text of the license may be found at\r
@@ -26,7 +26,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "ParseInf.h"\r
 #include "CommonLib.h"\r
 #include "EfiUtilityMsgs.h"\r
-\r
 //\r
 // Utility Name\r
 //\r
@@ -230,7 +229,6 @@ Returns:
   CHAR8         *CurrentDir = NULL;\r
   UINT64        Index;\r
   CHAR8         CharC;\r
-  BOOLEAN       QuietFlag = TRUE;\r
   UINT64        DebugLevel = 0;\r
   UINT64        VerboseLevel = 0;\r
 \r
@@ -308,7 +306,6 @@ Returns:
     }\r
 \r
     if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {\r
-      QuietFlag = TRUE;\r
       argc --;\r
       argv ++;\r
       continue;\r
index f0678ca3cb962d43d0186e7585b8f03b20047df6..94ad55b1bb4ab0f6a55b95a8c703376aaf19de4c 100644 (file)
@@ -662,6 +662,13 @@ CFormPkg::DeclarePendingQuestion (
 \r
       CNObj.SetQuestionId (QId);\r
       CNObj.SetVarStoreInfo (&Info);\r
+      //\r
+      // Numeric doesn't support BOOLEAN data type. \r
+      // BOOLEAN type has the same data size to UINT8. \r
+      //\r
+      if (Info.mVarType == EFI_IFR_TYPE_BOOLEAN) {\r
+        Info.mVarType = EFI_IFR_TYPE_NUM_SIZE_8;\r
+      }\r
       CNObj.SetFlags (0, Info.mVarType);\r
 \r
       //\r
index f908718c029bfbf2d7f72b4d717cfb880a67fe76..92e47d97a3c70aafa357b4c80a415e1de7a385b1 100644 (file)
@@ -847,7 +847,7 @@ private:
 \r
 public:\r
   CIfrImage () : CIfrObj (EFI_IFR_IMAGE_OP, (CHAR8 **)&mImage),\r
-                 CIfrOpHeader (EFI_IFR_FORM_OP, &mImage->Header) {\r
+                 CIfrOpHeader (EFI_IFR_IMAGE_OP, &mImage->Header) {\r
     mImage->Id = EFI_IMAGE_ID_INVALID;\r
   }\r
 \r
@@ -1061,12 +1061,8 @@ public:
     mRef2->FormId = FormId;\r
   }\r
 \r
-  EFI_VFR_RETURN_CODE SetQuestionId (IN EFI_QUESTION_ID QuestionId) {\r
-    if (QuestionId == EFI_QUESTION_ID_INVALID) {\r
-      return VFR_RETURN_UNDEFINED;\r
-    }\r
+  VOID SetQuestionId (IN EFI_QUESTION_ID QuestionId) {\r
     mRef2->QuestionId = QuestionId;\r
-    return VFR_RETURN_SUCCESS;\r
   }\r
 };\r
 \r
index d9f8dd99a72c1e879a90b7316f85f1ca243981bf..f27f05b68910a9430379082bcd65992b2e436298 100644 (file)
@@ -524,28 +524,28 @@ vfrFormSetDefinition :
                                                         FSObj->SetClassGuid(&DefaultClassGuid);\r
                                                         if (mOverrideClassGuid != NULL) {\r
                                                           FSObj->SetClassGuid(mOverrideClassGuid);\r
-                                                        }                                                        \r
+                                                        }\r
                                                         break;\r
                                                       case 1:\r
                                                         if (mOverrideClassGuid != NULL) {\r
                                                           ClassGuidNum ++;\r
-                                                        }                                                        \r
+                                                        }\r
                                                         FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
                                                         FSObj->SetClassGuid(&ClassGuid1);\r
                                                         if (mOverrideClassGuid != NULL) {\r
                                                           FSObj->SetClassGuid(mOverrideClassGuid);\r
-                                                        }                                                        \r
+                                                        }\r
                                                         break;\r
                                                       case 2:\r
                                                         if (mOverrideClassGuid != NULL) {\r
                                                           ClassGuidNum ++;\r
-                                                        }                                                        \r
+                                                        }\r
                                                         FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
                                                         FSObj->SetClassGuid(&ClassGuid1);\r
                                                         FSObj->SetClassGuid(&ClassGuid2);\r
                                                         if (mOverrideClassGuid != NULL) {\r
                                                           FSObj->SetClassGuid(mOverrideClassGuid);\r
-                                                        }    \r
+                                                        }\r
                                                         break;\r
                                                       case 3:\r
                                                         FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));\r
@@ -1646,6 +1646,7 @@ vfrStatementGoto :
      EFI_QUESTION_ID     QId    = EFI_QUESTION_ID_INVALID;\r
      UINT32              BitMask;\r
      CIfrQuestionHeader  *QHObj = NULL;\r
+     CIfrOpHeader        *OHObj = NULL;\r
      CIfrRef             *R1Obj = NULL;\r
      CIfrRef2            *R2Obj = NULL;\r
      CIfrRef3            *R3Obj = NULL;\r
@@ -1682,8 +1683,13 @@ vfrStatementGoto :
       FormId "=" F3:Number ","                         << RefType = 2; FId = _STOFID(F3->getText()); >>\r
       Question "="\r
       (\r
-          QN3:StringIdentifier ","                     << mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); >>\r
-        | QN3:Number ","                               << QId = _STOQID(QN3->getText()); >>\r
+          QN3:StringIdentifier ","                     << \r
+                                                          mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask);\r
+                                                          if (QId == EFI_QUESTION_ID_INVALID) {\r
+                                                            _PCATCH(VFR_RETURN_UNDEFINED, QN3);\r
+                                                          }\r
+                                                       >>\r
+        | QN4:Number ","                               << QId = _STOQID(QN4->getText()); >>\r
       )\r
     )\r
     |\r
@@ -1700,6 +1706,7 @@ vfrStatementGoto :
                                                             {\r
                                                               R5Obj = new CIfrRef5;\r
                                                               QHObj = R5Obj;\r
+                                                              OHObj = R5Obj;\r
                                                               R5Obj->SetLineNo(G->getLine());\r
                                                               break;\r
                                                             }\r
@@ -1707,6 +1714,7 @@ vfrStatementGoto :
                                                             {\r
                                                               R4Obj = new CIfrRef4;\r
                                                               QHObj = R4Obj;\r
+                                                              OHObj = R4Obj;\r
                                                               R4Obj->SetLineNo(G->getLine());\r
                                                               R4Obj->SetDevicePath (DevPath);\r
                                                               R4Obj->SetFormSetId (FSId);\r
@@ -1718,6 +1726,7 @@ vfrStatementGoto :
                                                             {\r
                                                               R3Obj = new CIfrRef3;\r
                                                               QHObj = R3Obj;\r
+                                                              OHObj = R3Obj;\r
                                                               R3Obj->SetLineNo(G->getLine());\r
                                                               R3Obj->SetFormSetId (FSId);\r
                                                               R3Obj->SetFormId (FId);\r
@@ -1728,15 +1737,17 @@ vfrStatementGoto :
                                                             {\r
                                                               R2Obj = new CIfrRef2;\r
                                                               QHObj = R2Obj;\r
+                                                              OHObj = R2Obj;\r
                                                               R2Obj->SetLineNo(G->getLine());\r
                                                               R2Obj->SetFormId (FId);\r
-                                                              _PCATCH(R2Obj->SetQuestionId (QId), QN3);\r
+                                                              R2Obj->SetQuestionId (QId);\r
                                                               break;\r
                                                             }\r
                                                           case 1:\r
                                                             {\r
                                                               R1Obj = new CIfrRef;\r
                                                               QHObj = R1Obj;\r
+                                                              OHObj = R1Obj;\r
                                                               R1Obj->SetLineNo(G->getLine());\r
                                                               R1Obj->SetFormId (FId);\r
                                                               break;\r
@@ -1745,11 +1756,14 @@ vfrStatementGoto :
                                                           }\r
                                                        >>\r
   vfrQuestionHeader[*QHObj, QUESTION_REF]\r
-  { "," vfrStatementStatTagList }\r
   { "," F:FLAGS  "=" vfrGotoFlags[QHObj, F->getLine()] }\r
   {\r
     "," Key "=" KN:Number                              << AssignQuestionKey (*QHObj, KN); >>\r
   }\r
+  {\r
+    E:"," \r
+      vfrStatementQuestionOptionList                   << OHObj->SetScope(1); CRT_END_OP (E);>>\r
+  }\r
   ";"                                                  << if (R1Obj != NULL) {delete R1Obj;} if (R2Obj != NULL) {delete R2Obj;} if (R3Obj != NULL) {delete R3Obj;} if (R4Obj != NULL) {delete R4Obj;} if (R5Obj != NULL) {delete R5Obj;}>>\r
   ;\r
 \r
@@ -3615,6 +3629,7 @@ vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
   | question2refExp[$RootLevel, $ExpOpCount]\r
   | stringref2Exp[$RootLevel, $ExpOpCount]\r
   | toboolExp[$RootLevel, $ExpOpCount]\r
+  | tostringExp[$RootLevel, $ExpOpCount]\r
   | unintExp[$RootLevel, $ExpOpCount]\r
   | toupperExp[$RootLevel, $ExpOpCount]\r
   | tolwerExp[$RootLevel, $ExpOpCount]\r
index 78c6cf656186e9373c37eb5dde73a92fb6d4be0b..f514ba8c38b7da2143be74b4d4571559d5c8948d 100644 (file)
@@ -30,7 +30,6 @@ Abstract:
 #include <Common/UefiCapsule.h>
 #include <Common/PiFirmwareFile.h>
 #include <Common/PiFirmwareVolume.h>
-
 #include <Guid/PiFirmwareFileSystem.h>
 #include <IndustryStandard/PeImage.h>
 #include <Protocol/GuidedSectionExtraction.h>
index 8150ea0b69014ca45d2387323f5feb982d715788..2def474b17997bbd00b73ff1ee797267579d3ffc 100644 (file)
@@ -180,16 +180,16 @@ class WorkspaceAutoGen(AutoGen):
             Fvs = []\r
         if Caps is None:\r
             Caps = []\r
-        self.MetaFile       = ActivePlatform.MetaFile\r
+        self.BuildDatabase  = MetaFileDb\r
+        self.MetaFile       = ActivePlatform\r
         self.WorkspaceDir   = WorkspaceDir\r
-        self.Platform       = ActivePlatform\r
+        self.Platform       = self.BuildDatabase[self.MetaFile, 'COMMON', Target, Toolchain]\r
         self.BuildTarget    = Target\r
         self.ToolChain      = Toolchain\r
         self.ArchList       = ArchList\r
         self.SkuId          = SkuId\r
         self.UniFlag        = UniFlag\r
 \r
-        self.BuildDatabase  = MetaFileDb\r
         self.TargetTxt      = BuildConfig\r
         self.ToolDef        = ToolDefinition\r
         self.FdfFile        = FlashDefinitionFile\r
@@ -201,30 +201,74 @@ class WorkspaceAutoGen(AutoGen):
         # there's many relative directory operations, so ...\r
         os.chdir(self.WorkspaceDir)\r
 \r
+        #\r
+        # Merge Arch\r
+        #\r
+        if not self.ArchList:\r
+            ArchList = set(self.Platform.SupArchList)\r
+        else:\r
+            ArchList = set(self.ArchList) & set(self.Platform.SupArchList)\r
+        if not ArchList:\r
+            EdkLogger.error("build", PARAMETER_INVALID,\r
+                            ExtraData = "Invalid ARCH specified. [Valid ARCH: %s]" % (" ".join(self.Platform.SupArchList)))\r
+        elif self.ArchList and len(ArchList) != len(self.ArchList):\r
+            SkippedArchList = set(self.ArchList).symmetric_difference(set(self.Platform.SupArchList))\r
+            EdkLogger.verbose("\nArch [%s] is ignored because the platform supports [%s] only!"\r
+                              % (" ".join(SkippedArchList), " ".join(self.Platform.SupArchList)))\r
+        self.ArchList = tuple(ArchList)\r
+\r
+        # Validate build target\r
+        if self.BuildTarget not in self.Platform.BuildTargets:\r
+            EdkLogger.error("build", PARAMETER_INVALID, \r
+                            ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"\r
+                                      % (self.BuildTarget, " ".join(self.Platform.BuildTargets)))\r
+\r
+        # Validate SKU ID\r
+        if not self.SkuId:\r
+            self.SkuId = 'DEFAULT'\r
+\r
+        if self.SkuId not in self.Platform.SkuIds:\r
+            EdkLogger.error("build", PARAMETER_INVALID, \r
+                            ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"\r
+                                      % (self.SkuId, " ".join(self.Platform.SkuIds.keys())))\r
+\r
         # parse FDF file to get PCDs in it, if any\r
-        if self.FdfFile != None and self.FdfFile != '':\r
-            #\r
-            # Make global macros available when parsing FDF file\r
-            #\r
-            InputMacroDict.update(self.BuildDatabase.WorkspaceDb._GlobalMacros)\r
+        if not self.FdfFile:\r
+            self.FdfFile = self.Platform.FlashDefinition\r
+        EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)\r
+\r
+        if self.FdfFile:\r
             #\r
             # Mark now build in AutoGen Phase\r
             #\r
-            GlobalData.gAutoGenPhase = True            \r
+            GlobalData.gAutoGenPhase = True    \r
             Fdf = FdfParser(self.FdfFile.Path)\r
             Fdf.ParseFile()\r
-            GlobalData.gAutoGenPhase = False  \r
+            GlobalData.gAutoGenPhase = False\r
             PcdSet = Fdf.Profile.PcdDict\r
             ModuleList = Fdf.Profile.InfList\r
             self.FdfProfile = Fdf.Profile\r
+            for fvname in self.FvTargetList:\r
+                if fvname.upper() not in self.FdfProfile.FvDict:\r
+                    EdkLogger.error("build", OPTION_VALUE_INVALID,\r
+                                    "No such an FV in FDF file: %s" % fvname)\r
         else:\r
             PcdSet = {}\r
             ModuleList = []\r
             self.FdfProfile = None\r
+            if self.FdTargetList:\r
+                EdkLogger.info("No flash definition file found. FD [%s] will be ignored." % " ".join(self.FdTargetList))\r
+                self.FdTargetList = []\r
+            if self.FvTargetList:\r
+                EdkLogger.info("No flash definition file found. FV [%s] will be ignored." % " ".join(self.FvTargetList))\r
+                self.FvTargetList = []\r
+            if self.CapTargetList:\r
+                EdkLogger.info("No flash definition file found. Capsule [%s] will be ignored." % " ".join(self.CapTargetList))\r
+                self.CapTargetList = []\r
         \r
         # apply SKU and inject PCDs from Flash Definition file\r
         for Arch in self.ArchList:\r
-            Platform = self.BuildDatabase[self.MetaFile, Arch]\r
+            Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]\r
             Platform.SkuName = self.SkuId\r
             for Name, Guid in PcdSet:\r
                 Platform.AddPcd(Name, Guid, PcdSet[Name, Guid])\r
@@ -971,7 +1015,7 @@ class PlatformAutoGen(AutoGen):
     ## Return the platform build data object\r
     def _GetPlatform(self):\r
         if self._Platform == None:\r
-            self._Platform = self.BuildDatabase[self.MetaFile, self.Arch]\r
+            self._Platform = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]\r
         return self._Platform\r
 \r
     ## Return platform name\r
@@ -1309,7 +1353,7 @@ class PlatformAutoGen(AutoGen):
                                             File=self.MetaFile,\r
                                             ExtraData="in [%s] [%s]\n\tconsumed by module [%s]" % (str(M), self.Arch, str(Module)))\r
 \r
-                    LibraryModule = self.BuildDatabase[LibraryPath, self.Arch]\r
+                    LibraryModule = self.BuildDatabase[LibraryPath, self.Arch, self.BuildTarget, self.ToolChain]\r
                     # for those forced library instance (NULL library), add a fake library class\r
                     if LibraryClassName.startswith("NULL"):\r
                         LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))\r
@@ -1907,6 +1951,7 @@ class ModuleAutoGen(AutoGen):
             self._Macro["ARCH"                  ] = self.Arch\r
             self._Macro["TOOLCHAIN"             ] = self.ToolChain\r
             self._Macro["TOOLCHAIN_TAG"         ] = self.ToolChain\r
+            self._Macro["TOOL_CHAIN_TAG"        ] = self.ToolChain\r
             self._Macro["TARGET"                ] = self.BuildTarget\r
 \r
             self._Macro["BUILD_DIR"             ] = self.PlatformInfo.BuildDir\r
@@ -1920,7 +1965,7 @@ class ModuleAutoGen(AutoGen):
     ## Return the module build data object\r
     def _GetModule(self):\r
         if self._Module == None:\r
-            self._Module = self.Workspace.BuildDatabase[self.MetaFile, self.Arch]\r
+            self._Module = self.Workspace.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]\r
         return self._Module\r
 \r
     ## Return the module name\r
@@ -2279,7 +2324,7 @@ class ModuleAutoGen(AutoGen):
             if File.IsBinary and File == Source and self._BinaryFileList != None and File in self._BinaryFileList:\r
                 # Skip all files that are not binary libraries\r
                 if not self.IsLibrary:\r
-                    continue\r
+                    continue            \r
                 RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]\r
             elif FileType in self.BuildRules:\r
                 RuleObject = self.BuildRules[FileType]\r
@@ -2672,7 +2717,7 @@ class ModuleAutoGen(AutoGen):
             DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}\r
 \r
             if len(Dpx.PostfixNotation) <> 0:\r
-              self.DepexGenerated = True\r
+                self.DepexGenerated = True\r
 \r
             if Dpx.Generate(path.join(self.OutputDir, DpxFile)):\r
                 AutoGenList.append(str(DpxFile))\r
index 73b4a97417a3f9ae5fd3a15691bd61293c35171b..45a560448e30c4dac203d2b9c7b04c17e7a5ed9e 100644 (file)
@@ -137,7 +137,7 @@ class FileBuildRule:
         self.MacroList = []
         self.CommandList = []
         for CmdLine in Command:
-            self.MacroList.extend(gMacroPattern.findall(CmdLine))
+            self.MacroList.extend(gMacroRefPattern.findall(CmdLine))
             # replace path separator with native one
             self.CommandList.append(CmdLine)
 
index f733ac3e8d03e25b8718aa3fb0614e35d9b11b1b..c6b65f49245f46b0b1e611a660cbb8793352b0db 100644 (file)
@@ -956,6 +956,14 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
         Value = Pcd.DefaultValue
         Unicode = False
         ValueNumber = 0
+
+        if Pcd.DatumType == 'BOOLEAN':
+            BoolValue = Value.upper()
+            if BoolValue == 'TRUE':
+                Value = 1
+            elif BoolValue == 'FALSE':
+                Value = 0
+
         if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
             try:
                 if Value.upper().startswith('0X'):
index 3720c8bfedbdfb8abdd2ba8ae669f7c2bf540c2f..478ab0f01b99d472f04e616dfc349eca7f99b143 100644 (file)
@@ -493,7 +493,7 @@ cleanlib:
 
         # convert source files and binary files to build targets
         self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]
-        if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:
+        if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:        
             EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
                             ExtraData="[%s]" % str(self._AutoGenObject))
 
@@ -1253,7 +1253,7 @@ ${END}\t@cd $(BUILD_DIR)
 #
 fds: init
 \t-@cd $(FV_DIR)
-${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list}${END}${BEGIN}${extra_options}${END}${BEGIN} -r ${fd}${END}${BEGIN} -i ${fv}${END}${BEGIN} -C ${cap}${END}${BEGIN} -D${macro}${END}
+${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END}
 
 #
 # run command for emulator platform only
@@ -1320,6 +1320,11 @@ ${END}\t@cd $(BUILD_DIR)\n
                     MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
                 else:
                     MacroList.append('"%s"' % MacroName)
+            for MacroName in GlobalData.gCommandLineDefines:
+                if GlobalData.gCommandLineDefines[MacroName] != "":
+                    MacroList.append('"%s=%s"' % (MacroName, GlobalData.gCommandLineDefines[MacroName]))
+                else:
+                    MacroList.append('"%s"' % MacroName)                
         else:
             FdfFileList = []
 
@@ -1335,9 +1340,6 @@ ${END}\t@cd $(BUILD_DIR)\n
 
         if GlobalData.gCaseInsensitive:
             ExtraOption += " -c"
-        ExtraOptionList = []
-        if ExtraOption:
-            ExtraOptionList.append(ExtraOption)
 
         MakefileName = self._FILE_NAME_[self._FileType]
         SubBuildCommandList = []
@@ -1369,7 +1371,7 @@ ${END}\t@cd $(BUILD_DIR)\n
             "fd"                        : PlatformInfo.FdTargetList,
             "fv"                        : PlatformInfo.FvTargetList,
             "cap"                       : PlatformInfo.CapTargetList,
-            "extra_options"             : ExtraOptionList,
+            "extra_options"             : ExtraOption,
             "macro"                     : MacroList,
         }
 
index fecc40e84a3cff32e817ab3d2e1722664229f56b..82597c094563dd9be8499e14e20cabe2d081350a 100644 (file)
@@ -1,3 +1,3 @@
 #This file is for build version number auto generation\r
 #\r
-gBUILD_VERSION = "Build 2361"\r
+gBUILD_VERSION = "Build 2386"\r
index 9a2556749ae63f2d7ebe24771db8febf58b244dd..fc0a7ad0260aa43520af5e6de55cfcd957dcb5bd 100644 (file)
@@ -360,6 +360,7 @@ TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
 TAB_DSC_DEFINES_DEFINE = 'DEFINE'\r
 TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'\r
 TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'\r
+TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'\r
 \r
 #\r
 # TargetTxt Definitions\r
diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py
new file mode 100644 (file)
index 0000000..e2889a8
--- /dev/null
@@ -0,0 +1,555 @@
+## @file\r
+# This file is used to parse and evaluate expression in directive or PCD value.\r
+#\r
+# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.    The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+## Import Modules\r
+#\r
+from Common.GlobalData import *\r
+from CommonDataClass.Exceptions import BadExpression\r
+from CommonDataClass.Exceptions import SymbolNotFound\r
+from CommonDataClass.Exceptions import WrnExpression\r
+from Misc import GuidStringToGuidStructureString\r
+\r
+ERR_STRING_EXPR         = 'This operator cannot be used in string expression: [%s].'\r
+ERR_SNYTAX              = 'Syntax error, the rest of expression cannot be evaluated: [%s].'\r
+ERR_MATCH               = 'No matching right parenthesis.'\r
+ERR_STRING_TOKEN        = 'Bad string token: [%s].'\r
+ERR_MACRO_TOKEN         = 'Bad macro token: [%s].'\r
+ERR_EMPTY_TOKEN         = 'Empty token is not allowed.'\r
+ERR_PCD_RESOLVE         = 'PCD token cannot be resolved: [%s].'\r
+ERR_VALID_TOKEN         = 'No more valid token found from rest of string: [%s].'\r
+ERR_EXPR_TYPE           = 'Different types found in expression.'\r
+ERR_OPERATOR_UNSUPPORT  = 'Unsupported operator: [%s]'\r
+ERR_REL_NOT_IN          = 'Expect "IN" after "not" operator.'\r
+WRN_BOOL_EXPR           = 'Operand of boolean type cannot be used in arithmetic expression.'\r
+WRN_EQCMP_STR_OTHERS    = '== Comparison between Operand of string type and Boolean/Number Type always return False.'\r
+WRN_NECMP_STR_OTHERS    = '!= Comparison between Operand of string type and Boolean/Number Type always return True.'\r
+ERR_RELCMP_STR_OTHERS   = 'Operator taking Operand of string type and Boolean/Number Type is not allowed: [%s].'\r
+ERR_STRING_CMP          = 'Unicode string and general string cannot be compared: [%s %s %s]'\r
+ERR_ARRAY_TOKEN         = 'Bad C array or C format GUID token: [%s].'\r
+ERR_ARRAY_ELE           = 'This must be HEX value for NList or Array: [%s].'\r
+\r
+## SplitString\r
+#  Split string to list according double quote\r
+#  For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn']\r
+#\r
+def SplitString(String):\r
+    # There might be escaped quote: "abc\"def\\\"ghi"\r
+    Str = String.replace('\\\\', '//').replace('\\\"', '\\\'')\r
+    RetList = []\r
+    InQuote = False\r
+    Item = ''\r
+    for i, ch in enumerate(Str):\r
+        if ch == '"':\r
+            InQuote = not InQuote\r
+            if not InQuote:\r
+                Item += String[i]\r
+                RetList.append(Item)\r
+                Item = ''\r
+                continue\r
+            if Item:\r
+                RetList.append(Item)\r
+                Item = ''\r
+        Item += String[i]\r
+    if InQuote:\r
+        raise BadExpression(ERR_STRING_TOKEN % Item)\r
+    if Item:\r
+        RetList.append(Item)\r
+    return RetList\r
+\r
+## ReplaceExprMacro\r
+#\r
+def ReplaceExprMacro(String, Macros, ExceptionList = None):\r
+    StrList = SplitString(String)\r
+    for i, String in enumerate(StrList):\r
+        InQuote = False\r
+        if String.startswith('"'):\r
+            InQuote = True\r
+        MacroStartPos = String.find('$(')\r
+        if MacroStartPos < 0:\r
+            continue\r
+        RetStr = ''\r
+        while MacroStartPos >= 0:\r
+            RetStr = String[0:MacroStartPos]\r
+            MacroEndPos = String.find(')', MacroStartPos)\r
+            if MacroEndPos < 0:\r
+                raise BadExpression(ERR_MACRO_TOKEN % String[MacroStartPos:])\r
+            Macro = String[MacroStartPos+2:MacroEndPos]\r
+            if Macro not in Macros:\r
+                # From C reference manual:\r
+                # If an undefined macro name appears in the constant-expression of\r
+                # !if or !elif, it is replaced by the integer constant 0.\r
+                RetStr += '0'\r
+            elif not InQuote and ExceptionList and Macro in ExceptionList:\r
+                # Make sure the macro in exception list is encapsulated by double quote\r
+                # For example: DEFINE ARCH = IA32 X64\r
+                # $(ARCH) is replaced with "IA32 X64"\r
+                RetStr += '"' + Macros[Macro] + '"'\r
+            else:\r
+                if Macros[Macro].strip() != "":\r
+                    RetStr += Macros[Macro]\r
+                else:\r
+                    RetStr += '""'\r
+            RetStr += String[MacroEndPos+1:]\r
+            String = RetStr\r
+            MacroStartPos = String.find('$(')\r
+        StrList[i] = RetStr\r
+    return ''.join(StrList)\r
+\r
+class ValueExpression(object):\r
+    # Logical operator mapping\r
+    LogicalOperators = {\r
+        '&&' : 'and', '||' : 'or',\r
+        '!'  : 'not', 'AND': 'and',\r
+        'OR' : 'or' , 'NOT': 'not',\r
+        'XOR': '^'  , 'xor': '^',\r
+        'EQ' : '==' , 'NE' : '!=',\r
+        'GT' : '>'  , 'LT' : '<',\r
+        'GE' : '>=' , 'LE' : '<=',\r
+        'IN' : 'in'\r
+    }\r
+\r
+    NonLetterOpLst = ['+', '-', '&', '|', '^', '!', '=', '>', '<']\r
+\r
+    PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$')\r
+    HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')\r
+    RegGuidPattern = re.compile(r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}')\r
+\r
+    SymbolPattern = re.compile("("\r
+                                 "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+|"\r
+                                 "&&|\|\||!(?!=)|"\r
+                                 "(?<=\W)AND(?=\W)|(?<=\W)OR(?=\W)|(?<=\W)NOT(?=\W)|(?<=\W)XOR(?=\W)|"\r
+                                 "(?<=\W)EQ(?=\W)|(?<=\W)NE(?=\W)|(?<=\W)GT(?=\W)|(?<=\W)LT(?=\W)|(?<=\W)GE(?=\W)|(?<=\W)LE(?=\W)"\r
+                               ")")\r
+\r
+    @staticmethod\r
+    def Eval(Operator, Oprand1, Oprand2 = None):\r
+        WrnExp = None\r
+        \r
+        if Operator not in ["==", "!=", ">=", "<=", ">", "<", "in", "not in"] and \\r
+            (type(Oprand1) == type('') or type(Oprand2) == type('')):\r
+            raise BadExpression(ERR_STRING_EXPR % Operator)\r
+\r
+        TypeDict = {\r
+            type(0)  : 0,\r
+            type(0L) : 0,\r
+            type('') : 1,\r
+            type(True) : 2\r
+        }\r
+\r
+        EvalStr = ''\r
+        if Operator in ["!", "NOT", "not"]:\r
+            if type(Oprand1) == type(''):\r
+                raise BadExpression(ERR_STRING_EXPR % Operator)\r
+            EvalStr = 'not Oprand1'\r
+        else:\r
+            if Operator in ["+", "-"] and (type(True) in [type(Oprand1), type(Oprand2)]):\r
+                # Boolean in '+'/'-' will be evaluated but raise warning\r
+                WrnExp = WrnExpression(WRN_BOOL_EXPR)\r
+            elif type('') in [type(Oprand1), type(Oprand2)] and type(Oprand1)!= type(Oprand2):\r
+                # == between string and number/boolean will always return False, != return True\r
+                if Operator == "==":\r
+                    WrnExp = WrnExpression(WRN_EQCMP_STR_OTHERS)\r
+                    WrnExp.result = False\r
+                    raise WrnExp\r
+                elif Operator == "!=":\r
+                    WrnExp = WrnExpression(WRN_NECMP_STR_OTHERS)\r
+                    WrnExp.result = True\r
+                    raise WrnExp\r
+                else:\r
+                    raise BadExpression(ERR_RELCMP_STR_OTHERS % Operator)\r
+            elif TypeDict[type(Oprand1)] != TypeDict[type(Oprand2)]: \r
+                if Operator in ["==", "!=", ">=", "<=", ">", "<"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):\r
+                    # comparison between number and boolean is allowed\r
+                    pass\r
+                elif Operator in ['&', '|', '^', "&&", "||"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):\r
+                    # bitwise and logical operation between number and boolean is allowed\r
+                    pass                \r
+                else:\r
+                    raise BadExpression(ERR_EXPR_TYPE)\r
+            if type(Oprand1) == type('') and type(Oprand2) == type(''):\r
+                if (Oprand1.startswith('L"') and not Oprand2.startswith('L"')) or \\r
+                    (not Oprand1.startswith('L"') and Oprand2.startswith('L"')):\r
+                    raise BadExpression(ERR_STRING_CMP % (Oprand1, Operator, Oprand2))\r
+            if 'in' in Operator and type(Oprand2) == type(''):\r
+                Oprand2 = Oprand2.split()\r
+            EvalStr = 'Oprand1 ' + Operator + ' Oprand2'\r
+\r
+        # Local symbols used by built in eval function\r
+        Dict = {\r
+            'Oprand1' : Oprand1,\r
+            'Oprand2' : Oprand2\r
+        }\r
+        try:\r
+            Val = eval(EvalStr, {}, Dict)\r
+        except Exception, Excpt:\r
+            raise BadExpression(str(Excpt))\r
+\r
+        if Operator in ['and', 'or']:\r
+            if Val:\r
+                Val = True\r
+            else:\r
+                Val = False\r
+        \r
+        if WrnExp:\r
+            WrnExp.result = Val\r
+            raise WrnExp\r
+        return Val\r
+\r
+    def __init__(self, Expression, SymbolTable={}):\r
+        self._NoProcess = False\r
+        if type(Expression) != type(''):\r
+            self._Expr = Expression\r
+            self._NoProcess = True\r
+            return\r
+\r
+        self._Expr = ReplaceExprMacro(Expression.strip(),\r
+                                  SymbolTable,\r
+                                  ['TARGET', 'TOOL_CHAIN_TAG', 'ARCH'])\r
+\r
+        if not self._Expr.strip():\r
+            self._NoProcess = True\r
+            return\r
+\r
+        #\r
+        # The symbol table including PCD and macro mapping\r
+        #\r
+        self._Symb = SymbolTable\r
+        self._Symb.update(self.LogicalOperators)\r
+        self._Idx = 0\r
+        self._Len = len(self._Expr)\r
+        self._Token = ''\r
+\r
+        # Literal token without any conversion\r
+        self._LiteralToken = ''\r
+\r
+    # Public entry for this class\r
+    def __call__(self):\r
+        if self._NoProcess:\r
+            return self._Expr\r
+\r
+        Val = self._OrExpr()\r
+        if type(Val) == type('') and Val == 'L""':\r
+            Val = ''\r
+\r
+        # The expression has been parsed, but the end of expression is not reached\r
+        # It means the rest does not comply EBNF of <Expression>\r
+        if self._Idx != self._Len:\r
+            raise BadExpression(ERR_SNYTAX % self._Expr[self._Idx:])\r
+\r
+        return Val\r
+\r
+    # Template function to parse binary operators which have same precedence\r
+    # Expr [Operator Expr]*\r
+    def _ExprFuncTemplate(self, EvalFunc, OpLst):\r
+        Val = EvalFunc()\r
+        while self._IsOperator(OpLst):\r
+            Op = self._Token\r
+            Val = self.Eval(Op, Val, EvalFunc())\r
+        return Val\r
+\r
+    # A [|| B]*\r
+    def _OrExpr(self):\r
+        return self._ExprFuncTemplate(self._AndExpr, ["OR", "or", "||"])\r
+\r
+    # A [&& B]*\r
+    def _AndExpr(self):\r
+        return self._ExprFuncTemplate(self._BitOr, ["AND", "and", "&&"])\r
+\r
+    # A [ | B]*\r
+    def _BitOr(self):\r
+        return self._ExprFuncTemplate(self._BitXor, ["|"])\r
+\r
+    # A [ ^ B]*\r
+    def _BitXor(self):\r
+        return self._ExprFuncTemplate(self._BitAnd, ["XOR", "xor", "^"])\r
+\r
+    # A [ & B]*\r
+    def _BitAnd(self):\r
+        return self._ExprFuncTemplate(self._EqExpr, ["&"])\r
+\r
+    # A [ == B]*\r
+    def _EqExpr(self):\r
+        Val = self._RelExpr()\r
+        while self._IsOperator(["==", "!=", "EQ", "NE", "IN", "in", "!", "NOT", "not"]):\r
+            Op = self._Token\r
+            if Op in ["!", "NOT", "not"]:\r
+                if not self._IsOperator(["IN", "in"]):\r
+                    raise BadExpression(ERR_REL_NOT_IN)\r
+                Op += ' ' + self._Token\r
+            Val = self.Eval(Op, Val, self._RelExpr())\r
+        return Val\r
+\r
+    # A [ > B]*\r
+    def _RelExpr(self):\r
+        return self._ExprFuncTemplate(self._AddExpr, ["<=", ">=", "<", ">", "LE", "GE", "LT", "GT"])\r
+\r
+    # A [ + B]*\r
+    def _AddExpr(self):\r
+        return self._ExprFuncTemplate(self._UnaryExpr, ["+", "-"])\r
+\r
+    # [!]*A\r
+    def _UnaryExpr(self):\r
+        if self._IsOperator(["!", "NOT", "not"]):\r
+            Val = self._UnaryExpr()\r
+            return self.Eval('not', Val)\r
+        return self._IdenExpr()\r
+\r
+    # Parse identifier or encapsulated expression\r
+    def _IdenExpr(self):\r
+        Tk = self._GetToken()\r
+        if Tk == '(':\r
+            Val = self._OrExpr()\r
+            try:\r
+                # _GetToken may also raise BadExpression\r
+                if self._GetToken() != ')':\r
+                    raise BadExpression(ERR_MATCH)\r
+            except BadExpression:\r
+                raise BadExpression(ERR_MATCH)\r
+            return Val\r
+        return Tk\r
+\r
+    # Skip whitespace or tab\r
+    def __SkipWS(self):\r
+        for Char in self._Expr[self._Idx:]:\r
+            if Char not in ' \t':\r
+                break\r
+            self._Idx += 1\r
+\r
+    # Try to convert string to number\r
+    def __IsNumberToken(self):\r
+        Radix = 10\r
+        if self._Token.lower()[0:2] == '0x' and len(self._Token) > 2:\r
+            Radix = 16\r
+        try:\r
+            self._Token = int(self._Token, Radix)\r
+            return True\r
+        except ValueError:\r
+            return False\r
+        except TypeError:\r
+            return False\r
+\r
+    # Parse array: {...}\r
+    def __GetArray(self):\r
+        Token = '{'\r
+        self._Idx += 1\r
+        self.__GetNList(True)\r
+        Token += self._LiteralToken\r
+        if self._Idx >= self._Len or self._Expr[self._Idx] != '}':\r
+            raise BadExpression(ERR_ARRAY_TOKEN % Token)\r
+        Token += '}'\r
+\r
+        # All whitespace and tabs in array are already stripped.\r
+        IsArray = IsGuid = False\r
+        if len(Token.split(',')) == 11 and len(Token.split(',{')) == 2 \\r
+            and len(Token.split('},')) == 1:\r
+            HexLen = [11,6,6,5,4,4,4,4,4,4,6]\r
+            HexList= Token.split(',')\r
+            if HexList[3].startswith('{') and \\r
+                not [Index for Index, Hex in enumerate(HexList) if len(Hex) > HexLen[Index]]:\r
+                IsGuid = True\r
+        if Token.lstrip('{').rstrip('}').find('{') == -1:\r
+            if not [Hex for Hex in Token.lstrip('{').rstrip('}').split(',') if len(Hex) > 4]:\r
+                IsArray = True\r
+        if not IsArray and not IsGuid:\r
+            raise BadExpression(ERR_ARRAY_TOKEN % Token)\r
+        self._Idx += 1\r
+        self._Token = self._LiteralToken = Token\r
+        return self._Token\r
+\r
+    # Parse string, the format must be: "..."\r
+    def __GetString(self):\r
+        Idx = self._Idx\r
+\r
+        # Skip left quote\r
+        self._Idx += 1\r
+\r
+        # Replace escape \\\", \"\r
+        Expr = self._Expr[self._Idx:].replace('\\\\', '//').replace('\\\"', '\\\'')\r
+        for Ch in Expr:\r
+            self._Idx += 1\r
+            if Ch == '"':\r
+                break\r
+        self._Token = self._LiteralToken = self._Expr[Idx:self._Idx]\r
+        if not self._Token.endswith('"'):\r
+            raise BadExpression(ERR_STRING_TOKEN % self._Token)\r
+        self._Token = self._Token[1:-1]\r
+        return self._Token\r
+\r
+    # Get token that is comprised by alphanumeric, underscore or dot(used by PCD)\r
+    # @param IsAlphaOp: Indicate if parsing general token or script operator(EQ, NE...)\r
+    def __GetIdToken(self, IsAlphaOp = False):\r
+        IdToken = ''\r
+        for Ch in self._Expr[self._Idx:]:\r
+            if not self.__IsIdChar(Ch):\r
+                break\r
+            self._Idx += 1\r
+            IdToken += Ch\r
+\r
+        self._Token = self._LiteralToken = IdToken\r
+        if not IsAlphaOp:\r
+            self.__ResolveToken()\r
+        return self._Token\r
+\r
+    # Try to resolve token\r
+    def __ResolveToken(self):\r
+        if not self._Token:\r
+            raise BadExpression(ERR_EMPTY_TOKEN)\r
+\r
+        # PCD token\r
+        if self.PcdPattern.match(self._Token):\r
+            if self._Token not in self._Symb:\r
+                raise SymbolNotFound(ERR_PCD_RESOLVE % self._Token)\r
+            self._Token = ValueExpression(self._Symb[self._Token], self._Symb)()\r
+            if type(self._Token) != type(''):\r
+                self._LiteralToken = hex(self._Token)\r
+                return\r
+\r
+        if self._Token.startswith('"'):\r
+            self._Token = self._Token[1:-1]\r
+        elif self._Token in ["FALSE", "false", "False"]:\r
+            self._Token = False\r
+        elif self._Token in ["TRUE", "true", "True"]:\r
+            self._Token = True\r
+        else:\r
+            self.__IsNumberToken()\r
+\r
+    def __GetNList(self, InArray=False):\r
+        self._GetSingleToken()\r
+        if not self.__IsHexLiteral():\r
+            if InArray:\r
+                raise BadExpression(ERR_ARRAY_ELE % self._Token)\r
+            return self._Token\r
+\r
+        self.__SkipWS()\r
+        Expr = self._Expr[self._Idx:]\r
+        if not Expr.startswith(','):\r
+            return self._Token\r
+\r
+        NList = self._LiteralToken\r
+        while Expr.startswith(','):\r
+            NList += ','\r
+            self._Idx += 1\r
+            self.__SkipWS()\r
+            self._GetSingleToken()\r
+            if not self.__IsHexLiteral():\r
+                raise BadExpression(ERR_ARRAY_ELE % self._Token)\r
+            NList += self._LiteralToken\r
+            self.__SkipWS()\r
+            Expr = self._Expr[self._Idx:]\r
+        self._Token = self._LiteralToken = NList\r
+        return self._Token\r
+\r
+    def __IsHexLiteral(self):\r
+        if self._LiteralToken.startswith('{') and \\r
+            self._LiteralToken.endswith('}'):\r
+            return True\r
+\r
+        if self.HexPattern.match(self._LiteralToken):\r
+            Token = self._LiteralToken[2:]\r
+            Token = Token.lstrip('0')\r
+            if not Token:\r
+                self._LiteralToken = '0x0'\r
+            else:\r
+                self._LiteralToken = '0x' + Token\r
+            return True\r
+        return False\r
+\r
+    def _GetToken(self):\r
+        return self.__GetNList()\r
+\r
+    @staticmethod\r
+    def __IsIdChar(Ch):\r
+        return Ch in '._/:' or Ch.isalnum()\r
+\r
+    # Parse operand\r
+    def _GetSingleToken(self):\r
+        self.__SkipWS()\r
+        Expr = self._Expr[self._Idx:]\r
+        if Expr.startswith('L"'):\r
+            # Skip L\r
+            self._Idx += 1\r
+            UStr = self.__GetString()\r
+            self._Token = 'L"' + UStr + '"'\r
+            return self._Token\r
+\r
+        self._Token = ''\r
+        if Expr:\r
+            Ch = Expr[0]\r
+            Match = self.RegGuidPattern.match(Expr)\r
+            if Match and not Expr[Match.end():Match.end()+1].isalnum() \\r
+                and Expr[Match.end():Match.end()+1] != '_':\r
+                self._Idx += Match.end()\r
+                self._Token = ValueExpression(GuidStringToGuidStructureString(Expr[0:Match.end()]))()\r
+                return self._Token\r
+            elif self.__IsIdChar(Ch):\r
+                return self.__GetIdToken()\r
+            elif Ch == '"':\r
+                return self.__GetString()\r
+            elif Ch == '{':\r
+                return self.__GetArray()\r
+            elif Ch == '(' or Ch == ')':\r
+                self._Idx += 1\r
+                self._Token = Ch\r
+                return self._Token\r
+\r
+        raise BadExpression(ERR_VALID_TOKEN % Expr)\r
+\r
+    # Parse operator\r
+    def _GetOperator(self):\r
+        self.__SkipWS()\r
+        LegalOpLst = ['&&', '||', '!=', '==', '>=', '<='] + self.NonLetterOpLst\r
+\r
+        self._Token = ''\r
+        Expr = self._Expr[self._Idx:]\r
+\r
+        # Reach end of expression\r
+        if not Expr:\r
+            return ''\r
+\r
+        # Script operator: LT, GT, LE, GE, EQ, NE, and, or, xor, not\r
+        if Expr[0].isalpha():\r
+            return self.__GetIdToken(True)\r
+\r
+        # Start to get regular operator: +, -, <, > ...\r
+        if Expr[0] not in self.NonLetterOpLst:\r
+            return ''\r
+\r
+        OpToken = ''\r
+        for Ch in Expr:\r
+            if Ch in self.NonLetterOpLst:\r
+                if '!' == Ch and OpToken in ['!=', '!']:\r
+                    break\r
+                self._Idx += 1\r
+                OpToken += Ch\r
+            else:\r
+                break\r
+\r
+        if OpToken not in LegalOpLst:\r
+            raise BadExpression(ERR_OPERATOR_UNSUPPORT % OpToken)\r
+        self._Token = OpToken\r
+        return OpToken\r
+\r
+    # Check if current token matches the operators given from OpList\r
+    def _IsOperator(self, OpList):\r
+        Idx = self._Idx\r
+        self._GetOperator()\r
+        if self._Token in OpList:\r
+            if self._Token in self.LogicalOperators:\r
+                self._Token = self.LogicalOperators[self._Token]\r
+            return True\r
+        self._Idx = Idx\r
+        return False\r
+\r
+if __name__ == '__main__':\r
+    pass\r
+\r
+\r
index 37ae2d33ebd86fbd057a8173f8f5df8061d8d317..bc7e0476768aa7b82f6269adaa0fb7ceb54b1322 100644 (file)
@@ -22,9 +22,11 @@ gEcpSource = "EdkCompatibilityPkg"
 
 gOptions = None
 gCaseInsensitive = False
-gGlobalDefines = {}
 gAllFiles = None
 
+gGlobalDefines = {}
+gPlatformDefines = {}
+gCommandLineDefines = {}
 gEdkGlobal = {}
 gOverrideDir = {}
 
@@ -33,8 +35,13 @@ gProcessingFile = ''
 gBuildingModule = ''
 
 ## Regular expression for matching macro used in DSC/DEC/INF file inclusion
-gMacroPattern = re.compile("\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
+gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE)
+gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
+gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$")
+# C-style wide string pattern
+gWideStringPattern = re.compile('(\W|\A)L"')
 #
 # A global variable for whether current build in AutoGen phase or not.
 #
 gAutoGenPhase = False
+
index 731bbf14584b7a610e412a7c716fe83ed3284e5e..50504aa73ca9689eb406fb5a90bf0c6b60d09946 100644 (file)
@@ -156,7 +156,7 @@ def GuidStructureStringToGuidValueName(GuidValue):
     guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "")
     guidValueList = guidValueString.split(",")
     if len(guidValueList) != 11:
-        EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue)
+        EdkLogger.error(None, FORMAT_INVALID, "Invalid GUID value string [%s]" % GuidValue)
     return "%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x" % (
             int(guidValueList[0], 16),
             int(guidValueList[1], 16),
@@ -1431,6 +1431,9 @@ class PathClass(object):
             self._Key = self.Path.upper()   # + self.ToolChainFamily + self.TagName + self.ToolCode + self.Target
         return self._Key
 
+    def _GetTimeStamp(self):
+        return os.stat(self.Path)[8]
+
     def Validate(self, Type='', CaseSensitive=True):
         if GlobalData.gCaseInsensitive:
             CaseSensitive = False
@@ -1465,6 +1468,7 @@ class PathClass(object):
         return ErrorCode, ErrorInfo
 
     Key = property(_GetFileKey)
+    TimeStamp = property(_GetTimeStamp)
 
 ## Parse PE image to get the required PE informaion.
 #
@@ -1482,7 +1486,7 @@ class PeImageClass():
         self.SectionHeaderList = []
         self.ErrorInfo = ''
         try:
-             PeObject = open(PeFile, 'rb')
+            PeObject = open(PeFile, 'rb')
         except:
             self.ErrorInfo = self.FileName + ' can not be found\n'
             return
index 48807688662132e7cbe94acfe25e19bd0743bd2d..a35f728dc0151c0ade819c93ffc4606ab019260d 100644 (file)
@@ -22,6 +22,7 @@ import EdkLogger as EdkLogger
 \r
 import GlobalData\r
 from BuildToolError import *\r
+from CommonDataClass.Exceptions import *\r
 \r
 gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE)\r
 gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')\r
@@ -39,7 +40,52 @@ gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
 # @retval list() A list for splitted string\r
 #\r
 def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1):\r
-    return map(lambda l: l.strip(), String.split(SplitTag, MaxSplit))\r
+    ValueList = []\r
+    Last = 0\r
+    Escaped = False\r
+    InString = False\r
+    for Index in range(0, len(String)):\r
+        Char = String[Index]\r
+\r
+        if not Escaped:\r
+            # Found a splitter not in a string, split it\r
+            if not InString and Char == SplitTag:\r
+                ValueList.append(String[Last:Index].strip())\r
+                Last = Index+1\r
+                if MaxSplit > 0 and len(ValueList) >= MaxSplit:\r
+                    break\r
+\r
+            if Char == '\\' and InString:\r
+                Escaped = True\r
+            elif Char == '"':\r
+                if not InString:\r
+                    InString = True\r
+                else:\r
+                    InString = False\r
+        else:\r
+            Escaped = False\r
+\r
+    if Last < len(String):\r
+        ValueList.append(String[Last:].strip())\r
+    elif Last == len(String):\r
+        ValueList.append('')\r
+\r
+    return ValueList\r
+\r
+## GetSplitList\r
+#\r
+# Get a value list from a string with multiple values splited with SplitString\r
+# The default SplitTag is DataType.TAB_VALUE_SPLIT\r
+# 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']\r
+#\r
+# @param String:    The input string to be splitted\r
+# @param SplitStr:  The split key, default is DataType.TAB_VALUE_SPLIT\r
+# @param MaxSplit:  The max number of split values, default is -1\r
+#\r
+# @retval list() A list for splitted string\r
+#\r
+def GetSplitList(String, SplitStr = DataType.TAB_VALUE_SPLIT, MaxSplit = -1):\r
+    return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit))\r
 \r
 ## MergeArches\r
 #\r
@@ -210,16 +256,18 @@ def ReplaceMacros(StringList, MacroDefinitions={}, SelfReplacement = False):
 #\r
 # @retval string            The string whose macros are replaced\r
 #\r
-def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement = False):\r
+def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=False):\r
     LastString = String\r
-    while MacroDefinitions:\r
-        MacroUsed = GlobalData.gMacroPattern.findall(String)\r
+    while String and MacroDefinitions:\r
+        MacroUsed = GlobalData.gMacroRefPattern.findall(String)\r
         # no macro found in String, stop replacing\r
         if len(MacroUsed) == 0:\r
             break\r
 \r
         for Macro in MacroUsed:\r
             if Macro not in MacroDefinitions:\r
+                if RaiseError:\r
+                    raise SymbolNotFound("%s not defined" % Macro)\r
                 if SelfReplacement:\r
                     String = String.replace("$(%s)" % Macro, '')\r
                 continue\r
index ebb0358b0bc65ac012c0de2742630cd1d62fdd75..3d971c84cdb8ef991bd0e4c2b1a7a1ce5459c17a 100644 (file)
@@ -89,11 +89,13 @@ MODEL_META_DATA_COMPONENT = 5009
 MODEL_META_DATA_USER_EXTENSION = 5010\r
 MODEL_META_DATA_PACKAGE = 5011\r
 MODEL_META_DATA_NMAKE = 5012\r
-MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 50013\r
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013\r
 MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014\r
 MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015\r
 MODEL_META_DATA_COMMENT = 5016\r
 MODEL_META_DATA_GLOBAL_DEFINE = 5017\r
+MODEL_META_DATA_SECTION_HEADER = 5100\r
+MODEL_META_DATA_SUBSECTION_HEADER = 5200\r
 \r
 MODEL_EXTERNAL_DEPENDENCY = 10000\r
 \r
diff --git a/BaseTools/Source/Python/CommonDataClass/Exceptions.py b/BaseTools/Source/Python/CommonDataClass/Exceptions.py
new file mode 100644 (file)
index 0000000..50541e8
--- /dev/null
@@ -0,0 +1,29 @@
+## @file\r
+# This file is used to define common Exceptions class used in python tools\r
+#\r
+# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.    The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+## Exceptions used in Expression\r
+class EvaluationException(Exception):\r
+    pass\r
+\r
+class BadExpression(EvaluationException):\r
+    pass\r
+\r
+class WrnExpression(Exception):\r
+    pass\r
+\r
+## Exceptions used in macro replacements\r
+class MacroException(Exception):\r
+    pass\r
+\r
+class SymbolNotFound(MacroException):\r
+    pass\r
+\r
index bb40d756c8a772d5720206f96214946a131fb6e5..a6dace82a628de908c35ddd83608572ffeda4a32 100644 (file)
@@ -79,11 +79,11 @@ class AprioriSection (AprioriSectionClassObject):
                 InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict, Arch)\r
 \r
                 if Arch != None:\r
-                    Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch]\r
+                    Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
                     Guid = Inf.Guid\r
 \r
                 else:\r
-                    Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), 'COMMON']\r
+                    Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
                     Guid = Inf.Guid\r
 \r
                     self.BinFileList = Inf.Module.Binaries\r
index 39678b23e96df52752caeedb2aa0e5cddcc036aa..b7b1ae7d93afdb61c93b2fc892d1002f1d92c9da 100644 (file)
@@ -39,7 +39,10 @@ class DepexSection (DepexSectionClassObject):
 \r
     def __FindGuidValue(self, CName):\r
         for Arch in GenFdsGlobalVariable.ArchList:\r
-            for PkgDb in GenFdsGlobalVariable.WorkSpace.PackageList:\r
+            for PkgDb in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, \r
+                                                                       Arch, \r
+                                                                       GenFdsGlobalVariable.TargetName, \r
+                                                                       GenFdsGlobalVariable.ToolChainTag):\r
                 if CName in PkgDb.Ppis:\r
                     return PkgDb.Ppis[CName]\r
                 if CName in PkgDb.Protocols:\r
index cbfd6715ca09572e5bf6f14510e38fa6344f66de..aa4d2e8262d0baaee5f80401cfcc0e423d4d1d41 100644 (file)
@@ -71,11 +71,11 @@ class FD(FDClassObject):
         \r
         for RegionObj in self.RegionList :\r
             if RegionObj.RegionType == 'CAPSULE':\r
-              continue\r
+                continue\r
             if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:\r
-              pass\r
+                pass\r
             elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):\r
-              pass\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
@@ -88,7 +88,7 @@ class FD(FDClassObject):
             # Call each region's AddToBuffer function\r
             #\r
             if PreviousRegionSize > self.Size:\r
-              pass\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
index 4f555e32bbaea27de65ee3f9cfc9899a73db24e2..e3a018c66c8ffadcadd711dbafe1dfccb1a3fba9 100644 (file)
@@ -15,6 +15,8 @@
 ##\r
 # Import Modules\r
 #\r
+import re\r
+\r
 import Fd\r
 import Region\r
 import Fv\r
@@ -45,6 +47,8 @@ from Common.BuildToolError import *
 from Common import EdkLogger\r
 from Common.Misc import PathClass\r
 from Common.String import NormPath\r
+import Common.GlobalData as GlobalData\r
+from Common.Expression import *\r
 from Common import GlobalData\r
 \r
 import re\r
@@ -68,6 +72,9 @@ T_CHAR_BACKSLASH, T_CHAR_DOUBLE_QUOTE, T_CHAR_SINGLE_QUOTE, T_CHAR_STAR, T_CHAR_
 \r
 SEPERATOR_TUPLE = ('=', '|', ',', '{', '}')\r
 \r
+RegionSizePattern = re.compile("\s*(?P<base>(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P<size>(?:0x|0X)?[a-fA-F0-9]+)\s*")\r
+RegionSizeGuidPattern = re.compile("\s*(?P<base>\w+\.\w+)\s*\|\s*(?P<size>\w+\.\w+)\s*")\r
+\r
 IncludeFileList = []\r
 # Macro passed from command line, which has greatest priority and can NOT be overridden by those in FDF\r
 InputMacroDict = {}\r
@@ -211,6 +218,10 @@ class FdfParser:
         if GenFdsGlobalVariable.WorkSpaceDir == '':\r
             GenFdsGlobalVariable.WorkSpaceDir = os.getenv("WORKSPACE")\r
 \r
+        InputMacroDict.update(GlobalData.gPlatformDefines)\r
+        InputMacroDict.update(GlobalData.gGlobalDefines)\r
+        InputMacroDict.update(GlobalData.gCommandLineDefines)\r
+\r
     ## __IsWhiteSpace() method\r
     #\r
     #   Whether char at current FileBufferPos is whitespace\r
@@ -317,10 +328,10 @@ class FdfParser:
     #\r
     def __GetOneChar(self):\r
         if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:\r
-                self.CurrentLineNumber += 1\r
-                self.CurrentOffsetWithinLine = 0\r
+            self.CurrentLineNumber += 1\r
+            self.CurrentOffsetWithinLine = 0\r
         else:\r
-                self.CurrentOffsetWithinLine += 1\r
+            self.CurrentOffsetWithinLine += 1\r
 \r
     ## __CurrentChar() method\r
     #\r
@@ -564,7 +575,7 @@ class FdfParser:
                 self.Profile.FileLinesList[IncludeLine - 1] = ''.join(TempList)\r
 \r
         self.Rewind()\r
-\r
+        \r
     def __GetIfListCurrentItemStat(self, IfList):\r
         if len(IfList) == 0:\r
             return True\r
@@ -574,8 +585,7 @@ class FdfParser:
                 return False\r
         \r
         return True\r
-                   \r
-\r
+    \r
     ## PreprocessConditionalStatement() method\r
     #\r
     #   Preprocess conditional statement.\r
@@ -586,9 +596,10 @@ class FdfParser:
     def PreprocessConditionalStatement(self):\r
         # IfList is a stack of if branches with elements of list [Pos, CondSatisfied, BranchDetermined]\r
         IfList = []\r
+        RegionLayoutLine = 0\r
         while self.__GetNextToken():\r
             if self.__Token == 'DEFINE':\r
-                if self.__GetIfListCurrentItemStat(IfList):\r
+                if self.__GetIfListCurrentItemStat(IfList): \r
                     DefineLine = self.CurrentLineNumber - 1\r
                     DefineOffset = self.CurrentOffsetWithinLine - len('DEFINE')\r
                     if not self.__GetNextToken():\r
@@ -609,60 +620,48 @@ class FdfParser:
                         MacProfile.MacroName = Macro\r
                         MacProfile.MacroValue = Value\r
                         AllMacroList.append(MacProfile)\r
+                        InputMacroDict[MacProfile.MacroName] = MacProfile.MacroValue\r
                     self.__WipeOffArea.append(((DefineLine, DefineOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
+            elif self.__Token == 'SET':\r
+                PcdPair = self.__GetNextPcdName()\r
+                PcdName = "%s.%s" % (PcdPair[1], PcdPair[0])\r
+                if not self.__IsToken( "="):\r
+                    raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
 \r
+                if not self.__GetNextToken():\r
+                    raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
+\r
+                Value = self.__Token\r
+                if Value.startswith("{"):\r
+                    # deal with value with {}\r
+                    if not self.__SkipToToken( "}"):\r
+                        raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
+                    Value += self.__SkippedChars\r
+\r
+                InputMacroDict[PcdName] = Value\r
             elif self.__Token in ('!ifdef', '!ifndef', '!if'):\r
                 IfStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))\r
                 IfList.append([IfStartPos, None, None])\r
+\r
                 CondLabel = self.__Token\r
+                Expression = self.__GetExpression()\r
                 \r
-                MacroName, NotFlag = self.__GetMacroName() \r
-                NotDefineFlag = False\r
-                if CondLabel == '!ifndef':\r
-                    NotDefineFlag = True\r
-                if CondLabel == '!ifdef' or CondLabel == '!ifndef':\r
-                    if NotFlag:\r
-                        raise Warning("'NOT' operation not allowed for Macro name", self.FileName, self.CurrentLineNumber)\r
-\r
                 if CondLabel == '!if':\r
-\r
-                    if not self.__GetNextOp():\r
-                        raise Warning("expected !endif", self.FileName, self.CurrentLineNumber)\r
-\r
-                    if self.__Token in ('!=', '==', '>', '<', '>=', '<='):\r
-                        Op = self.__Token\r
-                        if not self.__GetNextToken():\r
-                            raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
-                        if self.__GetStringData():\r
-                            pass\r
-                        MacroValue = self.__Token\r
-                        ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, Op, MacroValue)\r
-                        if NotFlag:\r
-                            ConditionSatisfied = not ConditionSatisfied\r
-                        BranchDetermined = ConditionSatisfied\r
-                    else:\r
-                        self.CurrentOffsetWithinLine -= len(self.__Token)\r
-                        ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, None, 'Bool')\r
-                        if NotFlag:\r
-                            ConditionSatisfied = not ConditionSatisfied\r
-                        BranchDetermined = ConditionSatisfied\r
-                    IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]\r
-                    if ConditionSatisfied:\r
-                        self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
-\r
+                    ConditionSatisfied = self.__EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'eval')\r
                 else:\r
-                    ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1)\r
-                    if NotDefineFlag:\r
+                    ConditionSatisfied = self.__EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'in')\r
+                    if CondLabel == '!ifndef':\r
                         ConditionSatisfied = not ConditionSatisfied\r
-                    BranchDetermined = ConditionSatisfied\r
-                    IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]\r
-                    if ConditionSatisfied:\r
-                        self.__WipeOffArea.append((IfStartPos, (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
 \r
+                BranchDetermined = ConditionSatisfied\r
+                IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]\r
+                if ConditionSatisfied:\r
+                    self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))                 \r
             elif self.__Token in ('!elseif', '!else'):\r
                 ElseStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))\r
                 if len(IfList) <= 0:\r
                     raise Warning("Missing !if statement", self.FileName, self.CurrentLineNumber)\r
+\r
                 if IfList[-1][1]:\r
                     IfList[-1] = [ElseStartPos, False, True]\r
                     self.__WipeOffArea.append((ElseStartPos, (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
@@ -670,27 +669,8 @@ class FdfParser:
                     self.__WipeOffArea.append((IfList[-1][0], ElseStartPos))\r
                     IfList[-1] = [ElseStartPos, True, IfList[-1][2]]\r
                     if self.__Token == '!elseif':\r
-                        MacroName, NotFlag = self.__GetMacroName() \r
-                        if not self.__GetNextOp():\r
-                            raise Warning("expected !endif", self.FileName, self.CurrentLineNumber)\r
-\r
-                        if self.__Token in ('!=', '==', '>', '<', '>=', '<='):\r
-                            Op = self.__Token\r
-                            if not self.__GetNextToken():\r
-                                raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
-                            if self.__GetStringData():\r
-                                pass\r
-                            MacroValue = self.__Token\r
-                            ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, Op, MacroValue)\r
-                            if NotFlag:\r
-                                ConditionSatisfied = not ConditionSatisfied\r
-\r
-                        else:\r
-                            self.CurrentOffsetWithinLine -= len(self.__Token)\r
-                            ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, None, 'Bool')\r
-                            if NotFlag:\r
-                                ConditionSatisfied = not ConditionSatisfied\r
-\r
+                        Expression = self.__GetExpression()\r
+                        ConditionSatisfied = self.__EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'eval')\r
                         IfList[-1] = [IfList[-1][0], ConditionSatisfied, IfList[-1][2]]\r
 \r
                     if IfList[-1][1]:\r
@@ -699,8 +679,6 @@ class FdfParser:
                         else:\r
                             IfList[-1][2] = True\r
                             self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
-\r
-\r
             elif self.__Token == '!endif':\r
                 if IfList[-1][1]:\r
                     self.__WipeOffArea.append(((self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len('!endif')), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
@@ -708,106 +686,48 @@ class FdfParser:
                     self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
 \r
                 IfList.pop()\r
+            elif not IfList:    # Don't use PCDs inside conditional directive\r
+                if self.CurrentLineNumber <= RegionLayoutLine:\r
+                    # Don't try the same line twice\r
+                    continue\r
+                RegionSize = RegionSizePattern.match(self.Profile.FileLinesList[self.CurrentLineNumber - 1])\r
+                if not RegionSize:\r
+                    RegionLayoutLine = self.CurrentLineNumber\r
+                    continue\r
+                RegionSizeGuid = RegionSizeGuidPattern.match(self.Profile.FileLinesList[self.CurrentLineNumber])\r
+                if not RegionSizeGuid:\r
+                    RegionLayoutLine = self.CurrentLineNumber + 1\r
+                    continue\r
+                InputMacroDict[RegionSizeGuid.group('base')] = RegionSize.group('base')\r
+                InputMacroDict[RegionSizeGuid.group('size')] = RegionSize.group('size')\r
+                RegionLayoutLine = self.CurrentLineNumber + 1\r
 \r
-\r
-        if len(IfList) > 0:\r
+        if IfList:\r
             raise Warning("Missing !endif", self.FileName, self.CurrentLineNumber)\r
         self.Rewind()\r
 \r
-    def __EvaluateConditional(self, Name, Line, Op = None, Value = None):\r
-\r
+    def __EvaluateConditional(self, Expression, Line, Op = None, Value = None):\r
         FileLineTuple = GetRealFileLine(self.FileName, Line)\r
-        if Name in InputMacroDict:\r
-            MacroValue = InputMacroDict[Name]\r
-            if Op == None:\r
-                if Value == 'Bool' and MacroValue == None or MacroValue.upper() == 'FALSE':\r
-                    return False\r
-                return True\r
-            elif Op == '!=':\r
-                if Value != MacroValue:\r
-                    return True\r
-                else:\r
-                    return False\r
-            elif Op == '==':\r
-                if Value == MacroValue:\r
-                    return True\r
-                else:\r
-                    return False\r
-            else:\r
-                if (self.__IsHex(Value) or Value.isdigit()) and (self.__IsHex(MacroValue) or (MacroValue != None and MacroValue.isdigit())):\r
-                    InputVal = long(Value, 0)\r
-                    MacroVal = long(MacroValue, 0)\r
-                    if Op == '>':\r
-                        if MacroVal > InputVal:\r
-                            return True\r
-                        else:\r
-                            return False\r
-                    elif Op == '>=':\r
-                        if MacroVal >= InputVal:\r
-                            return True\r
-                        else:\r
-                            return False\r
-                    elif Op == '<':\r
-                        if MacroVal < InputVal:\r
-                            return True\r
-                        else:\r
-                            return False\r
-                    elif Op == '<=':\r
-                        if MacroVal <= InputVal:\r
-                            return True\r
-                        else:\r
-                            return False\r
-                    else:\r
-                        return False\r
-                else:\r
-                    raise Warning("Value %s is not a number", self.FileName, Line)\r
-\r
-        for Profile in AllMacroList:\r
-            if Profile.MacroName == Name and Profile.DefinedAtLine <= FileLineTuple[1]:\r
-                if Op == None:\r
-                    if Value == 'Bool' and Profile.MacroValue == None or Profile.MacroValue.upper() == 'FALSE':\r
-                        return False\r
-                    return True\r
-                elif Op == '!=':\r
-                    if Value != Profile.MacroValue:\r
-                        return True\r
-                    else:\r
-                        return False\r
-                elif Op == '==':\r
-                    if Value == Profile.MacroValue:\r
-                        return True\r
-                    else:\r
-                        return False\r
-                else:\r
-                    if (self.__IsHex(Value) or Value.isdigit()) and (self.__IsHex(Profile.MacroValue) or (Profile.MacroValue != None and Profile.MacroValue.isdigit())):\r
-                        InputVal = long(Value, 0)\r
-                        MacroVal = long(Profile.MacroValue, 0)\r
-                        if Op == '>':\r
-                            if MacroVal > InputVal:\r
-                                return True\r
-                            else:\r
-                                return False\r
-                        elif Op == '>=':\r
-                            if MacroVal >= InputVal:\r
-                                return True\r
-                            else:\r
-                                return False\r
-                        elif Op == '<':\r
-                            if MacroVal < InputVal:\r
-                                return True\r
-                            else:\r
-                                return False\r
-                        elif Op == '<=':\r
-                            if MacroVal <= InputVal:\r
-                                return True\r
-                            else:\r
-                                return False\r
-                        else:\r
-                            return False\r
-                    else:\r
-                        raise Warning("Value %s is not a number", self.FileName, Line)\r
-\r
-        return False\r
+        if Op == 'eval':\r
+            try:\r
+                return ValueExpression(Expression, InputMacroDict)()\r
+            except SymbolNotFound:\r
+                return False\r
+            except WrnExpression, Excpt:\r
+                # \r
+                # Catch expression evaluation warning here. We need to report\r
+                # the precise number of line and return the evaluation result\r
+                #\r
+                EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),\r
+                                File=self.FileName, ExtraData=self.__CurrentLine(), \r
+                                Line=Line)\r
+                return Excpt.result\r
+            except Exception, Excpt:\r
+                raise Warning("Invalid expression", *FileLineTuple)\r
+        else:\r
+            if Expression.startswith('$(') and Expression[-1] == ')':\r
+                Expression = Expression[2:-1]            \r
+            return Expression in InputMacroDict\r
 \r
     ## __IsToken() method\r
     #\r
@@ -866,6 +786,16 @@ class FdfParser:
             return True\r
         return False\r
 \r
+    def __GetExpression(self):\r
+        Line = self.Profile.FileLinesList[self.CurrentLineNumber - 1]\r
+        Index = len(Line) - 1\r
+        while Line[Index] in ['\r', '\n']:\r
+            Index -= 1\r
+        ExpressionString = self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine:Index+1]\r
+        self.CurrentOffsetWithinLine += len(ExpressionString)\r
+        ExpressionString = ExpressionString.strip()\r
+        return ExpressionString\r
+\r
     ## __GetNextWord() method\r
     #\r
     #   Get next C name from file lines\r
@@ -1208,7 +1138,7 @@ class FdfParser:
             for Pos in self.__WipeOffArea:\r
                 self.__ReplaceFragment(Pos[0], Pos[1])\r
             self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]\r
-            \r
+\r
             while self.__GetDefines():\r
                 pass\r
             \r
@@ -2014,8 +1944,8 @@ class FdfParser:
         if not IsValidBaseAddrValue.match(self.__Token.upper()):\r
             raise Warning("Unknown FV base address value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
         Obj.FvBaseAddress = self.__Token\r
-        return True    \r
-    \r
+        return True  \r
+      \r
     ## __GetFvForceRebase() method\r
     #\r
     #   Get FvForceRebase for FV\r
@@ -2047,7 +1977,8 @@ class FdfParser:
             Obj.FvForceRebase = None\r
            \r
         return True\r
-    \r
+\r
+\r
     ## __GetFvAttributes() method\r
     #\r
     #   Get attributes for FV\r
@@ -2475,6 +2406,7 @@ class FdfParser:
                         if ErrorCode != 0:\r
                             EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)                    \r
 \r
+\r
         if not self.__IsToken( "}"):\r
             raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
 \r
index b85854936179a33c956c7e4f1bf0739742f746d4..04527fe00fee923d9e9b69e866c5dd4e94856e93 100644 (file)
@@ -71,7 +71,7 @@ class FileStatement (FileStatementClassObject) :
         \r
         OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)\r
         if not os.path.exists(OutputDir):\r
-             os.makedirs(OutputDir)\r
+            os.makedirs(OutputDir)\r
 \r
         Dict.update(self.DefineVarDict)\r
         SectionAlignments = None\r
@@ -98,7 +98,7 @@ class FileStatement (FileStatementClassObject) :
             SectionFiles = []\r
             Index = 0\r
             SectionAlignments = []\r
-            for section in self.SectionList:\r
+            for section in self.SectionList :\r
                 Index = Index + 1\r
                 SecIndex = '%d' %Index\r
                 # process the inside FvImage from FvSection or GuidSection\r
index c6f29f6ddd941bc79db2a8dc9c9c18d5ac9dbc7f..96e212cae7aa7d892ea06b1f2e4af7b21dbb5f04 100644 (file)
@@ -163,7 +163,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         \r
         if self.CurrentArch != None:\r
 \r
-            Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, self.CurrentArch]\r
+            Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
             #\r
             # Set Ffs BaseName, MdouleGuid, ModuleType, Version, OutputPath\r
             #\r
@@ -181,7 +181,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 self.ShadowFromInfFile = Inf.Shadow\r
 \r
         else:\r
-            Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, 'COMMON']\r
+            Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
             self.BaseName = Inf.BaseName\r
             self.ModuleGuid = Inf.Guid\r
             self.ModuleType = Inf.ModuleType\r
@@ -363,27 +363,27 @@ class FfsInfStatement(FfsInfStatementClassObject):
 \r
         InfFileKey = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))\r
         DscArchList = []\r
-        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IA32']\r
+        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IA32', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
         if  PlatformDataBase != None:\r
             if InfFileKey in PlatformDataBase.Modules:\r
                 DscArchList.append ('IA32')\r
 \r
-        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'X64']\r
+        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'X64', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
         if  PlatformDataBase != None:\r
             if InfFileKey in PlatformDataBase.Modules:\r
                 DscArchList.append ('X64')\r
 \r
-        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IPF']\r
+        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IPF', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
         if PlatformDataBase != None:\r
             if InfFileKey in (PlatformDataBase.Modules):\r
                 DscArchList.append ('IPF')\r
 \r
-        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'ARM']\r
+        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'ARM', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
         if PlatformDataBase != None:\r
             if InfFileKey in (PlatformDataBase.Modules):\r
                 DscArchList.append ('ARM')\r
 \r
-        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'EBC']\r
+        PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'EBC', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
         if PlatformDataBase != None:\r
             if InfFileKey in (PlatformDataBase.Modules):\r
                 DscArchList.append ('EBC')\r
index f186ab0e73265547b126daa9be098b3738c436df..fd5ad0e9ac382f104a8a249bec7529dc940ca52f 100644 (file)
@@ -48,7 +48,7 @@ class FV (FvClassObject):
         self.CapsuleName = None\r
         self.FvBaseAddress = None\r
         self.FvForceRebase = None\r
-\r
+        \r
     ## AddToBuffer()\r
     #\r
     #   Generate Fv and add it to the Buffer\r
@@ -83,13 +83,13 @@ class FV (FvClassObject):
                             elif RegionData.upper() + 'fv' in GenFds.ImageBinDict.keys():\r
                                 continue\r
                             elif self.UiFvName.upper() == RegionData.upper():\r
-                               GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))\r
+                                GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))\r
 \r
         GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)\r
         \r
         if self.FvBaseAddress != None:\r
-            BaseAddress = self.FvBaseAddress \r
-        \r
+            BaseAddress = self.FvBaseAddress\r
+\r
         self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)\r
         #\r
         # First Process the Apriori section\r
index cadd36c922e1400a0f8ab1f791a594a0efe96d14..0219783b03da07930c8884938d703b8ae642f387 100644 (file)
@@ -161,20 +161,22 @@ def main():
                 if len(List) == 2:
                     if List[0].strip() == "EFI_SOURCE":
                         GlobalData.gEfiSource = List[1].strip()
+                        GlobalData.gGlobalDefines["EFI_SOURCE"] = GlobalData.gEfiSource
                         continue
                     elif List[0].strip() == "EDK_SOURCE":
                         GlobalData.gEdkSource = List[1].strip()
+                        GlobalData.gGlobalDefines["EDK_SOURCE"] = GlobalData.gEdkSource
                         continue
+                    elif List[0].strip() in ["WORKSPACE", "TARGET", "TOOLCHAIN"]:
+                        GlobalData.gGlobalDefines[List[0].strip()] = List[1].strip()
                     else:
-                        GlobalData.gEdkGlobal[List[0].strip()] = List[1].strip()
-                        FdfParser.InputMacroDict[List[0].strip()] = List[1].strip()
+                        GlobalData.gCommandLineDefines[List[0].strip()] = List[1].strip()
                 else:
-                    FdfParser.InputMacroDict[List[0].strip()] = ""
+                    GlobalData.gCommandLineDefines[List[0].strip()] = "TRUE"
+        os.environ["WORKSPACE"] = Workspace
 
         """call Workspace build create database"""
-        os.environ["WORKSPACE"] = Workspace
-        FdfParser.InputMacroDict["WORKSPACE"] = Workspace
-        BuildWorkSpace = WorkspaceDatabase(':memory:', FdfParser.InputMacroDict)
+        BuildWorkSpace = WorkspaceDatabase(None)
         BuildWorkSpace.InitDatabase()
         
         #
@@ -187,15 +189,15 @@ def main():
             ArchList = Options.archList.split(',')
         else:
 #            EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH")
-            ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList
+            ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList
 
-        TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(ArchList)
+        TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchList) & set(ArchList)
         if len(TargetArchList) == 0:
             EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList)))
         
         for Arch in ArchList:
-            GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].OutputDirectory)
-            GenFdsGlobalVariable.PlatformName = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].PlatformName
+            GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].OutputDirectory)
+            GenFdsGlobalVariable.PlatformName = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Options.BuildTarget, Options.ToolChain].PlatformName
 
         if (Options.outputDir):
             OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(Options.outputDir)
@@ -276,7 +278,8 @@ def main():
                     ExtraData="Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!\n",
                     RaiseError=False
                     )
-        EdkLogger.quiet(traceback.format_exc())
+        if Options.debug != None:
+            EdkLogger.quiet(traceback.format_exc())
         ReturnCode = CODE_ERROR
     return ReturnCode
 
@@ -482,7 +485,7 @@ class GenFds :
     #   @retval None
     #
     def PreprocessImage(BuildDb, DscFile):
-        PcdDict = BuildDb.BuildObject[DscFile, 'COMMON'].Pcds
+        PcdDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds
         PcdValue = ''
         for Key in PcdDict:
             PcdObj = PcdDict[Key]
@@ -501,20 +504,20 @@ class GenFds :
         if Int64PcdValue > 0:
             TopAddress = Int64PcdValue
             
-        ModuleDict = BuildDb.BuildObject[DscFile, 'COMMON'].Modules
+        ModuleDict = BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules
         for Key in ModuleDict:
-            ModuleObj = BuildDb.BuildObject[Key, 'COMMON']
+            ModuleObj = BuildDb.BuildObject[Key, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
             print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType
 
     def GenerateGuidXRefFile(BuildDb, ArchList):
         GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
         GuidXRefFile = StringIO.StringIO('')
         for Arch in ArchList:
-            PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch]
+            PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
             for ModuleFile in PlatformDataBase.Modules:
-                Module = BuildDb.BuildObject[ModuleFile, Arch]
+                Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
                 GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
-        SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)\r
+        SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)
         GuidXRefFile.close()
         GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)
         
index 236283751e1ac0aa264a862e06e2d23034fd3c85..ea6b191bc1254178afe92cd048b7aa25f87dff82 100644 (file)
@@ -117,7 +117,7 @@ class GenFdsGlobalVariable:
         if not BuildRuleDatabase:
             return {}
 
-        PathClassObj = PathClass(str(Inf.MetaFile).lstrip(GenFdsGlobalVariable.WorkSpaceDir),
+        PathClassObj = PathClass(Inf.MetaFile.File,
                                  GenFdsGlobalVariable.WorkSpaceDir)
         Macro = {}
         Macro["WORKSPACE"             ] = GenFdsGlobalVariable.WorkSpaceDir
@@ -135,6 +135,7 @@ class GenFdsGlobalVariable:
         Macro["ARCH"                  ] = Arch
         Macro["TOOLCHAIN"             ] = GenFdsGlobalVariable.ToolChainTag
         Macro["TOOLCHAIN_TAG"         ] = GenFdsGlobalVariable.ToolChainTag
+        Macro["TOOL_CHAIN_TAG"        ] = GenFdsGlobalVariable.ToolChainTag
         Macro["TARGET"                ] = GenFdsGlobalVariable.TargetName
 
         Macro["BUILD_DIR"             ] = GenFdsGlobalVariable.OutputDirDict[Arch]
@@ -280,8 +281,8 @@ class GenFdsGlobalVariable:
         FvAddressFile.writelines("[options]" + T_CHAR_LF)
         BsAddress = '0'
         for Arch in ArchList:
-            if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].BsBaseAddress:
-                BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].BsBaseAddress
+            if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress:
+                BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].BsBaseAddress
                 break
 
         FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \
@@ -290,8 +291,8 @@ class GenFdsGlobalVariable:
 
         RtAddress = '0'
         for Arch in ArchList:
-            if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].RtBaseAddress:
-                RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].RtBaseAddress
+            if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress:
+                RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].RtBaseAddress
 
         FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \
                                        RtAddress          + \
@@ -345,10 +346,6 @@ class GenFdsGlobalVariable:
     @staticmethod
     def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None,
                         GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None):
-        if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
-            return
-        GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
-
         Cmd = ["GenSec"]
         if Type not in [None, '']:
             Cmd += ["-s", Type]
@@ -388,6 +385,13 @@ class GenFdsGlobalVariable:
         else:
             Cmd += ["-o", Output]
             Cmd += Input
+
+            CommandFile = Output + '.txt'
+            SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
+            if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
+                return
+            GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+
             GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
 
     @staticmethod
@@ -402,10 +406,6 @@ class GenFdsGlobalVariable:
     @staticmethod
     def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,
                     SectionAlign=None):
-        if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
-            return
-        GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
-
         Cmd = ["GenFfs", "-t", Type, "-g", Guid]
         if Fixed == True:
             Cmd += ["-x"]
@@ -419,6 +419,13 @@ class GenFdsGlobalVariable:
             Cmd += ("-i", Input[I])
             if SectionAlign not in [None, '', []] and SectionAlign[I] not in [None, '']:
                 Cmd += ("-n", SectionAlign[I])
+
+        CommandFile = Output + '.txt'
+        SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
+        if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):
+            return
+        GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
+
         GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")
 
     @staticmethod
@@ -436,7 +443,7 @@ class GenFdsGlobalVariable:
             Cmd +=["-F", "FALSE"]
         elif ForceRebase == True:
             Cmd +=["-F", "TRUE"]
-                        
+            
         if Capsule:
             Cmd += ["-c"]
         if Dump:
@@ -653,25 +660,9 @@ class GenFdsGlobalVariable:
         TokenCName = PcdPair[1]
 
         PcdValue = ''
-        for Platform in GenFdsGlobalVariable.WorkSpace.PlatformList:
-            #
-            # Only process platform which match current build option.
-            #
-            if Platform.MetaFile == GenFdsGlobalVariable.ActivePlatform:            
-                PcdDict = Platform.Pcds
-                for Key in PcdDict:
-                    PcdObj = PcdDict[Key]
-                    if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
-                        if PcdObj.Type != 'FixedAtBuild':
-                            EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
-                        if PcdObj.DatumType != 'VOID*':
-                            EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
-                            
-                        PcdValue = PcdObj.DefaultValue
-                        return PcdValue
-
-        for Package in GenFdsGlobalVariable.WorkSpace.PackageList:
-            PcdDict = Package.Pcds
+        for Arch in GenFdsGlobalVariable.ArchList:
+            Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+            PcdDict = Platform.Pcds
             for Key in PcdDict:
                 PcdObj = PcdDict[Key]
                 if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
@@ -682,6 +673,22 @@ class GenFdsGlobalVariable:
                         
                     PcdValue = PcdObj.DefaultValue
                     return PcdValue
+                
+            for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, 
+                                                                         Arch, 
+                                                                         GenFdsGlobalVariable.TargetName, 
+                                                                         GenFdsGlobalVariable.ToolChainTag):
+                PcdDict = Package.Pcds
+                for Key in PcdDict:
+                    PcdObj = PcdDict[Key]
+                    if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+                        if PcdObj.Type != 'FixedAtBuild':
+                            EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+                        if PcdObj.DatumType != 'VOID*':
+                            EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+                            
+                        PcdValue = PcdObj.DefaultValue
+                        return PcdValue
 
         return PcdValue
 
index ef9720a660674cff33d872fadf66186cb4d4834a..6f57ad568196050b0347cddd2193038c72498a37 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # section base class\r
 #\r
-#  Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007-2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
index a8c36ea3c3b49caaffc62aa07efceb14165f3857..3f6c575128b3bee3911988fc0f8e7d51fda6a346 100644 (file)
@@ -23,7 +23,6 @@ from optparse import make_option
 from Common.BuildToolError import *
 import Common.EdkLogger as EdkLogger
 from Common.BuildVersion import gBUILD_VERSION
-
 import array
 
 # Version and Copyright
index d6b9a096c7894955c48930e7633f1ef7585de75d..8efb56a61ab1c4aa939a398a87a8b79196f8b6f2 100644 (file)
@@ -17,6 +17,7 @@ PaserValidate
 \r
 import os.path\r
 import re\r
+import platform\r
 \r
 from Library.DataType import MODULE_LIST\r
 from Library.DataType import COMPONENT_TYPE_LIST\r
@@ -281,9 +282,14 @@ def IsValidPath(Path, Root):
 # @param Path: path to be checked\r
 #\r
 def IsValidInstallPath(Path):\r
-    if os.path.isabs(Path):\r
-        return False\r
-   \r
+    if platform.platform().find("Windows") >= 0:\r
+        if os.path.isabs(Path):\r
+            return False\r
+    else:\r
+        if Path[1:2] == ':' or Path.find('\\') >=0:\r
+            return False\r
+        if os.path.isabs(Path):\r
+            return False\r
     if Path.startswith('.'):\r
         return False\r
     \r
index 64f0480c37e860d39c9a469c1702d194bde9d12a..34ef4903df16625d49178a2e11fd52c883e87384 100644 (file)
@@ -140,6 +140,10 @@ class Table(object):
 \r
     def SetEndFlag(self):\r
         self.Exec("insert into %s values(%s)" % (self.Table, self._DUMMY_))\r
+        #\r
+        # Need to execution commit for table data changed.\r
+        #\r
+        self.Cur.connection.commit()\r
 \r
     def IsIntegral(self):\r
         Result = self.Exec("select min(ID) from %s" % (self.Table))\r
@@ -147,6 +151,9 @@ class Table(object):
             return False\r
         return True\r
 \r
+    def GetAll(self):\r
+        return self.Exec("select * from %s where ID > 0 order by ID" % (self.Table))\r
+\r
 ## TableFile\r
 #\r
 # This class defined a table used for file\r
@@ -198,19 +205,15 @@ class TableFile(Table):
     #\r
     # @retval FileID:       The ID after record is inserted\r
     #\r
-    def InsertFile(self, FileFullPath, Model):\r
-        (Filepath, Name) = os.path.split(FileFullPath)\r
-        (Root, Ext) = os.path.splitext(FileFullPath)\r
-        TimeStamp = os.stat(FileFullPath)[8]\r
-        File = FileClass(-1, Name, Ext, Filepath, FileFullPath, Model, '', [], [], [])\r
+    def InsertFile(self, File, Model):\r
         return self.Insert(\r
-            Name,\r
-            Ext,\r
-            Filepath,\r
-            FileFullPath,\r
-            Model,\r
-            TimeStamp\r
-            )\r
+                        File.Name,\r
+                        File.Ext,\r
+                        File.Dir,\r
+                        File.Path,\r
+                        Model,\r
+                        File.TimeStamp\r
+                        )\r
 \r
     ## Get ID of a given file\r
     #\r
@@ -218,8 +221,8 @@ class TableFile(Table):
     #\r
     #   @retval ID          ID value of given file in the table\r
     #\r
-    def GetFileId(self, FilePath):\r
-        QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, FilePath)\r
+    def GetFileId(self, File):\r
+        QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, str(File))\r
         RecordList = self.Exec(QueryScript)\r
         if len(RecordList) == 0:\r
             return None\r
index 4bad21298af6a433dc1d5613ab6f8e059aa9e751..bfa70543965218c08ef7c4e387c787e9ba7eabe5 100644 (file)
 # Import Modules
 #
 import os
+import re
 import time
 import copy
 
 import Common.EdkLogger as EdkLogger
+import Common.GlobalData as GlobalData
+
 from CommonDataClass.DataClass import *
 from Common.DataType import *
 from Common.String import *
-from Common.Misc import Blist, GuidStructureStringToGuidString, CheckPcdDatum
+from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData
+from Common.Expression import *
+from CommonDataClass.Exceptions import *
+
+from MetaFileTable import MetaFileStorage
+
+## A decorator used to parse macro definition
+def ParseMacro(Parser):
+    def MacroParser(self):
+        Match = gMacroDefPattern.match(self._CurrentLine)
+        if not Match:
+            # Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
+            Parser(self)
+            return
+
+        TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):], TAB_EQUAL_SPLIT, 1)
+        # Syntax check
+        if not TokenList[0]:
+            EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        if len(TokenList) < 2:
+            TokenList.append('')
+
+        Type = Match.group(1)
+        Name, Value = TokenList
+        # Global macros can be only defined via environment variable
+        if Name in GlobalData.gGlobalDefines:
+            EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name,
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        # Only upper case letters, digit and '_' are allowed
+        if not gMacroNamePattern.match(Name):
+            EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+
+        self._ItemType = self.DataType[Type]
+        # DEFINE defined macros
+        if self._ItemType == MODEL_META_DATA_DEFINE:
+            if self._SectionType == MODEL_META_DATA_HEADER:
+                self._FileLocalMacros[Name] = Value
+            else:
+                SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1]
+                if SectionDictKey not in self._SectionsMacroDict:
+                    self._SectionsMacroDict[SectionDictKey] = {}
+                SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
+                SectionLocalMacros[Name] = Value
+        # EDK_GLOBAL defined macros
+        elif type(self) != DscParser:
+            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        elif self._SectionType != MODEL_META_DATA_HEADER:
+            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value):
+            EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+            
+        self._ValueList = [Type, Name, Value]
+
+    return MacroParser
 
 ## Base class of parser
 #
@@ -73,23 +134,21 @@ class MetaFileParser(object):
     #   @param      Owner           Owner ID (for sub-section parsing)
     #   @param      From            ID from which the data comes (for !INCLUDE directive)
     #
-    def __init__(self, FilePath, FileType, Table, Macros=None, Owner=-1, From=-1):
-        # prevent re-initialization
-        if hasattr(self, "_Table"):
-            return
+    def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1):
         self._Table = Table
+        self._RawTable = Table
         self._FileType = FileType
         self.MetaFile = FilePath
-        self._FileDir = os.path.dirname(self.MetaFile)
-        self._Macros = copy.copy(Macros)
-        self._Macros["WORKSPACE"] = os.environ["WORKSPACE"]
+        self._FileDir = self.MetaFile.Dir
+        self._Defines = {}
+        self._FileLocalMacros = {}
+        self._SectionsMacroDict = {}
 
         # for recursive parsing
-        self._Owner = Owner
+        self._Owner = [Owner]
         self._From = From
 
         # parsr status for parsing
-        self._Content = None
         self._ValueList = ['', '', '', '', '']
         self._Scope = []
         self._LineIndex = 0
@@ -99,9 +158,13 @@ class MetaFileParser(object):
         self._InSubsection = False
         self._SubsectionType = MODEL_UNKNOWN
         self._SubsectionName = ''
+        self._ItemType = MODEL_UNKNOWN
         self._LastItem = -1
         self._Enabled = 0
         self._Finished = False
+        self._PostProcessed = False
+        # Different version of meta-file has different way to parse.
+        self._Version = 0
 
     ## Store the parsed data in table
     def _Store(self, *Args):
@@ -111,6 +174,10 @@ class MetaFileParser(object):
     def Start(self):
         raise NotImplementedError
 
+    ## Notify a post-process is needed
+    def DoPostProcess(self):
+        self._PostProcessed = False
+
     ## Set parsing complete flag in both class and table
     def _Done(self):
         self._Finished = True
@@ -118,15 +185,8 @@ class MetaFileParser(object):
         if self._From == -1:
             self._Table.SetEndFlag()
 
-    ## Return the table containg parsed data
-    #
-    #   If the parse complete flag is not set, this method will try to parse the
-    # file before return the table
-    #
-    def _GetTable(self):
-        if not self._Finished:
-            self.Start()
-        return self._Table
+    def _PostProcess(self):
+        self._PostProcessed = True
 
     ## Get the parse complete flag
     def _GetFinished(self):
@@ -138,12 +198,30 @@ class MetaFileParser(object):
 
     ## Use [] style to query data in table, just for readability
     #
-    #   DataInfo = [data_type, scope1(arch), scope2(platform,moduletype)]
+    #   DataInfo = [data_type, scope1(arch), scope2(platform/moduletype)]
     #
     def __getitem__(self, DataInfo):
         if type(DataInfo) != type(()):
             DataInfo = (DataInfo,)
-        return self.Table.Query(*DataInfo)
+
+        # Parse the file first, if necessary
+        if not self._Finished:
+            if self._RawTable.IsIntegrity():
+                self._Finished = True
+            else:
+                self._Table = self._RawTable
+                self._PostProcessed = False
+                self.Start()
+
+        # No specific ARCH or Platform given, use raw data
+        if self._RawTable and (len(DataInfo) == 1 or DataInfo[1] == None):
+            return self._RawTable.Query(*DataInfo)
+
+        # Do post-process if necessary
+        if not self._PostProcessed:
+            self._PostProcess()
+
+        return self._Table.Query(*DataInfo)
 
     ## Data parser for the common format in different type of file
     #
@@ -151,6 +229,7 @@ class MetaFileParser(object):
     #
     #       xxx1 | xxx2 | xxx3
     #
+    @ParseMacro
     def _CommonParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
         self._ValueList[0:len(TokenList)] = TokenList
@@ -159,15 +238,14 @@ class MetaFileParser(object):
     #
     #   Only path can have macro used. So we need to replace them before use.
     #
+    @ParseMacro
     def _PathParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
         self._ValueList[0:len(TokenList)] = TokenList
-        if len(self._Macros) > 0:
-            for Index in range(0, len(self._ValueList)):
-                Value = self._ValueList[Index]
-                if Value == None or Value == '':
-                    continue
-                self._ValueList[Index] = NormPath(Value, self._Macros)
+        # Don't do macro replacement for dsc file at this point
+        if type(self) != DscParser:
+            Macros = self._Macros
+            self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]
 
     ## Skip unsupported data
     def _Skip(self):
@@ -217,47 +295,47 @@ class MetaFileParser(object):
         if 'COMMON' in ArchList and len(ArchList) > 1:
             EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
                             File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+        # If the section information is needed later, it should be stored in database
+        self._ValueList[0] = self._SectionName
 
     ## [defines] section parser
+    @ParseMacro
     def _DefineParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
-        self._ValueList[0:len(TokenList)] = TokenList
-        if self._ValueList[1] == '':
-            EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
+        self._ValueList[1:len(TokenList)] = TokenList
+        if not self._ValueList[1]:
+            EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-
-    ## DEFINE name=value parser
-    def _MacroParser(self):
-        TokenList = GetSplitValueList(self._CurrentLine, ' ', 1)
-        MacroType = TokenList[0]
-        if len(TokenList) < 2 or TokenList[1] == '':
-            EdkLogger.error('Parser', FORMAT_INVALID, "No macro name/value given",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-        TokenList = GetSplitValueList(TokenList[1], TAB_EQUAL_SPLIT, 1)
-        if TokenList[0] == '':
-            EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
+        if not self._ValueList[2]:
+            EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
 
-        # Macros defined in the command line override ones defined in the meta-data file
-        if not TokenList[0] in self._Macros:
-            if len(TokenList) == 1:
-                self._Macros[TokenList[0]] = ''
-            else:
-                # keep the macro definition for later use
-                self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
+        Name, Value = self._ValueList[1], self._ValueList[2]
+        # Sometimes, we need to make differences between EDK and EDK2 modules 
+        if Name == 'INF_VERSION':
+            try:
+                self._Version = int(Value, 0)
+            except:
+                EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
+                                ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
 
-        return TokenList[0], self._Macros[TokenList[0]]
+        Value = ReplaceMacro(Value, self._Macros)
+        if type(self) == InfParser and self._Version < 0x00010005:
+            # EDK module allows using defines as macros
+            self._FileLocalMacros[Name] = Value
+        self._Defines[Name] = Value
 
     ## [BuildOptions] section parser
+    @ParseMacro
     def _BuildOptionParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
         TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
         if len(TokenList2) == 2:
-            self._ValueList[0] = TokenList2[0]  # toolchain family
-            self._ValueList[1] = TokenList2[1]  # keys
+            self._ValueList[0] = TokenList2[0]              # toolchain family
+            self._ValueList[1] = TokenList2[1]              # keys
         else:
             self._ValueList[1] = TokenList[0]
-        if len(TokenList) == 2:                 # value
+        if len(TokenList) == 2 and type(self) != DscParser: # value
             self._ValueList[2] = ReplaceMacro(TokenList[1], self._Macros)
 
         if self._ValueList[1].count('_') != 4:
@@ -270,9 +348,27 @@ class MetaFileParser(object):
                 Line=self._LineIndex+1
                 )
 
+    def _GetMacros(self):
+        Macros = {}
+        Macros.update(self._FileLocalMacros)
+        Macros.update(self._GetApplicableSectionMacro())
+        return Macros
+
+
+    ## Get section Macros that are applicable to current line, which may come from other sections 
+    ## that share the same name while scope is wider
+    def _GetApplicableSectionMacro(self):
+        Macros = {}
+
+        for SectionType, Scope1, Scope2 in self._SectionsMacroDict:
+            if (SectionType == self._SectionType) and (Scope1 == self._Scope[0][0] or Scope1 == "COMMON") and (Scope2 == self._Scope[0][1] or Scope2 == "COMMON"):
+                Macros.update(self._SectionsMacroDict[(SectionType, Scope1, Scope2)])
+
+        return Macros
+
     _SectionParser  = {}
-    Table           = property(_GetTable)
     Finished        = property(_GetFinished, _SetFinished)
+    _Macros         = property(_GetMacros)
 
 
 ## INF file parser class
@@ -287,6 +383,7 @@ class InfParser(MetaFileParser):
     DataType = {
         TAB_UNKNOWN.upper() : MODEL_UNKNOWN,
         TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER,
+        TAB_DSC_DEFINES_DEFINE : MODEL_META_DATA_DEFINE,
         TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
         TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
         TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
@@ -316,26 +413,30 @@ class InfParser(MetaFileParser):
     #   @param      Table           Database used to retrieve module/package information
     #   @param      Macros          Macros used for replacement in file
     #
-    def __init__(self, FilePath, FileType, Table, Macros=None):
-        MetaFileParser.__init__(self, FilePath, FileType, Table, Macros)
+    def __init__(self, FilePath, FileType, Table):
+        # prevent re-initialization
+        if hasattr(self, "_Table"):
+            return
+        MetaFileParser.__init__(self, FilePath, FileType, Table)
 
     ## Parser starter
     def Start(self):
         NmakeLine = ''
+        Content = ''
         try:
-            self._Content = open(self.MetaFile, 'r').readlines()
+            Content = open(str(self.MetaFile), 'r').readlines()
         except:
             EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
 
         # parse the file line by line
         IsFindBlockComment = False
 
-        for Index in range(0, len(self._Content)):
+        for Index in range(0, len(Content)):
             # skip empty, commented, block commented lines
-            Line = CleanString(self._Content[Index], AllowCppStyleComment=True)
+            Line = CleanString(Content[Index], AllowCppStyleComment=True)
             NextLine = ''
-            if Index + 1 < len(self._Content):
-                NextLine = CleanString(self._Content[Index + 1])
+            if Index + 1 < len(Content):
+                NextLine = CleanString(Content[Index + 1])
             if Line == '':
                 continue
             if Line.find(DataType.TAB_COMMENT_EDK_START) > -1:
@@ -353,6 +454,29 @@ class InfParser(MetaFileParser):
             # section header
             if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
                 self._SectionHeaderParser()
+                # Check invalid sections
+                if self._Version < 0x00010005:
+                    if self._SectionType in [MODEL_META_DATA_BUILD_OPTION,
+                                             MODEL_EFI_LIBRARY_CLASS,
+                                             MODEL_META_DATA_PACKAGE,
+                                             MODEL_PCD_FIXED_AT_BUILD,
+                                             MODEL_PCD_PATCHABLE_IN_MODULE,
+                                             MODEL_PCD_FEATURE_FLAG,
+                                             MODEL_PCD_DYNAMIC_EX,
+                                             MODEL_PCD_DYNAMIC,
+                                             MODEL_EFI_GUID,
+                                             MODEL_EFI_PROTOCOL,
+                                             MODEL_EFI_PPI,
+                                             MODEL_META_DATA_USER_EXTENSION]:
+                        EdkLogger.error('Parser', FORMAT_INVALID,
+                                        "Section [%s] is not allowed in inf file without version" % (self._SectionName),
+                                        ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+                elif self._SectionType in [MODEL_EFI_INCLUDE,
+                                           MODEL_EFI_LIBRARY_INSTANCE,
+                                           MODEL_META_DATA_NMAKE]:
+                    EdkLogger.error('Parser', FORMAT_INVALID,
+                                    "Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version),
+                                    ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
                 continue
             # merge two lines specified by '\' in section NMAKE
             elif self._SectionType == MODEL_META_DATA_NMAKE:
@@ -370,10 +494,6 @@ class InfParser(MetaFileParser):
                 else:
                     self._CurrentLine = NmakeLine + Line
                     NmakeLine = ''
-            elif Line.upper().startswith('DEFINE '):
-                # file private macros
-                self._MacroParser()
-                continue
 
             # section content
             self._ValueList = ['','','']
@@ -392,7 +512,7 @@ class InfParser(MetaFileParser):
                             self._ValueList[2],
                             Arch,
                             Platform,
-                            self._Owner,
+                            self._Owner[-1],
                             self._LineIndex+1,
                             -1,
                             self._LineIndex+1,
@@ -411,9 +531,13 @@ class InfParser(MetaFileParser):
     def _IncludeParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
         self._ValueList[0:len(TokenList)] = TokenList
-        if len(self._Macros) > 0:
+        Macros = self._Macros
+        if Macros:
             for Index in range(0, len(self._ValueList)):
                 Value = self._ValueList[Index]
+                if not Value:
+                    continue
+
                 if Value.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1:
                     Value = '$(EDK_SOURCE)' + Value[17:]
                 if Value.find('$(EFI_SOURCE)') > -1 or Value.find('$(EDK_SOURCE)') > -1:
@@ -425,34 +549,30 @@ class InfParser(MetaFileParser):
                 else:
                     Value = '$(EFI_SOURCE)/' + Value
 
-                if Value == None or Value == '':
-                    continue
-                self._ValueList[Index] = NormPath(Value, self._Macros)
+                self._ValueList[Index] = ReplaceMacro(Value, Macros)
 
     ## Parse [Sources] section
     #
     #   Only path can have macro used. So we need to replace them before use.
     #
+    @ParseMacro
     def _SourceFileParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
         self._ValueList[0:len(TokenList)] = TokenList
+        Macros = self._Macros
         # For Acpi tables, remove macro like ' TABLE_NAME=Sata1'
-        if 'COMPONENT_TYPE' in self._Macros:
-            if self._Macros['COMPONENT_TYPE'].upper() == 'ACPITABLE':
+        if 'COMPONENT_TYPE' in Macros:
+            if self._Defines['COMPONENT_TYPE'].upper() == 'ACPITABLE':
                 self._ValueList[0] = GetSplitValueList(self._ValueList[0], ' ', 1)[0]
-        if self._Macros['BASE_NAME'] == 'Microcode':
+        if self._Defines['BASE_NAME'] == 'Microcode':
             pass
-        if len(self._Macros) > 0:
-            for Index in range(0, len(self._ValueList)):
-                Value = self._ValueList[Index]
-                if Value == None or Value == '':
-                    continue
-                self._ValueList[Index] = NormPath(Value, self._Macros)
+        self._ValueList = [ReplaceMacro(Value, Macros) for Value in self._ValueList]
 
     ## Parse [Binaries] section
     #
     #   Only path can have macro used. So we need to replace them before use.
     #
+    @ParseMacro
     def _BinaryFileParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 2)
         if len(TokenList) < 2:
@@ -468,27 +588,19 @@ class InfParser(MetaFileParser):
                             ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
                             File=self.MetaFile, Line=self._LineIndex+1)
         self._ValueList[0:len(TokenList)] = TokenList
-        self._ValueList[1] = NormPath(self._ValueList[1], self._Macros)
+        self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
 
-    ## [defines] section parser
-    def _DefineParser(self):
-        TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
-        self._ValueList[0:len(TokenList)] = TokenList
-        if self._ValueList[1] == '':
-            EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-        self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
-        
-    ## [nmake] section parser (EDK.x style only)
+    ## [nmake] section parser (Edk.x style only)
     def _NmakeParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
         self._ValueList[0:len(TokenList)] = TokenList
         # remove macros
-        self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, False)
+        self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
         # remove self-reference in macro setting
         #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''})
 
     ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser
+    @ParseMacro
     def _PcdParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
         ValueList = GetSplitValueList(TokenList[0], TAB_SPLIT)
@@ -503,6 +615,7 @@ class InfParser(MetaFileParser):
             EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
                             ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
                             File=self.MetaFile, Line=self._LineIndex+1)
+
         # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
         if self._ValueList[2] != '':
             InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
@@ -512,18 +625,19 @@ class InfParser(MetaFileParser):
                 self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1);
 
     ## [depex] section parser
+    @ParseMacro
     def _DepexParser(self):
         self._ValueList[0:1] = [self._CurrentLine]
 
     _SectionParser = {
         MODEL_UNKNOWN                   :   MetaFileParser._Skip,
-        MODEL_META_DATA_HEADER          :   _DefineParser,
+        MODEL_META_DATA_HEADER          :   MetaFileParser._DefineParser,
         MODEL_META_DATA_BUILD_OPTION    :   MetaFileParser._BuildOptionParser,
-        MODEL_EFI_INCLUDE               :   _IncludeParser,                 # for EDK.x modules
-        MODEL_EFI_LIBRARY_INSTANCE      :   MetaFileParser._CommonParser,   # for EDK.x modules
+        MODEL_EFI_INCLUDE               :   _IncludeParser,                 # for Edk.x modules
+        MODEL_EFI_LIBRARY_INSTANCE      :   MetaFileParser._CommonParser,   # for Edk.x modules
         MODEL_EFI_LIBRARY_CLASS         :   MetaFileParser._PathParser,
         MODEL_META_DATA_PACKAGE         :   MetaFileParser._PathParser,
-        MODEL_META_DATA_NMAKE           :   _NmakeParser,                   # for EDK.x modules
+        MODEL_META_DATA_NMAKE           :   _NmakeParser,                   # for Edk.x modules
         MODEL_PCD_FIXED_AT_BUILD        :   _PcdParser,
         MODEL_PCD_PATCHABLE_IN_MODULE   :   _PcdParser,
         MODEL_PCD_FEATURE_FLAG          :   _PcdParser,
@@ -566,6 +680,8 @@ class DscParser(MetaFileParser):
         TAB_COMPONENTS.upper()                      :   MODEL_META_DATA_COMPONENT,
         TAB_COMPONENTS_SOURCE_OVERRIDE_PATH.upper() :   MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH,
         TAB_DSC_DEFINES.upper()                     :   MODEL_META_DATA_HEADER,
+        TAB_DSC_DEFINES_DEFINE                      :   MODEL_META_DATA_DEFINE,
+        TAB_DSC_DEFINES_EDKGLOBAL                   :   MODEL_META_DATA_GLOBAL_DEFINE,
         TAB_INCLUDE.upper()                         :   MODEL_META_DATA_INCLUDE,
         TAB_IF.upper()                              :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
         TAB_IF_DEF.upper()                          :   MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
@@ -575,37 +691,26 @@ class DscParser(MetaFileParser):
         TAB_END_IF.upper()                          :   MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF,
     }
 
-    # sections which allow "!include" directive
-    _IncludeAllowedSection = [
-        TAB_COMMON_DEFINES.upper(),
-        TAB_LIBRARIES.upper(),
-        TAB_LIBRARY_CLASSES.upper(),
-        TAB_SKUIDS.upper(),
-        TAB_COMPONENTS.upper(),
-        TAB_BUILD_OPTIONS.upper(),
-        TAB_PCDS_FIXED_AT_BUILD_NULL.upper(),
-        TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper(),
-        TAB_PCDS_FEATURE_FLAG_NULL.upper(),
-        TAB_PCDS_DYNAMIC_DEFAULT_NULL.upper(),
-        TAB_PCDS_DYNAMIC_HII_NULL.upper(),
-        TAB_PCDS_DYNAMIC_VPD_NULL.upper(),
-        TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL.upper(),
-        TAB_PCDS_DYNAMIC_EX_HII_NULL.upper(),
-        TAB_PCDS_DYNAMIC_EX_VPD_NULL.upper(),
-        ]
-
-    # operators which can be used in "!if/!ifdef/!ifndef" directives
-    _OP_ = {
-        "!"     :   lambda a:   not a,
-        "!="    :   lambda a,b: a!=b,
-        "=="    :   lambda a,b: a==b,
-        ">"     :   lambda a,b: a>b,
-        "<"     :   lambda a,b: a<b,
-        "=>"    :   lambda a,b: a>=b,
-        ">="    :   lambda a,b: a>=b,
-        "<="    :   lambda a,b: a<=b,
-        "=<"    :   lambda a,b: a<=b,
-    }
+    # Valid names in define section
+    DefineKeywords = [
+        "DSC_SPECIFICATION",
+        "PLATFORM_NAME",
+        "PLATFORM_GUID",
+        "PLATFORM_VERSION",
+        "SKUID_IDENTIFIER",
+        "SUPPORTED_ARCHITECTURES",
+        "BUILD_TARGETS",
+        "OUTPUT_DIRECTORY",
+        "FLASH_DEFINITION",
+        "BUILD_NUMBER",
+        "RFC_LANGUAGES",
+        "ISO_LANGUAGES",
+        "TIME_STAMP_FILE",
+        "VPD_TOOL_GUID",
+        "FIX_LOAD_TOP_MEMORY_ADDRESS"
+    ]
+
+    SymbolPattern = ValueExpression.SymbolPattern
 
     ## Constructor of DscParser
     #
@@ -618,162 +723,99 @@ class DscParser(MetaFileParser):
     #   @param      Owner           Owner ID (for sub-section parsing)
     #   @param      From            ID from which the data comes (for !INCLUDE directive)
     #
-    def __init__(self, FilePath, FileType, Table, Macros=None, Owner=-1, From=-1):
-        MetaFileParser.__init__(self, FilePath, FileType, Table, Macros, Owner, From)
+    def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1):
+        # prevent re-initialization
+        if hasattr(self, "_Table"):
+            return
+        MetaFileParser.__init__(self, FilePath, FileType, Table, Owner, From)
+        self._Version = 0x00010005  # Only EDK2 dsc file is supported
         # to store conditional directive evaluation result
-        self._Eval = Blist()
+        self._DirectiveStack = []
+        self._DirectiveEvalStack = []
+        self._Enabled = 1
+
+        # Final valid replacable symbols
+        self._Symbols = {}
+        #
+        #  Map the ID between the original table and new table to track
+        #  the owner item
+        #
+        self._IdMapping = {-1:-1}
 
     ## Parser starter
     def Start(self):
+        Content = ''
         try:
-            if self._Content == None:
-                self._Content = open(self.MetaFile, 'r').readlines()
+            Content = open(str(self.MetaFile), 'r').readlines()
         except:
             EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
 
-        for Index in range(0, len(self._Content)):
-            Line = CleanString(self._Content[Index])
+        for Index in range(0, len(Content)):
+            Line = CleanString(Content[Index])
             # skip empty line
             if Line == '':
                 continue
+
             self._CurrentLine = Line
             self._LineIndex = Index
-            if self._InSubsection and self._Owner == -1:
-                self._Owner = self._LastItem
+            if self._InSubsection and self._Owner[-1] == -1:
+                self._Owner.append(self._LastItem)
             
             # section header
             if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
-                self._SectionHeaderParser()
-                continue
+                self._SectionType = MODEL_META_DATA_SECTION_HEADER
             # subsection ending
-            elif Line[0] == '}':
+            elif Line[0] == '}' and self._InSubsection:
                 self._InSubsection = False
                 self._SubsectionType = MODEL_UNKNOWN
                 self._SubsectionName = ''
-                self._Owner = -1
+                self._Owner.pop()
                 continue
             # subsection header
             elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END:
-                self._SubsectionHeaderParser()
-                continue
+                self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER
             # directive line
             elif Line[0] == '!':
                 self._DirectiveParser()
                 continue
-            # file private macros
-            elif Line.upper().startswith('DEFINE '):
-                if self._Enabled < 0:
-                    # Do not parse the macro and add it to self._Macros dictionary if directives
-                    # statement is evaluated to false.
-                    continue
-                
-                (Name, Value) = self._MacroParser()
-                # Make the defined macro in DSC [Defines] section also
-                # available for FDF file.
-                if self._SectionName == TAB_COMMON_DEFINES.upper():
-                    self._LastItem = self._Store(
-                    MODEL_META_DATA_GLOBAL_DEFINE,
-                    Name,
-                    Value,
-                    '',
-                    'COMMON',
-                    'COMMON',
-                    self._Owner,
-                    self._From,
-                    self._LineIndex+1,
-                    -1,
-                    self._LineIndex+1,
-                    -1,
-                    self._Enabled
-                    )
-                continue
-            elif Line.upper().startswith('EDK_GLOBAL '):
-                if self._Enabled < 0:
-                    # Do not parse the macro and add it to self._Macros dictionary
-                    # if previous directives statement is evaluated to false.
-                    continue
-                
-                (Name, Value) = self._MacroParser()
-                for Arch, ModuleType in self._Scope:
-                    self._LastItem = self._Store(
-                    MODEL_META_DATA_DEFINE,
-                    Name,
-                    Value,
-                    '',
-                    Arch,
-                    'COMMON',
-                    self._Owner,
-                    self._From,
-                    self._LineIndex+1,
-                    -1,
-                    self._LineIndex+1,
-                    -1,
-                    self._Enabled
-                    )
-                continue
 
-            # section content
             if self._InSubsection:
                 SectionType = self._SubsectionType
-                SectionName = self._SubsectionName
             else:
                 SectionType = self._SectionType
-                SectionName = self._SectionName
+            self._ItemType = SectionType
 
             self._ValueList = ['', '', '']
             self._SectionParser[SectionType](self)
             if self._ValueList == None:
                 continue
-
             #
             # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
             # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
             #
             for Arch, ModuleType in self._Scope:
                 self._LastItem = self._Store(
-                    SectionType,
-                    self._ValueList[0],
-                    self._ValueList[1],
-                    self._ValueList[2],
-                    Arch,
-                    ModuleType,
-                    self._Owner,
-                    self._From,
-                    self._LineIndex+1,
-                    -1,
-                    self._LineIndex+1,
-                    -1,
-                    self._Enabled
-                    )
+                                        self._ItemType,
+                                        self._ValueList[0],
+                                        self._ValueList[1],
+                                        self._ValueList[2],
+                                        Arch,
+                                        ModuleType,
+                                        self._Owner[-1],
+                                        self._From,
+                                        self._LineIndex+1,
+                                        -1,
+                                        self._LineIndex+1,
+                                        -1,
+                                        self._Enabled
+                                        )
+
+        if self._DirectiveStack:
+            Type, Line, Text = self._DirectiveStack[-1]
+            EdkLogger.error('Parser', FORMAT_INVALID, "No matching '!endif' found",
+                            ExtraData=Text, File=self.MetaFile, Line=Line)
         self._Done()
 
-    ## [defines] section parser
-    def _DefineParser(self):
-        TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
-        if len(TokenList) < 2:
-            EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
-                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-        # 'FLASH_DEFINITION', 'OUTPUT_DIRECTORY' need special processing
-        if TokenList[0] in ['FLASH_DEFINITION', 'OUTPUT_DIRECTORY']:
-            TokenList[1] = NormPath(TokenList[1], self._Macros)
-        self._ValueList[0:len(TokenList)] = TokenList
-        # Treat elements in the [defines] section as global macros for FDF file.
-        self._LastItem = self._Store(
-                            MODEL_META_DATA_GLOBAL_DEFINE,
-                            TokenList[0],
-                            TokenList[1],
-                            '',
-                            'COMMON',
-                            'COMMON',
-                            self._Owner,
-                            self._From,
-                            self._LineIndex+1,
-                            -1,
-                            self._LineIndex+1,
-                            -1,
-                            self._Enabled
-                            )
-
     ## <subsection_header> parser
     def _SubsectionHeaderParser(self):
         self._SubsectionName = self._CurrentLine[1:-1].upper()
@@ -782,13 +824,16 @@ class DscParser(MetaFileParser):
         else:
             self._SubsectionType = MODEL_UNKNOWN
             EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile,
-                            Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+                           Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+        self._ValueList[0] = self._SubsectionName
 
     ## Directive statement parser
     def _DirectiveParser(self):
         self._ValueList = ['','','']
         TokenList = GetSplitValueList(self._CurrentLine, ' ', 1)
         self._ValueList[0:len(TokenList)] = TokenList
+
+        # Syntax check
         DirectiveName = self._ValueList[0].upper()
         if DirectiveName not in self.DataType:
             EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName,
@@ -797,134 +842,89 @@ class DscParser(MetaFileParser):
             EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression",
                             File=self.MetaFile, Line=self._LineIndex+1,
                             ExtraData=self._CurrentLine)
-        # keep the directive in database first
-        self._LastItem = self._Store(
-            self.DataType[DirectiveName],
-            self._ValueList[0],
-            self._ValueList[1],
-            self._ValueList[2],
-            'COMMON',
-            'COMMON',
-            self._Owner,
-            self._From,
-            self._LineIndex + 1,
-            -1,
-            self._LineIndex + 1,
-            -1,
-            0
-            )
-
-        # process the directive
-        if DirectiveName == "!INCLUDE":
-            if not self._SectionName in self._IncludeAllowedSection:
-                EdkLogger.error("Parser", FORMAT_INVALID, File=self.MetaFile, Line=self._LineIndex+1,
-                                ExtraData="'!include' is not allowed under section [%s]" % self._SectionName)
-            # the included file must be relative to workspace
-            IncludedFile = os.path.join(os.environ["WORKSPACE"], NormPath(self._ValueList[1], self._Macros))
-            Parser = DscParser(IncludedFile, self._FileType, self._Table, self._Macros, From=self._LastItem)
-            # set the parser status with current status
-            Parser._SectionName = self._SectionName
-            Parser._SectionType = self._SectionType
-            Parser._Scope = self._Scope
-            Parser._Enabled = self._Enabled
-            try:
-                Parser.Start()
-            except:
-                EdkLogger.error("Parser", PARSER_ERROR, File=self.MetaFile, Line=self._LineIndex+1,
-                                ExtraData="Failed to parse content in file %s" % IncludedFile)
-            # insert an imaginary token in the DSC table to indicate its external dependency on another file
-            self._Store(MODEL_EXTERNAL_DEPENDENCY, IncludedFile, str(os.stat(IncludedFile)[8]), "")
-            # update current status with sub-parser's status
-            self._SectionName = Parser._SectionName
-            self._SectionType = Parser._SectionType
-            self._Scope       = Parser._Scope
-            self._Enabled     = Parser._Enabled
-            self._Macros.update(Parser._Macros)
-        else:
-            if DirectiveName in ["!IF", "!IFDEF", "!IFNDEF"]:
-                # evaluate the expression
-                Result = self._Evaluate(self._ValueList[1])
-                if DirectiveName == "!IFNDEF":
-                    Result = not Result
-                self._Eval.append(Result)
-            elif DirectiveName in ["!ELSEIF"]:
-                # evaluate the expression
-                self._Eval[-1] = (not self._Eval[-1]) & self._Evaluate(self._ValueList[1])
-            elif DirectiveName in ["!ELSE"]:
-                self._Eval[-1] = not self._Eval[-1]
-            elif DirectiveName in ["!ENDIF"]:
-                if len(self._Eval) > 0:
-                    self._Eval.pop()
-                else:
-                    EdkLogger.error("Parser", FORMAT_INVALID, "!IF..[!ELSE]..!ENDIF doesn't match",
-                                    File=self.MetaFile, Line=self._LineIndex+1)
-            if self._Eval.Result == False:
-                self._Enabled = 0 - len(self._Eval)
-            else:
-                self._Enabled = len(self._Eval)
 
-    ## Evaluate the Token for its value; for now only macros are supported.
-    def _EvaluateToken(self, TokenName, Expression):
-        if TokenName.startswith("$(") and TokenName.endswith(")"):
-            Name = TokenName[2:-1]
-            return self._Macros.get(Name)
-        else:
-            EdkLogger.error('Parser', FORMAT_INVALID, "Unknown operand '%(Token)s', "
-                            "please use '$(%(Token)s)' if '%(Token)s' is a macro" % {"Token" : TokenName},
-                            File=self.MetaFile, Line=self._LineIndex+1, ExtraData=Expression)
-    
-    ## Evaluate the value of expression in "if/ifdef/ifndef" directives
-    def _Evaluate(self, Expression):
-        TokenList = Expression.split()
-        TokenNumber = len(TokenList)
-        # one operand, guess it's just a macro name
-        if TokenNumber == 1:
-            TokenValue =  self._EvaluateToken(TokenList[0], Expression)
-            return TokenValue != None
-        # two operands, suppose it's "!xxx" format
-        elif TokenNumber == 2:
-            Op = TokenList[0]
-            if Op not in self._OP_:
-                EdkLogger.error('Parser', FORMAT_INVALID, "Unsupported operator [%s]" % Op, File=self.MetaFile,
-                                Line=self._LineIndex+1, ExtraData=Expression)
-            if TokenList[1].upper() == 'TRUE':
-                Value = True
+        ItemType = self.DataType[DirectiveName]
+        if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:
+            # Remove all directives between !if and !endif, including themselves
+            while self._DirectiveStack:
+                # Remove any !else or !elseif
+                DirectiveInfo = self._DirectiveStack.pop()
+                if DirectiveInfo[0] in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+                                        MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+                                        MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+                    break
             else:
-                Value = False
-            return self._OP_[Op](Value)
-        # three operands
-        elif TokenNumber == 3:
-            TokenValue = TokenList[0] 
-            if TokenValue != "":
-                if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
-                    TokenValue = TokenValue[1:-1]             
-                if TokenValue.startswith("$(") and TokenValue.endswith(")"):
-                    TokenValue = self._EvaluateToken(TokenValue, Expression)
-                    if TokenValue == None:
-                        return False
-                if TokenValue != "":                
-                    if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']:
-                        TokenValue = TokenValue[1:-1]
-               
-            Value = TokenList[2]
-            if Value != "":
-                if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
-                    Value = Value[1:-1]         
-                if Value.startswith("$(") and Value.endswith(")"):
-                    Value = self._EvaluateToken(Value, Expression)          
-                    if Value == None:
-                        return False
-                if Value != "":                
-                    if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']:
-                        Value = Value[1:-1]
-            Op = TokenList[1]
-            if Op not in self._OP_:
-                EdkLogger.error('Parser', FORMAT_INVALID, "Unsupported operator [%s]" % Op, File=self.MetaFile,
-                                Line=self._LineIndex+1, ExtraData=Expression)
-            return self._OP_[Op](TokenValue, Value)
-        else:
-            EdkLogger.error('Parser', FORMAT_INVALID, File=self.MetaFile, Line=self._LineIndex+1,
-                            ExtraData=Expression)
+                EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'",
+                                File=self.MetaFile, Line=self._LineIndex+1,
+                                ExtraData=self._CurrentLine)
+        elif ItemType != MODEL_META_DATA_INCLUDE:
+            # Break if there's a !else is followed by a !elseif
+            if ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF and \
+               self._DirectiveStack and \
+               self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
+                EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'",
+                                File=self.MetaFile, Line=self._LineIndex+1,
+                                ExtraData=self._CurrentLine)
+            self._DirectiveStack.append((ItemType, self._LineIndex+1, self._CurrentLine))
+        elif self._From > 0:
+            EdkLogger.error('Parser', FORMAT_INVALID,
+                            "No '!include' allowed in included file",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, 
+                            Line=self._LineIndex+1)
+
+        #
+        # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
+        # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
+        #
+        self._LastItem = self._Store(
+                                ItemType,
+                                self._ValueList[0],
+                                self._ValueList[1],
+                                self._ValueList[2],
+                                'COMMON',
+                                'COMMON',
+                                self._Owner[-1],
+                                self._From,
+                                self._LineIndex+1,
+                                -1,
+                                self._LineIndex+1,
+                                -1,
+                                0
+                                )
+
+    ## [defines] section parser
+    @ParseMacro
+    def _DefineParser(self):
+        TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+        self._ValueList[1:len(TokenList)] = TokenList
+
+        # Syntax check
+        if not self._ValueList[1]:
+            EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        if not self._ValueList[2]:
+            EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        if not self._ValueList[1] in self.DefineKeywords:
+            EdkLogger.error('Parser', FORMAT_INVALID,
+                            "Unknown keyword found: %s. "
+                            "If this is a macro you must "
+                            "add it as a DEFINE in the DSC" % self._ValueList[1],
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        self._Defines[self._ValueList[1]] = self._ValueList[2]
+        self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()]
+
+    @ParseMacro
+    def _SkuIdParser(self):
+        TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
+        if len(TokenList) != 2:
+            EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Integer>|<UiName>'",
+                            ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+        self._ValueList[0:len(TokenList)] = TokenList
+
+    ## Parse Edk style of library modules
+    def _LibraryInstanceParser(self):
+        self._ValueList[0] = self._CurrentLine
 
     ## PCD sections parser
     #
@@ -940,8 +940,9 @@ class DscParser(MetaFileParser):
     #   [PcdsDynamicVpd]
     #   [PcdsDynamicHii]
     #
+    @ParseMacro
     def _PcdParser(self):
-        TokenList = GetSplitValueList(ReplaceMacro(self._CurrentLine, self._Macros), TAB_VALUE_SPLIT, 1)
+        TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
         self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
         if len(TokenList) == 2:
             self._ValueList[2] = TokenList[1]
@@ -959,17 +960,18 @@ class DscParser(MetaFileParser):
             self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1);
         elif DscPcdValueList[0] in ['False', 'false', 'FALSE']:
             self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1);
-            
+
     ## [components] section parser
+    @ParseMacro
     def _ComponentParser(self):
         if self._CurrentLine[-1] == '{':
             self._ValueList[0] = self._CurrentLine[0:-1].strip()
             self._InSubsection = True
         else:
             self._ValueList[0] = self._CurrentLine
-        if len(self._Macros) > 0:
-            self._ValueList[0] = NormPath(self._ValueList[0], self._Macros)
 
+    ## [LibraryClasses] section
+    @ParseMacro
     def _LibraryClassParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
         if len(TokenList) < 2:
@@ -984,35 +986,357 @@ class DscParser(MetaFileParser):
             EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified",
                             ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
                             File=self.MetaFile, Line=self._LineIndex+1)
+
         self._ValueList[0:len(TokenList)] = TokenList
-        if len(self._Macros) > 0:
-            self._ValueList[1] = NormPath(self._ValueList[1], self._Macros)
 
     def _CompponentSourceOverridePathParser(self):
-        if len(self._Macros) > 0:
-            self._ValueList[0] = NormPath(self._CurrentLine, self._Macros)
+        self._ValueList[0] = self._CurrentLine
+
+    ## [BuildOptions] section parser
+    @ParseMacro
+    def _BuildOptionParser(self):
+        TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
+        TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
+        if len(TokenList2) == 2:
+            self._ValueList[0] = TokenList2[0]  # toolchain family
+            self._ValueList[1] = TokenList2[1]  # keys
+        else:
+            self._ValueList[1] = TokenList[0]
+        if len(TokenList) == 2:                 # value
+            self._ValueList[2] = TokenList[1]
+
+        if self._ValueList[1].count('_') != 4:
+            EdkLogger.error(
+                'Parser',
+                FORMAT_INVALID,
+                "'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
+                ExtraData=self._CurrentLine,
+                File=self.MetaFile,
+                Line=self._LineIndex+1
+                )
+
+    ## Override parent's method since we'll do all macro replacements in parser
+    def _GetMacros(self):
+        Macros = {}
+        Macros.update(self._FileLocalMacros)
+        Macros.update(self._GetApplicableSectionMacro())
+        Macros.update(GlobalData.gEdkGlobal)
+        Macros.update(GlobalData.gPlatformDefines)
+        Macros.update(GlobalData.gCommandLineDefines)
+        # PCD cannot be referenced in macro definition
+        if self._ItemType not in [MODEL_META_DATA_DEFINE, MODEL_META_DATA_GLOBAL_DEFINE]:
+            Macros.update(self._Symbols)
+        return Macros
+
+    def _PostProcess(self):
+        Processer = {
+            MODEL_META_DATA_SECTION_HEADER                  :   self.__ProcessSectionHeader,
+            MODEL_META_DATA_SUBSECTION_HEADER               :   self.__ProcessSubsectionHeader,
+            MODEL_META_DATA_HEADER                          :   self.__ProcessDefine,
+            MODEL_META_DATA_DEFINE                          :   self.__ProcessDefine,
+            MODEL_META_DATA_GLOBAL_DEFINE                   :   self.__ProcessDefine,
+            MODEL_META_DATA_INCLUDE                         :   self.__ProcessDirective,
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_IF        :   self.__ProcessDirective,
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE      :   self.__ProcessDirective,
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF     :   self.__ProcessDirective,
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF    :   self.__ProcessDirective,
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF     :   self.__ProcessDirective,
+            MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF    :   self.__ProcessDirective,
+            MODEL_EFI_SKU_ID                                :   self.__ProcessSkuId,
+            MODEL_EFI_LIBRARY_INSTANCE                      :   self.__ProcessLibraryInstance,
+            MODEL_EFI_LIBRARY_CLASS                         :   self.__ProcessLibraryClass,
+            MODEL_PCD_FIXED_AT_BUILD                        :   self.__ProcessPcd,
+            MODEL_PCD_PATCHABLE_IN_MODULE                   :   self.__ProcessPcd,
+            MODEL_PCD_FEATURE_FLAG                          :   self.__ProcessPcd,
+            MODEL_PCD_DYNAMIC_DEFAULT                       :   self.__ProcessPcd,
+            MODEL_PCD_DYNAMIC_HII                           :   self.__ProcessPcd,
+            MODEL_PCD_DYNAMIC_VPD                           :   self.__ProcessPcd,
+            MODEL_PCD_DYNAMIC_EX_DEFAULT                    :   self.__ProcessPcd,
+            MODEL_PCD_DYNAMIC_EX_HII                        :   self.__ProcessPcd,
+            MODEL_PCD_DYNAMIC_EX_VPD                        :   self.__ProcessPcd,
+            MODEL_META_DATA_COMPONENT                       :   self.__ProcessComponent,
+            MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH  :   self.__ProcessSourceOverridePath,
+            MODEL_META_DATA_BUILD_OPTION                    :   self.__ProcessBuildOption,
+            MODEL_UNKNOWN                                   :   self._Skip,
+            MODEL_META_DATA_USER_EXTENSION                  :   self._Skip,
+        }
+
+        self._Table = MetaFileStorage(self._RawTable.Cur, self.MetaFile, MODEL_FILE_DSC, True)
+        self._Table.Create()
+        self._DirectiveStack = []
+        self._DirectiveEvalStack = []
+        self._FileWithError = self.MetaFile
+        self._FileLocalMacros = {}
+        self._SectionsMacroDict = {}
+        GlobalData.gPlatformDefines = {}
+
+        # Get all macro and PCD which has straitforward value
+        self.__RetrievePcdValue()
+        self._Content = self._RawTable.GetAll()
+        self._ContentIndex = 0
+        while self._ContentIndex < len(self._Content) :
+            Id, self._ItemType, V1, V2, V3, S1, S2, Owner, self._From, \
+                LineStart, ColStart, LineEnd, ColEnd, Enabled = self._Content[self._ContentIndex]
+
+            if self._From < 0:
+                self._FileWithError = self.MetaFile
+
+            self._ContentIndex += 1
+
+            self._Scope = [[S1, S2]]
+            self._LineIndex = LineStart - 1
+            self._ValueList = [V1, V2, V3]
+
+            try:
+                Processer[self._ItemType]()
+            except EvaluationException, Excpt:
+                # 
+                # Only catch expression evaluation error here. We need to report
+                # the precise number of line on which the error occurred
+                #
+                EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
+                                File=self._FileWithError, ExtraData=' '.join(self._ValueList), 
+                                Line=self._LineIndex+1)
+            except MacroException, Excpt:
+                EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
+                                File=self._FileWithError, ExtraData=' '.join(self._ValueList), 
+                                Line=self._LineIndex+1)
+
+            if self._ValueList == None:
+                continue 
+
+            NewOwner = self._IdMapping.get(Owner, -1)
+            self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack))
+            self._LastItem = self._Store(
+                                self._ItemType,
+                                self._ValueList[0],
+                                self._ValueList[1],
+                                self._ValueList[2],
+                                S1,
+                                S2,
+                                NewOwner,
+                                self._From,
+                                self._LineIndex+1,
+                                -1,
+                                self._LineIndex+1,
+                                -1,
+                                self._Enabled
+                                )
+            self._IdMapping[Id] = self._LastItem
+
+        GlobalData.gPlatformDefines.update(self._FileLocalMacros)
+        self._PostProcessed = True
+        self._Content = None
+
+    def __ProcessSectionHeader(self):
+        self._SectionName = self._ValueList[0]
+        if self._SectionName in self.DataType:
+            self._SectionType = self.DataType[self._SectionName]
+        else:
+            self._SectionType = MODEL_UNKNOWN
+
+    def __ProcessSubsectionHeader(self):
+        self._SubsectionName = self._ValueList[0]
+        if self._SubsectionName in self.DataType:
+            self._SubsectionType = self.DataType[self._SubsectionName]
+        else:
+            self._SubsectionType = MODEL_UNKNOWN
+
+    def __RetrievePcdValue(self):
+        Records = self._RawTable.Query(MODEL_PCD_FEATURE_FLAG, BelongsToItem=-1.0)
+        for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records:
+            Value, DatumType, MaxDatumSize = AnalyzePcdData(Value)
+            # Only use PCD whose value is straitforward (no macro and PCD)
+            if self.SymbolPattern.findall(Value):
+                continue
+            Name = TokenSpaceGuid + '.' + PcdName
+            # Don't use PCD with different values.
+            if Name in self._Symbols and self._Symbols[Name] != Value:
+                self._Symbols.pop(Name)
+                continue 
+            self._Symbols[Name] = Value
+
+        Records = self._RawTable.Query(MODEL_PCD_FIXED_AT_BUILD, BelongsToItem=-1.0)
+        for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records:
+            Value, DatumType, MaxDatumSize = AnalyzePcdData(Value)
+            # Only use PCD whose value is straitforward (no macro and PCD)
+            if self.SymbolPattern.findall(Value):
+                continue 
+            Name = TokenSpaceGuid+'.'+PcdName
+            # Don't use PCD with different values.
+            if Name in self._Symbols and self._Symbols[Name] != Value:
+                self._Symbols.pop(Name)
+                continue 
+            self._Symbols[Name] = Value
+
+    def __ProcessDefine(self):
+        if not self._Enabled:
+            return
+
+        Type, Name, Value = self._ValueList
+        Value = ReplaceMacro(Value, self._Macros, False)
+        if self._ItemType == MODEL_META_DATA_DEFINE:
+            if self._SectionType == MODEL_META_DATA_HEADER:
+                self._FileLocalMacros[Name] = Value
+            else:
+                SectionDictKey = self._SectionType, self._Scope[0][0], self._Scope[0][1]
+                if SectionDictKey not in self._SectionsMacroDict:
+                    self._SectionsMacroDict[SectionDictKey] = {}
+                SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
+                SectionLocalMacros[Name] = Value
+        elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
+            GlobalData.gEdkGlobal[Name] = Value
+        
+        #
+        # Keyword in [Defines] section can be used as Macros
+        #
+        if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER):
+            self._FileLocalMacros[Name] = Value
+            
+        self._ValueList = [Type, Name, Value]
+
+    def __ProcessDirective(self):
+        Result = None
+        if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+                              MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF]:
+            Macros = self._Macros
+            Macros.update(GlobalData.gGlobalDefines)
+            try:
+                Result = ValueExpression(self._ValueList[1], Macros)()
+            except SymbolNotFound, Exc:
+                EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
+                Result = False
+            except WrnExpression, Excpt:
+                # 
+                # Catch expression evaluation warning here. We need to report
+                # the precise number of line and return the evaluation result
+                #
+                EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),
+                                File=self._FileWithError, ExtraData=' '.join(self._ValueList), 
+                                Line=self._LineIndex+1)
+                Result = Excpt.result
+
+        if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+                              MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+                              MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+            self._DirectiveStack.append(self._ItemType)
+            if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IF:
+                Result = bool(Result)
+            else:
+                Macro = self._ValueList[1]
+                Macro = Macro[2:-1] if (Macro.startswith("$(") and Macro.endswith(")")) else Macro
+                Result = Macro in self._Macros
+                if self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF:
+                    Result = not Result
+            self._DirectiveEvalStack.append(Result)
+        elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF:
+            self._DirectiveStack.append(self._ItemType)
+            self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1]
+            self._DirectiveEvalStack.append(bool(Result))
+        elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
+            self._DirectiveStack[-1] = self._ItemType
+            self._DirectiveEvalStack[-1] = not self._DirectiveEvalStack[-1]
+        elif self._ItemType == MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF:
+            # Back to the nearest !if/!ifdef/!ifndef
+            while self._DirectiveStack:
+                self._DirectiveEvalStack.pop()
+                Directive = self._DirectiveStack.pop()
+                if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
+                                 MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+                                 MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,
+                                 MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
+                    break
+        elif self._ItemType == MODEL_META_DATA_INCLUDE:
+            # The included file must be relative to workspace
+            IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True))
+            IncludedFile = PathClass(IncludedFile, GlobalData.gWorkspace)
+            ErrorCode, ErrorInfo = IncludedFile.Validate()
+            if ErrorCode != 0:
+                EdkLogger.error('parser', ErrorCode, File=self._FileWithError, 
+                                Line=self._LineIndex+1, ExtraData=ErrorInfo)
+
+            self._FileWithError = IncludedFile
+
+            IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile, MODEL_FILE_DSC, False)
+            Owner = self._Content[self._ContentIndex-1][0]
+            Parser = DscParser(IncludedFile, self._FileType, IncludedFileTable, 
+                               Owner=Owner, From=Owner)
+
+            # set the parser status with current status
+            Parser._SectionName = self._SectionName
+            Parser._SectionType = self._SectionType
+            Parser._Scope = self._Scope
+            Parser._Enabled = self._Enabled
+            # Parse the included file
+            Parser.Start()
+
+            # update current status with sub-parser's status
+            self._SectionName = Parser._SectionName
+            self._SectionType = Parser._SectionType
+            self._Scope       = Parser._Scope
+            self._Enabled     = Parser._Enabled
+
+            # Insert all records in the table for the included file into dsc file table
+            Records = IncludedFileTable.GetAll()
+            if Records:
+                self._Content[self._ContentIndex:self._ContentIndex] = Records
+
+    def __ProcessSkuId(self):
+        self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=True)
+                           for Value in self._ValueList]
+
+    def __ProcessLibraryInstance(self):
+        self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList]
+
+    def __ProcessLibraryClass(self):
+        self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True)
+
+    def __ProcessPcd(self):
+        ValueList = GetSplitValueList(self._ValueList[2])
+        if len(ValueList) > 1 and ValueList[1] == 'VOID*':
+            PcdValue = ValueList[0]
+            ValueList[0] = ReplaceMacro(PcdValue, self._Macros)
+        else:
+            PcdValue = ValueList[-1]
+            ValueList[-1] = ReplaceMacro(PcdValue, self._Macros)
+
+        self._ValueList[2] = '|'.join(ValueList)
+
+    def __ProcessComponent(self):
+        self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
+
+    def __ProcessSourceOverridePath(self):
+        self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
+
+    def __ProcessBuildOption(self):
+        self._ValueList = [ReplaceMacro(Value, self._Macros, RaiseError=False)
+                           for Value in self._ValueList]
 
     _SectionParser = {
-        MODEL_META_DATA_HEADER                         :   _DefineParser,
-        MODEL_EFI_SKU_ID                               :   MetaFileParser._CommonParser,
-        MODEL_EFI_LIBRARY_INSTANCE                     :   MetaFileParser._PathParser,
-        MODEL_EFI_LIBRARY_CLASS                        :   _LibraryClassParser,
-        MODEL_PCD_FIXED_AT_BUILD                       :   _PcdParser,
-        MODEL_PCD_PATCHABLE_IN_MODULE                  :   _PcdParser,
-        MODEL_PCD_FEATURE_FLAG                         :   _PcdParser,
-        MODEL_PCD_DYNAMIC_DEFAULT                      :   _PcdParser,
-        MODEL_PCD_DYNAMIC_HII                          :   _PcdParser,
-        MODEL_PCD_DYNAMIC_VPD                          :   _PcdParser,
-        MODEL_PCD_DYNAMIC_EX_DEFAULT                   :   _PcdParser,
-        MODEL_PCD_DYNAMIC_EX_HII                       :   _PcdParser,
-        MODEL_PCD_DYNAMIC_EX_VPD                       :   _PcdParser,
-        MODEL_META_DATA_COMPONENT                      :   _ComponentParser,
-        MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH :   _CompponentSourceOverridePathParser,
-        MODEL_META_DATA_BUILD_OPTION                   :   MetaFileParser._BuildOptionParser,
-        MODEL_UNKNOWN                                  :   MetaFileParser._Skip,
-        MODEL_META_DATA_USER_EXTENSION                 :   MetaFileParser._Skip,
+        MODEL_META_DATA_HEADER                          :   _DefineParser,
+        MODEL_EFI_SKU_ID                                :   _SkuIdParser,
+        MODEL_EFI_LIBRARY_INSTANCE                      :   _LibraryInstanceParser,
+        MODEL_EFI_LIBRARY_CLASS                         :   _LibraryClassParser,
+        MODEL_PCD_FIXED_AT_BUILD                        :   _PcdParser,
+        MODEL_PCD_PATCHABLE_IN_MODULE                   :   _PcdParser,
+        MODEL_PCD_FEATURE_FLAG                          :   _PcdParser,
+        MODEL_PCD_DYNAMIC_DEFAULT                       :   _PcdParser,
+        MODEL_PCD_DYNAMIC_HII                           :   _PcdParser,
+        MODEL_PCD_DYNAMIC_VPD                           :   _PcdParser,
+        MODEL_PCD_DYNAMIC_EX_DEFAULT                    :   _PcdParser,
+        MODEL_PCD_DYNAMIC_EX_HII                        :   _PcdParser,
+        MODEL_PCD_DYNAMIC_EX_VPD                        :   _PcdParser,
+        MODEL_META_DATA_COMPONENT                       :   _ComponentParser,
+        MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH  :   _CompponentSourceOverridePathParser,
+        MODEL_META_DATA_BUILD_OPTION                    :   _BuildOptionParser,
+        MODEL_UNKNOWN                                   :   MetaFileParser._Skip,
+        MODEL_META_DATA_USER_EXTENSION                  :   MetaFileParser._Skip,
+        MODEL_META_DATA_SECTION_HEADER                  :   MetaFileParser._SectionHeaderParser,
+        MODEL_META_DATA_SUBSECTION_HEADER               :   _SubsectionHeaderParser,
     }
 
+    _Macros     = property(_GetMacros)
+
 ## DEC file parser class
 #
 #   @param      FilePath        The path of platform description file
@@ -1045,20 +1369,24 @@ class DecParser(MetaFileParser):
     #   @param      Table           Database used to retrieve module/package information
     #   @param      Macros          Macros used for replacement in file
     #
-    def __init__(self, FilePath, FileType, Table, Macro=None):
-        MetaFileParser.__init__(self, FilePath, FileType, Table, Macro, -1)
+    def __init__(self, FilePath, FileType, Table):
+        # prevent re-initialization
+        if hasattr(self, "_Table"):
+            return
+        MetaFileParser.__init__(self, FilePath, FileType, Table, -1)
         self._Comments = []
+        self._Version = 0x00010005  # Only EDK2 dec file is supported
 
     ## Parser starter
     def Start(self):
+        Content = ''
         try:
-            if self._Content == None:
-                self._Content = open(self.MetaFile, 'r').readlines()
+            Content = open(str(self.MetaFile), 'r').readlines()
         except:
             EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=self.MetaFile)
 
-        for Index in range(0, len(self._Content)):
-            Line, Comment = CleanString2(self._Content[Index])
+        for Index in range(0, len(Content)):
+            Line, Comment = CleanString2(Content[Index])
             self._CurrentLine = Line
             self._LineIndex = Index
 
@@ -1074,9 +1402,6 @@ class DecParser(MetaFileParser):
                 self._SectionHeaderParser()
                 self._Comments = []
                 continue
-            elif Line.startswith('DEFINE '):
-                self._MacroParser()
-                continue
             elif len(self._SectionType) == 0:
                 self._Comments = []
                 continue
@@ -1100,7 +1425,7 @@ class DecParser(MetaFileParser):
                     self._ValueList[2],
                     Arch,
                     ModuleType,
-                    self._Owner,
+                    self._Owner[-1],
                     self._LineIndex+1,
                     -1,
                     self._LineIndex+1,
@@ -1180,6 +1505,7 @@ class DecParser(MetaFileParser):
                             File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
 
     ## [guids], [ppis] and [protocols] section parser
+    @ParseMacro
     def _GuidParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
         if len(TokenList) < 2:
@@ -1210,6 +1536,7 @@ class DecParser(MetaFileParser):
     #   [PcdsDynamicEx
     #   [PcdsDynamic]
     #
+    @ParseMacro
     def _PcdParser(self):
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
         self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
@@ -1268,6 +1595,7 @@ class DecParser(MetaFileParser):
         if not IsValid:
             EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,
                             File=self.MetaFile, Line=self._LineIndex+1)
+
         if ValueList[0] in ['True', 'true', 'TRUE']:
             ValueList[0] = '1'
         elif ValueList[0] in ['False', 'false', 'FALSE']:
index d8dacacd64e14d15fc2fa6ff6740cd18f03d26fc..f20eab96887829db0cab77b0aaaddeac1ef38197 100644 (file)
 ##\r
 # Import Modules\r
 #\r
+import uuid\r
+\r
 import Common.EdkLogger as EdkLogger\r
-from MetaDataTable import Table\r
+\r
+from MetaDataTable import Table, TableFile\r
 from MetaDataTable import ConvertToSqlString\r
+from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODEL_FILE_INF, \\r
+                                      MODEL_FILE_OTHERS\r
 \r
-## Python class representation of table storing module data\r
-class ModuleTable(Table):\r
+class MetaFileTable(Table):\r
     # TRICK: use file ID as the part before '.'\r
+    _ID_STEP_ = 0.00000001\r
+    _ID_MAX_ = 0.99999999\r
+\r
+    ## Constructor\r
+    def __init__(self, Cursor, MetaFile, FileType, Temporary):\r
+        self.MetaFile = MetaFile\r
+\r
+        self._FileIndexTable = TableFile(Cursor)\r
+        self._FileIndexTable.Create(False)\r
+\r
+        FileId = self._FileIndexTable.GetFileId(MetaFile)\r
+        if not FileId:\r
+            FileId = self._FileIndexTable.InsertFile(MetaFile, FileType)\r
+\r
+        if Temporary:\r
+            TableName = "_%s_%s_%s" % (FileType, FileId, uuid.uuid4().hex)\r
+        else:\r
+            TableName = "_%s_%s" % (FileType, FileId)\r
+\r
+        #Table.__init__(self, Cursor, TableName, FileId, False)\r
+        Table.__init__(self, Cursor, TableName, FileId, Temporary)\r
+        self.Create(not self.IsIntegrity())\r
+\r
+    def IsIntegrity(self):\r
+        try:\r
+            Result = self.Cur.execute("select ID from %s where ID<0" % (self.Table)).fetchall()\r
+            if not Result:\r
+                return False\r
+\r
+            TimeStamp = self.MetaFile.TimeStamp\r
+            if TimeStamp != self._FileIndexTable.GetFileTimeStamp(self.IdBase):\r
+                # update the timestamp in database\r
+                self._FileIndexTable.SetFileTimeStamp(self.IdBase, TimeStamp)\r
+                return False\r
+        except Exception, Exc:\r
+            EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))\r
+            return False\r
+        return True\r
+\r
+## Python class representation of table storing module data\r
+class ModuleTable(MetaFileTable):\r
     _ID_STEP_ = 0.00000001\r
     _ID_MAX_  = 0.99999999\r
     _COLUMN_ = '''\r
@@ -42,8 +87,8 @@ class ModuleTable(Table):
     _DUMMY_ = "-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1"\r
 \r
     ## Constructor\r
-    def __init__(self, Cursor, Name='Inf', IdBase=0, Temporary=False):\r
-        Table.__init__(self, Cursor, Name, IdBase, Temporary)\r
+    def __init__(self, Cursor, MetaFile, Temporary):\r
+        MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_INF, Temporary)\r
 \r
     ## Insert a record into table Inf\r
     #\r
@@ -100,9 +145,7 @@ class ModuleTable(Table):
         return self.Exec(SqlCommand)\r
 \r
 ## Python class representation of table storing package data\r
-class PackageTable(Table):\r
-    _ID_STEP_ = 0.00000001\r
-    _ID_MAX_ = 0.99999999\r
+class PackageTable(MetaFileTable):\r
     _COLUMN_ = '''\r
         ID REAL PRIMARY KEY,\r
         Model INTEGER NOT NULL,\r
@@ -122,8 +165,8 @@ class PackageTable(Table):
     _DUMMY_ = "-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1"\r
 \r
     ## Constructor\r
-    def __init__(self, Cursor, Name='Dec', IdBase=0, Temporary=False):\r
-        Table.__init__(self, Cursor, Name, IdBase, Temporary)\r
+    def __init__(self, Cursor, MetaFile, Temporary):\r
+        MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DEC, Temporary)\r
 \r
     ## Insert table\r
     #\r
@@ -179,9 +222,7 @@ class PackageTable(Table):
         return self.Exec(SqlCommand)\r
 \r
 ## Python class representation of table storing platform data\r
-class PlatformTable(Table):\r
-    _ID_STEP_ = 0.00000001\r
-    _ID_MAX_ = 0.99999999\r
+class PlatformTable(MetaFileTable):\r
     _COLUMN_ = '''\r
         ID REAL PRIMARY KEY,\r
         Model INTEGER NOT NULL,\r
@@ -202,8 +243,8 @@ class PlatformTable(Table):
     _DUMMY_ = "-1, -1, '====', '====', '====', '====', '====', -1, -1, -1, -1, -1, -1, -1"\r
 \r
     ## Constructor\r
-    def __init__(self, Cursor, Name='Dsc', IdBase=0, Temporary=False):\r
-        Table.__init__(self, Cursor, Name, IdBase, Temporary)\r
+    def __init__(self, Cursor, MetaFile, Temporary):\r
+        MetaFileTable.__init__(self, Cursor, MetaFile, MODEL_FILE_DSC, Temporary)\r
 \r
     ## Insert table\r
     #\r
@@ -254,7 +295,7 @@ class PlatformTable(Table):
     # @retval:       A recordSet of all found records \r
     #\r
     def Query(self, Model, Scope1=None, Scope2=None, BelongsToItem=None, FromItem=None):\r
-        ConditionString = "Model=%s AND Enabled>=0" % Model\r
+        ConditionString = "Model=%s AND Enabled>0" % Model\r
         ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"\r
 \r
         if Scope1 != None and Scope1 != 'COMMON':\r
@@ -273,3 +314,36 @@ class PlatformTable(Table):
         SqlCommand = "SELECT %s FROM %s WHERE %s" % (ValueString, self.Table, ConditionString)\r
         return self.Exec(SqlCommand)\r
 \r
+## Factory class to produce different storage for different type of meta-file\r
+class MetaFileStorage(object):\r
+    _FILE_TABLE_ = {\r
+        MODEL_FILE_INF      :   ModuleTable,\r
+        MODEL_FILE_DEC      :   PackageTable,\r
+        MODEL_FILE_DSC      :   PlatformTable,\r
+        MODEL_FILE_OTHERS   :   MetaFileTable,\r
+    }\r
+\r
+    _FILE_TYPE_ = {\r
+        ".inf"  : MODEL_FILE_INF,\r
+        ".dec"  : MODEL_FILE_DEC,\r
+        ".dsc"  : MODEL_FILE_DSC,\r
+    }\r
+\r
+    ## Constructor\r
+    def __new__(Class, Cursor, MetaFile, FileType=None, Temporary=False):\r
+        # no type given, try to find one\r
+        if not FileType:\r
+            if MetaFile.Type in self._FILE_TYPE_:\r
+                FileType = Class._FILE_TYPE_[MetaFile.Type]\r
+            else:\r
+                FileType = MODEL_FILE_OTHERS\r
+\r
+        # don't pass the type around if it's well known\r
+        if FileType == MODEL_FILE_OTHERS:\r
+            Args = (Cursor, MetaFile, FileType, Temporary)\r
+        else:\r
+            Args = (Cursor, MetaFile, Temporary)\r
+\r
+        # create the storage object and return it to caller\r
+        return Class._FILE_TABLE_[FileType](*Args)\r
+\r
index ac2ca057ccdf9682ac5e51e2a2895a70ae77db84..71e98a94bea556533cc350df3cbaee22872929f5 100644 (file)
@@ -92,20 +92,14 @@ class DscBuildData(PlatformBuildClassObject):
     #   @param      Platform        (not used for DscBuildData)\r
     #   @param      Macros          Macros used for replacement in DSC file\r
     #\r
-    def __init__(self, FilePath, RawData, BuildDataBase, Arch='COMMON', Platform='DUMMY', Macros={}):\r
+    def __init__(self, FilePath, RawData, BuildDataBase, Arch='COMMON', Target=None, Toolchain=None):\r
         self.MetaFile = FilePath\r
         self._RawData = RawData\r
         self._Bdb = BuildDataBase\r
         self._Arch = Arch\r
-        self._Macros = Macros\r
+        self._Target = Target\r
+        self._Toolchain = Toolchain\r
         self._Clear()\r
-        RecordList = self._RawData[MODEL_META_DATA_DEFINE, self._Arch]\r
-        for Record in RecordList:\r
-            GlobalData.gEdkGlobal[Record[0]] = Record[1]\r
-        \r
-        RecordList = self._RawData[MODEL_META_DATA_GLOBAL_DEFINE, self._Arch]\r
-        for Record in RecordList:\r
-            GlobalData.gGlobalDefines[Record[0]] = Record[1]\r
 \r
     ## XXX[key] = value\r
     def __setitem__(self, key, value):\r
@@ -145,6 +139,16 @@ class DscBuildData(PlatformBuildClassObject):
         self._RFCLanguages      = None\r
         self._ISOLanguages      = None\r
         self._VpdToolGuid       = None\r
+        self.__Macros            = None\r
+\r
+    ## Get current effective macros\r
+    def _GetMacros(self):\r
+        if self.__Macros == None:\r
+            self.__Macros = {}\r
+            self.__Macros.update(GlobalData.gPlatformDefines)\r
+            self.__Macros.update(GlobalData.gGlobalDefines)\r
+            self.__Macros.update(GlobalData.gCommandLineDefines)\r
+        return self.__Macros\r
 \r
     ## Get architecture\r
     def _GetArch(self):\r
@@ -172,37 +176,40 @@ class DscBuildData(PlatformBuildClassObject):
     def _GetHeaderInfo(self):\r
         RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]\r
         for Record in RecordList:\r
-            Name = Record[0]\r
+            Name = Record[1]\r
             # items defined _PROPERTY_ don't need additional processing\r
             if Name in self:\r
-                self[Name] = Record[1]\r
+                self[Name] = Record[2]\r
             # some special items in [Defines] section need special treatment\r
             elif Name == TAB_DSC_DEFINES_OUTPUT_DIRECTORY:\r
-                self._OutputDirectory = NormPath(Record[1], self._Macros)\r
+                self._OutputDirectory = NormPath(Record[2], self._Macros)\r
                 if ' ' in self._OutputDirectory:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in OUTPUT_DIRECTORY",\r
                                     File=self.MetaFile, Line=Record[-1],\r
                                     ExtraData=self._OutputDirectory)\r
             elif Name == TAB_DSC_DEFINES_FLASH_DEFINITION:\r
-                self._FlashDefinition = PathClass(NormPath(Record[1], self._Macros), GlobalData.gWorkspace)\r
+                self._FlashDefinition = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)\r
                 ErrorCode, ErrorInfo = self._FlashDefinition.Validate('.fdf')\r
                 if ErrorCode != 0:\r
                     EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=Record[-1],\r
                                     ExtraData=ErrorInfo)\r
             elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:\r
-                self._SupArchList = GetSplitValueList(Record[1], TAB_VALUE_SPLIT)\r
+                self._SupArchList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)\r
             elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:\r
-                self._BuildTargets = GetSplitValueList(Record[1])\r
+                self._BuildTargets = GetSplitValueList(Record[2])\r
             elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:\r
                 if self._SkuName == None:\r
-                    self._SkuName = Record[1]\r
+                    self._SkuName = Record[2]\r
             elif Name == TAB_FIX_LOAD_TOP_MEMORY_ADDRESS:\r
-                self._LoadFixAddress = Record[1]\r
+                try:\r
+                    self._LoadFixAddress = int (Record[2], 0)\r
+                except:\r
+                    EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (Record[2]))\r
             elif Name == TAB_DSC_DEFINES_RFC_LANGUAGES:\r
-                if not Record[1] or Record[1][0] != '"' or Record[1][-1] != '"' or len(Record[1]) == 1:\r
+                if not Record[2] or Record[2][0] != '"' or Record[2][-1] != '"' or len(Record[2]) == 1:\r
                     EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'language code for RFC_LANGUAGES must have double quotes around it, for example: RFC_LANGUAGES = "en-us;zh-hans"',\r
                                     File=self.MetaFile, Line=Record[-1])\r
-                LanguageCodes = Record[1][1:-1]\r
+                LanguageCodes = Record[2][1:-1]\r
                 if not LanguageCodes:\r
                     EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more RFC4646 format language code must be provided for RFC_LANGUAGES statement',\r
                                     File=self.MetaFile, Line=Record[-1])                \r
@@ -213,10 +220,10 @@ class DscBuildData(PlatformBuildClassObject):
                                     File=self.MetaFile, Line=Record[-1])                      \r
                 self._RFCLanguages = LanguageList\r
             elif Name == TAB_DSC_DEFINES_ISO_LANGUAGES:\r
-                if not Record[1] or Record[1][0] != '"' or Record[1][-1] != '"' or len(Record[1]) == 1:\r
+                if not Record[2] or Record[2][0] != '"' or Record[2][-1] != '"' or len(Record[2]) == 1:\r
                     EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'language code for ISO_LANGUAGES must have double quotes around it, for example: ISO_LANGUAGES = "engchn"',\r
                                     File=self.MetaFile, Line=Record[-1])\r
-                LanguageCodes = Record[1][1:-1]\r
+                LanguageCodes = Record[2][1:-1]\r
                 if not LanguageCodes:\r
                     EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more ISO639-2 format language code must be provided for ISO_LANGUAGES statement',\r
                                     File=self.MetaFile, Line=Record[-1])                    \r
@@ -233,10 +240,10 @@ class DscBuildData(PlatformBuildClassObject):
                 # for VPD_TOOL_GUID is correct.\r
                 #\r
                 try:\r
-                    uuid.UUID(Record[1])\r
+                    uuid.UUID(Record[2])\r
                 except:\r
                     EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)\r
-                self._VpdToolGuid = Record[1]                   \r
+                self._VpdToolGuid = Record[2]                   \r
         # set _Header to non-None in order to avoid database re-querying\r
         self._Header = 'DUMMY'\r
 \r
@@ -368,8 +375,18 @@ class DscBuildData(PlatformBuildClassObject):
         if self._LoadFixAddress == None:\r
             if self._Header == None:\r
                 self._GetHeaderInfo()\r
+\r
             if self._LoadFixAddress == None:\r
-                self._LoadFixAddress = ''\r
+                self._LoadFixAddress = self._Macros.get(TAB_FIX_LOAD_TOP_MEMORY_ADDRESS, '0')\r
+\r
+            try:\r
+                self._LoadFixAddress = int (self._LoadFixAddress, 0)\r
+            except:\r
+                EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (self._LoadFixAddress))\r
+            if self._LoadFixAddress < 0:\r
+                EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid negative value %s" % (self._LoadFixAddress))\r
+            if self._LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self._LoadFixAddress % 0x1000 != 0:\r
+                EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid unaligned 4K value %s" % (self._LoadFixAddress))\r
         return self._LoadFixAddress\r
 \r
     ## Retrieve RFCLanguage filter\r
@@ -389,7 +406,6 @@ class DscBuildData(PlatformBuildClassObject):
             if self._ISOLanguages == None:\r
                 self._ISOLanguages = []\r
         return self._ISOLanguages\r
-\r
     ## Retrieve the GUID string for VPD tool\r
     def _GetVpdToolGuid(self):\r
         if self._VpdToolGuid == None:\r
@@ -402,8 +418,8 @@ class DscBuildData(PlatformBuildClassObject):
     ## Retrieve [SkuIds] section information\r
     def _GetSkuIds(self):\r
         if self._SkuIds == None:\r
-            self._SkuIds = {}\r
-            RecordList = self._RawData[MODEL_EFI_SKU_ID]\r
+            self._SkuIds = sdict()\r
+            RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]\r
             for Record in RecordList:\r
                 if Record[0] in [None, '']:\r
                     EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID number',\r
@@ -423,8 +439,8 @@ class DscBuildData(PlatformBuildClassObject):
 \r
         self._Modules = sdict()\r
         RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch]\r
-        Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource}\r
-        Macros.update(self._Macros)\r
+        Macros = self._Macros\r
+        Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
         for Record in RecordList:\r
             ModuleFile = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)\r
             ModuleId = Record[5]\r
@@ -530,9 +546,8 @@ class DscBuildData(PlatformBuildClassObject):
             LibraryClassDict = tdict(True, 3)\r
             # track all library class names\r
             LibraryClassSet = set()\r
-            RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch]\r
-            Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource}\r
-            Macros.update(self._Macros)\r
+            RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, None, -1]\r
+            Macros = self._Macros\r
             for Record in RecordList:\r
                 LibraryClass, LibraryInstance, Dummy, Arch, ModuleType, Dummy, LineNo = Record\r
                 if LibraryClass == '' or LibraryClass == 'NULL':\r
@@ -564,7 +579,8 @@ class DscBuildData(PlatformBuildClassObject):
                         continue\r
                     self._LibraryClasses[LibraryClass, ModuleType] = LibraryInstance\r
 \r
-            # for EDK style library instances, which are listed in different section\r
+            # for Edk style library instances, which are listed in different section\r
+            Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch]\r
             for Record in RecordList:\r
                 File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)\r
@@ -581,14 +597,14 @@ class DscBuildData(PlatformBuildClassObject):
                 # to parse it here. (self._Bdb[] will trigger a file parse if it\r
                 # hasn't been parsed)\r
                 #\r
-                Library = self._Bdb[File, self._Arch]\r
+                Library = self._Bdb[File, self._Arch, self._Target, self._Toolchain]\r
                 self._LibraryClasses[Library.BaseName, ':dummy:'] = Library\r
         return self._LibraryClasses\r
 \r
     ## Retrieve all PCD settings in platform\r
     def _GetPcds(self):\r
         if self._Pcds == None:\r
-            self._Pcds = {}\r
+            self._Pcds = sdict()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))\r
@@ -603,17 +619,17 @@ class DscBuildData(PlatformBuildClassObject):
     ## Retrieve [BuildOptions]\r
     def _GetBuildOptions(self):\r
         if self._BuildOptions == None:\r
-            self._BuildOptions = {}\r
+            self._BuildOptions = sdict()\r
             #\r
             # Retrieve build option for EDKII style module\r
             #\r
-            RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 'COMMON', EDKII_NAME]\r
+            RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, EDKII_NAME]\r
             for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList:\r
                 self._BuildOptions[ToolChainFamily, ToolChain, EDKII_NAME] = Option\r
             #\r
             # Retrieve build option for EDK style module\r
             #\r
-            RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, 'COMMON', EDK_NAME]     \r
+            RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, EDK_NAME]     \r
             for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4 in RecordList:\r
                 self._BuildOptions[ToolChainFamily, ToolChain, EDK_NAME] = Option\r
         return self._BuildOptions\r
@@ -625,7 +641,7 @@ class DscBuildData(PlatformBuildClassObject):
     #   @retval a dict object contains settings of given PCD type\r
     #\r
     def _GetPcd(self, Type):\r
-        Pcds = {}\r
+        Pcds = sdict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH\r
@@ -664,7 +680,7 @@ class DscBuildData(PlatformBuildClassObject):
     #   @retval a dict object contains settings of given PCD type\r
     #\r
     def _GetDynamicPcd(self, Type):\r
-        Pcds = {}\r
+        Pcds = sdict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH and SKU\r
@@ -706,7 +722,7 @@ class DscBuildData(PlatformBuildClassObject):
     #   @retval a dict object contains settings of given PCD type\r
     #\r
     def _GetDynamicHiiPcd(self, Type):\r
-        Pcds = {}\r
+        Pcds = sdict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH and SKU\r
@@ -746,7 +762,7 @@ class DscBuildData(PlatformBuildClassObject):
     #   @retval a dict object contains settings of given PCD type\r
     #\r
     def _GetDynamicVpdPcd(self, Type):\r
-        Pcds = {}\r
+        Pcds = sdict()\r
         #\r
         # tdict is a special dict kind of type, used for selecting correct\r
         # PCD settings for certain ARCH and SKU\r
@@ -814,6 +830,7 @@ class DscBuildData(PlatformBuildClassObject):
             self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '', '', {}, False, None)\r
         self.Pcds[Name, Guid].DefaultValue = Value\r
 \r
+    _Macros             = property(_GetMacros)\r
     Arch                = property(_GetArch, _SetArch)\r
     Platform            = property(_GetPlatformName)\r
     PlatformName        = property(_GetPlatformName)\r
@@ -884,13 +901,14 @@ class DecBuildData(PackageBuildClassObject):
     #   @param      Platform        (not used for DecBuildData)\r
     #   @param      Macros          Macros used for replacement in DSC file\r
     #\r
-    def __init__(self, File, RawData, BuildDataBase, Arch='COMMON', Platform='DUMMY', Macros={}):\r
+    def __init__(self, File, RawData, BuildDataBase, Arch='COMMON', Target=None, Toolchain=None):\r
         self.MetaFile = File\r
         self._PackageDir = File.Dir\r
         self._RawData = RawData\r
         self._Bdb = BuildDataBase\r
         self._Arch = Arch\r
-        self._Macros = Macros\r
+        self._Target = Target\r
+        self._Toolchain = Toolchain\r
         self._Clear()\r
 \r
     ## XXX[key] = value\r
@@ -918,6 +936,14 @@ class DecBuildData(PackageBuildClassObject):
         self._Includes          = None\r
         self._LibraryClasses    = None\r
         self._Pcds              = None\r
+        self.__Macros           = None\r
+\r
+    ## Get current effective macros\r
+    def _GetMacros(self):\r
+        if self.__Macros == None:\r
+            self.__Macros = {}\r
+            self.__Macros.update(GlobalData.gGlobalDefines)\r
+        return self.__Macros\r
 \r
     ## Get architecture\r
     def _GetArch(self):\r
@@ -943,11 +969,11 @@ class DecBuildData(PackageBuildClassObject):
     #   (Retriving all [Defines] information in one-shot is just to save time.)\r
     #\r
     def _GetHeaderInfo(self):\r
-        RecordList = self._RawData[MODEL_META_DATA_HEADER]\r
+        RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]\r
         for Record in RecordList:\r
-            Name = Record[0]\r
+            Name = Record[1]\r
             if Name in self:\r
-                self[Name] = Record[1]\r
+                self[Name] = Record[2]\r
         self._Header = 'DUMMY'\r
 \r
     ## Retrieve package name\r
@@ -1057,8 +1083,8 @@ class DecBuildData(PackageBuildClassObject):
         if self._Includes == None:\r
             self._Includes = []\r
             RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]\r
-            Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource}\r
-            Macros.update(self._Macros)\r
+            Macros = self._Macros\r
+            Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
             for Record in RecordList:\r
                 File = PathClass(NormPath(Record[0], Macros), self._PackageDir, Arch=self._Arch)\r
                 LineNo = Record[-1]\r
@@ -1082,8 +1108,7 @@ class DecBuildData(PackageBuildClassObject):
             LibraryClassDict = tdict(True)\r
             LibraryClassSet = set()\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch]\r
-            Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource}\r
-            Macros.update(self._Macros)\r
+            Macros = self._Macros\r
             for LibraryClass, File, Dummy, Arch, ID, LineNo in RecordList:\r
                 File = PathClass(NormPath(File, Macros), self._PackageDir, Arch=self._Arch)\r
                 # check the file validation\r
@@ -1100,7 +1125,7 @@ class DecBuildData(PackageBuildClassObject):
     ## Retrieve PCD declarations\r
     def _GetPcds(self):\r
         if self._Pcds == None:\r
-            self._Pcds = {}\r
+            self._Pcds = sdict()\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE))\r
             self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG))\r
@@ -1110,7 +1135,7 @@ class DecBuildData(PackageBuildClassObject):
 \r
     ## Retrieve PCD declarations for given type\r
     def _GetPcd(self, Type):\r
-        Pcds = {}\r
+        Pcds = sdict()\r
         #\r
         # tdict is a special kind of dict, used for selecting correct\r
         # PCD declaration for given ARCH\r
@@ -1150,6 +1175,7 @@ class DecBuildData(PackageBuildClassObject):
         return Pcds\r
 \r
 \r
+    _Macros         = property(_GetMacros)\r
     Arch            = property(_GetArch, _SetArch)\r
     PackageName     = property(_GetPackageName)\r
     Guid            = property(_GetFileGuid)\r
@@ -1194,7 +1220,7 @@ class InfBuildData(ModuleBuildClassObject):
         #\r
         # Optional Fields\r
         #\r
-        TAB_INF_DEFINES_INF_VERSION                 : "_AutoGenVersion",\r
+        #TAB_INF_DEFINES_INF_VERSION                 : "_AutoGenVersion",\r
         TAB_INF_DEFINES_COMPONENT_TYPE              : "_ComponentType",\r
         TAB_INF_DEFINES_MAKEFILE_NAME               : "_MakefileName",\r
         #TAB_INF_DEFINES_CUSTOM_MAKEFILE             : "_CustomMakefile",\r
@@ -1249,14 +1275,15 @@ class InfBuildData(ModuleBuildClassObject):
     #   @param      Platform        The name of platform employing this module\r
     #   @param      Macros          Macros used for replacement in DSC file\r
     #\r
-    def __init__(self, FilePath, RawData, BuildDatabase, Arch='COMMON', Platform='COMMON', Macros={}):\r
+    def __init__(self, FilePath, RawData, BuildDatabase, Arch='COMMON', Target=None, Toolchain=None):\r
         self.MetaFile = FilePath\r
         self._ModuleDir = FilePath.Dir\r
         self._RawData = RawData\r
         self._Bdb = BuildDatabase\r
         self._Arch = Arch\r
+        self._Target = Target\r
+        self._Toolchain = Toolchain\r
         self._Platform = 'COMMON'\r
-        self._Macros = Macros\r
         self._SourceOverridePath = None\r
         if FilePath.Key in GlobalData.gOverrideDir:\r
             self._SourceOverridePath = GlobalData.gOverrideDir[FilePath.Key]\r
@@ -1310,7 +1337,17 @@ class InfBuildData(ModuleBuildClassObject):
         self._BuildOptions          = None\r
         self._Depex                 = None\r
         self._DepexExpression       = None\r
-        #self._SourceOverridePath    = None\r
+        self.__Macros               = None\r
+\r
+    ## Get current effective macros\r
+    def _GetMacros(self):\r
+        if self.__Macros == None:\r
+            self.__Macros = {}\r
+            # EDK_GLOBAL defined macros can be applied to EDK modoule\r
+            if self.AutoGenVersion < 0x00010005:\r
+                self.__Macros.update(GlobalData.gEdkGlobal)\r
+            self.__Macros.update(GlobalData.gGlobalDefines)\r
+        return self.__Macros\r
 \r
     ## Get architecture\r
     def _GetArch(self):\r
@@ -1354,26 +1391,25 @@ class InfBuildData(ModuleBuildClassObject):
     def _GetHeaderInfo(self):\r
         RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]\r
         for Record in RecordList:\r
-            Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
-            Name = Record[0]\r
+            Name, Value = Record[1], ReplaceMacro(Record[2], self._Macros, False)\r
             # items defined _PROPERTY_ don't need additional processing\r
             if Name in self:\r
-                self[Name] = Record[1]\r
+                self[Name] = Value\r
             # some special items in [Defines] section need special treatment\r
             elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):\r
                 if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):\r
                     Name = 'UEFI_SPECIFICATION_VERSION'\r
                 if self._Specification == None:\r
                     self._Specification = sdict()\r
-                self._Specification[Name] = GetHexVerValue(Record[1])\r
+                self._Specification[Name] = GetHexVerValue(Value)\r
                 if self._Specification[Name] == None:\r
                     EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
-                                    "'%s' format is not supported for %s" % (Record[1], Name),\r
+                                    "'%s' format is not supported for %s" % (Value, Name),\r
                                     File=self.MetaFile, Line=Record[-1])\r
             elif Name == 'LIBRARY_CLASS':\r
                 if self._LibraryClass == None:\r
                     self._LibraryClass = []\r
-                ValueList = GetSplitValueList(Record[1])\r
+                ValueList = GetSplitValueList(Value)\r
                 LibraryClass = ValueList[0]\r
                 if len(ValueList) > 1:\r
                     SupModuleList = GetSplitValueList(ValueList[1], ' ')\r
@@ -1383,27 +1419,27 @@ class InfBuildData(ModuleBuildClassObject):
             elif Name == 'ENTRY_POINT':\r
                 if self._ModuleEntryPointList == None:\r
                     self._ModuleEntryPointList = []\r
-                self._ModuleEntryPointList.append(Record[1])\r
+                self._ModuleEntryPointList.append(Value)\r
             elif Name == 'UNLOAD_IMAGE':\r
                 if self._ModuleUnloadImageList == None:\r
                     self._ModuleUnloadImageList = []\r
-                if Record[1] == '':\r
+                if not Value:\r
                     continue\r
-                self._ModuleUnloadImageList.append(Record[1])\r
+                self._ModuleUnloadImageList.append(Value)\r
             elif Name == 'CONSTRUCTOR':\r
                 if self._ConstructorList == None:\r
                     self._ConstructorList = []\r
-                if Record[1] == '':\r
+                if not Value:\r
                     continue\r
-                self._ConstructorList.append(Record[1])\r
+                self._ConstructorList.append(Value)\r
             elif Name == 'DESTRUCTOR':\r
                 if self._DestructorList == None:\r
                     self._DestructorList = []\r
-                if Record[1] == '':\r
+                if not Value:\r
                     continue\r
-                self._DestructorList.append(Record[1])\r
+                self._DestructorList.append(Value)\r
             elif Name == TAB_INF_DEFINES_CUSTOM_MAKEFILE:\r
-                TokenList = GetSplitValueList(Record[1])\r
+                TokenList = GetSplitValueList(Value)\r
                 if self._CustomMakefile == None:\r
                     self._CustomMakefile = {}\r
                 if len(TokenList) < 2:\r
@@ -1418,25 +1454,25 @@ class InfBuildData(ModuleBuildClassObject):
             else:\r
                 if self._Defs == None:\r
                     self._Defs = sdict()\r
-                self._Defs[Name] = Record[1]\r
+                self._Defs[Name] = Value\r
 \r
         #\r
-        # Retrieve information in sections specific to EDK.x modules\r
+        # Retrieve information in sections specific to Edk.x modules\r
         #\r
-        if self._AutoGenVersion >= 0x00010005:   # _AutoGenVersion may be None, which is less than anything\r
+        if self.AutoGenVersion >= 0x00010005:\r
             if not self._ModuleType:\r
                 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
                                 "MODULE_TYPE is not given", File=self.MetaFile)\r
             if self._ModuleType not in SUP_MODULE_LIST:\r
                 RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]\r
                 for Record in RecordList:\r
-                    Name = Record[0]\r
+                    Name = Record[1]\r
                     if Name == "MODULE_TYPE":\r
                         LineNo = Record[6]\r
                         break\r
                 EdkLogger.error("build", FORMAT_NOT_SUPPORTED,\r
                                 "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType,' '.join(l for l in SUP_MODULE_LIST)), \r
-                                File=self.MetaFile, Line=LineNo)             \r
+                                File=self.MetaFile, Line=LineNo)\r
             if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):\r
                 if self._ModuleType == SUP_MODULE_SMM_CORE:\r
                     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)                \r
@@ -1459,29 +1495,28 @@ class InfBuildData(ModuleBuildClassObject):
                 if self.Sources == None:\r
                     self._Sources = []\r
                 self._Sources.append(File)\r
-        else:\r
-            self._BuildType = self._ComponentType.upper()\r
+        else:  \r
             if not self._ComponentType:\r
                 EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
                                 "COMPONENT_TYPE is not given", File=self.MetaFile)\r
+            self._BuildType = self._ComponentType.upper()                \r
             if self._ComponentType in self._MODULE_TYPE_:\r
                 self._ModuleType = self._MODULE_TYPE_[self._ComponentType]\r
             if self._ComponentType == 'LIBRARY':\r
                 self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)]\r
             # make use some [nmake] section macros\r
+            Macros = self._Macros\r
+            Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
+            Macros['PROCESSOR'] = self._Arch\r
             RecordList = self._RawData[MODEL_META_DATA_NMAKE, self._Arch, self._Platform]\r
             for Name,Value,Dummy,Arch,Platform,ID,LineNo in RecordList:\r
-                Value = Value.replace('$(PROCESSOR)', self._Arch)\r
-                Name = Name.replace('$(PROCESSOR)', self._Arch)\r
-                Name, Value = ReplaceMacros((Name, Value), GlobalData.gEdkGlobal, True)\r
+                Value = ReplaceMacro(Value, Macros, True)\r
                 if Name == "IMAGE_ENTRY_POINT":\r
                     if self._ModuleEntryPointList == None:\r
                         self._ModuleEntryPointList = []\r
                     self._ModuleEntryPointList.append(Value)\r
                 elif Name == "DPX_SOURCE":\r
-                    Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource}\r
-                    Macros.update(self._Macros)\r
-                    File = PathClass(NormPath(Value, Macros), self._ModuleDir, Arch=self._Arch)\r
+                    File = PathClass(NormPath(Value), self._ModuleDir, Arch=self._Arch)\r
                     # check the file validation\r
                     ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)\r
                     if ErrorCode != 0:\r
@@ -1505,9 +1540,9 @@ class InfBuildData(ModuleBuildClassObject):
                         else:\r
                             Tool = ToolList[0]\r
                         ToolChain = "*_*_*_%s_FLAGS" % Tool\r
-                        ToolChainFamily = 'MSFT'    # EDK.x only support MSFT tool chain\r
+                        ToolChainFamily = 'MSFT'    # Edk.x only support MSFT tool chain\r
                         #ignore not replaced macros in value\r
-                        ValueList = GetSplitValueList(' ' + Value, '/D')\r
+                        ValueList = GetSplitList(' ' + Value, '/D')\r
                         Dummy = ValueList[0]\r
                         for Index in range(1, len(ValueList)):\r
                             if ValueList[Index][-1] == '=' or ValueList[Index] == '':\r
@@ -1525,8 +1560,11 @@ class InfBuildData(ModuleBuildClassObject):
     ## Retrieve file version\r
     def _GetInfVersion(self):\r
         if self._AutoGenVersion == None:\r
-            if self._Header_ == None:\r
-                self._GetHeaderInfo()\r
+            RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]\r
+            for Record in RecordList:\r
+                if Record[1] == TAB_INF_DEFINES_INF_VERSION:\r
+                    self._AutoGenVersion = int(Record[2], 0)\r
+                    break\r
             if self._AutoGenVersion == None:\r
                 self._AutoGenVersion = 0x00010000\r
         return self._AutoGenVersion\r
@@ -1693,10 +1731,10 @@ class InfBuildData(ModuleBuildClassObject):
         if self._Binaries == None:\r
             self._Binaries = []\r
             RecordList = self._RawData[MODEL_EFI_BINARY_FILE, self._Arch, self._Platform]\r
-            Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource, 'PROCESSOR':self._Arch}\r
-            Macros.update(self._Macros)\r
+            Macros = self._Macros\r
+            Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
+            Macros['PROCESSOR'] = self._Arch\r
             for Record in RecordList:\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
                 FileType = Record[0]\r
                 LineNo = Record[-1]\r
                 Target = 'COMMON'\r
@@ -1721,17 +1759,17 @@ class InfBuildData(ModuleBuildClassObject):
         if self._Sources == None:\r
             self._Sources = []\r
             RecordList = self._RawData[MODEL_EFI_SOURCE_FILE, self._Arch, self._Platform]\r
-            Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource, 'PROCESSOR':self._Arch}\r
-            Macros.update(self._Macros)\r
+            Macros = self._Macros\r
+            Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
+            Macros['PROCESSOR'] = self._Arch\r
             for Record in RecordList:\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
                 LineNo = Record[-1]\r
                 ToolChainFamily = Record[1]\r
                 TagName = Record[2]\r
                 ToolCode = Record[3]\r
                 FeatureFlag = Record[4]\r
-                if self._AutoGenVersion < 0x00010005:\r
-                    # old module source files (EDK)\r
+                if self.AutoGenVersion < 0x00010005:\r
+                    # old module source files (Edk)\r
                     File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, self._SourceOverridePath,\r
                                      '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode)\r
                     # check the file validation\r
@@ -1760,23 +1798,22 @@ class InfBuildData(ModuleBuildClassObject):
             self._LibraryClasses = sdict()\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_CLASS, self._Arch, self._Platform]\r
             for Record in RecordList:\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
                 Lib = Record[0]\r
                 Instance = Record[1]\r
-                if Instance != None and Instance != '':\r
+                if Instance:\r
                     Instance = NormPath(Instance, self._Macros)\r
                 self._LibraryClasses[Lib] = Instance\r
         return self._LibraryClasses\r
 \r
-    ## Retrieve library names (for EDK.x style of modules)\r
+    ## Retrieve library names (for Edk.x style of modules)\r
     def _GetLibraryNames(self):\r
         if self._Libraries == None:\r
             self._Libraries = []\r
             RecordList = self._RawData[MODEL_EFI_LIBRARY_INSTANCE, self._Arch, self._Platform]\r
             for Record in RecordList:\r
-                # in case of name with '.lib' extension, which is unusual in EDK.x inf\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
-                LibraryName = os.path.splitext(Record[0])[0]\r
+                LibraryName = ReplaceMacro(Record[0], self._Macros, False)\r
+                # in case of name with '.lib' extension, which is unusual in Edk.x inf\r
+                LibraryName = os.path.splitext(LibraryName)[0]\r
                 if LibraryName not in self._Libraries:\r
                     self._Libraries.append(LibraryName)\r
         return self._Libraries\r
@@ -1829,23 +1866,23 @@ class InfBuildData(ModuleBuildClassObject):
                 self._Guids[CName] = Value\r
         return self._Guids\r
 \r
-    ## Retrieve include paths necessary for this module (for EDK.x style of modules)\r
+    ## Retrieve include paths necessary for this module (for Edk.x style of modules)\r
     def _GetIncludes(self):\r
         if self._Includes == None:\r
             self._Includes = []\r
             if self._SourceOverridePath:\r
                 self._Includes.append(self._SourceOverridePath)\r
+\r
+            Macros = self._Macros\r
+            if 'PROCESSOR' in GlobalData.gEdkGlobal.keys():\r
+                Macros['PROCESSOR'] = GlobalData.gEdkGlobal['PROCESSOR']\r
+            else:\r
+                Macros['PROCESSOR'] = self._Arch\r
             RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]\r
-            # [includes] section must be used only in old (EDK.x) inf file\r
-            if self.AutoGenVersion >= 0x00010005 and len(RecordList) > 0:\r
-                EdkLogger.error('build', FORMAT_NOT_SUPPORTED, "No [include] section allowed",\r
-                                File=self.MetaFile, Line=RecordList[0][-1]-1)\r
             for Record in RecordList:\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
-                Record[0] = Record[0].replace('$(PROCESSOR)', self._Arch)\r
-                Record[0] = ReplaceMacro(Record[0], {'EFI_SOURCE' : GlobalData.gEfiSource}, False)\r
                 if Record[0].find('EDK_SOURCE') > -1:\r
-                    File = NormPath(ReplaceMacro(Record[0], {'EDK_SOURCE' : GlobalData.gEcpSource}, False), self._Macros)\r
+                    Macros['EDK_SOURCE'] = GlobalData.gEcpSource\r
+                    File = NormPath(Record[0], self._Macros)\r
                     if File[0] == '.':\r
                         File = os.path.join(self._ModuleDir, File)\r
                     else:\r
@@ -1855,7 +1892,8 @@ class InfBuildData(ModuleBuildClassObject):
                         self._Includes.append(File)\r
 \r
                     #TRICK: let compiler to choose correct header file\r
-                    File = NormPath(ReplaceMacro(Record[0], {'EDK_SOURCE' : GlobalData.gEdkSource}, False), self._Macros)\r
+                    Macros['EDK_SOURCE'] = GlobalData.gEdkSource\r
+                    File = NormPath(Record[0], self._Macros)\r
                     if File[0] == '.':\r
                         File = os.path.join(self._ModuleDir, File)\r
                     else:\r
@@ -1864,7 +1902,7 @@ class InfBuildData(ModuleBuildClassObject):
                     if File:\r
                         self._Includes.append(File)\r
                 else:\r
-                    File = NormPath(Record[0], self._Macros)\r
+                    File = NormPath(Record[0], Macros)\r
                     if File[0] == '.':\r
                         File = os.path.join(self._ModuleDir, File)\r
                     else:\r
@@ -1879,8 +1917,8 @@ class InfBuildData(ModuleBuildClassObject):
         if self._Packages == None:\r
             self._Packages = []\r
             RecordList = self._RawData[MODEL_META_DATA_PACKAGE, self._Arch, self._Platform]\r
-            Macros = {"EDK_SOURCE":GlobalData.gEcpSource, "EFI_SOURCE":GlobalData.gEfiSource}\r
-            Macros.update(self._Macros)\r
+            Macros = self._Macros\r
+            Macros['EDK_SOURCE'] = GlobalData.gEcpSource\r
             for Record in RecordList:\r
                 File = PathClass(NormPath(Record[0], Macros), GlobalData.gWorkspace, Arch=self._Arch)\r
                 LineNo = Record[-1]\r
@@ -1889,7 +1927,7 @@ class InfBuildData(ModuleBuildClassObject):
                 if ErrorCode != 0:\r
                     EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo, File=self.MetaFile, Line=LineNo)\r
                 # parse this package now. we need it to get protocol/ppi/guid value\r
-                Package = self._Bdb[File, self._Arch]\r
+                Package = self._Bdb[File, self._Arch, self._Target, self._Toolchain]\r
                 self._Packages.append(Package)\r
         return self._Packages\r
 \r
@@ -1921,7 +1959,7 @@ class InfBuildData(ModuleBuildClassObject):
                     self._BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Option\r
         return self._BuildOptions\r
 \r
-    ## Retrieve depedency expression\r
+    ## Retrieve dependency expression\r
     def _GetDepex(self):\r
         if self._Depex == None:\r
             self._Depex = tdict(False, 2)\r
@@ -1929,8 +1967,8 @@ class InfBuildData(ModuleBuildClassObject):
             \r
             # If the module has only Binaries and no Sources, then ignore [Depex] \r
             if self.Sources == None or self.Sources == []:\r
-              if self.Binaries <> None and self.Binaries <> []:\r
-                return self._Depex\r
+                if self.Binaries != None and self.Binaries != []:\r
+                    return self._Depex\r
                 \r
             # PEIM and DXE drivers must have a valid [Depex] section\r
             if len(self.LibraryClass) == 0 and len(RecordList) == 0:\r
@@ -1939,12 +1977,12 @@ class InfBuildData(ModuleBuildClassObject):
                     EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \\r
                                     % self.ModuleType, File=self.MetaFile)\r
 \r
-            Depex = {}\r
+            Depex = sdict()\r
             for Record in RecordList:\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
+                DepexStr = ReplaceMacro(Record[0], self._Macros, False)\r
                 Arch = Record[3]\r
                 ModuleType = Record[4]\r
-                TokenList = Record[0].split()\r
+                TokenList = DepexStr.split()\r
                 if (Arch, ModuleType) not in Depex:\r
                     Depex[Arch, ModuleType] = []\r
                 DepexList = Depex[Arch, ModuleType]\r
@@ -1980,12 +2018,12 @@ class InfBuildData(ModuleBuildClassObject):
         if self._DepexExpression == None:\r
             self._DepexExpression = tdict(False, 2)\r
             RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]\r
-            DepexExpression = {}\r
+            DepexExpression = sdict()\r
             for Record in RecordList:\r
-                Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
+                DepexStr = ReplaceMacro(Record[0], self._Macros, False)\r
                 Arch = Record[3]\r
                 ModuleType = Record[4]\r
-                TokenList = Record[0].split()\r
+                TokenList = DepexStr.split()\r
                 if (Arch, ModuleType) not in DepexExpression:\r
                     DepexExpression[Arch, ModuleType] = ''\r
                 for Token in TokenList:\r
@@ -2123,6 +2161,7 @@ class InfBuildData(ModuleBuildClassObject):
 \r
         return Pcds\r
 \r
+    _Macros                 = property(_GetMacros)\r
     Arch                    = property(_GetArch, _SetArch)\r
     Platform                = property(_GetPlatform, _SetPlatform)\r
 \r
@@ -2170,21 +2209,6 @@ class InfBuildData(ModuleBuildClassObject):
 # @prarm RenewDb=False      Create new database file if it's already there\r
 #\r
 class WorkspaceDatabase(object):\r
-    # file parser\r
-    _FILE_PARSER_ = {\r
-        MODEL_FILE_INF  :   InfParser,\r
-        MODEL_FILE_DEC  :   DecParser,\r
-        MODEL_FILE_DSC  :   DscParser,\r
-        MODEL_FILE_FDF  :   None, #FdfParser,\r
-        MODEL_FILE_CIF  :   None\r
-    }\r
-\r
-    # file table\r
-    _FILE_TABLE_ = {\r
-        MODEL_FILE_INF  :   ModuleTable,\r
-        MODEL_FILE_DEC  :   PackageTable,\r
-        MODEL_FILE_DSC  :   PlatformTable,\r
-    }\r
 \r
     # default database file path\r
     _DB_PATH_ = "Conf/.cache/build.db"\r
@@ -2194,11 +2218,18 @@ class WorkspaceDatabase(object):
     # to avoid unnecessary re-parsing\r
     #\r
     class BuildObjectFactory(object):\r
+\r
         _FILE_TYPE_ = {\r
             ".inf"  : MODEL_FILE_INF,\r
             ".dec"  : MODEL_FILE_DEC,\r
             ".dsc"  : MODEL_FILE_DSC,\r
-            ".fdf"  : MODEL_FILE_FDF,\r
+        }\r
+\r
+        # file parser\r
+        _FILE_PARSER_ = {\r
+            MODEL_FILE_INF  :   InfParser,\r
+            MODEL_FILE_DEC  :   DecParser,\r
+            MODEL_FILE_DSC  :   DscParser,\r
         }\r
 \r
         # convert to xxxBuildData object\r
@@ -2206,7 +2237,6 @@ class WorkspaceDatabase(object):
             MODEL_FILE_INF  :   InfBuildData,\r
             MODEL_FILE_DEC  :   DecBuildData,\r
             MODEL_FILE_DSC  :   DscBuildData,\r
-            MODEL_FILE_FDF  :   None #FlashDefTable,\r
         }\r
 \r
         _CACHE_ = {}    # (FilePath, Arch)  : <object>\r
@@ -2215,46 +2245,61 @@ class WorkspaceDatabase(object):
         def __init__(self, WorkspaceDb):\r
             self.WorkspaceDb = WorkspaceDb\r
 \r
-        # key = (FilePath, Arch='COMMON')\r
+        # key = (FilePath, Arch=None)\r
         def __contains__(self, Key):\r
             FilePath = Key[0]\r
-            Arch = 'COMMON'\r
             if len(Key) > 1:\r
                 Arch = Key[1]\r
+            else:\r
+                Arch = None\r
             return (FilePath, Arch) in self._CACHE_\r
 \r
-        # key = (FilePath, Arch='COMMON')\r
+        # key = (FilePath, Arch=None, Target=None, Toochain=None)\r
         def __getitem__(self, Key):\r
             FilePath = Key[0]\r
-            Arch = 'COMMON'\r
-            Platform = 'COMMON'\r
-            if len(Key) > 1:\r
+            KeyLength = len(Key)\r
+            if KeyLength > 1:\r
                 Arch = Key[1]\r
-            if len(Key) > 2:\r
-                Platform = Key[2]\r
+            else:\r
+                Arch = None\r
+            if KeyLength > 2:\r
+                Target = Key[2]\r
+            else:\r
+                Target = None\r
+            if KeyLength > 3:\r
+                Toolchain = Key[3]\r
+            else:\r
+                Toolchain = None\r
 \r
             # if it's generated before, just return the cached one\r
-            Key = (FilePath, Arch)\r
+            Key = (FilePath, Arch, Target, Toolchain)\r
             if Key in self._CACHE_:\r
                 return self._CACHE_[Key]\r
 \r
             # check file type\r
-            Ext = FilePath.Ext.lower()\r
+            Ext = FilePath.Type\r
             if Ext not in self._FILE_TYPE_:\r
                 return None\r
             FileType = self._FILE_TYPE_[Ext]\r
             if FileType not in self._GENERATOR_:\r
                 return None\r
 \r
-            # get table for current file\r
-            MetaFile = self.WorkspaceDb[FilePath, FileType, self.WorkspaceDb._GlobalMacros]\r
+            # get the parser ready for this file\r
+            MetaFile = self._FILE_PARSER_[FileType](\r
+                                FilePath, \r
+                                FileType, \r
+                                MetaFileStorage(self.WorkspaceDb.Cur, FilePath, FileType)\r
+                                )\r
+            # alwasy do post-process, in case of macros change\r
+            MetaFile.DoPostProcess()\r
+            # object the build is based on\r
             BuildObject = self._GENERATOR_[FileType](\r
                                     FilePath,\r
                                     MetaFile,\r
                                     self,\r
                                     Arch,\r
-                                    Platform,\r
-                                    self.WorkspaceDb._GlobalMacros,\r
+                                    Target,\r
+                                    Toolchain\r
                                     )\r
             self._CACHE_[Key] = BuildObject\r
             return BuildObject\r
@@ -2274,11 +2319,9 @@ class WorkspaceDatabase(object):
     # @param GlobalMacros       Global macros used for replacement during file parsing\r
     # @prarm RenewDb=False      Create new database file if it's already there\r
     #\r
-    def __init__(self, DbPath, GlobalMacros={}, RenewDb=False):\r
+    def __init__(self, DbPath, RenewDb=False):\r
         self._DbClosedFlag = False\r
-        self._GlobalMacros = GlobalMacros\r
-\r
-        if DbPath == None or DbPath == '':\r
+        if not DbPath:\r
             DbPath = os.path.normpath(os.path.join(GlobalData.gWorkspace, self._DB_PATH_))\r
 \r
         # don't create necessary path for db in memory\r
@@ -2306,6 +2349,7 @@ class WorkspaceDatabase(object):
         # create table for internal uses\r
         self.TblDataModel = TableDataModel(self.Cur)\r
         self.TblFile = TableFile(self.Cur)\r
+        self.Platform = None\r
 \r
         # conversion object for build or file format conversion purpose\r
         self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)\r
@@ -2324,41 +2368,6 @@ class WorkspaceDatabase(object):
     #  @return Bool value for whether need renew workspace databse\r
     #\r
     def _CheckWhetherDbNeedRenew (self, force, DbPath):\r
-        DbDir = os.path.split(DbPath)[0]\r
-        MacroFilePath = os.path.normpath(os.path.join(DbDir, "build.mac"))\r
-        MacroMatch = False\r
-        if os.path.exists(MacroFilePath) and os.path.isfile(MacroFilePath):\r
-            LastMacros = None\r
-            try:\r
-                f = open(MacroFilePath,'r')\r
-                LastMacros = pickle.load(f)\r
-                f.close()\r
-            except IOError:\r
-                pass\r
-            except:\r
-                f.close()\r
-\r
-            if LastMacros != None and type(LastMacros) is DictType:\r
-                if LastMacros == self._GlobalMacros:\r
-                    MacroMatch = True\r
-                    for Macro in LastMacros.keys():\r
-                        if not (Macro in self._GlobalMacros and LastMacros[Macro] == self._GlobalMacros[Macro]):\r
-                            MacroMatch = False;\r
-                            break;\r
-\r
-        if not MacroMatch:\r
-            # save command line macros to file\r
-            try:\r
-                f = open(MacroFilePath,'w')\r
-                pickle.dump(self._GlobalMacros, f, 2)\r
-                f.close()\r
-            except IOError:\r
-                pass\r
-            except:\r
-                f.close()\r
-\r
-            force = True\r
-\r
         # if database does not exist, we need do nothing\r
         if not os.path.exists(DbPath): return False\r
             \r
@@ -2423,6 +2432,9 @@ determine whether database file is out of date!\n")
     def QueryTable(self, Table):\r
         Table.Query()\r
 \r
+    def __del__(self):\r
+        self.Close()\r
+\r
     ## Close entire database\r
     #\r
     # Commit all first\r
@@ -2435,83 +2447,28 @@ determine whether database file is out of date!\n")
             self.Conn.close()\r
             self._DbClosedFlag = True\r
 \r
-    ## Get unique file ID for the gvien file\r
-    def GetFileId(self, FilePath):\r
-        return self.TblFile.GetFileId(FilePath)\r
-\r
-    ## Get file type value for the gvien file ID\r
-    def GetFileType(self, FileId):\r
-        return self.TblFile.GetFileType(FileId)\r
-\r
-    ## Get time stamp stored in file table\r
-    def GetTimeStamp(self, FileId):\r
-        return self.TblFile.GetFileTimeStamp(FileId)\r
-\r
-    ## Update time stamp in file table\r
-    def SetTimeStamp(self, FileId, TimeStamp):\r
-        return self.TblFile.SetFileTimeStamp(FileId, TimeStamp)\r
-\r
-    ## Check if a table integrity flag exists or not\r
-    def CheckIntegrity(self, TableName):\r
-        try:\r
-            Result = self.Cur.execute("select min(ID) from %s" % (TableName)).fetchall()\r
-            if Result[0][0] != -1:\r
-                return False\r
-            #\r
-            # Check whether the meta data file has external dependency by comparing the time stamp\r
-            #\r
-            Sql = "select Value1, Value2 from %s where Model=%d" % (TableName, MODEL_EXTERNAL_DEPENDENCY)\r
-            for Dependency in self.Cur.execute(Sql).fetchall():\r
-                if str(os.stat(Dependency[0])[8]) != Dependency[1]:\r
-                    return False\r
-        except:\r
-            return False\r
-        return True\r
-\r
-    ## Compose table name for given file type and file ID\r
-    def GetTableName(self, FileType, FileId):\r
-        return "_%s_%s" % (FileType, FileId)\r
-\r
-    ## Return a temp table containing all content of the given file\r
-    #\r
-    #   @param  FileInfo    The tuple containing path and type of a file\r
-    #\r
-    def __getitem__(self, FileInfo):\r
-        FilePath, FileType, Macros = FileInfo\r
-        if FileType not in self._FILE_TABLE_:\r
-            return None\r
-\r
-        # flag used to indicate if it's parsed or not\r
-        FilePath = str(FilePath)\r
-        Parsed = False\r
-        FileId = self.GetFileId(FilePath)\r
-        if FileId != None:\r
-            TimeStamp = os.stat(FilePath)[8]\r
-            TableName = self.GetTableName(FileType, FileId)\r
-            if TimeStamp != self.GetTimeStamp(FileId):\r
-                # update the timestamp in database\r
-                self.SetTimeStamp(FileId, TimeStamp)\r
-            else:\r
-                # if the table exists and is integrity, don't parse it\r
-                Parsed = self.CheckIntegrity(TableName)\r
-        else:\r
-            FileId = self.TblFile.InsertFile(FilePath, FileType)\r
-            TableName = self.GetTableName(FileType, FileId)\r
-\r
-        FileTable = self._FILE_TABLE_[FileType](self.Cur, TableName, FileId)\r
-        FileTable.Create(not Parsed)\r
-        Parser = self._FILE_PARSER_[FileType](FilePath, FileType, FileTable, Macros)\r
-        # set the "Finished" flag in parser in order to avoid re-parsing (if parsed)\r
-        Parser.Finished = Parsed\r
-        return Parser\r
-\r
     ## Summarize all packages in the database\r
-    def _GetPackageList(self):\r
-        PackageList = []\r
-        for Module in self.ModuleList:\r
-            for Package in Module.Packages:\r
+    def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):\r
+        self.Platform = Platform\r
+        PackageList =[]\r
+        Pa = self.BuildObject[self.Platform, 'COMMON']\r
+        #\r
+        # Get Package related to Modules\r
+        #\r
+        for Module in Pa.Modules:\r
+            ModuleObj = self.BuildObject[Module, Arch, TargetName, ToolChainTag]\r
+            for Package in ModuleObj.Packages:\r
                 if Package not in PackageList:\r
                     PackageList.append(Package)\r
+        #\r
+        # Get Packages related to Libraries\r
+        #\r
+        for Lib in Pa.LibraryInstances:\r
+            LibObj = self.BuildObject[Lib, Arch, TargetName, ToolChainTag]\r
+            for Package in LibObj.Packages:\r
+                if Package not in PackageList:\r
+                    PackageList.append(Package)            \r
+        \r
         return PackageList\r
 \r
     ## Summarize all platforms in the database\r
@@ -2526,21 +2483,7 @@ determine whether database file is out of date!\n")
                 PlatformList.append(Platform)\r
         return PlatformList\r
 \r
-    ## Summarize all modules in the database\r
-    def _GetModuleList(self):\r
-        ModuleList = []\r
-        for ModuleFile in self.TblFile.GetFileList(MODEL_FILE_INF):\r
-            try:\r
-                Module = self.BuildObject[PathClass(ModuleFile), 'COMMON']\r
-            except:\r
-                Module = None\r
-            if Module != None:\r
-                ModuleList.append(Module)\r
-        return ModuleList\r
-\r
     PlatformList = property(_GetPlatformList)\r
-    PackageList = property(_GetPackageList)\r
-    ModuleList = property(_GetModuleList)\r
 \r
 ##\r
 #\r
index c6e49f9999683159eb53e1d00e11188f114869d3..f3555d705dcf92f5c45fbd0dd1f70fce24009c1f 100644 (file)
@@ -4,7 +4,7 @@
 # This module contains the functionality to generate build report after\r
 # build all target completes successfully.\r
 #\r
-# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -184,16 +184,17 @@ class DepexParser(object):
     #\r
     def __init__(self, Wa):\r
         self._GuidDb = {}\r
-        for Package in Wa.BuildDatabase.WorkspaceDb.PackageList:\r
-            for Protocol in Package.Protocols:\r
-                GuidValue = GuidStructureStringToGuidString(Package.Protocols[Protocol])\r
-                self._GuidDb[GuidValue.upper()] = Protocol\r
-            for Ppi in Package.Ppis:\r
-                GuidValue = GuidStructureStringToGuidString(Package.Ppis[Ppi])\r
-                self._GuidDb[GuidValue.upper()] = Ppi\r
-            for Guid in Package.Guids:\r
-                GuidValue = GuidStructureStringToGuidString(Package.Guids[Guid])\r
-                self._GuidDb[GuidValue.upper()] = Guid\r
+        for Pa in Wa.AutoGenObjectList:\r
+            for Package in Pa.PackageList:        \r
+                for Protocol in Package.Protocols:\r
+                    GuidValue = GuidStructureStringToGuidString(Package.Protocols[Protocol])\r
+                    self._GuidDb[GuidValue.upper()] = Protocol\r
+                for Ppi in Package.Ppis:\r
+                    GuidValue = GuidStructureStringToGuidString(Package.Ppis[Ppi])\r
+                    self._GuidDb[GuidValue.upper()] = Ppi\r
+                for Guid in Package.Guids:\r
+                    GuidValue = GuidStructureStringToGuidString(Package.Guids[Guid])\r
+                    self._GuidDb[GuidValue.upper()] = Guid\r
     \r
     ##\r
     # Parse the binary dependency expression files.\r
@@ -486,7 +487,7 @@ class ModuleReport(object):
             #\r
             if ModuleType == "DXE_SMM_DRIVER":\r
                 PiSpec =  M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")\r
-                if int(PiSpec, 16) >= 0x0001000A:\r
+                if int(PiSpec, 0) >= 0x0001000A:\r
                     ModuleType = "SMM_DRIVER"\r
             self.DriverType = gDriverTypeMap.get(ModuleType, "0x2 (FREE_FORM)")\r
         self.UefiSpecVersion = M.Module.Specification.get("UEFI_SPECIFICATION_VERSION", "")\r
@@ -641,10 +642,11 @@ class PcdReport(object):
         # Collect PCD DEC default value.\r
         #\r
         self.DecPcdDefault = {}\r
-        for Package in Wa.BuildDatabase.WorkspaceDb.PackageList:\r
-            for (TokenCName, TokenSpaceGuidCName, DecType) in Package.Pcds:\r
-                DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue\r
-                self.DecPcdDefault.setdefault((TokenCName, TokenSpaceGuidCName, DecType), DecDefaultValue)\r
+        for Pa in Wa.AutoGenObjectList:\r
+            for Package in Pa.PackageList:\r
+                for (TokenCName, TokenSpaceGuidCName, DecType) in Package.Pcds:\r
+                    DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue\r
+                    self.DecPcdDefault.setdefault((TokenCName, TokenSpaceGuidCName, DecType), DecDefaultValue)\r
         #\r
         # Collect PCDs defined in DSC common section\r
         #\r
@@ -1174,14 +1176,14 @@ class FdRegionReport(object):
             self._DiscoverNestedFvList(FvName, Wa)\r
 \r
         PlatformPcds = {}\r
-        \r
         #\r
         # Collect PCDs declared in DEC files.\r
-        #\r
-        for Package in Wa.BuildDatabase.WorkspaceDb.PackageList:\r
-            for (TokenCName, TokenSpaceGuidCName, DecType) in Package.Pcds:\r
-                DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue\r
-                PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DecDefaultValue\r
+        #        \r
+        for Pa in Wa.AutoGenObjectList:\r
+            for Package in Pa.PackageList:\r
+                for (TokenCName, TokenSpaceGuidCName, DecType) in Package.Pcds:\r
+                    DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue\r
+                    PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DecDefaultValue\r
         #\r
         # Collect PCDs defined in DSC common section\r
         #\r
index 9502bf3364442a5e3454d964013b95fd1367afe6..0319103138bacfaa0d9e985549fd99c4f3e0201b 100644 (file)
@@ -172,6 +172,12 @@ def CheckEnvVariable():
     GlobalData.gEdkSource = EdkSourceDir\r
     GlobalData.gEcpSource = EcpSourceDir\r
 \r
+    GlobalData.gGlobalDefines["WORKSPACE"]  = WorkspaceDir\r
+    GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir\r
+    GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir\r
+    GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir\r
+    GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]\r
+\r
 ## Get normalized file path\r
 #\r
 # Convert the path to be local format, and remove the WORKSPACE path at the\r
@@ -301,10 +307,14 @@ class BuildUnit:
         self.WorkingDir = WorkingDir\r
         self.Target = Target\r
         self.BuildCommand = BuildCommand\r
-        if BuildCommand == None or len(BuildCommand) == 0:\r
-            EdkLogger.error("build", OPTION_MISSING, "No build command found for",\r
+        if not BuildCommand:\r
+            EdkLogger.error("build", OPTION_MISSING,\r
+                            "No build command found for this module. "\r
+                            "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." % \r
+                                (Obj.BuildTarget, Obj.ToolChain, Obj.Arch),\r
                             ExtraData=str(Obj))\r
 \r
+\r
     ## str() method\r
     #\r
     #   It just returns the string representation of self.BuildObject\r
@@ -690,93 +700,59 @@ class Build():
     #\r
     #   @param  Target              The build command target, one of gSupportedTarget\r
     #   @param  WorkspaceDir        The directory of workspace\r
-    #   @param  Platform            The DSC file of active platform\r
-    #   @param  Module              The INF file of active module, if any\r
-    #   @param  Arch                The Arch list of platform or module\r
-    #   @param  ToolChain           The name list of toolchain\r
-    #   @param  BuildTarget         The "DEBUG" or "RELEASE" build\r
-    #   @param  FlashDefinition     The FDF file of active platform\r
-    #   @param  FdList=[]           The FD names to be individually built\r
-    #   @param  FvList=[]           The FV names to be individually built\r
-    #   @param  MakefileType        The type of makefile (for MSFT make or GNU make)\r
-    #   @param  SilentMode          Indicate multi-thread build mode\r
-    #   @param  ThreadNumber        The maximum number of thread if in multi-thread build mode\r
-    #   @param  SkipAutoGen         Skip AutoGen step\r
-    #   @param  Reparse             Re-parse all meta files\r
-    #   @param  SkuId               SKU id from command line\r
-    #\r
-    def __init__(self, Target, WorkspaceDir, Platform, Module, Arch, ToolChain,\r
-                 BuildTarget, FlashDefinition, FdList=[], FvList=[], CapList=[],\r
-                 MakefileType="nmake", SilentMode=False, ThreadNumber=2,\r
-                 SkipAutoGen=False, Reparse=False, SkuId=None, \r
-                 ReportFile=None, ReportType=None, UniFlag=None):\r
-\r
-        self.WorkspaceDir = WorkspaceDir\r
+    #   @param  BuildOptions        Build options passed from command line\r
+    #\r
+    def __init__(self, Target, WorkspaceDir, BuildOptions):\r
+        self.WorkspaceDir   = WorkspaceDir\r
         self.Target         = Target\r
-        self.PlatformFile   = Platform\r
-        self.ModuleFile     = Module\r
-        self.ArchList       = Arch\r
-        self.ToolChainList  = ToolChain\r
-        self.BuildTargetList= BuildTarget\r
-        self.Fdf            = FlashDefinition\r
-        self.FdList         = FdList\r
-        self.FvList         = FvList\r
-        self.CapList        = CapList\r
-        self.MakefileType   = MakefileType\r
-        self.SilentMode     = SilentMode\r
-        self.ThreadNumber   = ThreadNumber\r
-        self.SkipAutoGen    = SkipAutoGen\r
-        self.Reparse        = Reparse\r
-        self.SkuId          = SkuId\r
+        self.PlatformFile   = BuildOptions.PlatformFile\r
+        self.ModuleFile     = BuildOptions.ModuleFile\r
+        self.ArchList       = BuildOptions.TargetArch\r
+        self.ToolChainList  = BuildOptions.ToolChain\r
+        self.BuildTargetList= BuildOptions.BuildTarget\r
+        self.Fdf            = BuildOptions.FdfFile\r
+        self.FdList         = BuildOptions.RomImage\r
+        self.FvList         = BuildOptions.FvImage\r
+        self.CapList        = BuildOptions.CapName\r
+        self.SilentMode     = BuildOptions.SilentMode\r
+        self.ThreadNumber   = BuildOptions.ThreadNumber\r
+        self.SkipAutoGen    = BuildOptions.SkipAutoGen\r
+        self.Reparse        = BuildOptions.Reparse\r
+        self.SkuId          = BuildOptions.SkuId\r
         self.SpawnMode      = True\r
-        self.BuildReport    = BuildReport(ReportFile, ReportType)\r
+        self.BuildReport    = BuildReport(BuildOptions.ReportFile, BuildOptions.ReportType)\r
         self.TargetTxt      = TargetTxtClassObject()\r
         self.ToolDef        = ToolDefClassObject()\r
-        self.Db             = WorkspaceDatabase(None, GlobalData.gGlobalDefines, self.Reparse)\r
-        #self.Db             = WorkspaceDatabase(None, {}, self.Reparse)\r
+        if BuildOptions.DisableCache:\r
+            self.Db         = WorkspaceDatabase(":memory:")\r
+        else:\r
+            self.Db         = WorkspaceDatabase(None, self.Reparse)\r
         self.BuildDatabase  = self.Db.BuildObject\r
         self.Platform       = None\r
         self.LoadFixAddress = 0\r
-        self.UniFlag        = UniFlag\r
+        self.UniFlag        = BuildOptions.Flag\r
 \r
         # print dot character during doing some time-consuming work\r
         self.Progress = Utils.Progressor()\r
 \r
-        # parse target.txt, tools_def.txt, and platform file\r
-        #self.RestoreBuildData()\r
-        self.LoadConfiguration()\r
-        \r
-        #\r
-        # @attention Treat $(TARGET)/$(TOOL_CHAIN_TAG) in meta data files as special macro when it has only one build target/toolchain.\r
-        # This is not a complete support for $(TARGET)/$(TOOL_CHAIN_TAG) macro as it can only support one build target/toolchain in ONE\r
-        # invocation of build command. However, it should cover the frequent usage model that $(TARGET)/$(TOOL_CHAIN_TAG) macro\r
-        # is used in DSC/FDF files to specify different libraries & PCD setting for debug/release build.\r
-        #\r
-        if len(self.BuildTargetList) == 1:\r
-            self.Db._GlobalMacros.setdefault("TARGET", self.BuildTargetList[0])\r
-        if len(self.ToolChainList) == 1:   \r
-            self.Db._GlobalMacros.setdefault("TOOL_CHAIN_TAG", self.ToolChainList[0])\r
-        \r
         self.InitBuild()\r
 \r
         # print current build environment and configuration\r
-        EdkLogger.quiet("%-24s = %s" % ("WORKSPACE", os.environ["WORKSPACE"]))\r
-        EdkLogger.quiet("%-24s = %s" % ("ECP_SOURCE", os.environ["ECP_SOURCE"]))\r
-        EdkLogger.quiet("%-24s = %s" % ("EDK_SOURCE", os.environ["EDK_SOURCE"]))\r
-        EdkLogger.quiet("%-24s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))\r
-        EdkLogger.quiet("%-24s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))\r
-\r
-        EdkLogger.info('\n%-24s = %s' % ("TARGET_ARCH", ' '.join(self.ArchList)))\r
-        EdkLogger.info('%-24s = %s' % ("TARGET", ' '.join(self.BuildTargetList)))\r
-        EdkLogger.info('%-24s = %s' % ("TOOL_CHAIN_TAG", ' '.join(self.ToolChainList)))\r
-\r
-        EdkLogger.info('\n%-24s = %s' % ("Active Platform", self.PlatformFile))\r
-\r
-        if self.Fdf != None and self.Fdf != "":\r
-            EdkLogger.info('%-24s = %s' % ("Flash Image Definition", self.Fdf))\r
-\r
-        if self.ModuleFile != None and self.ModuleFile != "":\r
-            EdkLogger.info('%-24s = %s' % ("Active Module", self.ModuleFile))\r
+        EdkLogger.quiet("%-16s = %s" % ("WORKSPACE", os.environ["WORKSPACE"]))\r
+        EdkLogger.quiet("%-16s = %s" % ("ECP_SOURCE", os.environ["ECP_SOURCE"]))\r
+        EdkLogger.quiet("%-16s = %s" % ("EDK_SOURCE", os.environ["EDK_SOURCE"]))\r
+        EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))\r
+        EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))\r
+\r
+        EdkLogger.info("")\r
+        if self.ArchList:\r
+            EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' '.join(self.ArchList)))\r
+        EdkLogger.info('%-16s = %s' % ("Build target", ' '.join(self.BuildTargetList)))\r
+        EdkLogger.info('%-16s = %s' % ("Toolchain", ' '.join(self.ToolChainList)))\r
+\r
+        #EdkLogger.info('\n%-24s = %s' % ("Active Platform", self.PlatformFile))\r
+        if self.ModuleFile:\r
+            EdkLogger.info('%-16s = %s' % ("Active Module", self.ModuleFile))\r
 \r
         os.chdir(self.WorkspaceDir)\r
         self.Progress.Start("\nProcessing meta-data")\r
@@ -805,15 +781,16 @@ class Build():
             EdkLogger.error("build", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)\r
 \r
         # if no ARCH given in command line, get it from target.txt\r
-        if self.ArchList == None or len(self.ArchList) == 0:\r
+        if not self.ArchList:\r
             self.ArchList = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TARGET_ARCH]\r
+        self.ArchList = tuple(self.ArchList)\r
 \r
         # if no build target given in command line, get it from target.txt\r
-        if self.BuildTargetList == None or len(self.BuildTargetList) == 0:\r
+        if not self.BuildTargetList:\r
             self.BuildTargetList = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TARGET]\r
 \r
         # if no tool chain given in command line, get it from target.txt\r
-        if self.ToolChainList == None or len(self.ToolChainList) == 0:\r
+        if not self.ToolChainList:\r
             self.ToolChainList = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]\r
             if self.ToolChainList == None or len(self.ToolChainList) == 0:\r
                 EdkLogger.error("build", RESOURCE_NOT_AVAILABLE, ExtraData="No toolchain given. Don't know how to build.\n")\r
@@ -859,9 +836,6 @@ class Build():
                                     ExtraData="No active platform specified in target.txt or command line! Nothing can be built.\n")\r
 \r
             self.PlatformFile = PathClass(NormFile(PlatformFile, self.WorkspaceDir), self.WorkspaceDir)\r
-            ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)\r
-            if ErrorCode != 0:\r
-                EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
 \r
     ## Initialize build configuration\r
     #\r
@@ -869,90 +843,17 @@ class Build():
     #   command line and target.txt, then get the final build configurations.\r
     #\r
     def InitBuild(self):\r
-        ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc")\r
+        # parse target.txt, tools_def.txt, and platform file\r
+        self.LoadConfiguration()        \r
+\r
+        # Allow case-insensitive for those from command line or configuration file\r
+        ErrorCode, ErrorInfo = self.PlatformFile.Validate(".dsc", False)\r
         if ErrorCode != 0:\r
             EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
 \r
         # create metafile database\r
         self.Db.InitDatabase()\r
 \r
-        # we need information in platform description file to determine how to build\r
-        self.Platform = self.BuildDatabase[self.PlatformFile, 'COMMON']\r
-        if not self.Fdf:\r
-            self.Fdf = self.Platform.FlashDefinition\r
-        \r
-        LoadFixAddressString = None\r
-        if TAB_FIX_LOAD_TOP_MEMORY_ADDRESS in GlobalData.gGlobalDefines:\r
-            LoadFixAddressString = GlobalData.gGlobalDefines[TAB_FIX_LOAD_TOP_MEMORY_ADDRESS]\r
-        else:\r
-            LoadFixAddressString = self.Platform.LoadFixAddress\r
-\r
-        if LoadFixAddressString != None and LoadFixAddressString != '':\r
-            try:\r
-                if LoadFixAddressString.upper().startswith('0X'):\r
-                    self.LoadFixAddress = int (LoadFixAddressString, 16)\r
-                else:\r
-                    self.LoadFixAddress = int (LoadFixAddressString)\r
-            except:\r
-                EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (LoadFixAddressString))\r
-            if self.LoadFixAddress < 0:\r
-                EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid negative value %s" % (LoadFixAddressString))\r
-            if self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress % 0x1000 != 0:\r
-                EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid unaligned 4K value %s" % (LoadFixAddressString))\r
-\r
-        if self.SkuId == None or self.SkuId == '':\r
-            self.SkuId = self.Platform.SkuName\r
-\r
-        # check FD/FV build target\r
-        if self.Fdf == None or self.Fdf == "":\r
-            if self.FdList != []:\r
-                EdkLogger.info("No flash definition file found. FD [%s] will be ignored." % " ".join(self.FdList))\r
-                self.FdList = []\r
-            if self.FvList != []:\r
-                EdkLogger.info("No flash definition file found. FV [%s] will be ignored." % " ".join(self.FvList))\r
-                self.FvList = []\r
-        else:\r
-            #\r
-            # Mark now build in AutoGen Phase\r
-            #\r
-            GlobalData.gAutoGenPhase = True\r
-            FdfParserObj = FdfParser(str(self.Fdf))\r
-            for key in self.Db._GlobalMacros:\r
-                InputMacroDict[key] = self.Db._GlobalMacros[key]\r
-            FdfParserObj.ParseFile()\r
-            for fvname in self.FvList:\r
-                if fvname.upper() not in FdfParserObj.Profile.FvDict.keys():\r
-                    EdkLogger.error("build", OPTION_VALUE_INVALID,\r
-                                    "No such an FV in FDF file: %s" % fvname)\r
-            GlobalData.gAutoGenPhase = False\r
-\r
-        #\r
-        # Merge Arch\r
-        #\r
-        if self.ArchList == None or len(self.ArchList) == 0:\r
-            ArchList = set(self.Platform.SupArchList)\r
-        else:\r
-            ArchList = set(self.ArchList) & set(self.Platform.SupArchList)\r
-        if len(ArchList) == 0:\r
-            EdkLogger.error("build", PARAMETER_INVALID,\r
-                            ExtraData = "Active platform supports [%s] only, but [%s] is given."\r
-                                        % (" ".join(self.Platform.SupArchList), " ".join(self.ArchList)))\r
-        elif len(ArchList) != len(self.ArchList):\r
-            SkippedArchList = set(self.ArchList).symmetric_difference(set(self.Platform.SupArchList))\r
-            EdkLogger.verbose("\nArch [%s] is ignored because active platform supports [%s] but [%s] is specified !"\r
-                           % (" ".join(SkippedArchList), " ".join(self.Platform.SupArchList), " ".join(self.ArchList)))\r
-        self.ArchList = tuple(ArchList)\r
-\r
-        # Merge build target\r
-        if self.BuildTargetList == None or len(self.BuildTargetList) == 0:\r
-            BuildTargetList = self.Platform.BuildTargets\r
-        else:\r
-            BuildTargetList = list(set(self.BuildTargetList) & set(self.Platform.BuildTargets))\r
-        if BuildTargetList == []:\r
-            EdkLogger.error("build", PARAMETER_INVALID, "Active platform only supports [%s], but [%s] is given"\r
-                                % (" ".join(self.Platform.BuildTargets), " ".join(self.BuildTargetList)))\r
-        self.BuildTargetList = BuildTargetList\r
-\r
     ## Build a module or platform\r
     #\r
     # Create autogen code and makefile for a module or platform, and the launch\r
@@ -1000,7 +901,11 @@ class Build():
 \r
         BuildCommand = AutoGenObject.BuildCommand\r
         if BuildCommand == None or len(BuildCommand) == 0:\r
-            EdkLogger.error("build", OPTION_MISSING, ExtraData="No MAKE command found for [%s, %s, %s]" % Key)\r
+            EdkLogger.error("build", OPTION_MISSING,\r
+                            "No build command found for this module. "\r
+                            "Please check your setting of %s_%s_%s_MAKE_PATH in Conf/tools_def.txt file." % \r
+                                (AutoGenObject.BuildTarget, AutoGenObject.ToolChain, AutoGenObject.Arch),\r
+                            ExtraData=str(AutoGenObject))\r
 \r
         BuildCommand = BuildCommand + [Target]\r
         LaunchCommand(BuildCommand, AutoGenObject.MakeFileDir)\r
@@ -1011,7 +916,7 @@ class Build():
                 #\r
                 # First should close DB.\r
                 #\r
-                self.Db.Close()     \r
+                self.Db.Close()\r
                 RemoveDirectory(gBuildCacheDir, True)\r
             except WindowsError, X:\r
                 EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))\r
@@ -1121,7 +1026,7 @@ class Build():
     ## Collect MAP information of all FVs\r
     #\r
     def _CollectFvMapBuffer (self, MapBuffer, Wa, ModuleList):\r
-        if self.Fdf != '':\r
+        if self.Fdf:\r
             # First get the XIP base address for FV map file.\r
             GuidPattern = re.compile("[-a-fA-F0-9]+")\r
             GuidName = re.compile("\(GUID=[-a-fA-F0-9]+")\r
@@ -1318,10 +1223,13 @@ class Build():
     #\r
     def _BuildPlatform(self):\r
         for BuildTarget in self.BuildTargetList:\r
+            GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
             for ToolChain in self.ToolChainList:\r
+                GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
+                GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain\r
                 Wa = WorkspaceAutoGen(\r
                         self.WorkspaceDir,\r
-                        self.Platform,\r
+                        self.PlatformFile,\r
                         BuildTarget,\r
                         ToolChain,\r
                         self.ArchList,\r
@@ -1335,18 +1243,21 @@ class Build():
                         self.SkuId,\r
                         self.UniFlag\r
                         )\r
+                self.Fdf = Wa.FdfFile\r
+                self.LoadFixAddress = Wa.Platform.LoadFixAddress\r
                 self.BuildReport.AddPlatformReport(Wa)\r
                 self.Progress.Stop("done!")\r
                 self._Build(self.Target, Wa)\r
                 \r
                 # Create MAP file when Load Fix Address is enabled.\r
                 if self.Target in ["", "all", "fds"]:\r
-                    for Arch in self.ArchList:\r
+                    for Arch in Wa.ArchList:\r
+                        GlobalData.gGlobalDefines['ARCH'] = Arch\r
                         #\r
                         # Check whether the set fix address is above 4G for 32bit image.\r
                         #\r
                         if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:\r
-                            EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platorm with IA32 or ARM arch modules")\r
+                            EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platform with IA32 or ARM arch modules")\r
                     #\r
                     # Get Module List\r
                     #\r
@@ -1364,12 +1275,12 @@ class Build():
                         # Rebase module to the preferred memory address before GenFds\r
                         #\r
                         self._CollectModuleMapBuffer(MapBuffer, ModuleList)\r
-                        if self.Fdf != '':\r
+                        if self.Fdf:\r
                             #\r
                             # create FDS again for the updated EFI image\r
                             #\r
                             self._Build("fds", Wa)\r
-                    if self.Fdf != '':\r
+                    if self.Fdf:\r
                         #\r
                         # Create MAP file for all platform FVs after GenFds.\r
                         #\r
@@ -1383,14 +1294,17 @@ class Build():
     #\r
     def _BuildModule(self):\r
         for BuildTarget in self.BuildTargetList:\r
+            GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
             for ToolChain in self.ToolChainList:\r
+                GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
+                GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain             \r
                 #\r
                 # module build needs platform build information, so get platform\r
                 # AutoGen first\r
                 #\r
                 Wa = WorkspaceAutoGen(\r
                         self.WorkspaceDir,\r
-                        self.Platform,\r
+                        self.PlatformFile,\r
                         BuildTarget,\r
                         ToolChain,\r
                         self.ArchList,\r
@@ -1404,10 +1318,13 @@ class Build():
                         self.SkuId,\r
                         self.UniFlag\r
                         )\r
+                self.Fdf = Wa.FdfFile\r
+                self.LoadFixAddress = Wa.Platform.LoadFixAddress\r
                 Wa.CreateMakeFile(False)\r
                 self.Progress.Stop("done!")\r
                 MaList = []\r
-                for Arch in self.ArchList:\r
+                for Arch in Wa.ArchList:\r
+                    GlobalData.gGlobalDefines['ARCH'] = Arch\r
                     Ma = ModuleAutoGen(Wa, self.ModuleFile, BuildTarget, ToolChain, Arch, self.PlatformFile)\r
                     if Ma == None: continue\r
                     MaList.append(Ma)\r
@@ -1421,12 +1338,12 @@ class Build():
                                 "Module for [%s] is not a component of active platform."\\r
                                 " Please make sure that the ARCH and inf file path are"\\r
                                 " given in the same as in [%s]" %\\r
-                                    (', '.join(self.ArchList), self.Platform),\r
+                                    (', '.join(Wa.ArchList), self.PlatformFile),\r
                                 ExtraData=self.ModuleFile\r
                                 )\r
                 # Create MAP file when Load Fix Address is enabled.\r
-                if self.Target == "fds" and self.Fdf != '':\r
-                    for Arch in self.ArchList:\r
+                if self.Target == "fds" and self.Fdf:\r
+                    for Arch in Wa.ArchList:\r
                         #\r
                         # Check whether the set fix address is above 4G for 32bit image.\r
                         #\r
@@ -1466,10 +1383,13 @@ class Build():
     #\r
     def _MultiThreadBuildPlatform(self):\r
         for BuildTarget in self.BuildTargetList:\r
+            GlobalData.gGlobalDefines['TARGET'] = BuildTarget\r
             for ToolChain in self.ToolChainList:\r
+                GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain\r
+                GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain  \r
                 Wa = WorkspaceAutoGen(\r
                         self.WorkspaceDir,\r
-                        self.Platform,\r
+                        self.PlatformFile,\r
                         BuildTarget,\r
                         ToolChain,\r
                         self.ArchList,\r
@@ -1483,13 +1403,16 @@ class Build():
                         self.SkuId,\r
                         self.UniFlag\r
                         )\r
+                self.Fdf = Wa.FdfFile\r
+                self.LoadFixAddress = Wa.Platform.LoadFixAddress\r
                 self.BuildReport.AddPlatformReport(Wa)\r
                 Wa.CreateMakeFile(False)\r
 \r
                 # multi-thread exit flag\r
                 ExitFlag = threading.Event()\r
                 ExitFlag.clear()\r
-                for Arch in self.ArchList:\r
+                for Arch in Wa.ArchList:\r
+                    GlobalData.gGlobalDefines['ARCH'] = Arch\r
                     Pa = PlatformAutoGen(Wa, self.PlatformFile, BuildTarget, ToolChain, Arch)\r
                     if Pa == None:\r
                         continue\r
@@ -1546,7 +1469,7 @@ class Build():
 \r
                 # Create MAP file when Load Fix Address is enabled.\r
                 if self.Target in ["", "all", "fds"]:\r
-                    for Arch in self.ArchList:\r
+                    for Arch in Wa.ArchList:\r
                         #\r
                         # Check whether the set fix address is above 4G for 32bit image.\r
                         #\r
@@ -1569,7 +1492,7 @@ class Build():
                     if self.LoadFixAddress != 0:\r
                         self._CollectModuleMapBuffer(MapBuffer, ModuleList)\r
 \r
-                    if self.Fdf != '':\r
+                    if self.Fdf:\r
                         #\r
                         # Generate FD image if there's a FDF file found\r
                         #\r
@@ -1586,20 +1509,32 @@ class Build():
     ## Generate GuidedSectionTools.txt in the FV directories.\r
     #\r
     def CreateGuidedSectionToolsFile(self):\r
-        for Arch in self.ArchList:\r
-            for BuildTarget in self.BuildTargetList:\r
-                for ToolChain in self.ToolChainList:\r
-                    FvDir = os.path.join(\r
-                                self.WorkspaceDir,\r
-                                self.Platform.OutputDirectory,\r
-                                '_'.join((BuildTarget, ToolChain)),\r
-                                'FV'\r
-                                )\r
-                    if not os.path.exists(FvDir):\r
-                        continue\r
+        for BuildTarget in self.BuildTargetList:\r
+            for ToolChain in self.ToolChainList:\r
+                Wa = WorkspaceAutoGen(\r
+                        self.WorkspaceDir,\r
+                        self.PlatformFile,\r
+                        BuildTarget,\r
+                        ToolChain,\r
+                        self.ArchList,\r
+                        self.BuildDatabase,\r
+                        self.TargetTxt,\r
+                        self.ToolDef,\r
+                        self.Fdf,\r
+                        self.FdList,\r
+                        self.FvList,\r
+                        self.CapList,\r
+                        self.SkuId,\r
+                        self.UniFlag\r
+                        )\r
+                FvDir = Wa.FvDir\r
+                if not os.path.exists(FvDir):\r
+                    continue\r
+\r
+                for Arch in self.ArchList:    \r
                     # Build up the list of supported architectures for this build\r
                     prefix = '%s_%s_%s_' % (BuildTarget, ToolChain, Arch)\r
-\r
+    \r
                     # Look through the tool definitions for GUIDed tools\r
                     guidAttribs = []\r
                     for (attrib, value) in self.ToolDef.ToolsDefTxtDictionary.iteritems():\r
@@ -1614,7 +1549,7 @@ class Build():
                                 path = self.ToolDef.ToolsDefTxtDictionary[path]\r
                                 path = self.GetFullPathOfTool(path)\r
                                 guidAttribs.append((guid, toolName, path))\r
-\r
+    \r
                     # Write out GuidedSecTools.txt\r
                     toolsFile = os.path.join(FvDir, 'GuidedSectionTools.txt')\r
                     toolsFile = open(toolsFile, 'wt')\r
@@ -1642,7 +1577,7 @@ class Build():
     ## Launch the module or platform build\r
     #\r
     def Launch(self):\r
-        if self.ModuleFile == None or self.ModuleFile == "":\r
+        if not self.ModuleFile:\r
             if not self.SpawnMode or self.Target not in ["", "all"]:\r
                 self.SpawnMode = False\r
                 self._BuildPlatform()\r
@@ -1687,8 +1622,13 @@ def ParseDefines(DefineList=[]):
     if DefineList != None:\r
         for Define in DefineList:\r
             DefineTokenList = Define.split("=", 1)\r
+            if not GlobalData.gMacroNamePattern.match(DefineTokenList[0]):\r
+                EdkLogger.error('build', FORMAT_INVALID,\r
+                                "The macro name must be in the pattern [A-Z][A-Z0-9_]*",\r
+                                ExtraData=DefineTokenList[0])\r
+                \r
             if len(DefineTokenList) == 1:\r
-                DefineDict[DefineTokenList[0]] = ""\r
+                DefineDict[DefineTokenList[0]] = "TRUE"\r
             else:\r
                 DefineDict[DefineTokenList[0]] = DefineTokenList[1].strip()\r
     return DefineDict\r
@@ -1737,10 +1677,7 @@ def MyOptionParser():
     Parser.add_option("-u", "--skip-autogen", action="store_true", dest="SkipAutoGen", help="Skip AutoGen step.")\r
     Parser.add_option("-e", "--re-parse", action="store_true", dest="Reparse", help="Re-parse all meta-data files.")\r
 \r
-    Parser.add_option("-c", "--case-insensitive", action="store_true", dest="CaseInsensitive", help="Don't check case of file name.")\r
-\r
-    # Parser.add_option("-D", "--define", action="append", dest="Defines", metavar="NAME[=[VALUE]]",\r
-    #     help="Define global macro which can be used in DSC/DEC/INF files.")\r
+    Parser.add_option("-c", "--case-insensitive", action="store_true", dest="CaseInsensitive", default=False, help="Don't check case of file name.")\r
 \r
     Parser.add_option("-w", "--warning-as-error", action="store_true", dest="WarningAsError", help="Treat warning in tools as error.")\r
     Parser.add_option("-j", "--log", action="store", dest="LogFile", help="Put log in specified file as well as on console.")\r
@@ -1762,6 +1699,7 @@ def MyOptionParser():
         help="Specify the specific option to parse EDK UNI file. Must be one of: [-c, -s]. -c is for EDK framework UNI file, and -s is for EDK UEFI UNI file. "\\r
              "This option can also be specified by setting *_*_*_BUILD_FLAGS in [BuildOptions] section of platform DSC. If they are both specified, this value "\\r
              "will override the setting in [BuildOptions] section of platform DSC.")\r
+    Parser.add_option("-N", "--no-cache", action="store_true", dest="DisableCache", default=False, help="Disable build cache mechanism")\r
 \r
     (Opt, Args)=Parser.parse_args()\r
     return (Opt, Args)\r
@@ -1826,11 +1764,12 @@ def Main():
             EdkLogger.error("build", OPTION_NOT_SUPPORTED, "Not supported target [%s]." % Target,\r
                             ExtraData="Please select one of: %s" %(' '.join(gSupportedTarget)))\r
 \r
-        GlobalData.gGlobalDefines = ParseDefines(Option.Macros)\r
         #\r
         # Check environment variable: EDK_TOOLS_PATH, WORKSPACE, PATH\r
         #\r
         CheckEnvVariable()\r
+        GlobalData.gCommandLineDefines.update(ParseDefines(Option.Macros))\r
+\r
         Workspace = os.getenv("WORKSPACE")\r
         #\r
         # Get files real name in workspace dir\r
@@ -1861,9 +1800,6 @@ def Main():
                 if os.path.normcase (os.path.normpath(Option.PlatformFile)).find (Workspace) == 0:\r
                     Option.PlatformFile = NormFile(os.path.normpath(Option.PlatformFile), Workspace)\r
             Option.PlatformFile = PathClass(Option.PlatformFile, Workspace)\r
-            ErrorCode, ErrorInfo = Option.PlatformFile.Validate(".dsc", False)\r
-            if ErrorCode != 0:\r
-                EdkLogger.error("build", ErrorCode, ExtraData=ErrorInfo)\r
 \r
         if Option.FdfFile != None:\r
             if os.path.isabs (Option.FdfFile):\r
@@ -1877,12 +1813,7 @@ def Main():
         if Option.Flag != None and Option.Flag not in ['-c', '-s']:\r
             EdkLogger.error("build", OPTION_VALUE_INVALID, "UNI flag must be one of -c or -s")\r
 \r
-        MyBuild = Build(Target, Workspace, Option.PlatformFile, Option.ModuleFile,\r
-                        Option.TargetArch, Option.ToolChain, Option.BuildTarget,\r
-                        Option.FdfFile, Option.RomImage, Option.FvImage, Option.CapName,\r
-                        None, Option.SilentMode, Option.ThreadNumber,\r
-                        Option.SkipAutoGen, Option.Reparse, Option.SkuId, \r
-                        Option.ReportFile, Option.ReportType, Option.Flag)\r
+        MyBuild = Build(Target, Workspace, Option)\r
         MyBuild.Launch()\r
         #MyBuild.DumpBuildData()\r
     except FatalError, X:\r
@@ -1925,7 +1856,8 @@ def Main():
                     ExtraData="\n(Please send email to edk2-buildtools-devel@lists.sourceforge.net for help, attaching following call stack trace!)\n",\r
                     RaiseError=False\r
                     )\r
-        EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
+        if Option != None and Option.debug != None:\r
+            EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())\r
         ReturnCode = CODE_ERROR\r
     finally:\r
         Utils.Progressor.Abort()\r
index 2a645811fa6cafc8703dcd2adfa052280764e1a5..e479261a1dcbbdc3740942286efcf0ddf2b0c4a0 100644 (file)
@@ -53,13 +53,13 @@ annotation reference;}{\s18\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0
 \levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698703\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li2940\lin2940 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\r
 \levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698713\'02\'07);}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li3360\lin3360 }{\listlevel\levelnfc2\levelnfcn2\leveljc2\leveljcn2\levelfollow0\levelstartat1\r
 \lvltentative\levelspace0\levelindent0{\leveltext\leveltemplateid67698715\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \fi-420\li3780\lin3780 }{\listname ;}\listid940380088}}{\*\listoverridetable{\listoverride\listid940380088\r
-\listoverridecount0\ls1}}{\*\revtbl {Unknown;}{lhauch;}}{\*\rsidtbl \rsid91813\rsid396487\rsid483735\rsid552779\rsid655454\rsid685363\rsid805008\rsid1009867\rsid1050478\rsid1054871\rsid1064894\rsid1536027\rsid1734833\rsid1924533\rsid2172204\rsid2383780\rsid2490530\rsid2562233\r
-\rsid2574604\rsid2707436\rsid2819890\rsid3217417\rsid3356758\rsid3687826\rsid3947812\rsid3958709\rsid4003508\rsid4412180\rsid4472091\rsid4527705\rsid4868941\rsid5134899\rsid5203345\rsid5310607\rsid5464326\rsid5852719\rsid6362790\rsid7164825\rsid7174505\r
-\rsid7424010\rsid7609983\rsid7997214\rsid8276687\rsid8812445\rsid8814479\rsid8943713\rsid9138298\rsid9446431\rsid9901089\rsid9964275\rsid10190081\rsid10246519\rsid10316983\rsid10440781\rsid10490922\rsid10891364\rsid10963834\rsid11147893\rsid11365531\r
-\rsid11761618\rsid12071700\rsid12143623\rsid12200614\rsid12483726\rsid12718714\rsid12721085\rsid12721903\rsid12803398\rsid12810495\rsid12914083\rsid13187009\rsid13379505\rsid13771663\rsid13849670\rsid14181487\rsid14245224\rsid14292565\rsid14313265\r
-\rsid15022072\rsid15164179\rsid15283407\rsid15421225\rsid15548121\rsid15563257\rsid15625864\rsid15803579\rsid15860657\rsid16128153\rsid16193110\rsid16255980\rsid16453629\rsid16464444\rsid16524051}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\r
-\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author kgui1}{\operator lhauch}{\creatim\yr2011\mo7\dy1\hr9\min12}{\revtim\yr2011\mo7\dy1\hr9\min12}{\version2}{\edmins22}{\nofpages8}{\nofwords2241}{\nofchars12776}\r
-{\*\company Intel Corporation}{\nofcharsws14988}{\vern49255}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect \r
+\listoverridecount0\ls1}}{\*\revtbl {Unknown;}{lhauch;}}{\*\rsidtbl \rsid1799\rsid91813\rsid396487\rsid483735\rsid552779\rsid655454\rsid685363\rsid805008\rsid1009867\rsid1050478\rsid1054871\rsid1064894\rsid1536027\rsid1734833\rsid1924533\rsid2172204\rsid2383780\rsid2490530\r
+\rsid2562233\rsid2574604\rsid2707436\rsid2819890\rsid3217417\rsid3356758\rsid3687826\rsid3947812\rsid3958709\rsid4003508\rsid4355979\rsid4412180\rsid4472091\rsid4527705\rsid4868941\rsid5134899\rsid5203345\rsid5310607\rsid5464326\rsid5852719\rsid6362790\r
+\rsid7164825\rsid7174505\rsid7424010\rsid7609983\rsid7997214\rsid8276687\rsid8812445\rsid8814479\rsid8943713\rsid9138298\rsid9446431\rsid9901089\rsid9964275\rsid10190081\rsid10246519\rsid10316983\rsid10440781\rsid10490922\rsid10891364\rsid10963834\r
+\rsid11147893\rsid11365531\rsid11761618\rsid12071700\rsid12143623\rsid12200614\rsid12483726\rsid12718714\rsid12721085\rsid12721903\rsid12803398\rsid12810495\rsid12914083\rsid13187009\rsid13379505\rsid13771663\rsid13849670\rsid14181487\rsid14245224\r
+\rsid14313265\rsid15022072\rsid15164179\rsid15283407\rsid15421225\rsid15548121\rsid15563257\rsid15625864\rsid15803579\rsid15860657\rsid16128153\rsid16193110\rsid16255980\rsid16453629\rsid16464444\rsid16524051}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\r
+\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author kgui1}{\operator lhauch}{\creatim\yr2011\mo7\dy1\hr9\min12}{\revtim\yr2011\mo7\dy1\hr9\min12}{\version2}{\edmins0}{\nofpages8}{\nofwords2241}\r
+{\nofchars12776}{\*\company Intel Corporation}{\nofcharsws14988}{\vern49255}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect \r
 \deftab360\widowctrl\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\r
 \dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot2707436 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}\r
 {\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\r
@@ -417,12 +417,11 @@ When installing a UEFI Distribution Package generated by other tools that allow
 \hich\af39\dbch\af31505\loch\f39 Empty_Package_Information_Data_File.ini\r
 \par \hich\af39\dbch\af31505\loch\f39 Linux & OS/X: $(WORKSPACE)/BaseTools/Conf/Empty_Package_Information_Data_File.ini}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid9138298 \r
 \par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \hich\f39 Intel\'ae\loch\f39 \hich\f39  UEFI Packaging Tool (Intel\'ae\loch\f39  UEFIPT\hich\af39\dbch\af31505\loch\f39 ) Quick Start guide (}\r
-{\field{\*\fldinst {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm-1493759412\insrsid14292565 \hich\af39\dbch\af31505\loch\f39 HYPERLINK "../../../Tools/UEFI_PackagingTool/UserDocs/www.tianocore.org"}{\rtlch\fcs1 \af39\afs18 \r
-\ltrch\fcs0 \deleted\fs18\cf1\revauthdel1\revdttmdel-1493759412\insrsid9138298\delrsid14292565 \hich\af39\dbch\af31505\loch\f39 HYPERLINK "www.tianocore.org"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \r
-\fs18\cf1\revised\revauth1\revdttm-1493759412\insrsid14292565 {\*\datafield \r
-00d0c9ea79f9bace118c8200aa004ba90b0200000001000000e0c9ea79f9bace118c8200aa004ba90b920000002e002e002f002e002e002f002e002e002f0054006f006f006c0073002f0055004500460049005f005000610063006b006100670069006e00670054006f006f006c002f00550073006500720044006f006300\r
-73002f007700770077002e007400690061006e006f0063006f00720065002e006f00720067000000795881f43b1d7f48af2c825dc485276300000000a5ab0000}}}{\fldrslt {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\ul\cf2\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 \r
-www.tianocore.org}}}\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 , edk2/Documents)\r
+{\field{\*\fldinst {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm-1493759412\insrsid1799 \hich\af39\dbch\af31505\loch\f39 HYPERLINK "../../BaseTools_r2100/UserManuals/www.tianocore.org"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \r
+\deleted\fs18\cf1\revauthdel1\revdttmdel-1493759412\insrsid9138298\delrsid1799 \hich\af39\dbch\af31505\loch\f39 HYPERLINK "www.tianocore.org"}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\revised\revauth1\revdttm-1493759412\insrsid1799 {\*\datafield \r
+00d0c9ea79f9bace118c8200aa004ba90b0200000001000000e0c9ea79f9bace118c8200aa004ba90b800000002e002e002f002e002e002f00420061007300650054006f006f006c0073005f00720032003100300030002f0055007300650072004d0061006e00750061006c0073002f007700770077002e00740069006100\r
+6e006f0063006f00720065002e006f00720067000000795881f43b1d7f48af2c825dc485276300000000a5ab0000}}}{\fldrslt {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\ul\cf2\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 www.tianocore.org}}}\sectd \ltrsect\r
+\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid9138298 \hich\af39\dbch\af31505\loch\f39 , edk2/Documents)\r
 \par \hich\af39\dbch\af31505\loch\f39 The Distribution Package (.dist) for install and create, along with the Package Infor\hich\af39\dbch\af31505\loch\f39 \r
 mation Data File (.ini) are not required to be in the EDK II WORKSPACE. All other files are required to be in the directory tree pointed to by the system environment variable: WORKSPACE. (The Distribution Package file name used during removal is in the $(\r
 \hich\af39\dbch\af31505\loch\f39 W\hich\af39\dbch\af31505\loch\f39 ORKSPACE)/Conf directory tree, placed there during package installation by the tool.)\r
@@ -552,8 +551,8 @@ fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffff
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
-ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000008055\r
-a1ab0938cc01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000\r
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e50000000000000000000000006032\r
+b4b80938cc01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000\r
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000\r
 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000\r
 0000000000000000000000000000000000000000000000000105000000000000}}
\ No newline at end of file
index f60564619a725db6441747fc0886d90420cf974b..7548e1b21016bd11e5764794b7ce19d9ac05aa24 100644 (file)
@@ -1,8 +1,8 @@
 {\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}\r
 {\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}\r
 {\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}\r
-{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana{\*\falt Verdana};}{\f40\fbidi \fnil\fcharset134\fprq2{\*\panose 00000000000000000000}@\'cb\'ce\'cc\'e5;}\r
-{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 00000000000000000000}Consolas;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}\r
+{\f39\fbidi \fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}Verdana{\*\falt Verdana};}{\f40\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}\r
+{\f41\fbidi \fmodern\fcharset0\fprq1{\*\panose 020b0609020204030204}Consolas;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}\r
 {\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}\r
 {\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}\r
 {\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}\r
@@ -53,9 +53,9 @@
 \brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \r
 \trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \r
 \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \r
-\sbasedon11 \snext21 \spriority59 \styrsid8347714 Table Grid;}}{\*\revtbl {Unknown;}{yzeng15;}}{\*\rsidtbl \rsid2436965\rsid3155658\rsid4999604\rsid5138063\rsid5911148\rsid6037602\rsid6643493\rsid6907013\rsid8089322\rsid8347714\rsid8600807\rsid8606769\rsid8651272\rsid14103422\r
-\rsid15752598}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator yzeng15}{\creatim\yr2010\mo10\dy6\hr17\min15}{\revtim\yr2011\mo9\dy8\hr13\min45}{\version11}\r
-{\edmins10}{\nofpages3}{\nofwords668}{\nofchars3492}{\nofcharsws4152}{\vern32771}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect \r
+\sbasedon11 \snext21 \spriority59 \styrsid8347714 Table Grid;}}{\*\revtbl {Unknown;}{yzeng15;}}{\*\rsidtbl \rsid2436965\rsid3155658\rsid4999604\rsid5138063\rsid5911148\rsid6037602\rsid6643493\rsid6907013\rsid8089322\rsid8347714\rsid8412573\rsid8600807\rsid8606769\rsid8651272\r
+\rsid14103422\rsid16001458}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\operator yzeng15}{\creatim\yr2010\mo10\dy6\hr17\min15}{\revtim\yr2011\mo9\dy8\hr12\min14}\r
+{\version13}{\edmins11}{\nofpages3}{\nofwords668}{\nofchars3492}{\nofcharsws4152}{\vern32771}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect \r
 \deftab360\ftnbj\aenddoc\revisions\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\r
 \dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale135\rsidroot6643493 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang \r
 {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\r
@@ -69,7 +69,7 @@
 \par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\tx1440\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \r
 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 Synopsis\r
 \par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs18 \r
-\ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 trim [-s|-r|-a|-8] [-c] [-v|-d <debug_level>|-q] [-o <output_file>] <input_file>\r
+\ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 trim [-s|-r|\hich\af39\dbch\af31505\loch\f39 -a|-8] [-c] [-v|-d <debug_level>|-q] [-o <output_file>] <input_file>\r
 \par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0\pararsid3155658 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\lang1033\langfe2052\langfenp2052\insrsid3155658 \hich\af39\dbch\af31505\loch\f39 trim \hich\f39 \endash \r
 \loch\f39 h\r
 \par \hich\af39\dbch\af31505\loch\f39 trim --version}{\rtlch\fcs1 \af0 \ltrch\fcs0 \lang1033\langfe2052\langfenp2052\insrsid3155658\charrsid8089322 \r
 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 Trim tool }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39 process}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \r
 \hich\af39\dbch\af31505\loch\f39  the preprocessed file by}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39  a}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 \r
  Compiler to remove the unused content }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39 and }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 \r
-generate the file to be processed further by EDKII t\hich\af39\dbch\af31505\loch\f39 ools.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
-\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 Trim tool can also be used generate the expected source file to work with EDKII build system and EDKII core code}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \r
-\fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39 . It extends the EDKII build system to support more source file types.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
+generate the file to be processed further by EDKII tools.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
+\par }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 Trim t\hich\af39\dbch\af31505\loch\f39 ool can also be used generate the expected source file to work with EDKII build system and EDKII core code}{\rtlch\fcs1 \r
+\af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39 . It extends the EDKII build system to support more source file types.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
 \par \r
 \par }\pard\plain \ltrpar\s2\ql \li-1440\ri0\sb400\sa60\sl-340\slmult0\keep\keepn\nowidctlpar\wrapdefault\faauto\outlinelevel1\rin0\lin-1440\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \r
 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs28 \ltrch\fcs0 \b\fs28\cf17\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 Options\r
 \par }\pard\plain \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 \fs24\lang1033\langfe1033\loch\af39\hich\af39\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \ab\af39\afs18 \r
 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 input_file\r
-\par \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 The input file may be the preprocessed source \hich\af39\dbch\af31505\loch\f39 code, the preprocessed VFR file, ASL file or R8 framework source file.}{\r
+\par \tab }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 The input file may be the preprocessed source code, the pr\hich\af39\dbch\af31505\loch\f39 eprocessed VFR file, ASL file or R8 framework source file.}{\r
 \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
 \par }{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -s, --source-code     \r
 \par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 The input file is}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \r
 \hich\af39\dbch\af31505\loch\f39  a }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 \r
-preprocessed source code, including C or assembly code. All generated codes from the include header files are remove all. Only content in sour\hich\af39\dbch\af31505\loch\f39 ce file is kept.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \r
+preprocessed source code, including C or assembly code. All generated codes from the include header files are remove all. Only content in source file is k\hich\af39\dbch\af31505\loch\f39 ept.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \r
 \f0\fs18\cf1\insrsid6643493 \r
 \par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -r, --vfr-file        \r
 \par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 The input file is }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \r
@@ -101,17 +101,19 @@ preprocessed source code, including C or assembly code. All generated codes from
 \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
 \par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -a, --asl-file        \r
 \par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 The input file is }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \r
-\fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39 an }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 ASL file. The asl source include s\hich\af39\dbch\af31505\loch\f39 \r
-tyle Include(*.asi) will be changed to C style #include *.asi. The preprocessed asl file can be preprocessed by C compiler. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
+\fs18\cf1\insrsid14103422 \hich\af39\dbch\af31505\loch\f39 an }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 ASL file. The asl source include style Include\hich\af39\dbch\af31505\loch\f39 \r
+(*.asi) will be changed to C style #include *.asi. The preprocessed asl file can be preprocessed by C compiler. }{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
 \par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -8, --}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \r
-\b\deleted\fs18\cf1\revauthdel1\revdttmdel-2030484627\insrsid6643493\delrsid15752598 \hich\af39\dbch\af31505\loch\f39 r8}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \r
-\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm-2030484627\langfenp2052\insrsid15752598 \hich\af39\dbch\af31505\loch\f39 Edk}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -source-code  \r
+\b\deleted\fs18\cf1\revauthdel1\revdttmdel-2030484795\insrsid6643493\delrsid8412573 \hich\af39\dbch\af31505\loch\f39 r8}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \r
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm-2030484795\langfenp2052\insrsid8412573 \hich\af39\dbch\af31505\loch\f39 E}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \r
+\b\fs18\cf1\revised\lang1033\langfe2052\revauth1\revdttm-2030484722\langfenp2052\insrsid16001458 \hich\af39\dbch\af31505\loch\f39 dk}{\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -source-code  \r
 \par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 \r
 The input file is the EDK style source code to be trimmed for ECP platform. Some EDK framework source file w\hich\af39\dbch\af31505\loch\f39 \hich\f39 ill be modified to work with EDKII thunk and core drivers. A window script tool \'93\loch\f39 \hich\f39 \r
 ImportTool.bat\'94\loch\f39  is created to process a group of EDK framework source files in the same file directory. }{\rtlch\fcs1 \af2\afs20 \ltrch\fcs0 \f2\fs20\insrsid6643493 \r
 \par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -c, --convert-hex     \r
 \par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 Convert}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \r
-\hich\af39\dbch\af31505\loch\f39 s}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39  standard hex format (0xabcd) to MASM format (abcdh).}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
+\hich\af39\dbch\af31505\loch\f39 s}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39  standard hex format (0xabcd) to MASM f\hich\af39\dbch\af31505\loch\f39 ormat (abcdh).}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \r
+\f0\fs18\cf1\insrsid6643493 \r
 \par }\pard \ltrpar\ql \li0\ri0\sb200\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \ab\af39\afs18 \ltrch\fcs0 \b\fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 -o OUTPUTFILE, --output=OUTPUTFILE\r
 \par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39 The output file }{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid14103422 \r
 \hich\af39\dbch\af31505\loch\f39 stores}{\rtlch\fcs1 \af39\afs18 \ltrch\fcs0 \fs18\cf1\insrsid6643493 \hich\af39\dbch\af31505\loch\f39  the trimmed content.}{\rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \f0\fs18\cf1\insrsid6643493 \r
@@ -318,18 +320,18 @@ fffffffffffffffffdffffff04000000feffffff05000000fefffffffeffffffffffffffffffffff
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
-ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff01000000ec69d9888b8b3d4c859eaf6cd158be0f000000000000000000000000804b\r
-5694ea6dcc010300000080020000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff020000000000000000000000000000000000000000000000804b5694ea6dcc01\r
-804b5694ea6dcc01000000000000000000000000d40058004200d0004600da00df00530043004500c2004300c000d50051003000dc005600d400d800d80051003d003d000000000000000000000000000000000032000101ffffffffffffffff030000000000000000000000000000000000000000000000804b5694ea6d\r
-cc01804b5694ea6dcc010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000\r
+ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffff01000000ec69d9888b8b3d4c859eaf6cd158be0f00000000000000000000000060c7\r
+dccddd6dcc010300000080020000000000004d0073006f004400610074006100530074006f0072006500000000000000000000000000000000000000000000000000000000000000000000000000000000001a000101ffffffffffffffff02000000000000000000000000000000000000000000000060c7dccddd6dcc01\r
+60c7dccddd6dcc010000000000000000000000005500c500c2003500c0005500c60054004b00d400ca0042004b00c1004c00d400db004d00c5003000d400d0003d003d000000000000000000000000000000000032000101ffffffffffffffff03000000000000000000000000000000000000000000000060c7dccddd6d\r
+cc0160c7dccddd6dcc010000000000000000000000004900740065006d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000201ffffffff04000000ffffffff000000000000000000000000000000000000000000000000\r
 00000000000000000000000000000000da00000000000000010000000200000003000000feffffff0500000006000000070000000800000009000000feffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\r
 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3c623a536f75726365732053656c65637465645374796c653d225c4150412e58534c22205374796c654e616d653d224150412220786d6c6e733a623d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f7267\r
 2f6f6666696365446f63756d656e742f323030362f6269626c696f6772617068792220786d6c6e733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f6269626c696f677261706879223e3c2f623a536f75726365733e0d0a0000\r
-0000000000000000000000000000000000000000000000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b31373730\r
-373044312d443241462d343830382d383238332d3534314146313544333845317d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c\r
+0000000000000000000000000000000000000000000000000000000000000000000000003c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0d0a3c64733a6461746173746f72654974656d2064733a6974656d49443d227b38313946\r
+353835322d393334392d344132422d383132412d3132463445434339354144337d2220786d6c6e733a64733d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f6f6666696365446f63756d656e742f323030362f637573746f6d586d6c223e3c64733a736368656d61526566733e3c\r
 64733a736368656d615265662064733a7572693d22687474703a2f2f736368656d61732e6f70656e500072006f007000650072007400690065007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000200ffffffffffffffffffffffff000000000000\r
 0000000000000000000000000000000000000000000000000000000000000400000055010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000\r
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000\r