]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
BaseTools: Fix the bug 'DSC DEFAULT' in report wrongly use FDF value
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / WorkspaceDatabase.py
index 5168e838a8bc08657833607e8dbc76ca612ac9b4..2c4b973901a9b92982d4856a540a413031739d89 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to create a database used by build tool\r
 #\r
-# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -231,9 +231,21 @@ class DscBuildData(PlatformBuildClassObject):
                     EdkLogger.error('build', ErrorCode, File=self.MetaFile, Line=Record[-1],\r
                                     ExtraData=ErrorInfo)\r
             elif Name == TAB_DSC_PREBUILD:\r
-                self._Prebuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)\r
+                PrebuildValue = Record[2]\r
+                if Record[2][0] == '"':\r
+                    if Record[2][-1] != '"':\r
+                        EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_PREBUILD,\r
+                                    File=self.MetaFile, Line=Record[-1])\r
+                    PrebuildValue = Record[2][1:-1]\r
+                self._Prebuild = PrebuildValue\r
             elif Name == TAB_DSC_POSTBUILD:\r
-                self._Postbuild = PathClass(NormPath(Record[2], self._Macros), GlobalData.gWorkspace)\r
+                PostbuildValue = Record[2]\r
+                if Record[2][0] == '"':\r
+                    if Record[2][-1] != '"':\r
+                        EdkLogger.error('build', FORMAT_INVALID, 'Missing double quotes in the end of %s statement.' % TAB_DSC_POSTBUILD,\r
+                                    File=self.MetaFile, Line=Record[-1])\r
+                    PostbuildValue = Record[2][1:-1]\r
+                self._Postbuild = PostbuildValue\r
             elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:\r
                 self._SupArchList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT)\r
             elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:\r
@@ -802,9 +814,10 @@ class DscBuildData(PlatformBuildClassObject):
             options = sdict()\r
             self._ModuleTypeOptions[Edk, ModuleType] = options\r
             DriverType = '%s.%s' % (Edk, ModuleType)\r
+            CommonDriverType = '%s.%s' % ('COMMON', ModuleType)\r
             RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, DriverType]\r
             for ToolChainFamily, ToolChain, Option, Arch, Type, Dummy3, Dummy4 in RecordList:\r
-                if Type == DriverType:\r
+                if Type == DriverType or Type == CommonDriverType:\r
                     Key = (ToolChainFamily, ToolChain, Edk)\r
                     if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):\r
                         options[Key] = Option\r
@@ -872,8 +885,8 @@ class DscBuildData(PlatformBuildClassObject):
                                                 MaxDatumSize,\r
                                                 {},\r
                                                 False,\r
-                                                None\r
-                                                )\r
+                                                None,\r
+                                                IsDsc=True)\r
         return Pcds\r
 \r
     ## Retrieve dynamic PCD settings\r
@@ -937,9 +950,9 @@ class DscBuildData(PlatformBuildClassObject):
                                                     MaxDatumSize,\r
                                                     {SkuName : SkuInfo},\r
                                                     False,\r
-                                                    None\r
-                                                    )\r
-        \r
+                                                    None,\r
+                                                    IsDsc=True)\r
+\r
         for pcd in Pcds.values():\r
             pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName]\r
             if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():                \r
@@ -1056,9 +1069,8 @@ class DscBuildData(PlatformBuildClassObject):
                                                 None,\r
                                                 pcdDecObject.validateranges,\r
                                                 pcdDecObject.validlists,\r
-                                                pcdDecObject.expressions\r
-                                                )\r
-                \r
+                                                pcdDecObject.expressions,\r
+                                                IsDsc=True)\r
 \r
         for pcd in Pcds.values():\r
             SkuInfoObj = pcd.SkuInfoList.values()[0]\r
@@ -1166,8 +1178,8 @@ class DscBuildData(PlatformBuildClassObject):
                                                 MaxDatumSize,\r
                                                 {SkuName : SkuInfo},\r
                                                 False,\r
-                                                None\r
-                                                )\r
+                                                None,\r
+                                                IsDsc=True)\r
         for pcd in Pcds.values():\r
             SkuInfoObj = pcd.SkuInfoList.values()[0]\r
             pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName]\r
@@ -1409,6 +1421,7 @@ class DecBuildData(PackageBuildClassObject):
             PrivateProtocolDict = tdict(True)\r
             NameList = []\r
             PrivateNameList = []\r
+            PublicNameList = []\r
             # find out all protocol definitions for specific and 'common' arch\r
             RecordList = self._RawData[MODEL_EFI_PROTOCOL, self._Arch]\r
             for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
@@ -1416,6 +1429,13 @@ class DecBuildData(PackageBuildClassObject):
                     if Name not in PrivateNameList:\r
                         PrivateNameList.append(Name)\r
                         PrivateProtocolDict[Arch, Name] = Guid\r
+                    if Name in PublicNameList:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
+                else:\r
+                    if Name not in PublicNameList:\r
+                        PublicNameList.append(Name)\r
+                    if Name in PrivateNameList:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
                 if Name not in NameList:\r
                     NameList.append(Name)\r
                 ProtocolDict[Arch, Name] = Guid\r
