From nobody Mon Feb 9 18:19:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70517+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70517+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1611018903; cv=none; d=zohomail.com; s=zohoarc; b=C2emlbFbiouWQFzqMQaEujgRSRk4Zy5wzjLqG27z5pCgzC4t1WD0qtXDClm1dA8XPY2k/H/QxVqG9MyEKJbTgvwonQId7sxo8eYUI7DsR641pWki4FP9/uGN8Js1CDt7jYL2dG81+iJGqFX8Nczcj+SV3zcFaBPVYY4Fk/FMci4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611018903; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=NYa5lom4PNqUzvvYMgwUyfcCprpPvzD5KxdnfHSnwOc=; b=R44pUOEx6TJjUKsgtdswskBeyZTirFoMUMAzo1erHdKY/KHH7Z+VxAhqXEdUXQeN9F9t474t5PiRcIZYBf99a+99Ej2sPGH48vjgBAaQJNN1r1J+EkvA9UZhRmUkCPBlAtr4Zt3yoc4/wJQUwxS5o5eNRk/J3/Wzl15owq3oA8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70517+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 161101890325583.65544001905823; Mon, 18 Jan 2021 17:15:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id eNgDYY1788612x0GsNlsJ6Pv; Mon, 18 Jan 2021 17:15:02 -0800 X-Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mx.groups.io with SMTP id smtpd.web11.5328.1611018896462274118 for ; Mon, 18 Jan 2021 17:14:57 -0800 X-Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DKVzK13hFz7Wxc; Tue, 19 Jan 2021 09:13:49 +0800 (CST) X-Received: from localhost (10.174.184.155) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Tue, 19 Jan 2021 09:14:47 +0800 From: "Jiahui Cen via groups.io" To: CC: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Rebecca Cran , Peter Grehan , Anthony Perard , Julien Grall , Leif Lindholm , Sami Mujawar , , , Jiahui Cen , Yubo Miao Subject: [edk2-devel] [PATCH v6 05/11] OvmfPkg/PciHostBridgeUtilityLib: Extend parameters of InitRootBridge() Date: Tue, 19 Jan 2021 09:12:56 +0800 Message-ID: <20210119011302.10908-6-cenjiahui@huawei.com> In-Reply-To: <20210119011302.10908-1-cenjiahui@huawei.com> References: <20210119011302.10908-1-cenjiahui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.184.155] X-CFilter-Loop: Reflected 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,cenjiahui@huawei.com X-Gm-Message-State: nyeeCcFNcI1zspQ89oykjD2Qx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1611018902; bh=K76bJWy0ALlqUqsNmtU5dc2/EszIvRTxovCjKw4QwuY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=PfqJr2Qh6G+Sy8KYx8D1YTkOuzEi3YISj5bleLminHp5Rrd3oZoZRGU/sZU4q+jHf8v 68oehRFYCHdx0duaj+XMYzWbBbgfU2yKrHtLhqtBibpwikzwPJwTFm6/Yac5ORkE9mTJH oWIFgRvnPP3mTG0DmhaIyl3zj0VvEDXLLmE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Extend parameter list of PciHostBridgeUtilityInitRootBridge() with DmaAbove4G and NoExtendedConfigSpace to prepare for sharing with ArmVirtPkg. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3059 Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Anthony Perard Cc: Julien Grall Signed-off-by: Jiahui Cen Signed-off-by: Yubo Miao Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 + OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf | 4 -- OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h | 56 += ++++++++-------- OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 5 ++ OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 1 + OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c | 63 += ++++++++++--------- 6 files changed, 73 insertions(+), 57 deletions(-) diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/OvmfPk= g/Library/PciHostBridgeLib/PciHostBridgeLib.inf index 7944f94b7743..72458262cb42 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -50,4 +50,5 @@ [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration diff --git a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLi= b.inf b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf index e3d0a3740952..4d6764b702f4 100644 --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf @@ -39,7 +39,3 @@ [LibraryClasses] DebugLib DevicePathLib MemoryAllocationLib - PcdLib - -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h b/OvmfPkg/In= clude/Library/PciHostBridgeUtilityLib.h index 8a1ddc2f5e02..a44ad5034520 100644 --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h +++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h @@ -20,43 +20,49 @@ /** Utility function to initialize a PCI_ROOT_BRIDGE structure. =20 - @param[in] Supports Supported attributes. + @param[in] Supports Supported attributes. =20 - @param[in] Attributes Initial attributes. + @param[in] Attributes Initial attributes. =20 - @param[in] AllocAttributes Allocation attributes. + @param[in] AllocAttributes Allocation attributes. =20 - @param[in] RootBusNumber The bus number to store in RootBus. + @param[in] DmaAbove4G DMA above 4GB memory. =20 - @param[in] MaxSubBusNumber The inclusive maximum bus number that can be - assigned to any subordinate bus found behin= d any - PCI bridge hanging off this root bus. + @param[in] NoExtendedConfigSpace No Extended Config Space. =20 - The caller is repsonsible for ensuring that - RootBusNumber <=3D MaxSubBusNumber. If - RootBusNumber equals MaxSubBusNumber, then = the - root bus has no room for subordinate buses. + @param[in] RootBusNumber The bus number to store in RootBus. =20 - @param[in] Io IO aperture. + @param[in] MaxSubBusNumber The inclusive maximum bus number that= can + be assigned to any subordinate bus fo= und + behind any PCI bridge hanging off this + root bus. =20 - @param[in] Mem MMIO aperture. + The caller is repsonsible for ensuring + that RootBusNumber <=3D MaxSubBusNumb= er. If + RootBusNumber equals MaxSubBusNumber,= then + the root bus has no room for subordin= ate + buses. =20 - @param[in] MemAbove4G MMIO aperture above 4G. + @param[in] Io IO aperture. =20 - @param[in] PMem Prefetchable MMIO aperture. + @param[in] Mem MMIO aperture. =20 - @param[in] PMemAbove4G Prefetchable MMIO aperture above 4G. + @param[in] MemAbove4G MMIO aperture above 4G. =20 - @param[out] RootBus The PCI_ROOT_BRIDGE structure (allocated by= the - caller) that should be filled in by this - function. + @param[in] PMem Prefetchable MMIO aperture. =20 - @retval EFI_SUCCESS Initialization successful. A device path - consisting of an ACPI device path node, wi= th - UID =3D RootBusNumber, has been allocated = and - linked into RootBus. + @param[in] PMemAbove4G Prefetchable MMIO aperture above 4G. =20 - @retval EFI_OUT_OF_RESOURCES Memory allocation failed. + @param[out] RootBus The PCI_ROOT_BRIDGE structure (alloca= ted + by the caller) that should be filled = in by + this function. + + @retval EFI_SUCCESS Initialization successful. A device p= ath + consisting of an ACPI device path nod= e, + with UID =3D RootBusNumber, has been + allocated and linked into RootBus. + + @retval EFI_OUT_OF_RESOURCES Memory allocation failed. **/ EFI_STATUS EFIAPI @@ -64,6 +70,8 @@ PciHostBridgeUtilityInitRootBridge ( IN UINT64 Supports, IN UINT64 Attributes, IN UINT64 AllocAttributes, + IN BOOLEAN DmaAbove4G, + IN BOOLEAN NoExtendedConfigSpace, IN UINT8 RootBusNumber, IN UINT8 MaxSubBusNumber, IN PCI_ROOT_BRIDGE_APERTURE *Io, diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/= Library/PciHostBridgeLib/PciHostBridgeLib.c index 07fa98110e98..8758d7c12bf0 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -10,6 +10,7 @@ #include =20 #include +#include =20 #include #include @@ -151,6 +152,8 @@ PciHostBridgeGetRootBridges ( Attributes, Attributes, AllocationAttributes, + FALSE, + PcdGet16 (PcdOvmfHostBridgePciDevId) !=3D INTEL_Q35_MCH_DEVICE_ID, (UINT8) LastRootBridgeNumber, (UINT8) (RootBridgeNumber - 1), &Io, @@ -176,6 +179,8 @@ PciHostBridgeGetRootBridges ( Attributes, Attributes, AllocationAttributes, + FALSE, + PcdGet16 (PcdOvmfHostBridgePciDevId) !=3D INTEL_Q35_MCH_DEVICE_ID, (UINT8) LastRootBridgeNumber, PCI_MAX_BUS, &Io, diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Librar= y/PciHostBridgeLib/XenSupport.c index 5dfeba0e6e23..9ef39f01821b 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c +++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c @@ -456,6 +456,7 @@ ScanForRootBridges ( ASSERT (RootBridges !=3D NULL); PciHostBridgeUtilityInitRootBridge ( Attributes, Attributes, 0, + FALSE, PcdGet16 (PcdOvmfHostBridgePciDevId) !=3D INTEL_Q35_MCH_DEV= ICE_ID, (UINT8) PrimaryBus, (UINT8) SubBus, &Io, &Mem, &MemAbove4G, &mNonExistAperture, &mNonExistAperture, &RootBridges[*NumberOfRootBridges] diff --git a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLi= b.c b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c index 92b42566e5f8..bed2d87ea89c 100644 --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c @@ -11,12 +11,10 @@ **/ =20 #include -#include #include #include #include #include -#include #include =20 =20 @@ -64,43 +62,49 @@ OVMF_PCI_ROOT_BRIDGE_DEVICE_PATH mRootBridgeDevicePathT= emplate =3D { /** Utility function to initialize a PCI_ROOT_BRIDGE structure. =20 - @param[in] Supports Supported attributes. + @param[in] Supports Supported attributes. =20 - @param[in] Attributes Initial attributes. + @param[in] Attributes Initial attributes. =20 - @param[in] AllocAttributes Allocation attributes. + @param[in] AllocAttributes Allocation attributes. =20 - @param[in] RootBusNumber The bus number to store in RootBus. + @param[in] DmaAbove4G DMA above 4GB memory. =20 - @param[in] MaxSubBusNumber The inclusive maximum bus number that can be - assigned to any subordinate bus found behin= d any - PCI bridge hanging off this root bus. + @param[in] NoExtendedConfigSpace No Extended Config Space. =20 - The caller is repsonsible for ensuring that - RootBusNumber <=3D MaxSubBusNumber. If - RootBusNumber equals MaxSubBusNumber, then = the - root bus has no room for subordinate buses. + @param[in] RootBusNumber The bus number to store in RootBus. =20 - @param[in] Io IO aperture. + @param[in] MaxSubBusNumber The inclusive maximum bus number that= can + be assigned to any subordinate bus fo= und + behind any PCI bridge hanging off this + root bus. =20 - @param[in] Mem MMIO aperture. + The caller is repsonsible for ensuring + that RootBusNumber <=3D MaxSubBusNumb= er. If + RootBusNumber equals MaxSubBusNumber,= then + the root bus has no room for subordin= ate + buses. =20 - @param[in] MemAbove4G MMIO aperture above 4G. + @param[in] Io IO aperture. =20 - @param[in] PMem Prefetchable MMIO aperture. + @param[in] Mem MMIO aperture. =20 - @param[in] PMemAbove4G Prefetchable MMIO aperture above 4G. + @param[in] MemAbove4G MMIO aperture above 4G. =20 - @param[out] RootBus The PCI_ROOT_BRIDGE structure (allocated by= the - caller) that should be filled in by this - function. + @param[in] PMem Prefetchable MMIO aperture. =20 - @retval EFI_SUCCESS Initialization successful. A device path - consisting of an ACPI device path node, wi= th - UID =3D RootBusNumber, has been allocated = and - linked into RootBus. + @param[in] PMemAbove4G Prefetchable MMIO aperture above 4G. =20 - @retval EFI_OUT_OF_RESOURCES Memory allocation failed. + @param[out] RootBus The PCI_ROOT_BRIDGE structure (alloca= ted + by the caller) that should be filled = in by + this function. + + @retval EFI_SUCCESS Initialization successful. A device p= ath + consisting of an ACPI device path nod= e, + with UID =3D RootBusNumber, has been + allocated and linked into RootBus. + + @retval EFI_OUT_OF_RESOURCES Memory allocation failed. **/ EFI_STATUS EFIAPI @@ -108,6 +112,8 @@ PciHostBridgeUtilityInitRootBridge ( IN UINT64 Supports, IN UINT64 Attributes, IN UINT64 AllocAttributes, + IN BOOLEAN DmaAbove4G, + IN BOOLEAN NoExtendedConfigSpace, IN UINT8 RootBusNumber, IN UINT8 MaxSubBusNumber, IN PCI_ROOT_BRIDGE_APERTURE *Io, @@ -130,7 +136,7 @@ PciHostBridgeUtilityInitRootBridge ( RootBus->Supports =3D Supports; RootBus->Attributes =3D Attributes; =20 - RootBus->DmaAbove4G =3D FALSE; + RootBus->DmaAbove4G =3D DmaAbove4G; =20 RootBus->AllocationAttributes =3D AllocAttributes; RootBus->Bus.Base =3D RootBusNumber; @@ -141,8 +147,7 @@ PciHostBridgeUtilityInitRootBridge ( CopyMem (&RootBus->PMem, PMem, sizeof (*PMem)); CopyMem (&RootBus->PMemAbove4G, PMemAbove4G, sizeof (*PMemAbove4G)); =20 - RootBus->NoExtendedConfigSpace =3D (PcdGet16 (PcdOvmfHostBridgePciDevId)= !=3D - INTEL_Q35_MCH_DEVICE_ID); + RootBus->NoExtendedConfigSpace =3D NoExtendedConfigSpace; =20 DevicePath =3D AllocateCopyPool (sizeof mRootBridgeDevicePathTemplate, &mRootBridgeDevicePathTemplate); --=20 2.29.2 -=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 (#70517): https://edk2.groups.io/g/devel/message/70517 Mute This Topic: https://groups.io/mt/79941620/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-