summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2017-12-22 20:07:54 +0800
committerLiming Gao <liming.gao@intel.com>2017-12-25 11:05:48 +0800
commite651d06c5ed167e706e2dbe122ec0953a54033f3 (patch)
treee3e87c6190f829372feebf4809db6ad5614b4d48 /BaseTools
parent2b8a6c44e0deb508f79804dd5ff7156bc7e25493 (diff)
downloadedk2-e651d06c5ed167e706e2dbe122ec0953a54033f3.tar.gz
edk2-e651d06c5ed167e706e2dbe122ec0953a54033f3.tar.bz2
edk2-e651d06c5ed167e706e2dbe122ec0953a54033f3.zip
BaseTools: Report Structure PCD value and SKU, DefaultStore info
https://bugzilla.tianocore.org/show_bug.cgi?id=706 Add Structure PCD support for Build report. Structure PCD field value described in DEC/DSC will be display in build report. And, PCD value for each SKU and Default store will also be shown in build report. Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenPcdDb.py2
-rw-r--r--BaseTools/Source/Python/Common/GlobalData.py3
-rw-r--r--BaseTools/Source/Python/Common/Misc.py10
-rw-r--r--BaseTools/Source/Python/Workspace/BuildClassObject.py3
-rw-r--r--BaseTools/Source/Python/Workspace/DecBuildData.py5
-rw-r--r--BaseTools/Source/Python/Workspace/DscBuildData.py41
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py4
-rw-r--r--BaseTools/Source/Python/build/BuildReport.py296
-rw-r--r--BaseTools/Source/Python/build/build.py2
9 files changed, 299 insertions, 67 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index e3ab027501..fe1a598e41 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -1078,7 +1078,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
}
- SkuObj = SkuClass(Platform.Platform.AvilableSkuIds, Platform.Platform.SkuIds)
+ SkuObj = SkuClass(Platform.Platform.SkuName, Platform.Platform.SkuIds)
Dict['SYSTEM_SKU_ID_VALUE'] = Platform.Platform.SkuIds[SkuObj.SystemSkuId][0]
Dict['PCD_INFO_FLAG'] = Platform.Platform.PcdInfoFlag
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index 57ba0546ed..f7d4d577f9 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -24,6 +24,7 @@ gOptions = None
gCaseInsensitive = False
gAllFiles = None
gCommand = None
+gSKUID_CMD = None
gGlobalDefines = {}
gPlatformDefines = {}
@@ -39,6 +40,8 @@ gCommandMaxLength = 4096
# for debug trace purpose when problem occurs
gProcessingFile = ''
gBuildingModule = ''
+gSkuids = []
+gDefaultStores = []
## Regular expression for matching macro used in DSC/DEC/INF file inclusion
gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE)
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 2ff8516469..a2c6a6a0fb 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -2149,9 +2149,6 @@ class SkuClass():
EdkLogger.error("build", PARAMETER_INVALID,
ExtraData = "SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"
% (k, " | ".join(SkuIds.keys())))
- if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet and SkuIdentifier != 'ALL':
- self.SkuIdSet.remove('DEFAULT')
- self.SkuIdNumberSet.remove('0U')
for each in self.SkuIdSet:
if each in SkuIds:
self.AvailableSkuIds[each] = SkuIds[each][0]
@@ -2161,6 +2158,13 @@ class SkuClass():
% (each, " | ".join(SkuIds.keys())))
if self.SkuUsageType != self.SINGLE:
self.AvailableSkuIds.update({'DEFAULT':0, 'COMMON':0})
+ if self.SkuIdSet:
+ GlobalData.gSkuids = (self.SkuIdSet)
+ if 'COMMON' in GlobalData.gSkuids:
+ GlobalData.gSkuids.remove('COMMON')
+ if GlobalData.gSkuids:
+ GlobalData.gSkuids.sort()
+
def GetNextSkuId(self, skuname):
if not self.__SkuInherit:
self.__SkuInherit = {}
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 631c1c7b99..acf33ab03a 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -118,7 +118,7 @@ class StructurePcd(PcdClassObject):
self.PcdMode = None
self.SkuOverrideValues = collections.OrderedDict({})
self.FlexibleFieldName = None
-
+ self.StructName = None
def __repr__(self):
return self.TypeName
@@ -170,6 +170,7 @@ class StructurePcd(PcdClassObject):
self.DefaultFromDSC=None
self.OverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
self.FlexibleFieldName = PcdObject.FlexibleFieldName if PcdObject.FlexibleFieldName else self.FlexibleFieldName
+ self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
## LibraryClassObject
#
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index d0e77fa440..84489b5b4f 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -401,14 +401,15 @@ class DecBuildData(PackageBuildClassObject):
#
PcdDict = tdict(True, 3)
# for summarizing PCD
- PcdSet = set()
+ PcdSet = []
# find out all PCDs of the 'type'
StrPcdSet = []
RecordList = self._RawData[Type, self._Arch]
for TokenSpaceGuid, PcdCName, Setting, Arch, PrivateFlag, Dummy1, Dummy2 in RecordList:
PcdDict[Arch, PcdCName, TokenSpaceGuid] = (Setting,Dummy2)
- PcdSet.add((PcdCName, TokenSpaceGuid))
+ if not (PcdCName, TokenSpaceGuid) in PcdSet:
+ PcdSet.append((PcdCName, TokenSpaceGuid))
for PcdCName, TokenSpaceGuid in PcdSet:
#
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index d2114fedcd..2e5834bc69 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -159,7 +159,7 @@ class DscBuildData(PlatformBuildClassObject):
else:
self.OutputPath = os.path.dirname(self.DscFile)
self.DefaultStores = None
- self.SkuIdMgr = SkuClass(self.SkuIdentifier, self.SkuIds)
+ self.SkuIdMgr = SkuClass(self.SkuName, self.SkuIds)
arraystr = self.SkuIdMgr.DumpSkuIdArrary()
## XXX[key] = value
@@ -185,8 +185,6 @@ class DscBuildData(PlatformBuildClassObject):
self._SupArchList = None
self._BuildTargets = None
self._SkuName = None
- self._SkuIdentifier = None
- self._AvilableSkuIds = None
self._PcdInfoFlag = None
self._VarCheckFlag = None
self._FlashDefinition = None
@@ -306,8 +304,8 @@ class DscBuildData(PlatformBuildClassObject):
elif Name == TAB_DSC_DEFINES_SKUID_IDENTIFIER:
if self._SkuName == None:
self._SkuName = Record[2]
- self._SkuIdentifier = Record[2]
- self._AvilableSkuIds = Record[2]
+ if GlobalData.gSKUID_CMD:
+ self._SkuName = GlobalData.gSKUID_CMD
elif Name == TAB_DSC_DEFINES_PCD_INFO_GENERATION:
self._PcdInfoFlag = Record[2]
elif Name == TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION:
@@ -438,23 +436,13 @@ class DscBuildData(PlatformBuildClassObject):
return True
else:
return False
- def _GetAviableSkuIds(self):
- if self._AvilableSkuIds:
- return self._AvilableSkuIds
- return self.SkuIdentifier
- def _GetSkuIdentifier(self):
- if self._SkuName:
- return self._SkuName
- if self._SkuIdentifier == None:
- if self._Header == None:
- self._GetHeaderInfo()
- return self._SkuIdentifier
- ## Retrieve SKUID_IDENTIFIER
+
+ # # Retrieve SKUID_IDENTIFIER
def _GetSkuName(self):
if self._SkuName == None:
if self._Header == None:
self._GetHeaderInfo()
- if (self._SkuName == None or self._SkuName not in self.SkuIds):
+ if self._SkuName == None:
self._SkuName = 'DEFAULT'
return self._SkuName
@@ -620,6 +608,9 @@ class DscBuildData(PlatformBuildClassObject):
self.DefaultStores[Record[1].upper()] = (self.ToInt(Record[0]),Record[1].upper())
if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores:
self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] = (0,TAB_DEFAULT_STORES_DEFAULT)
+ GlobalData.gDefaultStores = self.DefaultStores.keys()
+ if GlobalData.gDefaultStores:
+ GlobalData.gDefaultStores.sort()
return self.DefaultStores
## Retrieve [Components] section information
@@ -854,10 +845,14 @@ class DscBuildData(PlatformBuildClassObject):
for pcdname in Pcds:
pcd = Pcds[pcdname]
Pcds[pcdname].SkuInfoList = {"DEFAULT":pcd.SkuInfoList[skuid] for skuid in pcd.SkuInfoList if skuid in available_sku}
+ if type(pcd) is StructurePcd and pcd.OverrideValues:
+ Pcds[pcdname].OverrideValues = {"DEFAULT":pcd.OverrideValues[skuid] for skuid in pcd.OverrideValues if skuid in available_sku}
else:
for pcdname in Pcds:
pcd = Pcds[pcdname]
Pcds[pcdname].SkuInfoList = {skuid:pcd.SkuInfoList[skuid] for skuid in pcd.SkuInfoList if skuid in available_sku}
+ if type(pcd) is StructurePcd and pcd.OverrideValues:
+ Pcds[pcdname].OverrideValues = {skuid:pcd.OverrideValues[skuid] for skuid in pcd.OverrideValues if skuid in available_sku}
return Pcds
def CompleteHiiPcdsDefaultStores(self,Pcds):
HiiPcd = [Pcds[pcd] for pcd in Pcds if Pcds[pcd].Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]]
@@ -1574,6 +1569,10 @@ class DscBuildData(PlatformBuildClassObject):
for pcd in Pcds.values():
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
+ # Only fix the value while no value provided in DSC file.
+ for sku in pcd.SkuInfoList.values():
+ if (sku.DefaultValue == "" or sku.DefaultValue==None):
+ sku.DefaultValue = pcdDecObject.DefaultValue
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
valuefromDec = pcdDecObject.DefaultValue
SkuInfo = SkuInfoClass('DEFAULT', '0', '', '', '', '', '', valuefromDec)
@@ -1872,6 +1871,10 @@ class DscBuildData(PlatformBuildClassObject):
for pcd in Pcds.values():
SkuInfoObj = pcd.SkuInfoList.values()[0]
pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
+ # Only fix the value while no value provided in DSC file.
+ for sku in pcd.SkuInfoList.values():
+ if (sku.DefaultValue == "" or sku.DefaultValue==None):
+ sku.DefaultValue = pcdDecObject.DefaultValue
if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys():
valuefromDec = pcdDecObject.DefaultValue
SkuInfo = SkuInfoClass('DEFAULT', '0', '', '', '', '', SkuInfoObj.VpdOffset, valuefromDec)
@@ -1927,8 +1930,6 @@ class DscBuildData(PlatformBuildClassObject):
SupArchList = property(_GetSupArch)
BuildTargets = property(_GetBuildTarget)
SkuName = property(_GetSkuName, _SetSkuName)
- SkuIdentifier = property(_GetSkuIdentifier)
- AvilableSkuIds = property(_GetAviableSkuIds)
PcdInfoFlag = property(_GetPcdInfoFlag)
VarCheckFlag = property(_GetVarCheckFlag)
FlashDefinition = property(_GetFdfFile)
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 13a08c8846..6fa008ef65 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1144,9 +1144,9 @@ class DscParser(MetaFileParser):
File=self.MetaFile, Line=self._LineIndex + 1)
if self._ValueList[2] == '':
#
- # The PCD values are optional for FIXEDATBUILD and PATCHABLEINMODULE
+ # The PCD values are optional for FIXEDATBUILD, PATCHABLEINMODULE, Dynamic/DynamicEx default
#
- if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE):
+ if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
return
EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 6a4d7e099b..e1adaabe0c 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -37,19 +37,14 @@ from Common.InfClassObject import gComponentType2ModuleType
from Common.BuildToolError import FILE_WRITE_FAILURE
from Common.BuildToolError import CODE_ERROR
from Common.BuildToolError import COMMAND_FAILURE
-from Common.DataType import TAB_LINE_BREAK
-from Common.DataType import TAB_DEPEX
-from Common.DataType import TAB_SLASH
-from Common.DataType import TAB_SPACE_SPLIT
-from Common.DataType import TAB_BRG_PCD
-from Common.DataType import TAB_BRG_LIBRARY
-from Common.DataType import TAB_BACK_SLASH
from Common.LongFilePathSupport import OpenLongFilePath as open
from Common.MultipleWorkspace import MultipleWorkspace as mws
import Common.GlobalData as GlobalData
from AutoGen.AutoGen import ModuleAutoGen
from Common.Misc import PathClass
from Common.String import NormPath
+from Common.DataType import *
+import collections
## Pattern to extract contents in EDK DXS files
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
@@ -145,6 +140,37 @@ def FileWrite(File, String, Wrapper=False):
String = textwrap.fill(String, 120)
File.write(String + gEndOfLine)
+def ByteArrayForamt(Value):
+ IsByteArray = False
+ SplitNum = 16
+ ArrayList = []
+ if Value.startswith('{') and Value.endswith('}'):
+ Value = Value[1:-1]
+ ValueList = Value.split(',')
+ if len(ValueList) >= SplitNum:
+ IsByteArray = True
+ if IsByteArray:
+ if ValueList:
+ Len = len(ValueList)/SplitNum
+ for i, element in enumerate(ValueList):
+ ValueList[i] = '0x%02X' % int(element.strip(), 16)
+ if Len:
+ Id = 0
+ while (Id <= Len):
+ End = min(SplitNum*(Id+1), len(ValueList))
+ Str = ','.join(ValueList[SplitNum*Id : End])
+ if End == len(ValueList):
+ Str += '}'
+ ArrayList.append(Str)
+ break
+ else:
+ Str += ','
+ ArrayList.append(Str)
+ Id += 1
+ else:
+ ArrayList = [Value + '}']
+ return IsByteArray, ArrayList
+
##
# Find all the header file that the module source directly includes.
#
@@ -723,6 +749,7 @@ class PcdReport(object):
self.UnusedPcds = {}
self.ConditionalPcds = {}
self.MaxLen = 0
+ self.Arch = None
if Wa.FdfProfile:
self.FdfPcdSet = Wa.FdfProfile.PcdDict
else:
@@ -730,6 +757,7 @@ class PcdReport(object):
self.ModulePcdOverride = {}
for Pa in Wa.AutoGenObjectList:
+ self.Arch = Pa.Arch
#
# Collect all platform referenced PCDs and grouped them by PCD token space
# GUID C Names
@@ -830,10 +858,9 @@ class PcdReport(object):
# Collect PCDs defined in DSC common section
#
self.DscPcdDefault = {}
- for Arch in Wa.ArchList:
- Platform = Wa.BuildDatabase[Wa.MetaFile, Arch, Wa.BuildTarget, Wa.ToolChain]
- for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:
- DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DscDefaultValue
+ for Pa in Wa.AutoGenObjectList:
+ for (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds:
+ DscDefaultValue = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue
if DscDefaultValue:
self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
@@ -978,39 +1005,39 @@ class PcdReport(object):
else:
DscMatch = (DscDefaultValue.strip() == PcdValue.strip())
+ IsStructure = False
+ if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructurePcd.keys()) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.gStructurePcd[self.Arch]):
+ IsStructure = True
+ if TypeName in ('DYNVPD', 'DEXVPD'):
+ SkuInfoList = Pcd.SkuInfoList
+ Pcd = GlobalData.gStructurePcd[self.Arch][(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)]
+ Pcd.DatumType = Pcd.StructName
+ if TypeName in ('DYNVPD', 'DEXVPD'):
+ Pcd.SkuInfoList = SkuInfoList
+ if Pcd.OverrideValues:
+ DscMatch = True
+ DecMatch = False
#
# Report PCD item according to their override relationship
#
if DecMatch and InfMatch:
- FileWrite(File, ' %-*s: %6s %10s = %-22s' % (self.MaxLen, PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, ' ')
elif BuildOptionMatch:
- FileWrite(File, ' *B %-*s: %6s %10s = %-22s' % (self.MaxLen, PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*B')
else:
if DscMatch:
if (Pcd.TokenCName, Key) in self.FdfPcdSet:
- FileWrite(File, ' *F %-*s: %6s %10s = %-22s' % (self.MaxLen, PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*F')
else:
- FileWrite(File, ' *P %-*s: %6s %10s = %-22s' % (self.MaxLen, PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*P')
else:
- FileWrite(File, ' *M %-*s: %6s %10s = %-22s' % (self.MaxLen, PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', PcdValue.strip()))
-
- if TypeName in ('DYNHII', 'DEXHII', 'DYNVPD', 'DEXVPD'):
- for SkuInfo in Pcd.SkuInfoList.values():
- if TypeName in ('DYNHII', 'DEXHII'):
- FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset))
- else:
- FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset))
-
- if not DscMatch and DscDefaultValBak != None:
- FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValBak.strip()))
-
- if not InfMatch and InfDefaultValue != None:
- FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', InfDefaultValue.strip()))
-
- if not DecMatch and DecDefaultValue != None:
- FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', DecDefaultValue.strip()))
+ self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M')
if ModulePcdSet == None:
+ if IsStructure:
+ continue
+ if not TypeName in ('PATCH', 'FLAG', 'FIXED'):
+ continue
if not BuildOptionMatch:
ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
for ModulePath in ModuleOverride:
@@ -1022,7 +1049,13 @@ class PcdReport(object):
Match = (ModuleDefault.strip() == PcdValue.strip())
if Match:
continue
- FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip()))
+ IsByteArray, ArrayList = ByteArrayForamt(ModuleDefault.strip())
+ if IsByteArray:
+ FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, '{'))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip()))
if ModulePcdSet == None:
FileWrite(File, gSectionEnd)
@@ -1031,6 +1064,181 @@ class PcdReport(object):
FileWrite(File, gSubSectionEnd)
+ def PrintPcdDefault(self, File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue):
+ if not DscMatch and DscDefaultValue != None:
+ Value = DscDefaultValue.strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', "{"))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', Value))
+ if not InfMatch and InfDefaultValue != None:
+ Value = InfDefaultValue.strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', "{"))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', Value))
+
+ if not DecMatch and DecDefaultValue != None:
+ Value = DecDefaultValue.strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', "{"))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', Value))
+ if IsStructure:
+ self.PrintStructureInfo(File, Pcd.DefaultValues)
+
+ def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, Flag = ' '):
+ if not Pcd.SkuInfoList:
+ Value = Pcd.DefaultValue
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
+ if IsStructure:
+ OverrideValues = Pcd.OverrideValues
+ if OverrideValues:
+ Keys = OverrideValues.keys()
+ Data = OverrideValues[Keys[0]]
+ Struct = Data.values()[0]
+ self.PrintStructureInfo(File, Struct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+ else:
+ FirstPrint = True
+ 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:
+ Value = SkuInfo.DefaultStoreDict[DefaultStore]
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if FirstPrint:
+ FirstPrint = False
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', '(' + DefaultStore + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', '(' + DefaultStore + ')', Value))
+ else:
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', '(' + DefaultStore + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', '(' + DefaultStore + ')', Value))
+ FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset))
+ if IsStructure:
+ OverrideValues = Pcd.OverrideValues[Sku]
+ Struct = OverrideValues[DefaultStore]
+ self.PrintStructureInfo(File, Struct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+ elif TypeName in ('DYNVPD', 'DEXVPD'):
+ Value = SkuInfo.DefaultValue
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if FirstPrint:
+ FirstPrint = False
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', "{"))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', Value))
+ else:
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', "{"))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', Value))
+ FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset))
+ if IsStructure:
+ OverrideValues = Pcd.OverrideValues[Sku]
+ if OverrideValues:
+ Keys = OverrideValues.keys()
+ Struct = OverrideValues[Keys[0]]
+ self.PrintStructureInfo(File, Struct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+ else:
+ Value = SkuInfo.DefaultValue
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if FirstPrint:
+ FirstPrint = False
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', Value))
+ else:
+ if IsByteArray:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', '{'))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuInfo.SkuIdName + ')', Value))
+ if IsStructure:
+ OverrideValues = Pcd.OverrideValues[Sku]
+ if OverrideValues:
+ Keys = OverrideValues.keys()
+ Struct = OverrideValues[Keys[0]]
+ self.PrintStructureInfo(File, Struct)
+ self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
+
+ def PrintStructureInfo(self, File, Struct):
+ NewInfo = collections.OrderedDict()
+ for Key, Value in Struct.items():
+ if Key not in NewInfo:
+ NewInfo[Key] = Value[0]
+ else:
+ del NewInfo[Key]
+ NewInfo[Key] = Value[0]
+ if NewInfo:
+ for item in NewInfo:
+ FileWrite(File, ' %-*s = %s' % (self.MaxLen + 4, '.' + item, NewInfo[item]))
+
+ def StrtoHex(self, value):
+ try:
+ value = hex(int(value))
+ return value
+ except:
+ if value.startswith("L\"") and value.endswith("\""):
+ valuelist = []
+ for ch in value[2:-1]:
+ valuelist.append(hex(ord(ch)))
+ valuelist.append('0x00')
+ return valuelist
+ elif value.startswith("\"") and value.endswith("\""):
+ return hex(ord(value[1:-1]))
+ elif value.startswith("{") and value.endswith("}"):
+ valuelist = []
+ if ',' not in value:
+ return value[1:-1]
+ for ch in value[1:-1].split(','):
+ ch = ch.strip()
+ if ch.startswith('0x') or ch.startswith('0X'):
+ valuelist.append(ch)
+ continue
+ try:
+ valuelist.append(hex(int(ch.strip())))
+ except:
+ pass
+ return valuelist
+ else:
+ return value
##
# Reports platform and module Prediction information
@@ -1413,10 +1621,9 @@ class FdRegionReport(object):
#
# Collect PCDs defined in DSC file
#
- for arch in Wa.ArchList:
- Platform = Wa.BuildDatabase[Wa.MetaFile, arch]
- for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:
- DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue
+ for Pa in Wa.AutoGenObjectList:
+ for (TokenCName, TokenSpaceGuidCName) in Pa.Platform.Pcds:
+ DscDefaultValue = Pa.Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue
PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
#
@@ -1620,7 +1827,16 @@ class FdReport(object):
FileWrite(File, "Size: 0x%X (%.0fK)" % (self.VPDSize, self.VPDSize / 1024.0))
FileWrite(File, gSubSectionSep)
for item in self.VPDInfoList:
- FileWrite(File, item)
+ ValueList = item.split('|')
+ Value = ValueList[-1].strip()
+ IsByteArray, ArrayList = ByteArrayForamt(Value)
+ if IsByteArray:
+ ValueList[-1] = ' {'
+ FileWrite(File, '|'.join(ValueList))
+ for Array in ArrayList:
+ FileWrite(File, '%s' % (Array))
+ else:
+ FileWrite(File, item)
FileWrite(File, gSubSectionEnd)
FileWrite(File, gSectionEnd)
@@ -1718,6 +1934,10 @@ class PlatformReport(object):
FileWrite(File, "Architectures: %s" % self.Architectures)
FileWrite(File, "Tool Chain: %s" % self.ToolChain)
FileWrite(File, "Target: %s" % self.Target)
+ if GlobalData.gSkuids:
+ FileWrite(File, "SKUID: %s" % " ".join(GlobalData.gSkuids))
+ if GlobalData.gDefaultStores:
+ FileWrite(File, "DefaultStore: %s" % " ".join(GlobalData.gDefaultStores))
FileWrite(File, "Output Path: %s" % self.OutputPath)
FileWrite(File, "Build Environment: %s" % self.BuildEnvironment)
FileWrite(File, "Build Duration: %s" % BuildDuration)
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 8cf139c77c..38498046d7 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -761,6 +761,8 @@ class Build():
self.SkipAutoGen = BuildOptions.SkipAutoGen
self.Reparse = BuildOptions.Reparse
self.SkuId = BuildOptions.SkuId
+ if self.SkuId:
+ GlobalData.gSKUID_CMD = self.SkuId
self.ConfDirectory = BuildOptions.ConfDirectory
self.SpawnMode = True
self.BuildReport = BuildReport(BuildOptions.ReportFile, BuildOptions.ReportType)