]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h
IntelSiliconPkg/Include: Add PlatformVtdPolicy Protocol
[mirror_edk2.git] / IntelSiliconPkg / Include / Protocol / PlatformVtdPolicy.h
diff --git a/IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h b/IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h
new file mode 100644 (file)
index 0000000..29774c1
--- /dev/null
@@ -0,0 +1,100 @@
+/** @file\r
+  The definition for platform VTD policy.\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
+\r
+**/\r
+\r
+#ifndef __PLATFORM_VTD_POLICY_PROTOCOL_H__\r
+#define __PLATFORM_VTD_POLICY_PROTOCOL_H__\r
+\r
+#include <IndustryStandard/Vtd.h>\r
+\r
+#define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \\r
+    { \\r
+      0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \\r
+    }\r
+\r
+typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL  EDKII_PLATFORM_VTD_POLICY_PROTOCOL;\r
+\r
+#define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000\r
+\r
+typedef struct {\r
+  UINT16                                   Segment;\r
+  VTD_SOURCE_ID                            SourceId;\r
+} EDKII_PLATFORM_VTD_DEVICE_INFO;\r
+\r
+/**\r
+  Get the VTD SourceId from the device handler.\r
+  This function is required for non PCI device handler.\r
+\r
+  Pseudo-algo in Intel VTd driver:\r
+    Status = PlatformGetVTdDeviceId ();\r
+    if (EFI_ERROR(Status)) {\r
+      if (DeviceHandle is PCI) {\r
+        Get SourceId from Bus/Device/Function\r
+      } else {\r
+        return EFI_UNSUPPORTED\r
+      }\r
+    }\r
+    Get VTd engine by Segment/Bus/Device/Function.\r
+\r
+  @param[in]  This                  The protocol instance pointer.\r
+  @param[in]  DeviceHandle          Device Identifier in UEFI.\r
+  @param[out] DeviceInfo            DeviceInfo for indentify the VTd engine in ACPI Table\r
+                                    and the VTd page entry.\r
+\r
+  @retval EFI_SUCCESS           The VtdIndex and SourceId are returned.\r
+  @retval EFI_INVALID_PARAMETER DeviceHandle is not a valid handler.\r
+  @retval EFI_INVALID_PARAMETER DeviceInfo is NULL.\r
+  @retval EFI_NOT_FOUND         The Segment or SourceId information is NOT found.\r
+  @retval EFI_UNSUPPORTED       This function is not supported.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID) (\r
+  IN  EDKII_PLATFORM_VTD_POLICY_PROTOCOL       *This,\r
+  IN  EFI_HANDLE                               DeviceHandle,\r
+  OUT EDKII_PLATFORM_VTD_DEVICE_INFO           *DeviceInfo\r
+  );\r
+\r
+/**\r
+  Get a list of the exception devices.\r
+\r
+  The VTd driver should always set ALLOW for the device in this list.\r
+\r
+  @param[in]  This                  The protocol instance pointer.\r
+  @param[out] DeviceInfoCount       The count of the list of DeviceInfo.\r
+  @param[out] DeviceInfo            A callee allocated buffer to hold a list of DeviceInfo.\r
+\r
+  @retval EFI_SUCCESS           The DeviceInfoCount and DeviceInfo are returned.\r
+  @retval EFI_INVALID_PARAMETER DeviceInfoCount is NULL, or DeviceInfo is NULL.\r
+  @retval EFI_UNSUPPORTED       This function is not supported.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST) (\r
+  IN  EDKII_PLATFORM_VTD_POLICY_PROTOCOL       *This,\r
+  OUT UINTN                                    *DeviceInfoCount,\r
+  OUT EDKII_PLATFORM_VTD_DEVICE_INFO           **DeviceInfo\r
+  );\r
+\r
+struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL {\r
+  UINT64                                               Revision;\r
+  EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID              GetDeviceId;\r
+  EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST  GetExceptionDeviceList;\r
+};\r
+\r
+extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid;\r
+\r
+#endif\r
+\r