]> git.proxmox.com Git - mirror_edk2.git/blob - IntelSiliconPkg/Include/Protocol/PlatformVtdPolicy.h
IntelSiliconPkg/header: update PlatformVtdPolicy
[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 #include <IndustryStandard/DmaRemappingReportingTable.h>
20
21 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \
22 { \
23 0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \
24 }
25
26 typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL EDKII_PLATFORM_VTD_POLICY_PROTOCOL;
27
28 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000
29
30 typedef struct {
31 UINT16 Segment;
32 VTD_SOURCE_ID SourceId;
33 } EDKII_PLATFORM_VTD_DEVICE_INFO;
34
35 /**
36 Get the VTD SourceId from the device handler.
37 This function is required for non PCI device handler.
38
39 Pseudo-algo in Intel VTd driver:
40 Status = PlatformGetVTdDeviceId ();
41 if (EFI_ERROR(Status)) {
42 if (DeviceHandle is PCI) {
43 Get SourceId from Bus/Device/Function
44 } else {
45 return EFI_UNSUPPORTED
46 }
47 }
48 Get VTd engine by Segment/Bus/Device/Function.
49
50 @param[in] This The protocol instance pointer.
51 @param[in] DeviceHandle Device Identifier in UEFI.
52 @param[out] DeviceInfo DeviceInfo for indentify the VTd engine in ACPI Table
53 and the VTd page entry.
54
55 @retval EFI_SUCCESS The VtdIndex and SourceId are returned.
56 @retval EFI_INVALID_PARAMETER DeviceHandle is not a valid handler.
57 @retval EFI_INVALID_PARAMETER DeviceInfo is NULL.
58 @retval EFI_NOT_FOUND The Segment or SourceId information is NOT found.
59 @retval EFI_UNSUPPORTED This function is not supported.
60
61 **/
62 typedef
63 EFI_STATUS
64 (EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID) (
65 IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This,
66 IN EFI_HANDLE DeviceHandle,
67 OUT EDKII_PLATFORM_VTD_DEVICE_INFO *DeviceInfo
68 );
69
70 #pragma pack(1)
71
72 typedef struct {
73 //
74 // The segment number of the device
75 //
76 UINT16 SegmentNumber;
77 //
78 // Device scope definition in DMAR table
79 //
80 EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER DeviceScope;
81 //
82 // Pci path definition in DMAR table
83 //
84 //EFI_ACPI_DMAR_PCI_PATH PciPath[];
85 } EDKII_PLATFORM_VTD_DEVICE_SCOPE;
86
87 typedef struct {
88 UINT16 VendorId;
89 UINT16 DeviceId;
90 UINT8 RevisionId;
91 UINT16 SubsystemVendorId;
92 UINT16 SubsystemDeviceId;
93 } EDKII_PLATFORM_VTD_PCI_DEVICE_ID;
94
95 #define EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_END 0
96 #define EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_DEVICE_SCOPE 1
97 #define EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_PCI_DEVICE_ID 2
98
99 typedef struct {
100 //
101 // EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_xxx defined above.
102 //
103 UINT8 Type;
104 //
105 // The length of the full data structure including EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO and Data.
106 //
107 UINT8 Length;
108 //
109 // Data can be EDKII_PLATFORM_VTD_DEVICE_SCOPE or EDKII_PLATFORM_VTD_PCI_DEVICE_ID
110 //
111 //UINT8 Data[Length - sizeof(EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO)];
112 } EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO;
113
114 #pragma pack()
115
116
117 /**
118 Get a list of the exception devices.
119
120 The VTd driver should always set ALLOW for the device in this list.
121
122 @param[in] This The protocol instance pointer.
123 @param[out] DeviceInfoCount The count of the list of DeviceInfo.
124 @param[out] DeviceInfo A callee allocated buffer to hold a list of DeviceInfo.
125 Each DeviceInfo pointer points to EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO.
126
127 @retval EFI_SUCCESS The DeviceInfoCount and DeviceInfo are returned.
128 @retval EFI_INVALID_PARAMETER DeviceInfoCount is NULL, or DeviceInfo is NULL.
129 @retval EFI_UNSUPPORTED This function is not supported.
130
131 **/
132 typedef
133 EFI_STATUS
134 (EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST) (
135 IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This,
136 OUT UINTN *DeviceInfoCount,
137 OUT VOID **DeviceInfo
138 );
139
140 struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL {
141 UINT64 Revision;
142 EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID GetDeviceId;
143 EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST GetExceptionDeviceList;
144 };
145
146 extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid;
147
148 #endif
149