From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Enhance BaseTools supports FixedAtBuild usage in VFR file
Date: Sun, 12 Feb 2017 13:40:18 +0800 [thread overview]
Message-ID: <1486878018-14408-1-git-send-email-yonghong.zhu@intel.com> (raw)
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>
---
BaseTools/Source/Python/AutoGen/GenC.py | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 63cfe04..6bb975f 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1,9 +1,9 @@
## @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
# http://opensource.org/licenses/bsd-license.php
#
@@ -1958,10 +1958,33 @@ def CreateCode(Info, AutoGenC, AutoGenH, StringH, UniGenCFlag, UniGenBinBuffer,
if Guid in Info.Module.GetGuidsUsedByPcd():
continue
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 not Info.IsLibrary and Info.ModulePcdList:
+ 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' % ('FixedPcdGetBool(' + TokenCName +')', '_PCD_VALUE_'+TokenCName))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet8(' + TokenCName +')', '_PCD_VALUE_'+TokenCName))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet16(' + TokenCName +')', '_PCD_VALUE_'+TokenCName))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet32(' + TokenCName +')', '_PCD_VALUE_'+TokenCName))
+ GuidMacros.append('#define %s %s' % ('FixedPcdGet64(' + TokenCName +')', '_PCD_VALUE_'+TokenCName))
+ GuidMacros.append('#define %s %s' % ('_PCD_VALUE_'+TokenCName, Value))
+
if GuidMacros:
StringH.Append('\n#ifdef VFRCOMPILE\n%s\n#endif\n' % '\n'.join(GuidMacros))
StringH.Append("\n#endif\n")
AutoGenH.Append('#include "%s"\n' % FileName)
--
2.6.1.windows.1
reply other threads:[~2017-02-12 5:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486878018-14408-1-git-send-email-yonghong.zhu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox