From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.13034.1591275509599925157 for ; Thu, 04 Jun 2020 05:58:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=PCfc2pVL; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: maurice.ma@intel.com) IronPort-SDR: f/dbWcx6r+h1E6y9pWj+t0AsleZvIBCO2Hd9CJVVdw8gE51VoVLPoGytJT0gQccdTRKw7BAUEi qHpmL9xz4Y7g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2020 05:58:28 -0700 IronPort-SDR: hL+ss+ievWUa0Hq7YcU8PAZr4Z9g2NLFPBnpIoH2q0LV0qS6olWtAqNdZae+Ovm03h6jedE8j2 CeQy4OkikvwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,472,1583222400"; d="scan'208";a="445494955" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga005.jf.intel.com with ESMTP; 04 Jun 2020 05:58:27 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jun 2020 05:58:27 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jun 2020 05:58:27 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.173) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 4 Jun 2020 05:58:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iFuvBOMRDLDEg0tTOFQMuQRQ/OKt2xqGWKtTipylktLr16O5gVwJlD1LRzPf9kMxl9xQmKxPzAMoB0Jrj/MBRqvZab6fVjwn6+aZsAHR+UTdNc908sQKCldnIhoT9aejXDbalFdisnNecztTfCVZZxhjHI52ZcJvysLHH3Aomq8KldtNFcGgk3RyFvYeBwslQ2/4K45cUjLm+mQ9XWrxGJ/3GlcTYsswYdTmWrIe8IwpZLcXdlTR/pqbN4KlOZvoPf21B4S0k+f0j6Kpd3UpfDgrd222Bv8c9Uwk1zZ+fWttoIGf1MjpGlB6P7E5HnmAdVkmiXQj0XGMq/LOt4VrYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wpNJqUQbpY07GK1E/kMzgujYLO5XITY9fBm7ZR9396k=; b=jhyvcfA94b+uBE+T5tP9D4VIixGxaRHQ0Q1QNbn2q3ny6Bm6l3gesZhQeEJTJomb5OfD1W0JeSbDg8DO2eE0xHKT6RCzv9Ebg1fAyfm2uznC/YtQTu9yl80YUA807GfEovDU1/U9vSkh63oR05/IB/EXEOLpk87Bs0IcZeafeBFN581uKrF1046cczeD4DawuQ62l+dkdZVzlJ/Qn6zzgyN53a9Giz8BUOCbMVsrYgpJy//7YNS0Q7GgVZ0/X83VsgoWxclTdecYchdh8UBYz3MztfkM72v49Zd0KjSfQWYuUGuXMHK2/vCZPf+H+SJ6tJzUaslVpREa4T8HdQyN2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wpNJqUQbpY07GK1E/kMzgujYLO5XITY9fBm7ZR9396k=; b=PCfc2pVLy7qN8plkY0qVhFPh3ofNUaNpT9zCOv21Fc4268nNzrWgxu2ZddDadpHwXQCUUqQLTLRiLLOx5ss4HQnzj0Dklec3XYJmvUND6dOUNxf9qJT9TGm223dFOFc9g7WnXrhSE7Xw9FlcNEyM2w+pKRFuJ1DH9WtTbobHNRE= Received: from DM6PR11MB2793.namprd11.prod.outlook.com (2603:10b6:5:c0::29) by DM6PR11MB3260.namprd11.prod.outlook.com (2603:10b6:5:b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.25; Thu, 4 Jun 2020 12:58:25 +0000 Received: from DM6PR11MB2793.namprd11.prod.outlook.com ([fe80::ccf0:142e:4ef4:34d0]) by DM6PR11MB2793.namprd11.prod.outlook.com ([fe80::ccf0:142e:4ef4:34d0%5]) with mapi id 15.20.3045.018; Thu, 4 Jun 2020 12:58:25 +0000 From: "Ma, Maurice" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Guo" , "You, Benjamin" Subject: Re: [PATCH 2/2] UefiPayloadPkg/Pci: Use the PCIE Base Addr stored in AcpiBoardInfo HOB Thread-Topic: [PATCH 2/2] UefiPayloadPkg/Pci: Use the PCIE Base Addr stored in AcpiBoardInfo HOB Thread-Index: AQHWOZDLEkg/37xhX06cA0coBDPQ4qjHAlhwgADD40CAAKXWgA== Date: Thu, 4 Jun 2020 12:58:25 +0000 Message-ID: References: <20200603102039.768-1-ray.ni@intel.com> <20200603102039.768-3-ray.ni@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C59EEE8@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C59EEE8@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [104.153.200.60] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8e285f5f-9083-4b03-628e-08d80886f80d x-ms-traffictypediagnostic: DM6PR11MB3260: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 04244E0DC5 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6c3Rw1XXlSWxRmiTSxKxHnIIbiCzicF6Lx1iV9bY84yQY9X7AlVhZfGrI35FCT3ghASmdThpMZEml7h2OJ/u6x0f9QVE2YQkfLBoH2B1kbPPqeAynR0qy2k4GfL//lAtTjXKwy72zso9WmI/GZ9os9NFcegvJwbywVF2xFKNwuCBONFS1sXjOfXA/gfXbfCWUQkALXCSCWJGCIUjw1jwYoXJrr6E0ElnUhIY2W7nCJlXTaeXkEtLiAEesXbhiLS70f88dezTn0NnxTFp+Wbz2gTKapeoqUugX8495o7LEFAoG1mwFeDmwaacA2WFMo2ZfLmWLgpBW0ROown44aMdpg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB2793.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(346002)(376002)(39860400002)(366004)(136003)(396003)(186003)(52536014)(71200400001)(4326008)(5660300002)(66946007)(55016002)(76116006)(9686003)(66446008)(66556008)(2906002)(66476007)(64756008)(83380400001)(54906003)(8676002)(33656002)(6506007)(53546011)(110136005)(316002)(19627235002)(86362001)(107886003)(26005)(7696005)(478600001)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: AYY+23n7NlcP/N9nRjGUec6ZdP9obRgKfaEFAyA8FjvZOuWxHIX/B9e9pnGWGQ56rfoq1HDpKs/3vagB/6TrfIvx+o5ts07a8/3j9lZWPJ1KUd3C2qn3QbUd0htdcCpQp5p9Kj0K8p8ZilOk0TQJ51zUpMAqR/p8K381yjKpboy/PdUTWnrkidkxhCjrnEYO57wLffaEshWJg++4p5uNn+0miJZ9EA0VTTTpGCefRhmqDE7DtQYJGqmm/tnu9Gt/Chl6Rr7xh2yQmFcJDVu3u1Y6OFeesGBgAdXXpti9E071VVUFCYugPhFynigZwHP3A+jU6CCbmk6CY0WzVoo/k+kkghxLBZ8PXWCpXDGPHNiLyzT74qHVoc38URdG461hny/nfmQIjMrK95tbKTuab7dRTEC7slXF2RWiLwtP0rCpluyYBj/cjoKkQFspZwBHJn565yyoNhTWQXCJNdmVFvgdWKpcoCtpfgw9qqj/hID6y6LPEBBLSkb2L4gAeFgq MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8e285f5f-9083-4b03-628e-08d80886f80d X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2020 12:58:25.1792 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: e4nnSaRcxLtFJJ5LJXebp2uYf4hGASJH4g5iLaptK0+T+HT3tJt1gtPgJ27Dlm889TXe3d2eex8Na9D3eg5oWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3260 Return-Path: maurice.ma@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Ray, Yes, that addressed my questions. Thank you! Thanks Maurice > -----Original Message----- > From: Ni, Ray > Sent: Wednesday, June 3, 2020 20:06 > To: Ma, Maurice ; devel@edk2.groups.io > Cc: Dong, Guo ; You, Benjamin > > Subject: RE: [PATCH 2/2] UefiPayloadPkg/Pci: Use the PCIE Base Addr store= d in > AcpiBoardInfo HOB >=20 > Maurice, > 1. EFIAPI: sure. I will add the missing "EFIAPI". > 2. ASSERT: Is below code to avoid dereferencing NULL pointer ok to you? >=20 > ASSERT (Count !=3D NULL); > + if (Count =3D=3D NULL) { > + return NULL; > + } >=20 > Thanks, > Ray >=20 > > -----Original Message----- > > From: Ma, Maurice > > Sent: Wednesday, June 3, 2020 11:35 PM > > To: Ni, Ray ; devel@edk2.groups.io > > Cc: Dong, Guo ; You, Benjamin > > > > Subject: RE: [PATCH 2/2] UefiPayloadPkg/Pci: Use the PCIE Base Addr > > stored in AcpiBoardInfo HOB > > > > Hi, Ray, > > > > Thank you very much for making this change. > > > > Two minor comments here, > > - Should we add "EFIAPI" for function GetPciSegmentInfo() since it is s= tandard > library interface ? > > - For ASSERT (Count !=3D NULL), can we have an error handling flow i= n the > code to deal with the case ? > > > > Thanks > > Maurice > > > > > -----Original Message----- > > > From: Ni, Ray > > > Sent: Wednesday, June 3, 2020 3:21 > > > To: devel@edk2.groups.io > > > Cc: Ma, Maurice ; Dong, Guo > > > ; You, Benjamin > > > Subject: [PATCH 2/2] UefiPayloadPkg/Pci: Use the PCIE Base Addr > > > stored in AcpiBoardInfo HOB > > > > > > Today's UefiPayloadPkg always uses 0xE0000000 as the PCIE base > > > address and ignores the value set in AcpiBoardInfo HOB created by > > > the boot loader. This makes the payload binary cannot work in > > > environment where the PCIE base address set by boot loader doesn't eq= ual > to 0xE0000000. > > > > > > The patch enhances UefiPayloadPkg so that the PCIE base address set > > > by boot loader in the AcpiBoardInfo HOB is used. > > > > > > Signed-off-by: Ray Ni > > > Cc: Maurice Ma > > > Cc: Guo Dong > > > Cc: Benjamin You > > > --- > > > .../PciSegmentInfoLibAcpiBoardInfo.c | 55 +++++++++++++++++= ++ > > > .../PciSegmentInfoLibAcpiBoardInfo.inf | 36 ++++++++++++ > > > UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc | 6 +- > > > 3 files changed, 95 insertions(+), 2 deletions(-) create mode > > > 100644 > > > UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfo > > > LibAc > > > piBoardInfo.c > > > create mode 100644 > > > UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfo > > > LibAc > > > piBoardInfo.inf > > > > > > diff --git > > > a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentIn > > > foLib > > > AcpiBoardInfo.c > > > b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentIn > > > foLib > > > AcpiBoardInfo.c > > > new file mode 100644 > > > index 0000000000..28ca4b5799 > > > --- /dev/null > > > +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegme > > > +++ ntIn > > > +++ foLibAcpiBoardInfo.c > > > @@ -0,0 +1,55 @@ > > > +/** @file+ PCI Segment Information Library that returns one > > > +segment > > > whose+ segment base address is retrieved from AcpiBoardInfo HOB.++ > > > Copyright (c) 2020, Intel Corporation. All rights reserved.
+ > > > SPDX-License- > > > Identifier: BSD-2-Clause-Patent++**/++#include +#include > > > ++#include +#include > > > +#include ++STATIC > > > PCI_SEGMENT_INFO mPciSegment0 =3D {+ 0, // Segment number+ 0, // > > > To be fixed later+ 0, // Start bus number+ 255 // End bus > > > number+};++/**+ Return an array of PCI_SEGMENT_INFO holding the > > > segment information.++ Note: The returned array/buffer is owned by > > > callee.++ @param Count Return the count of segments.++ @retval A > > > callee owned array holding the segment > > > information.+**/+PCI_SEGMENT_INFO *+GetPciSegmentInfo (+ UINTN > > > *Count+ )+{+ EFI_HOB_GUID_TYPE *GuidHob;+ ACPI_BOARD_INFO > *AcpiBoardInfo;++ ASSERT (Count !=3D NULL);++ if (mPciSegment0.BaseAddr= ess > > > =3D=3D 0) {+ //+ // Find the acpi board information guid hob+ = //+ > GuidHob =3D > > > GetFirstGuidHob (&gUefiAcpiBoardInfoGuid);+ ASSERT (GuidHob !=3D > NULL);++ > > > AcpiBoardInfo =3D (ACPI_BOARD_INFO *) GET_GUID_HOB_DATA (GuidHob);+ > > > mPciSegment0.BaseAddress =3D AcpiBoardInfo->PcieBaseAddress;+ }+ > > > *Count =3D 1;+ return &mPciSegment0;+}diff --git > > > a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentIn > > > foLib > > > AcpiBoardInfo.inf > > > b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentIn > > > foLib > > > AcpiBoardInfo.inf > > > new file mode 100644 > > > index 0000000000..ec4dbaaa55 > > > --- /dev/null > > > +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegme > > > +++ ntIn > > > +++ foLibAcpiBoardInfo.inf > > > @@ -0,0 +1,36 @@ > > > +## @file+# PCI Segment Information Library that returns one segmen= t > > > whose+# segment base address is retrieved from AcpiBoardInfo HOB.+#= +# > > > Copyright (c) 2020, Intel Corporation. All rights reserved.
+#+# > > > SPDX- > > > License-Identifier: BSD-2-Clause-Patent+#+#+##++[Defines]+ INF_VERSI= ON > > > =3D 0x00010005+ BASE_NAME =3D > PciSegmentInfoLibAcpiBoardInfo+ > > > FILE_GUID =3D 0EA82AA2-6C36-4FD5-BC90-FFA3ECB5E0= CE+ > > > MODULE_TYPE =3D BASE+ VERSION_STRING = =3D 1.0+ > > > LIBRARY_CLASS =3D PciSegmentInfoLib | DXE_DRIVER++#+= # The > > > following information is for reference only and not required by the b= uild > > > tools.+#+# VALID_ARCHITECTURES =3D IA32 X64 EBC+#++[Source= s]+ > > > PciSegmentInfoLibAcpiBoardInfo.c++[Packages]+ MdePkg/MdePkg.dec+ > > > UefiPayloadPkg/UefiPayloadPkg.dec++[LibraryClasses]+ PcdLib+ > > > HobLib+ DebugLibdiff --git > > > a/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc > > > b/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc > > > index 0736cd9954..e114039f82 100644 > > > --- a/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc > > > +++ b/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc > > > @@ -129,7 +129,8 @@ [LibraryClasses] > > > > > > PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf > > > PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf > > > PciExpressLib|!endif- > > > > PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibP > > > PciSegmentLib|ci.i > > > nf+ > > > > PciSegmentLib|MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegment > > > PciSegmentLib|Li > > > bSegmentInfo.inf+ > > > PciSegmentInfoLib|UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardI > > > PciSegmentInfoLib|nfo/Pc > > > iSegmentInfoLibAcpiBoardInfo.inf > > > PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf > > > PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Bas > > > PeCoffGetEntryPointLib|ePeC > > > offGetEntryPointLib.inf > > > > CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCache > > > MaintenanceLib.inf@@ -288,7 +289,6 @@ [PcdsFixedAtBuild] > > > gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE > > > gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, > 0xaa, > > > 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, > > > 0x66, 0x23, > > > 0x31 } - > > > gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|$(PCIE_BASE) !if > > > $(SOURCE_DEBUG_ENABLE) > > > > gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2@ > > > @ -360,6 +360,8 @@ [PcdsDynamicDefault] > > > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31 > > > gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100 + > > > gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|$(PCIE_BASE)+ > > > > ################################################################ > > > ################ # # Components Section - list of all EDK II Modules > > > needed by this Platform.-- > > > 2.26.2.windows.1 > > >=20