summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2017-05-11 21:23:29 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2017-05-12 13:34:53 +0800
commit7256bd55e9883bbdfda32733eb533ddeccd3e2da (patch)
tree60e86bae66220c8cb3ab1470f25d067ba46fd806
parentfb1c81a1e5d299c0cb0783cbfe7e727202c2c471 (diff)
downloadedk2-7256bd55e9883bbdfda32733eb533ddeccd3e2da.zip
edk2-7256bd55e9883bbdfda32733eb533ddeccd3e2da.tar.gz
edk2-7256bd55e9883bbdfda32733eb533ddeccd3e2da.tar.bz2
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> Reviewed-by: Liming Gao <liming.gao@intel.com>
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py5
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py7
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
@@ -2759,10 +2759,7 @@ class ModuleAutoGen(AutoGen):
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)
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
@@ -1218,7 +1218,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
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))
@@ -1226,7 +1226,10 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
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)