From nobody Sun Feb 8 14:53:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61394+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61394+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1592383307; cv=none; d=zohomail.com; s=zohoarc; b=XJ1gXCbhi0Dszi0/nQmenp2x8uwdJZXqyaeV9rZjQo5rMKCMvPl8hEszsbdImurfFu85TvjcQR11JlBmHHsao1IlRb0Ds409b5kUxLF3fRuAKJCWtHf3T5dKynKlQLXFlAZclm//MkvcOh7sl6jccyw8anChykbZ2GQFD23gXNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592383307; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=95QPBaA8tQ0vJ8ayPX/13CNlmnZENyDdI0MkqW5JV6g=; b=ilDtkGRVxPJlbp2EJd9EmVPwWvD2JmiqSYfFwd1ULQ3RiW8HWHrHnVJxxnOim02Q0rSRPXCq4JRSrC2cPWD4Pi1RXXXY0yVrhxVwjztBWA9QBXgU7wohIwP0MxQuLyP7fkNzYGSMv9MY0BSFzFIMObOJNkiLZbLsdDVmTbbDezg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61394+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592383307864958.8047099249067; Wed, 17 Jun 2020 01:41:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id PtWaYY1788612xbVhcY92i5r; Wed, 17 Jun 2020 01:41:47 -0700 X-Received: from mga17.intel.com (mga17.intel.com []) by mx.groups.io with SMTP id smtpd.web11.3224.1592383304997702094 for ; Wed, 17 Jun 2020 01:41:47 -0700 IronPort-SDR: IoouQCLcmSa19gqc4IQQ5E5hTRaiNB8ryaYWopG2c7KxN2Vz8MP739qxRukWYHzVpgcncSmcBP lR3FlQVYSETw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 01:41:46 -0700 IronPort-SDR: 0iYpPLbNWQwTtQt1EWj09TnURgS8hkxe/ESYUvFifjCGMDmTUtLhXl+y00Rg6k4wvn4PCdvi/a bwWmR39FN7kQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,522,1583222400"; d="scan'208";a="299219023" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.158.87]) by fmsmga004.fm.intel.com with ESMTP; 17 Jun 2020 01:41:45 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH V3 2/2] UefiPayloadPkg/Pci: Use the PCIE Base Addr stored in AcpiBoardInfo HOB Date: Wed, 17 Jun 2020 16:40:58 +0800 Message-Id: <20200617084058.196-3-ray.ni@intel.com> In-Reply-To: <20200617084058.196-1-ray.ni@intel.com> References: <20200617084058.196-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ray.ni@intel.com X-Gm-Message-State: iDg9CIkYER4MOi8u7RaUprAbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592383307; bh=rakx68JvC8WsKJD3ha4iPf1rlIQSgyqpuRXeamz8Qhw=; h=Cc:Date:From:Reply-To:Subject:To; b=BewasFNl7bfSO2iWddz8z1L+2XIJuWmoDhUjC9erPwI5LHfqhF8017XQpW50CkA5X/C P8/efvNScjOFPyhgm1/g5H5nT9eLrsFxcP8QbFGXpGqZaRUcbIWeIR6+drp4AsLSzPkXc oshixptRtjqVfGxKihb8gz/H1XcKudISzCM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 equal 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 Reviewed-by: Dong, Guo Reviewed-by: Maurice Ma --- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 13 +++- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf | 3 +- .../PciSegmentInfoLibAcpiBoardInfo.c | 59 +++++++++++++++++++ .../PciSegmentInfoLibAcpiBoardInfo.inf | 36 +++++++++++ UefiPayloadPkg/UefiPayloadPkgIa32.dsc | 10 ++-- UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc | 11 ++-- 6 files changed, 121 insertions(+), 11 deletions(-) create mode 100644 UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/P= ciSegmentInfoLibAcpiBoardInfo.c create mode 100644 UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/P= ciSegmentInfoLibAcpiBoardInfo.inf diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/Bl= SupportDxe/BlSupportDxe.c index 28dfc8fc55..a3974dcc02 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -2,7 +2,7 @@ This driver will report some MMIO/IO resources to dxe core, extract smbi= os and acpi tables from bootloader. =20 - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -101,6 +101,7 @@ BlDxeEntryPoint ( EFI_HOB_GUID_TYPE *GuidHob; SYSTEM_TABLE_INFO *SystemTableInfo; EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo; + ACPI_BOARD_INFO *AcpiBoardInfo; =20 Status =3D EFI_SUCCESS; // @@ -153,6 +154,16 @@ BlDxeEntryPoint ( ASSERT_EFI_ERROR (Status); } =20 + // + // Set PcdPciExpressBaseAddress by HOB info + // + GuidHob =3D GetFirstGuidHob (&gUefiAcpiBoardInfoGuid); + if (GuidHob !=3D NULL) { + AcpiBoardInfo =3D (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (GuidHob); + Status =3D PcdSet64S (PcdPciExpressBaseAddress, AcpiBoardInfo->PcieBas= eAddress); + ASSERT_EFI_ERROR (Status); + } + return EFI_SUCCESS; } =20 diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/= BlSupportDxe/BlSupportDxe.inf index 4c2b4670af..1371d5eb79 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf @@ -3,7 +3,7 @@ # # Report some MMIO/IO resources to dxe core, extract smbios and acpi tables # -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -53,6 +53,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress =20 [Depex] TRUE diff --git a/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegme= ntInfoLibAcpiBoardInfo.c b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoar= dInfo/PciSegmentInfoLibAcpiBoardInfo.c new file mode 100644 index 0000000000..d37c91cc9f --- /dev/null +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoL= ibAcpiBoardInfo.c @@ -0,0 +1,59 @@ +/** @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 * +EFIAPI +GetPciSegmentInfo ( + UINTN *Count + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + ACPI_BOARD_INFO *AcpiBoardInfo; + + ASSERT (Count !=3D NULL); + if (Count =3D=3D NULL) { + return NULL; + } + + if (mPciSegment0.BaseAddress =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/PciSegme= ntInfoLibAcpiBoardInfo.inf b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBo= ardInfo/PciSegmentInfoLibAcpiBoardInfo.inf new file mode 100644 index 0000000000..ec4dbaaa55 --- /dev/null +++ b/UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/PciSegmentInfoL= ibAcpiBoardInfo.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 PciSegmentInfoLibAcpiBoardInfo + FILE_GUID =3D 0EA82AA2-6C36-4FD5-BC90-FFA3ECB5E0CE + 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 = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + PciSegmentInfoLibAcpiBoardInfo.c + +[Packages] + MdePkg/MdePkg.dec + UefiPayloadPkg/UefiPayloadPkg.dec + +[LibraryClasses] + PcdLib + HobLib + DebugLib diff --git a/UefiPayloadPkg/UefiPayloadPkgIa32.dsc b/UefiPayloadPkg/UefiPay= loadPkgIa32.dsc index d52945442e..4ce1b8ef1c 100644 --- a/UefiPayloadPkg/UefiPayloadPkgIa32.dsc +++ b/UefiPayloadPkg/UefiPayloadPkgIa32.dsc @@ -3,7 +3,7 @@ # # Provides drivers and definitions to create uefi payload for bootloaders. # -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -40,7 +40,7 @@ [Defines] # # PCI options # - DEFINE PCIE_BASE =3D 0xE0000000 + DEFINE PCIE_BASE_SUPPORT =3D TRUE =20 # # Serial port set up @@ -121,14 +121,15 @@ [LibraryClasses] PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf -!if $(PCIE_BASE) =3D=3D 0 +!if $(PCIE_BASE_SUPPORT) =3D=3D FALSE PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf !else PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf !endif - PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.i= nf + PciSegmentLib|MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibS= egmentInfo.inf + PciSegmentInfoLib|UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/= PciSegmentInfoLibAcpiBoardInfo.inf PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.inf @@ -357,6 +358,7 @@ [PcdsDynamicDefault] =20 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100 + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0 =20 ##########################################################################= ###### # diff --git a/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc b/UefiPayloadPkg/Uefi= PayloadPkgIa32X64.dsc index 0736cd9954..7388543751 100644 --- a/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc +++ b/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc @@ -3,7 +3,7 @@ # # Provides drivers and definitions to create uefi payload for bootloaders. # -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -41,7 +41,7 @@ [Defines] # # PCI options # - DEFINE PCIE_BASE =3D 0xE0000000 + DEFINE PCIE_BASE_SUPPORT =3D TRUE =20 # # Serial port set up @@ -122,14 +122,15 @@ [LibraryClasses] PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf -!if $(PCIE_BASE) =3D=3D 0 +!if $(PCIE_BASE_SUPPORT) =3D=3D FALSE PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf !else PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf !endif - PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.i= nf + PciSegmentLib|MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLibS= egmentInfo.inf + PciSegmentInfoLib|UefiPayloadPkg/Library/PciSegmentInfoLibAcpiBoardInfo/= PciSegmentInfoLibAcpiBoardInfo.inf PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.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, 0= x31 } =20 - gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|$(PCIE_BASE) =20 !if $(SOURCE_DEBUG_ENABLE) gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 @@ -359,6 +359,7 @@ [PcdsDynamicDefault] =20 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|31 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100 + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0 =20 ##########################################################################= ###### # --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61394): https://edk2.groups.io/g/devel/message/61394 Mute This Topic: https://groups.io/mt/74933722/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-