BaseTools: Enhance the *P Flag display for Structure Pcd

Cover the case:
1.only define the structure Pcd in DEC file, it should not have any
Flag.
2.In the DEC file and DSC file only have the PCD's default value, and
without the field value, it should have *P Flag.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu 2018-10-11 15:04:41 +08:00
parent 27f38c6d6e
commit 15298db95c
1 changed files with 39 additions and 27 deletions

View File

@ -1085,37 +1085,48 @@ class PcdReport(object):
DecMatch = False DecMatch = False
elif Pcd.SkuOverrideValues: elif Pcd.SkuOverrideValues:
DscOverride = False DscOverride = False
if not Pcd.SkuInfoList: if Pcd.DefaultFromDSC:
OverrideValues = Pcd.SkuOverrideValues DscOverride = True
if OverrideValues:
Keys = list(OverrideValues.keys())
Data = OverrideValues[Keys[0]]
Struct = list(Data.values())[0]
DscOverride = self.ParseStruct(Struct)
else: else:
SkuList = sorted(Pcd.SkuInfoList.keys()) DictLen = 0
for Sku in SkuList: for item in Pcd.SkuOverrideValues:
SkuInfo = Pcd.SkuInfoList[Sku] DictLen += len(Pcd.SkuOverrideValues[item])
if TypeName in ('DYNHII', 'DEXHII'): if not DictLen:
if SkuInfo.DefaultStoreDict: DscOverride = False
DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys()) else:
for DefaultStore in DefaultStoreList: if not Pcd.SkuInfoList:
OverrideValues = Pcd.SkuOverrideValues[Sku] OverrideValues = Pcd.SkuOverrideValues
DscOverride = self.ParseStruct(OverrideValues[DefaultStore])
if DscOverride:
break
else:
OverrideValues = Pcd.SkuOverrideValues[Sku]
if OverrideValues: if OverrideValues:
Keys = list(OverrideValues.keys()) Keys = list(OverrideValues.keys())
OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) Data = OverrideValues[Keys[0]]
DscOverride = self.ParseStruct(OverrideFieldStruct) Struct = list(Data.values())
if DscOverride: DscOverride = self.ParseStruct(Struct[0])
break else:
SkuList = sorted(Pcd.SkuInfoList.keys())
for Sku in SkuList:
SkuInfo = Pcd.SkuInfoList[Sku]
if TypeName in ('DYNHII', 'DEXHII'):
if SkuInfo.DefaultStoreDict:
DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys())
for DefaultStore in DefaultStoreList:
OverrideValues = Pcd.SkuOverrideValues[Sku]
DscOverride = self.ParseStruct(OverrideValues[DefaultStore])
if DscOverride:
break
else:
OverrideValues = Pcd.SkuOverrideValues[Sku]
if OverrideValues:
Keys = list(OverrideValues.keys())
OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
DscOverride = self.ParseStruct(OverrideFieldStruct)
if DscOverride:
break
if DscOverride: if DscOverride:
DscDefaultValue = True DscDefaultValue = True
DscMatch = True DscMatch = True
DecMatch = False DecMatch = False
else:
DecMatch = True
else: else:
DscDefaultValue = True DscDefaultValue = True
DscMatch = True DscMatch = True
@ -1270,9 +1281,10 @@ class PcdReport(object):
if OverrideValues: if OverrideValues:
Keys = list(OverrideValues.keys()) Keys = list(OverrideValues.keys())
Data = OverrideValues[Keys[0]] Data = OverrideValues[Keys[0]]
Struct = list(Data.values())[0] Struct = list(Data.values())
OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct) if Struct:
self.PrintStructureInfo(File, OverrideFieldStruct) OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0])
self.PrintStructureInfo(File, OverrideFieldStruct)
self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
else: else:
FirstPrint = True FirstPrint = True