diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2017-02-13 13:10:43 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2017-02-14 09:02:49 +0800 |
commit | 5b97eb4c35316cbe8235ae526209263da818e1a4 (patch) | |
tree | 53a67cc3653ddac870198cdbe2a3443a939982bb /BaseTools/Source/Python/AutoGen/GenC.py | |
parent | 8b2a15fd5c7235f2998e26906e034204147d07a9 (diff) | |
download | edk2-5b97eb4c35316cbe8235ae526209263da818e1a4.tar.gz edk2-5b97eb4c35316cbe8235ae526209263da818e1a4.tar.bz2 edk2-5b97eb4c35316cbe8235ae526209263da818e1a4.zip |
BaseTools: Enhance BaseTools supports FixedAtBuild usage in VFR file
This patch is to update BaseTools generate Fixed PCD APIs and Value into
$(MODULE_NAME)StrDefs.h for VFR only. If the module has VFR files, and it
directly consumes FixedAtBuild PCD, BaseTool will generate those
FixedAtBuild PCD value into its $(MODULE_NAME)StrDefs.h. FixedPcdGetXX
macro are always generated. Every FixedPcd _PCD_VALUE_PcdName will be
generated without the postfix U or UL or ULL.
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=348
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>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenC.py')
-rw-r--r-- | BaseTools/Source/Python/AutoGen/GenC.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 63cfe0422b..c1d64cccfd 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1,7 +1,7 @@ ## @file
# Routines for generating AutoGen.h and AutoGen.c
#
-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2017, 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
@@ -1960,6 +1960,29 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer, GuidMacros.append('#define %s %s' % (Guid, Info.Module.Guids[Guid]))
for Guid, Value in Info.Module.Protocols.items() + Info.Module.Ppis.items():
GuidMacros.append('#define %s %s' % (Guid, Value))
+ # supports FixedAtBuild usage in VFR file
+ if Info.VfrFileList and Info.ModulePcdList:
+ GuidMacros.append('#define %s %s' % ('FixedPcdGetBool(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet8(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet16(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet32(TokenName)', '_PCD_VALUE_##TokenName'))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet64(TokenName)', '_PCD_VALUE_##TokenName'))
+ for Pcd in Info.ModulePcdList:
+ if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD:
+ TokenCName = Pcd.TokenCName
+ Value = Pcd.DefaultValue
+ if Pcd.DatumType == 'BOOLEAN':
+ BoolValue = Value.upper()
+ if BoolValue == 'TRUE':
+ Value = '1'
+ elif BoolValue == 'FALSE':
+ Value = '0'
+ for PcdItem in GlobalData.MixedPcd:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.MixedPcd[PcdItem]:
+ TokenCName = PcdItem[0]
+ break
+ GuidMacros.append('#define %s %s' % ('_PCD_VALUE_'+TokenCName, Value))
+
if GuidMacros:
StringH.Append('\n#ifdef VFRCOMPILE\n%s\n#endif\n' % '\n'.join(GuidMacros))
|