[edk2-devel] 回复: [PATCH] BaseTools: Should always define PCD TOKEN value as Zero for static PCD
gaoliming
gaoliming at byosoft.com.cn
Wed Dec 16 02:09:47 UTC 2020
Bob:
Yes. Token value is designed for Dynamic and DynamicEx PCD. It is not used
for static PCD. I propose to use EFI_PCD_INVALID_TOKEN_NUMBER (0) for the
static PCD token value. If so, the consumer code can base on PcdToken value
to know whether this PCD is dynamic or not.
Thanks
Liming
> -----邮件原件-----
> 发件人: Feng, Bob C <bob.c.feng at intel.com>
> 发送时间: 2020年12月16日 9:26
> 收件人: Yunhua Feng <fengyunhua at byosoft.com.cn>; devel at edk2.groups.io
> 抄送: Liming Gao <gaoliming at byosoft.com.cn>; Chen, Christine
> <yuwei.chen at intel.com>
> 主题: RE: [PATCH] BaseTools: Should always define PCD TOKEN value as Zero
> for static PCD
>
> Yunhua, if FixedAtBuild, PatchableInModule and FeatureFlag PCD don't use
> PCD TOKEN, maybe it's better to remove "#define PcdTokenName TOKEN"
> statement for those static PCD from AutoGen.h.
>
> Thanks,
> Bob
>
> -----Original Message-----
> From: Yunhua Feng <fengyunhua at byosoft.com.cn>
> Sent: Wednesday, December 16, 2020 9:03 AM
> To: devel at edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng at intel.com>; Liming Gao
> <gaoliming at byosoft.com.cn>; Chen, Christine <yuwei.chen at intel.com>
> Subject: [PATCH] BaseTools: Should always define PCD TOKEN value as Zero
> for static PCD
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3120
> FixedAtBuild, PatchableInModule and FeatureFlag PCD don't use PCD TOKEN.
> Their PCD TOKEN value can always be zero. If so, AutoGen.h will not be
> changed when PCD is added or removed.
>
> Cc: Bob Feng <bob.c.feng at intel.com>
> Cc: Liming Gao <gaoliming at byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen at intel.com>
> Signed-off-by: Yunhua Feng <fengyunhua at byosoft.com.cn>
> ---
> BaseTools/Source/Python/AutoGen/GenC.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
> b/BaseTools/Source/Python/AutoGen/GenC.py
> index a2053d5485..ac561ba82e 100755
> --- a/BaseTools/Source/Python/AutoGen/GenC.py
> +++ b/BaseTools/Source/Python/AutoGen/GenC.py
> @@ -913,6 +913,8 @@ def CreateModulePcdCode(Info, AutoGenC,
> AutoGenH, Pcd):
> ExtraData="[%s]" % str(Info))
> else:
> TokenNumber = PcdTokenNumber[Pcd.TokenCName,
> Pcd.TokenSpaceGuidCName]
> + if Pcd.Type not in PCD_DYNAMIC_TYPE_SET:
> + TokenNumber = 0
> AutoGenH.Append('\n#define %s %dU\n' % (PcdTokenName,
> TokenNumber))
>
> EdkLogger.debug(EdkLogger.DEBUG_3, "Creating code for " +
> TokenCName + "." + Pcd.TokenSpaceGuidCName)
> --
> 2.27.0.windows.1
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68927): https://edk2.groups.io/g/devel/message/68927
Mute This Topic: https://groups.io/mt/78992081/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list