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