Hi Ray, Thank you for sharing the solution. I am worrying on this issue now. I have found some produce did not support this lib. I will update the patch. BR Sheng Wei
> -----Original Message----- > From: Ni, Ray <[email protected]> > Sent: 2021年10月20日 8:29 > To: Sheng, W <[email protected]>; [email protected] > Cc: Kowalewski, Robert <[email protected]>; Huang, Jenny > <[email protected]>; Chaganty, Rangasai V > <[email protected]>; Albecki, Mateusz > <[email protected]> > Subject: RE: [PATCH v2] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root > Bus > > Can you rely on the PciRootBridgeIo protocol instances instead of this > library? > > It will make the driver usable in platforms that don't produce the > PciHostBridgeLib. > > Thanks, > Rya > > > -----Original Message----- > > From: Sheng, W <[email protected]> > > Sent: Monday, October 18, 2021 4:43 PM > > To: [email protected] > > Cc: Kowalewski, Robert <[email protected]>; Huang, Jenny > > <[email protected]>; Ni, Ray <[email protected]>; Chaganty, > > Rangasai V <[email protected]>; Albecki, Mateusz > > <[email protected]> > > Subject: [PATCH v2] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI > > Root Bus > > > > 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=3695 > > > > Signed-off-by: Robert Kowalewski <[email protected]> > > Signed-off-by: Sheng Wei <[email protected]> > > Cc: Jenny Huang <[email protected]> > > Cc: Ray Ni <[email protected]> > > Cc: Rangasai V Chaganty <[email protected]> > > Cc: Robert Kowalewski <[email protected]> > > Cc: Albecki Mateusz <[email protected]> > > --- > > .../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/DmaProtection. > > h > > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection. > > h > > index a24fbc37..97061de5 100644 > > --- > > a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection. > > h > > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtect > > +++ ion.h > > @@ -23,6 +23,7 @@ > > #include <Library/PerformanceLib.h> > > #include <Library/PrintLib.h> > > #include <Library/ReportStatusCodeLib.h> > > +#include <Library/PciHostBridgeLib.h> > > > > #include <Guid/EventGroup.h> > > #include <Guid/Acpi.h> > > diff --git > > a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable. > > c > > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable. > > c > > index 2d9b4374..e717aeb2 100644 > > --- > > a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable. > > c > > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTa > > +++ ble.c > > @@ -682,6 +682,9 @@ ProcessDhrd ( > > UINT8 SecondaryBusNumber; > > EFI_STATUS Status; > > VTD_SOURCE_ID SourceId; > > + PCI_ROOT_BRIDGE *RootBridges; > > + UINTN RootBridgeCount; > > + UINTN Index; > > > > mVtdUnitInformation[VtdIndex].VtdUnitBaseAddress = > (UINTN)DmarDrhd->RegisterBaseAddress; > > DEBUG ((DEBUG_INFO," VTD (%d) BaseAddress - 0x%016lx\n", > > VtdIndex, DmarDrhd->RegisterBaseAddress)); @@ -692,9 +695,17 @@ > ProcessDhrd ( > > mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag = TRUE; > > DEBUG ((DEBUG_INFO," ProcessDhrd: with INCLUDE ALL\n")); > > > > - Status = ScanPciBus((VOID *)VtdIndex, DmarDrhd->SegmentNumber, 0, > ScanBusCallbackRegisterPciDevice); > > - if (EFI_ERROR (Status)) { > > - return Status; > > + RootBridges = PciHostBridgeGetRootBridges (&RootBridgeCount); > > + if ((RootBridges == NULL) || (RootBridgeCount == 0)) { > > + return EFI_UNSUPPORTED; > > + } > > + DEBUG ((DEBUG_INFO,"Find %d root bridges\n", RootBridgeCount)); > > + for (Index = 0; Index < RootBridgeCount; Index++) { > > + DEBUG ((DEBUG_INFO,"Scan root bridges : %d, Segment : %d, Bus : > > + 0x%02X\n", Index, RootBridges[Index].Segment, > > RootBridges[Index].Bus.Base)); > > + Status = ScanPciBus((VOID *)VtdIndex, (UINT16) > > + RootBridges[Index].Segment, (UINT8) RootBridges[Index].Bus.Base, > > ScanBusCallbackRegisterPciDevice); > > + if (EFI_ERROR (Status)) { > > + return Status; > > + } > > } > > } else { > > mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag = > > FALSE; diff --git > > a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.in > > f > > b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.in > > f > > index 220636ad..25ff86f4 100644 > > --- > > a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.in > > f > > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDx > > +++ e.inf > > @@ -55,6 +55,7 @@ > > PerformanceLib > > PrintLib > > ReportStatusCodeLib > > + PciHostBridgeLib > > > > [Guids] > > gEfiEventExitBootServicesGuid ## CONSUMES ## Event > > -- > > 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82400): https://edk2.groups.io/g/devel/message/82400 Mute This Topic: https://groups.io/mt/86408993/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
