BaseTools: Enhance BaseTools supports FeaturePcd usage in VFR file
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 19 Jun 2018 01:08:41 +0000 (09:08 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 22 Jun 2018 05:34:01 +0000 (13:34 +0800)
Bugzilla 348 only fixed FixedAtBuild Pcd type, now this patch also add
support for FeaturePcd type.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=348
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/GenC.py

index ae3af085a16b49151939f33df81d1490ba0b58b4..5b24ae5fc464be6e1961ac9e1ce8de48033149e8 100644 (file)
@@ -2095,15 +2095,16 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer,
             GuidMacros.append('#define %s %s' % (Guid, Info.Module.Guids[Guid]))\r
         for Guid, Value in Info.Module.Protocols.items() + Info.Module.Ppis.items():\r
             GuidMacros.append('#define %s %s' % (Guid, Value))\r
-        # supports FixedAtBuild usage in VFR file\r
+        # supports FixedAtBuild and FeaturePcd usage in VFR file\r
         if Info.VfrFileList and Info.ModulePcdList:\r
             GuidMacros.append('#define %s %s' % ('FixedPcdGetBool(TokenName)', '_PCD_VALUE_##TokenName'))\r
             GuidMacros.append('#define %s %s' % ('FixedPcdGet8(TokenName)', '_PCD_VALUE_##TokenName'))\r
             GuidMacros.append('#define %s %s' % ('FixedPcdGet16(TokenName)', '_PCD_VALUE_##TokenName'))\r
             GuidMacros.append('#define %s %s' % ('FixedPcdGet32(TokenName)', '_PCD_VALUE_##TokenName'))\r
             GuidMacros.append('#define %s %s' % ('FixedPcdGet64(TokenName)', '_PCD_VALUE_##TokenName'))\r
+            GuidMacros.append('#define %s %s' % ('FeaturePcdGet(TokenName)', '_PCD_VALUE_##TokenName'))\r
             for Pcd in Info.ModulePcdList:\r
-                if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD:\r
+                if Pcd.Type in [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_FEATURE_FLAG]:\r
                     TokenCName = Pcd.TokenCName\r
                     Value = Pcd.DefaultValue\r
                     if Pcd.DatumType == 'BOOLEAN':\r