]> git.proxmox.com Git - mirror_edk2.git/blob - IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h
29774c1b6acafdda0d280187111780105df7b3e6
[mirror_edk2.git] / IntelSiliconPkg / Include / Protocol / PlatformVtdPolicy.h
1 /** @file
2 The definition for platform VTD policy.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __PLATFORM_VTD_POLICY_PROTOCOL_H__
16 #define __PLATFORM_VTD_POLICY_PROTOCOL_H__
17
18 #include <IndustryStandard/Vtd.h>
19
20 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \
21 { \
22 0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \
23 }
24
25 typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL EDKII_PLATFORM_VTD_POLICY_PROTOCOL;
26
27 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000
28
29 typedef struct {
30 UINT16 Segment;
31 VTD_SOURCE_ID SourceId;
32 } EDKII_PLATFORM_VTD_DEVICE_INFO;
33
34 /**
35 Get the VTD SourceId from the device handler.
36 This function is required for non PCI device handler.
37
38 Pseudo-algo in Intel VTd driver:
39 Status = PlatformGetVTdDeviceId ();
40 if (EFI_ERROR(Status)) {
41 if (DeviceHandle is PCI) {
42 Get SourceId from Bus/Device/Function
43 } else {
44 return EFI_UNSUPPORTED
45 }
46 }
47 Get VTd engine by Segment/Bus/Device/Function.
48
49 @param[in] This The protocol instance pointer.
50 @param[in] DeviceHandle Device Identifier in UEFI.
51 @param[out] DeviceInfo DeviceInfo for indentify the VTd engine in ACPI Table
52 and the VTd page entry.
53
54 @retval EFI_SUCCESS The VtdIndex and SourceId are returned.
55 @retval EFI_INVALID_PARAMETER DeviceHandle is not a valid handler.
56 @retval EFI_INVALID_PARAMETER DeviceInfo is NULL.
57 @retval EFI_NOT_FOUND The Segment or SourceId information is NOT found.
58 @retval EFI_UNSUPPORTED This function is not supported.
59
60 **/
61 typedef
62 EFI_STATUS
63 (EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID) (
64 IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This,
65 IN EFI_HANDLE DeviceHandle,
66 OUT EDKII_PLATFORM_VTD_DEVICE_INFO *DeviceInfo
67 );
68
69 /**
70 Get a list of the exception devices.
71
72 The VTd driver should always set ALLOW for the device in this list.
73
74 @param[in] This The protocol instance pointer.
75 @param[out] DeviceInfoCount The count of the list of DeviceInfo.
76 @param[out] DeviceInfo A callee allocated buffer to hold a list of DeviceInfo.
77
78 @retval EFI_SUCCESS The DeviceInfoCount and DeviceInfo are returned.
79 @retval EFI_INVALID_PARAMETER DeviceInfoCount is NULL, or DeviceInfo is NULL.
80 @retval EFI_UNSUPPORTED This function is not supported.
81
82 **/
83 typedef
84 EFI_STATUS
85 (EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST) (
86 IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This,
87 OUT UINTN *DeviceInfoCount,
88 OUT EDKII_PLATFORM_VTD_DEVICE_INFO **DeviceInfo
89 );
90
91 struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL {
92 UINT64 Revision;
93 EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID GetDeviceId;
94 EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST GetExceptionDeviceList;
95 };
96
97 extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid;
98
99 #endif
100