From nobody Mon May 6 04:51:24 2024 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+82216+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+82216+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1634546307; cv=none; d=zohomail.com; s=zohoarc; b=SUIBa+gLB9exKfZ5S/RJVX7Ie+usUDCqOSRqMjF0MjnyhFoNyhTjxEQnB+803NXbUpBqnbAmpYWlGQlgIzGtuZ8YzmXRsLKRpSyxm4ddLyhO4ncPoRI0GRo2fNQAyS6kLssTte/d/615YTW+kGD6M3dup3Wii/CUinfqXu0i6Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634546307; h=Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=MvX9LBmN1tZHkcYnuBnKNULajf0aGdjcPFbB64yaZ88=; b=NPdbVuN/vW18ClogoSedPDEy7/EF1Sj4LzLYrZ/yXjHQnZld8fg6XxoHyo7k/rfOHp4LKsbauEzwFG2j5o/JuQuGaISrnHMNyLmM70x8f/4tuO5uU53krU+Vn45g2WZ/MvEUdx7gr0cQx9l/lWY8mTX1DIdT8Ml48QM45S0Frlw= 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+82216+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634546307922911.9851077188194; Mon, 18 Oct 2021 01:38:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0uoQYY1788612xewth9QS2GJ; Mon, 18 Oct 2021 01:38:27 -0700 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web09.33520.1634546306479026148 for ; Mon, 18 Oct 2021 01:38:26 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10140"; a="228080388" X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="228080388" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 01:38:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,381,1624345200"; d="scan'208";a="629091245" X-Received: from shwdesssddpdwei.ccr.corp.intel.com ([10.239.157.43]) by fmsmga001.fm.intel.com with ESMTP; 18 Oct 2021 01:38:23 -0700 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Robert Kowalewski , Jenny Huang , Ray Ni , Rangasai V Chaganty , Albecki, Mateusz Subject: [edk2-devel] [PATCH] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root Bus Date: Mon, 18 Oct 2021 16:38:20 +0800 Message-Id: <20211018083820.1108-1-w.sheng@intel.com> Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,w.sheng@intel.com X-Gm-Message-State: nXVYaiQgBhr7XH01H7aljxkix1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634546307; bh=phiwvsJx69eEY2amE8VbBUu4FjuTIclxMYvJ95mKjNM=; h=Cc:Date:From:Reply-To:Subject:To; b=mm5RCsfh0UaE63TjHI2Vc1NsLKU3Ll/7sPw7p2uS4ED5Gj8qAhnBJwL2tKMQI9z1pYA HiQqUjhqN9bCXYYgYN26gsjisPS9npZDk82lmHjWaXIE3xdtaM6N1ys/M8ZjCRd7JraRB LQGejBt6so637sRMcaSupOm1xhdEUHbJxgw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634546308509100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some system may has multi PCI root bus. It needs to use function PciHostBridgeGetRootBridges () to get the root bus count. Then, scan each root bus to get all devices. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3695 Change-Id: I0c647d03dff574d1d2a12e7c8a1426d29217fa5c Signed-off-by: Robert Kowalewski Signed-off-by: Sheng Wei Cc: Jenny Huang Cc: Ray Ni Cc: Rangasai V Chaganty Cc: Robert Kowalewski Cc: Albecki, Mateusz --- .../Feature/VTd/IntelVTdDxe/DmaProtection.h | 1 + .../Feature/VTd/IntelVTdDxe/DmarAcpiTable.c | 17 +++++++++++++= +--- .../Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProte= ction.h b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtecti= on.h index a24fbc37..97061de5 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.h +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.h @@ -23,6 +23,7 @@ #include #include #include +#include =20 #include #include diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpi= Table.c b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTab= le.c index 2d9b4374..e717aeb2 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c @@ -682,6 +682,9 @@ ProcessDhrd ( UINT8 SecondaryBusNumber; EFI_STATUS Status; VTD_SOURCE_ID SourceId; + PCI_ROOT_BRIDGE *RootBridges; + UINTN RootBridgeCount; + UINTN Index; =20 mVtdUnitInformation[VtdIndex].VtdUnitBaseAddress =3D (UINTN)DmarDrhd->Re= gisterBaseAddress; DEBUG ((DEBUG_INFO," VTD (%d) BaseAddress - 0x%016lx\n", VtdIndex, Dma= rDrhd->RegisterBaseAddress)); @@ -692,9 +695,17 @@ ProcessDhrd ( mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag =3D TRUE; DEBUG ((DEBUG_INFO," ProcessDhrd: with INCLUDE ALL\n")); =20 - Status =3D ScanPciBus((VOID *)VtdIndex, DmarDrhd->SegmentNumber, 0, Sc= anBusCallbackRegisterPciDevice); - if (EFI_ERROR (Status)) { - return Status; + RootBridges =3D PciHostBridgeGetRootBridges (&RootBridgeCount); + if ((RootBridges =3D=3D NULL) || (RootBridgeCount =3D=3D 0)) { + return EFI_UNSUPPORTED; + } + DEBUG ((DEBUG_INFO,"Find %d root bridges\n", RootBridgeCount)); + for (Index =3D 0; Index < RootBridgeCount; Index++) { + DEBUG ((DEBUG_INFO,"Scan root bridges : %d, Segment : %d, Bus : 0x%0= 2X\n", Index, RootBridges[Index].Segment, RootBridges[Index].Bus.Base)); + Status =3D ScanPciBus((VOID *)VtdIndex, (UINT16) RootBridges[Index].= Segment, (UINT8) RootBridges[Index].Bus.Base, ScanBusCallbackRegisterPciDev= ice); + if (EFI_ERROR (Status)) { + return Status; + } } } else { mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag =3D FALSE; diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTd= Dxe.inf b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe= .inf index 220636ad..25ff86f4 100644 --- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf @@ -55,6 +55,7 @@ PerformanceLib PrintLib ReportStatusCodeLib + PciHostBridgeLib =20 [Guids] gEfiEventExitBootServicesGuid ## CONSUMES ## Event --=20 2.16.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 (#82216): https://edk2.groups.io/g/devel/message/82216 Mute This Topic: https://groups.io/mt/86408963/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-