]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmaProtection.h
IntelSiliconPkg IntelVTdDxe: Support early SetAttributes()
[mirror_edk2.git] / IntelSiliconPkg / Feature / VTd / IntelVTdDxe / DmaProtection.h
index bc14ff9a6631fa3b214c5cc86cc370951bc180c7..767531e4a93ff99f2668d8c8079779746ed2bcc6 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -84,6 +84,21 @@ typedef struct {
   PCI_DEVICE_INFORMATION           PciDeviceInfo;\r
 } VTD_UNIT_INFORMATION;\r
 \r
+//\r
+// This is the initial max ACCESS request.\r
+// The number may be enlarged later.\r
+//\r
+#define MAX_VTD_ACCESS_REQUEST      0x100\r
+\r
+typedef struct {\r
+  UINT16                Segment;\r
+  VTD_SOURCE_ID         SourceId;\r
+  UINT64                BaseAddress;\r
+  UINT64                Length;\r
+  UINT64                IoMmuAccess;\r
+} VTD_ACCESS_REQUEST;\r
+\r
+\r
 /**\r
   The scan bus callback function.\r
 \r
@@ -561,4 +576,33 @@ GetPciBusDeviceFunction (
   OUT UINT8                                       *Function\r
   );\r
 \r
+/**\r
+  Append VTd Access Request to global.\r
+\r
+  @param[in]  Segment           The Segment used to identify a VTd engine.\r
+  @param[in]  SourceId          The SourceId used to identify a VTd engine and table entry.\r
+  @param[in]  BaseAddress       The base of device memory address to be used as the DMA memory.\r
+  @param[in]  Length            The length of device memory address to be used as the DMA memory.\r
+  @param[in]  IoMmuAccess       The IOMMU access.\r
+\r
+  @retval EFI_SUCCESS           The IoMmuAccess is set for the memory range specified by BaseAddress and Length.\r
+  @retval EFI_INVALID_PARAMETER BaseAddress is not IoMmu Page size aligned.\r
+  @retval EFI_INVALID_PARAMETER Length is not IoMmu Page size aligned.\r
+  @retval EFI_INVALID_PARAMETER Length is 0.\r
+  @retval EFI_INVALID_PARAMETER IoMmuAccess specified an illegal combination of access.\r
+  @retval EFI_UNSUPPORTED       The bit mask of IoMmuAccess is not supported by the IOMMU.\r
+  @retval EFI_UNSUPPORTED       The IOMMU does not support the memory range specified by BaseAddress and Length.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to modify the IOMMU access.\r
+  @retval EFI_DEVICE_ERROR      The IOMMU device reported an error while attempting the operation.\r
+\r
+**/\r
+EFI_STATUS\r
+RequestAccessAttribute (\r
+  IN UINT16                 Segment,\r
+  IN VTD_SOURCE_ID          SourceId,\r
+  IN UINT64                 BaseAddress,\r
+  IN UINT64                 Length,\r
+  IN UINT64                 IoMmuAccess\r
+  );\r
+\r
 #endif\r