From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mx.groups.io with SMTP id smtpd.web09.11106.1604927139399831901 for ; Mon, 09 Nov 2020 05:05:39 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.35, mailfrom: cenjiahui@huawei.com) Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CVB7G4R43z71hX; Mon, 9 Nov 2020 21:05:30 +0800 (CST) Received: from localhost (10.174.184.155) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Mon, 9 Nov 2020 21:05:26 +0800 From: "Jiahui Cen" To: CC: , , , , , , Jiahui Cen Subject: [PATCH v2 2/4] ArmVirtPkg: Use extracted PciHostBridgeUtilityLib Date: Mon, 9 Nov 2020 21:05:09 +0800 Message-ID: <20201109130511.5946-3-cenjiahui@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201109130511.5946-1-cenjiahui@huawei.com> References: <20201109130511.5946-1-cenjiahui@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.184.155] X-CFilter-Loop: Reflected Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Yubo Miao Eliminate the currently duplicated code in ArmVirtPkg and use the extracted PciHostBridgeResourceConflict from PciHostBridgeUtilityLib. Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Yubo Miao Signed-off-by: Jiahui Cen --- ArmVirtPkg/ArmVirt.dsc.inc | 1 + ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf | 2 + ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 61 +-----= -------------- 3 files changed, 4 insertions(+), 60 deletions(-) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index 4dafd1fa0f1d..593a523171ff 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -144,6 +144,7 @@ [LibraryClasses.common] PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf=0D PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf=0D PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf= =0D + PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostB= ridgeUtilityLib.inf=0D =0D # USB Libraries=0D UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf=0D diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf= b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf index 277ccfd24546..97e9368c8e9f 100644 --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf +++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf @@ -31,6 +31,7 @@ [Packages] ArmVirtPkg/ArmVirtPkg.dec=0D MdeModulePkg/MdeModulePkg.dec=0D MdePkg/MdePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D =0D [LibraryClasses]=0D DebugLib=0D @@ -38,6 +39,7 @@ [LibraryClasses] DxeServicesTableLib=0D MemoryAllocationLib=0D PciPcdProducerLib=0D + PciHostBridgeUtilityLib=0D =0D [FixedPcd]=0D gArmTokenSpaceGuid.PcdPciMmio32Translation=0D diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c b= /ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c index 496b192d2291..3952f511b4d2 100644 --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c +++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c @@ -14,6 +14,7 @@ #include =0D #include =0D #include =0D +#include =0D =0D #include =0D #include =0D @@ -51,9 +52,6 @@ STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeD= evicePath =3D { };=0D =0D GLOBAL_REMOVE_IF_UNREFERENCED=0D -CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] =3D {=0D - L"Mem", L"I/O", L"Bus"=0D -};=0D =0D //=0D // We expect the "ranges" property of "pci-host-ecam-generic" to consist o= f=0D @@ -414,60 +412,3 @@ PciHostBridgeFreeRootBridges ( ASSERT (Count =3D=3D 1);=0D }=0D =0D -/**=0D - Inform the platform that the resource conflict happens.=0D -=0D - @param HostBridgeHandle Handle of the Host Bridge.=0D - @param Configuration Pointer to PCI I/O and PCI memory resource=0D - descriptors. The Configuration contains the reso= urces=0D - for all the root bridges. The resource for each = root=0D - bridge is terminated with END descriptor and an= =0D - additional END is appended indicating the end of= the=0D - entire resources. The resource descriptor field= =0D - values follow the description in=0D - EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL= =0D - .SubmitResources().=0D -**/=0D -VOID=0D -EFIAPI=0D -PciHostBridgeResourceConflict (=0D - EFI_HANDLE HostBridgeHandle,=0D - VOID *Configuration=0D - )=0D -{=0D - EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;=0D - UINTN RootBridgeIndex;=0D - DEBUG ((EFI_D_ERROR, "PciHostBridge: Resource conflict happens!\n"));=0D -=0D - RootBridgeIndex =3D 0;=0D - Descriptor =3D (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;=0D - while (Descriptor->Desc =3D=3D ACPI_ADDRESS_SPACE_DESCRIPTOR) {=0D - DEBUG ((EFI_D_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));=0D - for (; Descriptor->Desc =3D=3D ACPI_ADDRESS_SPACE_DESCRIPTOR; Descript= or++) {=0D - ASSERT (Descriptor->ResType <=0D - (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /=0D - sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0])=0D - )=0D - );=0D - DEBUG ((EFI_D_ERROR, " %s: Length/Alignment =3D 0x%lx / 0x%lx\n",=0D - mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType= ],=0D - Descriptor->AddrLen, Descriptor->AddrRangeMax=0D - ));=0D - if (Descriptor->ResType =3D=3D ACPI_ADDRESS_SPACE_TYPE_MEM) {=0D - DEBUG ((EFI_D_ERROR, " Granularity/SpecificFlag =3D %ld / %02x= %s\n",=0D - Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag= ,=0D - ((Descriptor->SpecificFlag &=0D - EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETC= HABLE=0D - ) !=3D 0) ? L" (Prefetchable)" : L""=0D - ));=0D - }=0D - }=0D - //=0D - // Skip the END descriptor for root bridge=0D - //=0D - ASSERT (Descriptor->Desc =3D=3D ACPI_END_TAG_DESCRIPTOR);=0D - Descriptor =3D (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(=0D - (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1=0D - );=0D - }=0D -}=0D --=20 2.28.0