]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/IntelVTdDxe/DmaProtection.h
IntelSiliconPkg/IntelVTdDxe: Improve performance.
[mirror_edk2.git] / IntelSiliconPkg / IntelVTdDxe / DmaProtection.h
index 8cfa69cb2364a670e77bc7f95b4cceb3c302cf56..c3b57a03bb424ebd41771584f0d6e260b5d4d84e 100644 (file)
@@ -25,6 +25,9 @@
 #include <Library/PciSegmentLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiLib.h>\r
+#include <Library/CacheMaintenanceLib.h>\r
+#include <Library/PerformanceLib.h>\r
+#include <Library/PrintLib.h>\r
 \r
 #include <Guid/EventGroup.h>\r
 #include <Guid/Acpi.h>\r
@@ -58,6 +61,8 @@ typedef struct {
   UINTN                  PciDescriptorMaxNumber;\r
   BOOLEAN                *IsRealPciDevice;\r
   VTD_SOURCE_ID          *PciDescriptors;\r
+  // for statistic analysis\r
+  UINTN                  *AccessCount;\r
 } PCI_DEVICE_INFORMATION;\r
 \r
 typedef struct {\r
@@ -68,6 +73,7 @@ typedef struct {
   VTD_ROOT_ENTRY                   *RootEntryTable;\r
   VTD_EXT_ROOT_ENTRY               *ExtRootEntryTable;\r
   VTD_SECOND_LEVEL_PAGING_ENTRY    *FixedSecondLevelPagingEntry;\r
+  BOOLEAN                          HasDirtyContext;\r
   BOOLEAN                          HasDirtyPages;\r
   PCI_DEVICE_INFORMATION           PciDeviceInfo;\r
 } VTD_UNIT_INFORMATION;\r
@@ -124,40 +130,6 @@ DisableDmar (
   VOID\r
   );\r
 \r
-/**\r
-  Invalid VTd IOTLB page.\r
-\r
-  @param[in]  VtdIndex              The index of VTd engine.\r
-  @param[in]  Address               The address of IOTLB page.\r
-  @param[in]  AddressMode           The address mode of IOTLB page.\r
-  @param[in]  DomainIdentifier      The domain ID of the source.\r
-\r
-  @retval EFI_SUCCESS           VTd IOTLB page is invalidated.\r
-  @retval EFI_DEVICE_ERROR      VTd IOTLB page is not invalidated.\r
-**/\r
-EFI_STATUS\r
-InvalidateVtdIOTLBPage (\r
-  IN UINTN  VtdIndex,\r
-  IN UINT64 Address,\r
-  IN UINT8  AddressMode,\r
-  IN UINT16 DomainIdentifier\r
-  );\r
-\r
-/**\r
-  Invalid VTd IOTLB domain.\r
-\r
-  @param[in]  VtdIndex              The index of VTd engine.\r
-  @param[in]  DomainIdentifier      The domain ID of the source.\r
-\r
-  @retval EFI_SUCCESS           VTd IOTLB domain is invalidated.\r
-  @retval EFI_DEVICE_ERROR      VTd IOTLB domain is not invalidated.\r
-**/\r
-EFI_STATUS\r
-InvalidateVtdIOTLBDomain (\r
-  IN UINTN  VtdIndex,\r
-  IN UINT16 DomainIdentifier\r
-  );\r
-\r
 /**\r
   Invalid VTd global IOTLB.\r
 \r
@@ -362,6 +334,7 @@ DumpSecondLevelPagingEntry (
 EFI_STATUS\r
 SetPageAttribute (\r
   IN UINTN                         VtdIndex,\r
+  IN UINT16                        DomainIdentifier,\r
   IN VTD_SECOND_LEVEL_PAGING_ENTRY *SecondLevelPagingEntry,\r
   IN UINT64                        BaseAddress,\r
   IN UINT64                        Length,\r
@@ -500,4 +473,20 @@ AllocateZeroPages (
   IN UINTN  Pages\r
   );\r
 \r
+/**\r
+  Flush VTD page table and context table memory.\r
+\r
+  This action is to make sure the IOMMU engine can get final data in memory.\r
+\r
+  @param[in]  VtdIndex          The index used to identify a VTd engine.\r
+  @param[in]  Base              The base address of memory to be flushed.\r
+  @param[in]  Size              The size of memory in bytes to be flushed.\r
+**/\r
+VOID\r
+FlushPageTableMemory (\r
+  IN UINTN  VtdIndex,\r
+  IN UINTN  Base,\r
+  IN UINTN  Size\r
+  );\r
+\r
 #endif\r