/** @file\r
The definition for DMA access Library.\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
#ifndef __DMA_ACCESS_LIB_H__\r
#define __DMA_ACCESS_LIB_H__\r
\r
+typedef struct {\r
+ EFI_ACPI_DMAR_HEADER *AcpiDmarTable;\r
+ UINT64 EngineMask;\r
+ UINT8 HostAddressWidth;\r
+ UINTN VTdEngineCount;\r
+ UINT64 VTdEngineAddress[1];\r
+} VTD_INFO;\r
+\r
/**\r
Set DMA protected region.\r
\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
@param LowMemoryBase The protected low memory region base.\r
@param LowMemoryLength The protected low memory region length.\r
@param HighMemoryBase The protected high memory region base.\r
**/\r
EFI_STATUS\r
SetDmaProtectedRange (\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask,\r
IN UINT32 LowMemoryBase,\r
IN UINT32 LowMemoryLength,\r
IN UINT64 HighMemoryBase,\r
/**\r
Diable DMA protection.\r
\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
+\r
@retval DMA protection is disabled.\r
**/\r
EFI_STATUS\r
DisableDmaProtection (\r
- VOID\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask\r
+ );\r
+\r
+/**\r
+ Return if the DMA protection is enabled.\r
+\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
+\r
+ @retval TRUE DMA protection is enabled in at least one VTd engine.\r
+ @retval FALSE DMA protection is disabled in all VTd engines.\r
+**/\r
+UINT64\r
+GetDmaProtectionEnabledEngineMask (\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask\r
);\r
\r
/**\r
Get protected low memory alignment.\r
\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
+\r
@return protected low memory alignment.\r
**/\r
UINT32\r
GetLowMemoryAlignment (\r
- VOID\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask\r
);\r
\r
/**\r
Get protected high memory alignment.\r
\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
+\r
@return protected high memory alignment.\r
**/\r
UINT64\r
GetHighMemoryAlignment (\r
- VOID\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask\r
+ );\r
+\r
+/**\r
+ Enable VTd translation table protection.\r
+\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
+**/\r
+VOID\r
+EnableVTdTranslationProtection (\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask\r
);\r
\r
+/**\r
+ Disable VTd translation table protection.\r
+\r
+ @param VTdInfo The VTd engine context information.\r
+ @param EngineMask The mask of the VTd engine to be accessed.\r
+**/\r
+VOID\r
+DisableVTdTranslationProtection (\r
+ IN VTD_INFO *VTdInfo,\r
+ IN UINT64 EngineMask\r
+ );\r
+\r
+/**\r
+ Parse DMAR DRHD table.\r
+\r
+ @param[in] AcpiDmarTable DMAR ACPI table\r
+\r
+ @return EFI_SUCCESS The DMAR DRHD table is parsed.\r
+**/\r
+EFI_STATUS\r
+ParseDmarAcpiTableDrhd (\r
+ IN EFI_ACPI_DMAR_HEADER *AcpiDmarTable\r
+ );\r
+\r
+/**\r
+ Parse DMAR DRHD table.\r
+\r
+ @param VTdInfo The VTd engine context information.\r
+**/\r
+VOID\r
+ParseDmarAcpiTableRmrr (\r
+ IN VTD_INFO *VTdInfo\r
+ );\r
+\r
+/**\r
+ Dump DMAR ACPI table.\r
+\r
+ @param[in] Dmar DMAR ACPI table\r
+**/\r
+VOID\r
+DumpAcpiDMAR (\r
+ IN EFI_ACPI_DMAR_HEADER *Dmar\r
+ );\r
+\r
+extern EFI_GUID mVTdInfoGuid;\r
+\r
#endif\r
\r