* [Patch] BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd
@ 2017-05-12 3:22 Yonghong Zhu
2017-05-12 5:24 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2017-05-12 3:22 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao
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>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 5 +----
BaseTools/Source/Python/AutoGen/GenC.py | 7 +++++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 205a75d..8d8957b 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2757,14 +2757,11 @@ class ModuleAutoGen(AutoGen):
# Get FixedAtBuild Pcds of this Module
def _GetFixedAtBuildPcds(self):
if self._FixedAtBuildPcds:
return self._FixedAtBuildPcds
for Pcd in self.ModulePcdList:
- if self.IsLibrary:
- if not (Pcd.Pending == False and Pcd.Type == "FixedAtBuild"):
- continue
- elif Pcd.Type != "FixedAtBuild":
+ if Pcd.Type != "FixedAtBuild":
continue
if Pcd not in self._FixedAtBuildPcds:
self._FixedAtBuildPcds.append(Pcd)
return self._FixedAtBuildPcds
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 542edb3..ae191d8 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1216,19 +1216,22 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
AutoGenH.Append('#define %s %s\n' % (GetModeSizeName,PatchPcdSizeVariableName))
AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:
key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))
-
+ PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName
if DatumType == 'VOID*' and Array == '[]':
DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))
AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):
- AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
+ if DatumType == 'VOID*':
+ AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
+ else:
+ AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:
PcdDataSize = GetPcdSize(Pcd)
AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
AutoGenH.Append('#define %s %s\n' % (GetModeSizeName,FixPcdSizeTokenName))
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd
2017-05-12 3:22 [Patch] BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd Yonghong Zhu
@ 2017-05-12 5:24 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-05-12 5:24 UTC (permalink / raw)
To: Zhu, Yonghong, edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Friday, May 12, 2017 11:23 AM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray
>Pcd
>
>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>
>---
> BaseTools/Source/Python/AutoGen/AutoGen.py | 5 +----
> BaseTools/Source/Python/AutoGen/GenC.py | 7 +++++--
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index 205a75d..8d8957b 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -2757,14 +2757,11 @@ class ModuleAutoGen(AutoGen):
> # Get FixedAtBuild Pcds of this Module
> def _GetFixedAtBuildPcds(self):
> if self._FixedAtBuildPcds:
> return self._FixedAtBuildPcds
> for Pcd in self.ModulePcdList:
>- if self.IsLibrary:
>- if not (Pcd.Pending == False and Pcd.Type == "FixedAtBuild"):
>- continue
>- elif Pcd.Type != "FixedAtBuild":
>+ if Pcd.Type != "FixedAtBuild":
> continue
> if Pcd not in self._FixedAtBuildPcds:
> self._FixedAtBuildPcds.append(Pcd)
>
> return self._FixedAtBuildPcds
>diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
>b/BaseTools/Source/Python/AutoGen/GenC.py
>index 542edb3..ae191d8 100644
>--- a/BaseTools/Source/Python/AutoGen/GenC.py
>+++ b/BaseTools/Source/Python/AutoGen/GenC.py
>@@ -1216,19 +1216,22 @@ def CreateLibraryPcdCode(Info, AutoGenC,
>AutoGenH, Pcd):
> AutoGenH.Append('#define %s %s\n' %
>(GetModeSizeName,PatchPcdSizeVariableName))
> AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
>
> if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType ==
>TAB_PCDS_FEATURE_FLAG:
> key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))
>-
>+ PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_'
>+ TokenCName
> if DatumType == 'VOID*' and Array == '[]':
> DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
> AutoGenH.Append('extern const %s
>_gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
>
>AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeN
>ame, Type, TokenCName))
> AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to
>set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
>
> if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd
>or (Info.IsLibrary and not Info._ReferenceModules)):
>- AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName,
>Pcd.DefaultValue))
>+ if DatumType == 'VOID*':
>+ AutoGenH.Append('#define
>_PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
>+ else:
>+ AutoGenH.Append('#define
>_PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
>
> if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:
> PcdDataSize = GetPcdSize(Pcd)
> AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName,
>PcdDataSize))
> AutoGenH.Append('#define %s %s\n' %
>(GetModeSizeName,FixPcdSizeTokenName))
>--
>2.6.1.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-12 5:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 3:22 [Patch] BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd Yonghong Zhu
2017-05-12 5:24 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox