From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.16800.1591198529258235379 for ; Wed, 03 Jun 2020 08:35:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Tolbvc6s; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: maurice.ma@intel.com) IronPort-SDR: OEumDttWjyQ51oQyvXpkTRclQz1HZK/uZF5bZQNViJi/Hs/E1lC+9eeeLXc/GUCe8sK8eJujte bASL6Rzikb7g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 08:35:28 -0700 IronPort-SDR: tF3H1UaoRepy+yahb3qGfnJPe5AVGwrIWbWyZ+p/KMgjKgzu33q5SVP5gY8JfmY7Fk1DEok2lb ZW533KUoDpvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,467,1583222400"; d="scan'208";a="445150307" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 03 Jun 2020 08:35:28 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 3 Jun 2020 08:35:27 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 3 Jun 2020 08:35:27 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 3 Jun 2020 08:35:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cj2nbr086zDkMqWwsIU0Hc9DIHnlXyu7aRCvc3V6i7recPkia+Ofwj0LfUh3YQRMaWvBWgN5BVcXPGRpRrMl3dYB2Iw2vjMKp6AUAFKkha0AZiVB94cNA2RQsIatK2cuBUaYhpuLjkR3qftTTlJo6EXFR47TDz0F+dlgkUibTMcDF3U3w+Fd1LD2e6rKXnc6nLND1jNn554BkQqgBVHrbMYzC8VLUwOqBnkTDGHc//GyUiMtrdXZls9QVEMkaCLfhF/R0UFy/hkcAOztrpBB/lwL9E8FidhL5iyKKj9Q6N6y60SmVyHz6xXIwEzpft5GHYceHYoe/Z6M2E16lr9cwQ== 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=B7AR6qg6WebHWPEKj8jA9O3zthErFuZhOIQCYv65vSk=; b=k/rKfaX+FLy6xihlormyhtMxatYHeykoYlKqVjDvL27kUFCHq1WX0r8tR1DOsQU3cH/DTCSCgdPIkWmmXMT8IPhp6En3/toyfWW6gPSMrnnYT32ROk/yC0qm+OMe/6Xcs/2VZ14+uktKIhrKYH/qyfGL06l+4UYy/ejNtgc6a0vmi9IhN4hsMXbhGYvQ66CaSPt+0/dJ80v0XWQZGPb1fSvBui9mDin6UJ0o0SWh3Qs2z4CjOucacHcu1rA83n2aU0wHhYJl3QrjE2w1mQ/+eCQc9ezNfbaOMuRsIdSVi7zoH5EUq4Vzm6XODIn0siihNBJ1fUfHXCa1NpgORLsXpw== 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=B7AR6qg6WebHWPEKj8jA9O3zthErFuZhOIQCYv65vSk=; b=Tolbvc6sdQaaEbpBcuDWl1mzL8PWGLdvPe5M4m22LMh7j2x56BvPqloa++yzVpg42mPsIxFfDxwbWf9/j5XwtrYOgJEC1TFUS0gUAzDVRdEQ/nHul8oNeAt0vPOH8+ifLFMTCI8rfgbe9bOPfsYpGTJgeaavxjatlFluLI6iOXY= Received: from DM6PR11MB2793.namprd11.prod.outlook.com (2603:10b6:5:c0::29) by DM6PR11MB3401.namprd11.prod.outlook.com (2603:10b6:5:56::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Wed, 3 Jun 2020 15:35:24 +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; Wed, 3 Jun 2020 15:35:24 +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/37xhX06cA0coBDPQ4qjHAlhw Date: Wed, 3 Jun 2020 15:35:24 +0000 Message-ID: References: <20200603102039.768-1-ray.ni@intel.com> <20200603102039.768-3-ray.ni@intel.com> In-Reply-To: <20200603102039.768-3-ray.ni@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: 8de91845-9f07-442a-a988-08d807d3bbf4 x-ms-traffictypediagnostic: DM6PR11MB3401: 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: 04238CD941 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KvjEnRD4Uft+xv6x8MBVU/AtphleJa5Fd9i584/spwNAzqF+a7a0GpD1Cc/Y3s7YCZu7Is9GafjaAEuktTH1pqi5z37NPcyoS5lh0ubW73ORqNcD65SK63CP0Q8plm2Gz7albNVZsfWoRmhAs0rraRB1Se3Ce9Y/tK2NS9QfdaU1N1Nf35j+UqfDwOth6Mqdvc45L+mdWHSoHW/9cAkAPDmgJpHJjlSOZesrhOnnd0+Xpz8f3pVsLIgUM8NEc0aRLpzeg737YpK4lIvZLlxSBGUiqU7qksO79Q7dZheFATiKlfb8p5Iwat/gbyKJnW6r6RXakdFki5JfQmUMWUmOvQ== 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:(376002)(39860400002)(366004)(346002)(396003)(136003)(76116006)(64756008)(66446008)(26005)(53546011)(66556008)(9686003)(186003)(19627235002)(66946007)(66476007)(6506007)(54906003)(107886003)(110136005)(4326008)(86362001)(316002)(55016002)(83380400001)(478600001)(7696005)(71200400001)(5660300002)(8676002)(33656002)(8936002)(52536014)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: I0wg2jOVTIRVi/fUpGOybGmGghFFK/zcg4t0fgF0tbhVMlpPAtWb7kWsswV3mxFFgQQ1nhBNQ9KMFYet31kNQ76cLT1e5cqFMU7vCqbPMUYqldVelSHCGSlZ7QX90oXkl6Mehq50k8jZ77eLqeIxUVyp1quPCGLPagdsYtw7OQ+tR1GmXrDim5YKBxBwrBJam5PqhS+rMTV1Vjfr77D7HYN2zXswRpiMFRDDAp8v1iMYbGtYBlzyqgCkWlsQF7jCmriA290JNRMrrFDJ/2mpkQYih/SuVsPM6JBgz3MnKiQmhnNANXhOeM1D6euAS6pzfKxU1Y80RtekP5thlKO/YxovYhQn+wI2TTw6jMXW9P1+i1ehusdYI9yzqq+2HIFhRE8OtfZUk1+ZpOwYUIwVkBSssruirQb6sj6BjtF1rlaeZ2a8r0V72ye+sqvbZjP+OUs5nZNu+KzwRYHDiYF9DuZjDmB9nB/zHpLB5ZmtpC+WAJ0v0dhg3w8urO4GtF5g MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 8de91845-9f07-442a-a988-08d807d3bbf4 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jun 2020 15:35:24.3014 (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: G8D8Xk90AAPxmzPobX1MHaIEZcwEl5Hv60utdGHMkZkwIIBW9Jeutq1Gdqj7m1S7TVi+dNJoROELzM/FPbQOZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3401 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, Thank you very much for making this change. Two minor comments here, =20 - Should we add "EFIAPI" for function GetPciSegmentInfo() since it is stand= ard library interface ?=20 - For ASSERT (Count !=3D NULL), can we have an error handling flow in th= e 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 >=20 > Today's UefiPayloadPkg always uses 0xE0000000 as the PCIE base address an= d > ignores the value set in AcpiBoardInfo HOB created by the boot loader. Th= is > makes the payload binary cannot work in environment where the PCIE base > address set by boot loader doesn't equal to 0xE0000000. >=20 > The patch enhances UefiPayloadPkg so that the PCIE base address set by bo= ot > loader in the AcpiBoardInfo HOB is used. >=20 > 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/PciSegmentInfoLibAc > piBoardInfo.c > create mode 100644 > UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLibAc > piBoardInfo.inf >=20 > diff --git > a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLib > AcpiBoardInfo.c > b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLib > AcpiBoardInfo.c > new file mode 100644 > index 0000000000..28ca4b5799 > --- /dev/null > +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentIn > +++ 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-Li= cense- > Identifier: BSD-2-Clause-Patent++**/++#include +#include > ++#include +#include > +#include ++STATIC > PCI_SEGMENT_INFO mPciSegment0 =3D {+ 0, // Segment number+ 0, // To b= e > fixed later+ 0, // Start bus number+ 255 // End bus number+};++/**+ R= eturn > an array of PCI_SEGMENT_INFO holding the segment information.++ Note: Th= e > returned array/buffer is owned by callee.++ @param Count Return the co= unt > 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/PciSegmentInfoLib > AcpiBoardInfo.inf > b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoLib > AcpiBoardInfo.inf > new file mode 100644 > index 0000000000..ec4dbaaa55 > --- /dev/null > +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentIn > +++ foLibAcpiBoardInfo.inf > @@ -0,0 +1,36 @@ > +## @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+#+#+##++[Defines]+ INF_VERSION > =3D 0x00010005+ BASE_NAME =3D PciSegmentInfoLibAcpi= BoardInfo+ > FILE_GUID =3D 0EA82AA2-6C36-4FD5-BC90-FFA3ECB5E0CE+ > MODULE_TYPE =3D BASE+ VERSION_STRING = =3D 1.0+ > LIBRARY_CLASS =3D PciSegmentInfoLib | DXE_DRIVER++#+# Th= e > following information is for reference only and not required by the build > tools.+#+# VALID_ARCHITECTURES =3D IA32 X64 EBC+#++[Sources]+ > 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 !end= if- > PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.i > nf+ > PciSegmentLib|MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLi > bSegmentInfo.inf+ > PciSegmentInfoLib|UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/P= c > iSegmentInfoLibAcpiBoardInfo.inf > PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf > PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC > 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, 0= x23, > 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 need= ed > by this Platform.-- > 2.26.2.windows.1