From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DB3032117FD7A for ; Thu, 25 Oct 2018 00:29:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 00:29:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,423,1534834800"; d="scan'208";a="84317956" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga008.jf.intel.com with ESMTP; 25 Oct 2018 00:29:09 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 00:29:09 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 00:29:08 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.214]) with mapi id 14.03.0415.000; Thu, 25 Oct 2018 15:29:08 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] BaseTools: Fix VPD PCD Sub-section display bug Thread-Index: AQHUasDst9UQzKJox0OgDF5Nei857qUvk0ww Date: Thu, 25 Oct 2018 07:29:08 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E35D0A7@SHSMSX104.ccr.corp.intel.com> References: <1540292979-13700-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1540292979-13700-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDc0ZTBjZjEtMmQwMS00N2Y3LThlNWMtNGJjMzQxNWM5ZjU0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNHBjekttSTVvV1gzZzNPOFlXTk9Takd0TlRxRVpISVJSbzFuSlh4MzRnOTV1aWV0ZU14SkJyRTRcL1FUR0RobXgifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Fix VPD PCD Sub-section display bug X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2018 07:29:10 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yo= nghong Zhu > Sent: Tuesday, October 23, 2018 7:10 PM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch] BaseTools: Fix VPD PCD Sub-section display bug >=20 > original we get the VPD PCD items from the VPDGuid.map file in the FV > output folder. but this logic doesn't work when 1) there only have > single non Default SKU, 2) there have multiple SKU with same value. > Now we change it to get the really VPD Pcd items that already display > in the PCD section of the report. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Source/Python/build/BuildReport.py | 46 ++++++++++------------= ------ > 1 file changed, 17 insertions(+), 29 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sou= rce/Python/build/BuildReport.py > index de8f0fb..ea98ef7 100644 > --- a/BaseTools/Source/Python/build/BuildReport.py > +++ b/BaseTools/Source/Python/build/BuildReport.py > @@ -124,10 +124,13 @@ gDriverTypeMap =3D { > } >=20 > ## The look up table of the supported opcode in the dependency expressio= n binaries > gOpCodeList =3D ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT", "TRUE", = "FALSE", "END", "SOR"] >=20 > +## Save VPD Pcd > +VPDPcdList =3D [] > + > ## > # Writes a string to the file object. > # > # This function writes a string to the file object and a new line is app= ended > # afterwards. It may optionally wraps the string for better readability. > @@ -1399,10 +1402,13 @@ class PcdReport(object): > FileWrite(File, ' %-*s : %6s %10s =3D = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + > ')', Value)) > else: > FileWrite(File, ' %-*s : %6s %10s %10s= =3D %s' % (self.MaxLen, ' ', TypeName, '(' + > Pcd.DatumType + ')', '(' + SkuIdName + ')', Value)) > if TypeName in ('DYNVPD', 'DEXVPD'): > FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInf= o.VpdOffset)) > + VPDPcdItem =3D (Pcd.TokenSpaceGuidCName + '.' + = PcdTokenCName, SkuIdName, SkuInfo.VpdOffset, > Pcd.MaxDatumSize, SkuInfo.DefaultValue) > + if VPDPcdItem not in VPDPcdList: > + VPDPcdList.append(VPDPcdItem) > if IsStructure: > FiledOverrideFlag =3D False > OverrideValues =3D Pcd.SkuOverrideValues[Sku] > if OverrideValues: > Keys =3D OverrideValues.keys() > @@ -2015,39 +2021,18 @@ class FdReport(object): > self.FdName =3D Fd.FdUiName > self.BaseAddress =3D Fd.BaseAddress > self.Size =3D Fd.Size > self.FdRegionList =3D [FdRegionReport(FdRegion, Wa) for FdRegion= in Fd.RegionList] > self.FvPath =3D os.path.join(Wa.BuildDir, TAB_FV_DIRECTORY) > - self.VpdFilePath =3D os.path.join(self.FvPath, "%s.map" % Wa.Pla= tform.VpdToolGuid) > self.VPDBaseAddress =3D 0 > self.VPDSize =3D 0 > - self.VPDInfoList =3D [] > for index, FdRegion in enumerate(Fd.RegionList): > if str(FdRegion.RegionType) is 'FILE' and Wa.Platform.VpdToo= lGuid in str(FdRegion.RegionDataList): > self.VPDBaseAddress =3D self.FdRegionList[index].BaseAdd= ress > self.VPDSize =3D self.FdRegionList[index].Size > break >=20 > - if os.path.isfile(self.VpdFilePath): > - fd =3D open(self.VpdFilePath, "r") > - Lines =3D fd.readlines() > - for Line in Lines: > - Line =3D Line.strip() > - if len(Line) =3D=3D 0 or Line.startswith("#"): > - continue > - try: > - PcdName, SkuId, Offset, Size, Value =3D Line.split("= #")[0].split("|") > - PcdName, SkuId, Offset, Size, Value =3D PcdName.stri= p(), SkuId.strip(), Offset.strip(), Size.strip(), Value.strip() > - if Offset.lower().startswith('0x'): > - Offset =3D '0x%08X' % (int(Offset, 16) + self.VP= DBaseAddress) > - else: > - Offset =3D '0x%08X' % (int(Offset, 10) + self.VP= DBaseAddress) > - self.VPDInfoList.append("%s | %s | %s | %s | %s" % (= PcdName, SkuId, Offset, Size, Value)) > - except: > - EdkLogger.error("BuildReport", CODE_ERROR, "Fail to = parse VPD information file %s" % self.VpdFilePath) > - fd.close() > - > ## > # Generate report for the firmware device. > # > # This function generates report for the firmware device. > # > @@ -2063,27 +2048,30 @@ class FdReport(object): > if len(self.FdRegionList) > 0: > FileWrite(File, gSectionSep) > for FdRegionItem in self.FdRegionList: > FdRegionItem.GenerateReport(File) >=20 > - if len(self.VPDInfoList) > 0: > + if VPDPcdList: > + VPDPcdList.sort(key=3Dlambda x: int(x[2], 0)) > FileWrite(File, gSubSectionStart) > FileWrite(File, "FD VPD Region") > FileWrite(File, "Base Address: 0x%X" % self.VPDBaseAdd= ress) > FileWrite(File, "Size: 0x%X (%.0fK)" % (self.V= PDSize, self.VPDSize / 1024.0)) > FileWrite(File, gSubSectionSep) > - for item in self.VPDInfoList: > - ValueList =3D item.split('|') > - Value =3D ValueList[-1].strip() > - IsByteArray, ArrayList =3D ByteArrayForamt(Value) > + for item in VPDPcdList: > + # Add BaseAddress for offset > + Offset =3D '0x%08X' % (int(item[2], 16) + self.VPDBaseAd= dress) > + IsByteArray, ArrayList =3D ByteArrayForamt(item[-1]) > + Skuinfo =3D item[1] > + if len(GlobalData.gSkuids) =3D=3D 1 : > + Skuinfo =3D GlobalData.gSkuids[0] > if IsByteArray: > - ValueList[-1] =3D ' {' > - FileWrite(File, '|'.join(ValueList)) > + FileWrite(File, "%s | %s | %s | %s | %s" % (item[0],= Skuinfo, Offset, item[3], '{')) > for Array in ArrayList: > FileWrite(File, Array) > else: > - FileWrite(File, item) > + FileWrite(File, "%s | %s | %s | %s | %s" % (item[0],= Skuinfo, Offset, item[3], item[-1])) > FileWrite(File, gSubSectionEnd) > FileWrite(File, gSectionEnd) >=20 >=20 >=20 > -- > 2.6.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel