/** @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
#include <Protocol/PciRootBridgeIo.h>\r
#include <Protocol/PciIo.h>\r
#include <Protocol/PciEnumerationComplete.h>\r
-#include <Protocol/AcpiSystemDescriptionTable.h>\r
#include <Protocol/PlatformVtdPolicy.h>\r
#include <Protocol/IoMmu.h>\r
\r
#define ALIGN_VALUE_UP(Value, Alignment) (((Value) + (Alignment) - 1) & (~((Alignment) - 1)))\r
#define ALIGN_VALUE_LOW(Value, Alignment) ((Value) & (~((Alignment) - 1)))\r
\r
+#define VTD_TPL_LEVEL TPL_NOTIFY\r
+\r
//\r
// This is the initial max PCI DATA number.\r
// The number may be enlarged later.\r
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
\r
extern EFI_ACPI_DMAR_HEADER *mAcpiDmarTable;\r
\r
-extern UINT64 mVtdHostAddressWidthMask;\r
extern UINTN mVtdUnitNumber;\r
extern VTD_UNIT_INFORMATION *mVtdUnitInformation;\r
\r
/**\r
Get the DMAR ACPI table.\r
\r
- @retval EFI_SUCCESS The DMAR ACPI table is got.\r
- @retval EFI_NOT_FOUND The DMAR ACPI table is not found.\r
+ @retval EFI_SUCCESS The DMAR ACPI table is got.\r
+ @retval EFI_ALREADY_STARTED The DMAR ACPI table has been got previously.\r
+ @retval EFI_NOT_FOUND The DMAR ACPI table is not found.\r
**/\r
EFI_STATUS\r
GetDmarAcpiTable (\r
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