* [PATCH] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root Bus
@ 2021-10-18 8:38 Sheng Wei
0 siblings, 0 replies; only message in thread
From: Sheng Wei @ 2021-10-18 8:38 UTC (permalink / raw)
To: devel
Cc: Robert Kowalewski, Jenny Huang, Ray Ni, Rangasai V Chaganty,
Albecki, Mateusz
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
Change-Id: I0c647d03dff574d1d2a12e7c8a1426d29217fa5c
Signed-off-by: Robert Kowalewski <robert.kowalewski@intel.com>
Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Jenny Huang <jenny.huang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Cc: Robert Kowalewski <robert.kowalewski@intel.com>
Cc: Albecki, Mateusz <mateusz.albecki@intel.com>
---
.../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/DmaProtection.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/DmarAcpiTable.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.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
[Guids]
gEfiEventExitBootServicesGuid ## CONSUMES ## Event
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-18 8:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-18 8:38 [PATCH] IntelSiliconPkg/IntelVTdDxe: Support Multi PCI Root Bus Sheng Wei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox