public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiewen Yao <jiewen.yao@intel.com>
To: edk2-devel@lists.01.org
Cc: Star Zeng <star.zeng@intel.com>
Subject: [PATCH 2/7] IntelSiliconPkg/Include: Add PlatformVtdPolicy Protocol
Date: Tue, 18 Jul 2017 15:51:32 +0800	[thread overview]
Message-ID: <1500364297-17072-3-git-send-email-jiewen.yao@intel.com> (raw)
In-Reply-To: <1500364297-17072-1-git-send-email-jiewen.yao@intel.com>

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h | 100 ++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h b/IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h
new file mode 100644
index 0000000..1bd9365
--- /dev/null
+++ b/IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h
@@ -0,0 +1,100 @@
+/** @file
+  The definition for platform VTD policy.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __PLATFORM_VTD_POLICY_PROTOCOL_H__
+#define __PLATFORM_VTD_POLICY_PROTOCOL_H__
+
+#include <IndustryStandard/Vtd.h>
+
+#define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \
+    { \
+      0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \
+    }
+
+typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL  EDKII_PLATFORM_VTD_POLICY_PROTOCOL;
+
+#define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000
+
+typedef struct {
+  UINT16                                   Segment;
+  VTD_SOURCE_ID                            SourceId;
+} EDKII_PLATFORM_VTD_DEVICE_INFO;
+
+/**
+  Get the VTD SourceId from the device handler.
+  This function is required for non PCI device handler.
+
+  Pseudo-algo in Intel VTd driver:
+    Status = PlatformGetVTdDeviceId ();
+    if (EFI_ERROR(Status)) {
+      if (DeviceHandle is PCI) {
+        Get SourceId from Bus/Device/Function
+      } else {
+        return EFI_UNSUPPORTED
+      }
+    }
+    Get VTd engine by Segment/Bus/Device/Function.
+
+  @param[in]  This                  The protocol instance pointer.
+  @param[in]  DeviceHandle          Device Identifier in UEFI.
+  @param[out] DeviceInfo            DeviceInfo for indentify the VTd engine in ACPI Table
+                                    and the VTd page entry.
+
+  @retval EFI_SUCCESS           The VtdIndex and SourceId are returned.
+  @retval EFI_INVALID_PARAMETER DeviceHandle is not a valid handler.
+  @retval EFI_INVALID_PARAMETER DeviceInfo is NULL.
+  @retval EFI_NOT_FOUND         The Segment or SourceId information is NOT found.
+  @retval EFI_UNSUPPORTED       This function is not supported.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID) (
+  IN  EDKII_PLATFORM_VTD_POLICY_PROTOCOL       *This,
+  IN  EFI_HANDLE                               DeviceHandle,
+  OUT EDKII_PLATFORM_VTD_DEVICE_INFO           *DeviceInfo
+  );
+
+/**
+  Get a list of handles for the exception devices.
+
+  The VTd driver should always set ALLOW for the device in this list.
+
+  @param[in]  This                  The protocol instance pointer.
+  @param[out] DeviceInfoCount       The count of the list of DeviceInfo.
+  @param[out] DeviceInfo            A callee allocated buffer to hold a list of DeviceInfo.
+
+  @retval EFI_SUCCESS           The DeviceInfoCount and DeviceInfo are returned.
+  @retval EFI_INVALID_PARAMETER DeviceInfoCount is NULL, or DeviceInfo is NULL.
+  @retval EFI_UNSUPPORTED       This function is not supported.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST) (
+  IN  EDKII_PLATFORM_VTD_POLICY_PROTOCOL       *This,
+  OUT UINTN                                    *DeviceInfoCount,
+  OUT EDKII_PLATFORM_VTD_DEVICE_INFO           **DeviceInfo
+  );
+
+struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL {
+  UINT64                                               Revision;
+  EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID              GetDeviceId;
+  EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST  GetExceptionDeviceList;
+};
+
+extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid;
+
+#endif
+
-- 
2.7.4.windows.1



  parent reply	other threads:[~2017-07-18  7:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18  7:51 [PATCH 0/7] Add VTd as IOMMU for UEFI Jiewen Yao
2017-07-18  7:51 ` [PATCH 1/7] IntelSiliconPkg/Include: Add VTD industry standard Jiewen Yao
2017-07-18  7:51 ` Jiewen Yao [this message]
2017-07-26  8:36   ` [PATCH 2/7] IntelSiliconPkg/Include: Add PlatformVtdPolicy Protocol Zeng, Star
2017-07-18  7:51 ` [PATCH 3/7] IntelSiliconPkg/Dec: Add ProtocolGuid Jiewen Yao
2017-07-18  7:51 ` [PATCH 4/7] IntelSiliconPkg: Add VTd driver Jiewen Yao
2017-07-18  7:51 ` [PATCH 5/7] IntelSiliconPkg/dsc: Add Vtd driver Jiewen Yao
2017-07-18  7:51 ` [PATCH 6/7] IntelSiliconPkg: Add PlatformVTdSample driver Jiewen Yao
2017-07-18  7:51 ` [PATCH 7/7] IntelSiliconPkg/dsc: Add PlatformVtd sample driver Jiewen Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1500364297-17072-3-git-send-email-jiewen.yao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox