]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / AutoGen.py
index a7af33d520367110db63f82d73c7356fd221c3b7..06ff84b4cdbc02d57d29d1053e7243cdc7b3f7da 100644 (file)
@@ -2752,6 +2752,10 @@ class ModuleAutoGen(AutoGen):
         self._FixedAtBuildPcds         = []\r
         self.ConstPcd                  = {}\r
 \r
+        ##Store the VOID* type FixedAtBuild Pcds\r
+        #\r
+        self._FixedPcdVoidTypeDict = {}\r
+\r
     def __repr__(self):\r
         return "%s [%s]" % (self.MetaFile, self.Arch)\r
 \r
@@ -2767,6 +2771,15 @@ class ModuleAutoGen(AutoGen):
 \r
         return self._FixedAtBuildPcds\r
 \r
+    def _GetFixedAtBuildVoidTypePcds(self):\r
+        if self._FixedPcdVoidTypeDict:\r
+            return self._FixedPcdVoidTypeDict\r
+        for Pcd in self.ModulePcdList:\r
+            if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType == TAB_VOID:\r
+                if '{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in self._FixedPcdVoidTypeDict:\r
+                    self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)] = Pcd.DefaultValue\r
+        return self._FixedPcdVoidTypeDict\r
+\r
     def _GetUniqueBaseName(self):\r
         BaseName = self.Name\r
         for Module in self.PlatformInfo.ModuleAutoGenList:\r
@@ -3036,7 +3049,7 @@ class ModuleAutoGen(AutoGen):
                 return self._DepexDict\r
 \r
             self._DepexDict[self.ModuleType] = []\r
-\r
+            self._GetFixedAtBuildVoidTypePcds()\r
             for ModuleType in self._DepexDict:\r
                 DepexList = self._DepexDict[ModuleType]\r
                 #\r
@@ -3048,7 +3061,21 @@ class ModuleAutoGen(AutoGen):
                         if DepexList != []:\r
                             DepexList.append('AND')\r
                         DepexList.append('(')\r
-                        DepexList.extend(D)\r
+                        #replace D with value if D is FixedAtBuild PCD\r
+                        NewList = []\r
+                        for item in D:\r
+                            if '.' not in item:\r
+                                NewList.append(item)\r
+                            else:\r
+                                if item not in self._FixedPcdVoidTypeDict:\r
+                                    EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item))\r
+                                else:\r
+                                    Value = self._FixedPcdVoidTypeDict[item]\r
+                                    if len(Value.split(',')) != 16:\r
+                                        EdkLogger.error("build", FORMAT_INVALID,\r
+                                                        "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item))\r
+                                    NewList.append(Value)\r
+                        DepexList.extend(NewList)\r
                         if DepexList[-1] == 'END':  # no need of a END at this time\r
                             DepexList.pop()\r
                         DepexList.append(')')\r
@@ -4420,6 +4447,7 @@ class ModuleAutoGen(AutoGen):
 \r
     FixedAtBuildPcds         = property(_GetFixedAtBuildPcds)\r
     UniqueBaseName          = property(_GetUniqueBaseName)\r
+    FixedVoidTypePcds       = property(_GetFixedAtBuildVoidTypePcds)\r
 \r
 # This acts like the main() function for the script, unless it is 'import'ed into another script.\r
 if __name__ == '__main__':\r