IntelSiliconPkg/header: update PlatformVtdPolicy
[mirror_edk2.git] / IntelSiliconPkg / Include / Protocol / PlatformVtdPolicy.h
CommitLineData
4fd8eda9
JY
1/** @file\r
2 The definition for platform VTD policy.\r
3\r
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __PLATFORM_VTD_POLICY_PROTOCOL_H__\r
16#define __PLATFORM_VTD_POLICY_PROTOCOL_H__\r
17\r
18#include <IndustryStandard/Vtd.h>\r
71872f7c 19#include <IndustryStandard/DmaRemappingReportingTable.h>\r
4fd8eda9
JY
20\r
21#define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \\r
22 { \\r
23 0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \\r
24 }\r
25\r
26typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL EDKII_PLATFORM_VTD_POLICY_PROTOCOL;\r
27\r
28#define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000\r
29\r
30typedef struct {\r
31 UINT16 Segment;\r
32 VTD_SOURCE_ID SourceId;\r
33} EDKII_PLATFORM_VTD_DEVICE_INFO;\r
34\r
35/**\r
36 Get the VTD SourceId from the device handler.\r
37 This function is required for non PCI device handler.\r
38\r
39 Pseudo-algo in Intel VTd driver:\r
40 Status = PlatformGetVTdDeviceId ();\r
41 if (EFI_ERROR(Status)) {\r
42 if (DeviceHandle is PCI) {\r
43 Get SourceId from Bus/Device/Function\r
44 } else {\r
45 return EFI_UNSUPPORTED\r
46 }\r
47 }\r
48 Get VTd engine by Segment/Bus/Device/Function.\r
49\r
50 @param[in] This The protocol instance pointer.\r
51 @param[in] DeviceHandle Device Identifier in UEFI.\r
52 @param[out] DeviceInfo DeviceInfo for indentify the VTd engine in ACPI Table\r
53 and the VTd page entry.\r
54\r
55 @retval EFI_SUCCESS The VtdIndex and SourceId are returned.\r
56 @retval EFI_INVALID_PARAMETER DeviceHandle is not a valid handler.\r
57 @retval EFI_INVALID_PARAMETER DeviceInfo is NULL.\r
58 @retval EFI_NOT_FOUND The Segment or SourceId information is NOT found.\r
59 @retval EFI_UNSUPPORTED This function is not supported.\r
60\r
61**/\r
62typedef\r
63EFI_STATUS\r
64(EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID) (\r
65 IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This,\r
66 IN EFI_HANDLE DeviceHandle,\r
67 OUT EDKII_PLATFORM_VTD_DEVICE_INFO *DeviceInfo\r
68 );\r
69\r
71872f7c
JY
70#pragma pack(1)\r
71\r
72typedef struct {\r
73 //\r
74 // The segment number of the device\r
75 //\r
76 UINT16 SegmentNumber;\r
77 //\r
78 // Device scope definition in DMAR table\r
79 //\r
80 EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER DeviceScope;\r
81 //\r
82 // Pci path definition in DMAR table\r
83 //\r
84//EFI_ACPI_DMAR_PCI_PATH PciPath[];\r
85} EDKII_PLATFORM_VTD_DEVICE_SCOPE;\r
86\r
87typedef struct {\r
88 UINT16 VendorId;\r
89 UINT16 DeviceId;\r
90 UINT8 RevisionId;\r
91 UINT16 SubsystemVendorId;\r
92 UINT16 SubsystemDeviceId;\r
93} EDKII_PLATFORM_VTD_PCI_DEVICE_ID;\r
94\r
95#define EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_END 0\r
96#define EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_DEVICE_SCOPE 1\r
97#define EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_PCI_DEVICE_ID 2\r
98\r
99typedef struct {\r
100 //\r
101 // EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_xxx defined above.\r
102 //\r
103 UINT8 Type;\r
104 //\r
105 // The length of the full data structure including EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO and Data.\r
106 //\r
107 UINT8 Length;\r
108 //\r
109 // Data can be EDKII_PLATFORM_VTD_DEVICE_SCOPE or EDKII_PLATFORM_VTD_PCI_DEVICE_ID\r
110 //\r
111//UINT8 Data[Length - sizeof(EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO)];\r
112} EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO;\r
113\r
114#pragma pack()\r
115\r
116\r
4fd8eda9
JY
117/**\r
118 Get a list of the exception devices.\r
119\r
120 The VTd driver should always set ALLOW for the device in this list.\r
121\r
122 @param[in] This The protocol instance pointer.\r
123 @param[out] DeviceInfoCount The count of the list of DeviceInfo.\r
124 @param[out] DeviceInfo A callee allocated buffer to hold a list of DeviceInfo.\r
71872f7c 125 Each DeviceInfo pointer points to EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO.\r
4fd8eda9
JY
126\r
127 @retval EFI_SUCCESS The DeviceInfoCount and DeviceInfo are returned.\r
128 @retval EFI_INVALID_PARAMETER DeviceInfoCount is NULL, or DeviceInfo is NULL.\r
129 @retval EFI_UNSUPPORTED This function is not supported.\r
130\r
131**/\r
132typedef\r
133EFI_STATUS\r
134(EFIAPI *EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST) (\r
135 IN EDKII_PLATFORM_VTD_POLICY_PROTOCOL *This,\r
136 OUT UINTN *DeviceInfoCount,\r
71872f7c 137 OUT VOID **DeviceInfo\r
4fd8eda9
JY
138 );\r
139\r
140struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL {\r
141 UINT64 Revision;\r
142 EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID GetDeviceId;\r
143 EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST GetExceptionDeviceList;\r
144};\r
145\r
146extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid;\r
147\r
148#endif\r
149\r