@@ -1443,6 +1463,7 @@ class DecBuildData(PackageBuildClassObject):
             PrivatePpiDict = tdict(True)\r
             NameList = []\r
             PrivateNameList = []\r
+            PublicNameList = []\r
             # find out all PPI definitions for specific arch and 'common' arch\r
             RecordList = self._RawData[MODEL_EFI_PPI, self._Arch]\r
             for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
@@ -1450,6 +1471,13 @@ class DecBuildData(PackageBuildClassObject):
                     if Name not in PrivateNameList:\r
                         PrivateNameList.append(Name)\r
                         PrivatePpiDict[Arch, Name] = Guid\r
+                    if Name in PublicNameList:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
+                else:\r
+                    if Name not in PublicNameList:\r
+                        PublicNameList.append(Name)\r
+                    if Name in PrivateNameList:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
                 if Name not in NameList:\r
                     NameList.append(Name)\r
                 PpiDict[Arch, Name] = Guid\r
@@ -1477,6 +1505,7 @@ class DecBuildData(PackageBuildClassObject):
             PrivateGuidDict = tdict(True)\r
             NameList = []\r
             PrivateNameList = []\r
+            PublicNameList = []\r
             # find out all protocol definitions for specific and 'common' arch\r
             RecordList = self._RawData[MODEL_EFI_GUID, self._Arch]\r
             for Name, Guid, Dummy, Arch, PrivateFlag, ID, LineNo in RecordList:\r
@@ -1484,6 +1513,13 @@ class DecBuildData(PackageBuildClassObject):
                     if Name not in PrivateNameList:\r
                         PrivateNameList.append(Name)\r
                         PrivateGuidDict[Arch, Name] = Guid\r
+                    if Name in PublicNameList:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
+                else:\r
+                    if Name not in PublicNameList:\r
+                        PublicNameList.append(Name)\r
+                    if Name in PrivateNameList:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % Name, File=self.MetaFile, Line=LineNo)\r
                 if Name not in NameList:\r
                     NameList.append(Name)\r
                 GuidDict[Arch, Name] = Guid\r
@@ -1505,6 +1541,7 @@ class DecBuildData(PackageBuildClassObject):
         if self._Includes == None:\r
             self._Includes = []\r
             self._PrivateIncludes = []\r
+            PublicInclues = []\r
             RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch]\r
             Macros = self._Macros\r
             Macros["EDK_SOURCE"] = GlobalData.gEcpSource\r
@@ -1522,6 +1559,14 @@ class DecBuildData(PackageBuildClassObject):
                 if Record[4] == 'PRIVATE':\r
                     if File not in self._PrivateIncludes:\r
                         self._PrivateIncludes.append(File)\r
+                    if File in PublicInclues:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)\r
+                else:\r
+                    if File not in PublicInclues:\r
+                        PublicInclues.append(File)\r
+                    if File in self._PrivateIncludes:\r
+                        EdkLogger.error('build', OPTION_CONFLICT, "Can't determine %s's attribute, it is both defined as Private and non-Private attribute in DEC file." % File, File=self.MetaFile, Line=LineNo)\r
+\r
         return self._Includes\r
 \r
     ## Retrieve library class declarations (not used in build at present)\r
@@ -1848,6 +1893,7 @@ class InfBuildData(ModuleBuildClassObject):
                 if self._Defs == None:\r
                     self._Defs = sdict()\r
                 self._Defs[Name] = Value\r
+                self._Macros[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
@@ -1908,6 +1954,7 @@ class InfBuildData(ModuleBuildClassObject):
                 if self._Defs == None:\r
                     self._Defs = sdict()\r
                 self._Defs[Name] = Value\r
+                self._Macros[Name] = Value\r
 \r
         #\r
         # Retrieve information in sections specific to Edk.x modules\r
@@ -1929,9 +1976,18 @@ class InfBuildData(ModuleBuildClassObject):
             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
+            if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):\r
+                if self._ModuleType == SUP_MODULE_MM_CORE_STANDALONE:\r
+                    EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)\r
+                if self._ModuleType == SUP_MODULE_MM_STANDALONE:\r
+                    EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File=self.MetaFile)\r
             if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \\r
-               and 'PCI_CLASS_CODE' in self._Defs:\r
+               and 'PCI_CLASS_CODE' in self._Defs and 'PCI_REVISION' in self._Defs:\r
                 self._BuildType = 'UEFI_OPTIONROM'\r
+                if 'PCI_COMPRESS' in self._Defs:\r
+                    if self._Defs['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):\r
+                        EdkLogger.error("build", FORMAT_INVALID, "Expected TRUE/FALSE for PCI_COMPRESS: %s" %self.MetaFile)\r
+\r
             elif self._Defs and 'UEFI_HII_RESOURCE_SECTION' in self._Defs \\r
                and self._Defs['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':\r
                 self._BuildType = 'UEFI_HII'\r
@@ -3052,7 +3108,7 @@ determine whether database file is out of date!\n")
     def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):\r
         self.Platform = Platform\r
         PackageList = []\r
-        Pa = self.BuildObject[self.Platform, 'COMMON']\r
+        Pa = self.BuildObject[self.Platform, Arch]\r
         #\r
         # Get Package related to Modules\r
         #\r