2 The definition for platform VTD policy.
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.
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.
15 #ifndef __PLATFORM_VTD_POLICY_PROTOCOL_H__
16 #define __PLATFORM_VTD_POLICY_PROTOCOL_H__
18 #include <IndustryStandard/Vtd.h>
19 #include <IndustryStandard/DmaRemappingReportingTable.h>
21 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \
23 0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \
26 typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL EDKII_PLATFORM_VTD_POLICY_PROTOCOL
;
28 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000
32 VTD_SOURCE_ID SourceId
;
33 } EDKII_PLATFORM_VTD_DEVICE_INFO
;
36 Get the VTD SourceId from the device handler.
37 This function is required for non PCI device handler.
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
45 return EFI_UNSUPPORTED
48 Get VTd engine by Segment/Bus/Device/Function.
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.
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.
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
74 // The segment number of the device
78 // Device scope definition in DMAR table
80 EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER DeviceScope
;
82 // Pci path definition in DMAR table
84 //EFI_ACPI_DMAR_PCI_PATH PciPath[];
85 } EDKII_PLATFORM_VTD_DEVICE_SCOPE
;
91 UINT16 SubsystemVendorId
;
92 UINT16 SubsystemDeviceId
;
93 } EDKII_PLATFORM_VTD_PCI_DEVICE_ID
;
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
101 // EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_xxx defined above.
105 // The length of the full data structure including EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO and Data.
109 // Data can be EDKII_PLATFORM_VTD_DEVICE_SCOPE or EDKII_PLATFORM_VTD_PCI_DEVICE_ID
111 //UINT8 Data[Length - sizeof(EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO)];
112 } EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO
;
118 Get a list of the exception devices.
120 The VTd driver should always set ALLOW for the device in this list.
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.
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.
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
140 struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL
{
142 EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID GetDeviceId
;
143 EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST GetExceptionDeviceList
;
146 extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid
;