]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.h
IntelSiliconPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelSiliconPkg / Feature / VTd / IntelVTdPmrPei / IntelVTdPmrPei.h
index 720f5d42c35f2073e24dcc9ed41ac625b912d9d5..58e6afad082fb7d5167c157725e9cf33988b6d1f 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   The definition for DMA access Library.\r
 \r
-  Copyright (c) 2017, 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
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -16,6 +10,8 @@
 #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
@@ -24,6 +20,7 @@ typedef struct {
 /**\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
@@ -35,6 +32,7 @@ typedef struct {
 **/\r
 EFI_STATUS\r
 SetDmaProtectedRange (\r
+  IN VTD_INFO      *VTdInfo,\r
   IN UINT64        EngineMask,\r
   IN UINT32        LowMemoryBase,\r
   IN UINT32        LowMemoryLength,\r
@@ -45,38 +43,117 @@ SetDmaProtectedRange (
 /**\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
+  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
+  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
+  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