]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd
authorYonghong Zhu <yonghong.zhu@intel.com>
Thu, 11 May 2017 13:23:29 +0000 (21:23 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 12 May 2017 05:34:53 +0000 (13:34 +0800)
This patch for the bug FixedPcdGetPtr report failure for the CArray type
Pcd. 1) correct the Fixed Pcd list; 2) correct the Fixed Pcd in Library
AutoGen file to same with Driver AutoGen file format.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/GenC.py

index 205a75dc805104bdf46ff0cf54a276a98f8225a2..8d8957b3d9134bce308e54fa60c8a17b1cc61223 100644 (file)
@@ -2759,10 +2759,7 @@ class ModuleAutoGen(AutoGen):
         if self._FixedAtBuildPcds:\r
             return self._FixedAtBuildPcds\r
         for Pcd in self.ModulePcdList:\r
         if self._FixedAtBuildPcds:\r
             return self._FixedAtBuildPcds\r
         for Pcd in self.ModulePcdList:\r
-            if self.IsLibrary:\r
-                if not (Pcd.Pending == False and Pcd.Type == "FixedAtBuild"):\r
-                    continue\r
-            elif Pcd.Type != "FixedAtBuild":\r
+            if Pcd.Type != "FixedAtBuild":\r
                 continue\r
             if Pcd not in self._FixedAtBuildPcds:\r
                 self._FixedAtBuildPcds.append(Pcd)\r
                 continue\r
             if Pcd not in self._FixedAtBuildPcds:\r
                 self._FixedAtBuildPcds.append(Pcd)\r
index 542edb3ce283a050116abc9c5d1a595c65a69893..ae191d8c13cd06b94e0fc5994660d1771b8f21b5 100644 (file)
@@ -1218,7 +1218,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
         \r
     if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:\r
         key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))\r
         \r
     if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:\r
         key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))\r
-        \r
+        PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName\r
         if DatumType == 'VOID*' and Array == '[]':\r
             DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']\r
         AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))\r
         if DatumType == 'VOID*' and Array == '[]':\r
             DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']\r
         AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))\r
@@ -1226,7 +1226,10 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)\r
         \r
         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):\r
         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)\r
         \r
         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):\r
-            AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))\r
+            if DatumType == 'VOID*':\r
+                AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))\r
+            else:\r
+                AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))\r
         \r
         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:\r
             PcdDataSize = GetPcdSize(Pcd)\r
         \r
         if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:\r
             PcdDataSize = GetPcdSize(Pcd)\r