]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/IntelVTdDxe/DmarAcpiTable.c
IntelSiliconPkg/IntelVTd: update PlatformVtdPolicy
[mirror_edk2.git] / IntelSiliconPkg / IntelVTdDxe / DmarAcpiTable.c
index 84b5485af4f1f8d937b7f9daa86d28e457adc765..2456b0c48ff19f93848a3965ae85e205948baada 100644 (file)
@@ -49,7 +49,11 @@ DumpDmarDeviceScopeEntry (
 \r
   DEBUG ((DEBUG_INFO,\r
     "    *************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "    *       DMA-Remapping Device Scope Entry Structure                      *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "    *************************************************************************\n"\r
     ));\r
   DEBUG ((DEBUG_INFO,\r
@@ -140,7 +144,11 @@ DumpDmarAndd (
 \r
   DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  *       ACPI Name-space Device Declaration Structure                      *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
     ));\r
   DEBUG ((DEBUG_INFO,\r
@@ -189,7 +197,11 @@ DumpDmarRhsa (
 \r
   DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  *       Remapping Hardware Status Affinity Structure                      *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
     ));\r
   DEBUG ((DEBUG_INFO,\r
@@ -241,7 +253,11 @@ DumpDmarAtsr (
 \r
   DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  *       Root Port ATS Capability Reporting Structure                      *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
     ));\r
   DEBUG ((DEBUG_INFO,\r
@@ -305,7 +321,11 @@ DumpDmarRmrr (
 \r
   DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  *       Reserved Memory Region Reporting Structure                        *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
     ));\r
   DEBUG ((DEBUG_INFO,\r
@@ -369,7 +389,11 @@ DumpDmarDrhd (
 \r
   DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  *       DMA-Remapping Hardware Definition Structure                       *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "  ***************************************************************************\n"\r
     ));\r
   DEBUG ((DEBUG_INFO,\r
@@ -440,7 +464,11 @@ DumpAcpiDMAR (
   //\r
   DEBUG ((DEBUG_INFO,\r
     "*****************************************************************************\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "*         DMAR Table                                                        *\n"\r
+    ));\r
+  DEBUG ((DEBUG_INFO,\r
     "*****************************************************************************\n"\r
     ));\r
 \r
@@ -548,11 +576,11 @@ GetPciBusDeviceFunction (
   switch (DmarDevScopeEntry->Type) {\r
   case EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_PCI_ENDPOINT:\r
   case EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_PCI_BRIDGE:\r
-    while ((UINTN)DmarPciPath < (UINTN)DmarDevScopeEntry + DmarDevScopeEntry->Length) {\r
+    while ((UINTN)DmarPciPath + sizeof(EFI_ACPI_DMAR_PCI_PATH) < (UINTN)DmarDevScopeEntry + DmarDevScopeEntry->Length) {\r
       MyBus = PciSegmentRead8 (PCI_SEGMENT_LIB_ADDRESS(Segment, MyBus, MyDevice, MyFunction, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET));\r
+      DmarPciPath ++;\r
       MyDevice = DmarPciPath->Device;\r
       MyFunction = DmarPciPath->Function;\r
-      DmarPciPath ++;\r
     }\r
     break;\r
   case EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_IOAPIC:\r
@@ -589,7 +617,6 @@ ProcessDhrd (
   UINT8                                             SecondaryBusNumber;\r
   EFI_STATUS                                        Status;\r
   VTD_SOURCE_ID                                     SourceId;\r
-  BOOLEAN                                           IsRealPciDevice;\r
 \r
   mVtdUnitInformation[VtdIndex].VtdUnitBaseAddress = (UINTN)DmarDrhd->RegisterBaseAddress;\r
   DEBUG ((DEBUG_INFO,"  VTD (%d) BaseAddress -  0x%016lx\n", VtdIndex, DmarDrhd->RegisterBaseAddress));\r
@@ -600,7 +627,7 @@ ProcessDhrd (
     mVtdUnitInformation[VtdIndex].PciDeviceInfo.IncludeAllFlag = TRUE;\r
     DEBUG ((DEBUG_INFO,"  ProcessDhrd: with INCLUDE ALL\n"));\r
 \r
-    Status = ScanPciBus(VtdIndex, DmarDrhd->SegmentNumber, 0);\r
+    Status = ScanPciBus((VOID *)VtdIndex, DmarDrhd->SegmentNumber, 0, ScanBusCallbackRegisterPciDevice);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -616,15 +643,6 @@ ProcessDhrd (
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-    switch (DmarDevScopeEntry->Type) {\r
-    case EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_PCI_ENDPOINT:\r
-    case EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_PCI_BRIDGE:\r
-      IsRealPciDevice = TRUE;\r
-      break;\r
-    default:\r
-      IsRealPciDevice = FALSE;\r
-      break;\r
-    }\r
 \r
     DEBUG ((DEBUG_INFO,"  ProcessDhrd: "));\r
     switch (DmarDevScopeEntry->Type) {\r
@@ -650,7 +668,7 @@ ProcessDhrd (
     SourceId.Bits.Device = Device;\r
     SourceId.Bits.Function = Function;\r
 \r
-    Status = RegisterPciDevice (VtdIndex, DmarDrhd->SegmentNumber, SourceId, IsRealPciDevice, TRUE);\r
+    Status = RegisterPciDevice (VtdIndex, DmarDrhd->SegmentNumber, SourceId, DmarDevScopeEntry->Type, TRUE);\r
     if (EFI_ERROR (Status)) {\r
       //\r
       // There might be duplication for special device other than standard PCI device.\r
@@ -665,7 +683,7 @@ ProcessDhrd (
     switch (DmarDevScopeEntry->Type) {\r
     case EFI_ACPI_DEVICE_SCOPE_ENTRY_TYPE_PCI_BRIDGE:\r
       SecondaryBusNumber = PciSegmentRead8 (PCI_SEGMENT_LIB_ADDRESS(DmarDrhd->SegmentNumber, Bus, Device, Function, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET));\r
-      Status = ScanPciBus (VtdIndex, DmarDrhd->SegmentNumber, SecondaryBusNumber);\r
+      Status = ScanPciBus ((VOID *)VtdIndex, DmarDrhd->SegmentNumber, SecondaryBusNumber, ScanBusCallbackRegisterPciDevice);\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r