2 The definition for platform VTD policy.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __PLATFORM_VTD_POLICY_PROTOCOL_H__
10 #define __PLATFORM_VTD_POLICY_PROTOCOL_H__
12 #include <IndustryStandard/Vtd.h>
13 #include <IndustryStandard/DmaRemappingReportingTable.h>
15 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_GUID \
17 0x3d17e448, 0x466, 0x4e20, { 0x99, 0x9f, 0xb2, 0xe1, 0x34, 0x88, 0xee, 0x22 } \
20 typedef struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL EDKII_PLATFORM_VTD_POLICY_PROTOCOL
;
22 #define EDKII_PLATFORM_VTD_POLICY_PROTOCOL_REVISION 0x00010000
26 VTD_SOURCE_ID SourceId
;
27 } EDKII_PLATFORM_VTD_DEVICE_INFO
;
30 Get the VTD SourceId from the device handler.
31 This function is required for non PCI device handler.
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
39 return EFI_UNSUPPORTED
42 Get VTd engine by Segment/Bus/Device/Function.
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.
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.
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
68 // The segment number of the device
72 // Device scope definition in DMAR table
74 EFI_ACPI_DMAR_DEVICE_SCOPE_STRUCTURE_HEADER DeviceScope
;
76 // Pci path definition in DMAR table
78 //EFI_ACPI_DMAR_PCI_PATH PciPath[];
79 } EDKII_PLATFORM_VTD_DEVICE_SCOPE
;
85 UINT16 SubsystemVendorId
;
86 UINT16 SubsystemDeviceId
;
87 } EDKII_PLATFORM_VTD_PCI_DEVICE_ID
;
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
95 // EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO_TYPE_xxx defined above.
99 // The length of the full data structure including EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO and Data.
103 // Data can be EDKII_PLATFORM_VTD_DEVICE_SCOPE or EDKII_PLATFORM_VTD_PCI_DEVICE_ID
105 //UINT8 Data[Length - sizeof(EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO)];
106 } EDKII_PLATFORM_VTD_EXCEPTION_DEVICE_INFO
;
112 Get a list of the exception devices.
114 The VTd driver should always set ALLOW for the device in this list.
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.
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.
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
134 struct _EDKII_PLATFORM_VTD_POLICY_PROTOCOL
{
136 EDKII_PLATFORM_VTD_POLICY_GET_DEVICE_ID GetDeviceId
;
137 EDKII_PLATFORM_VTD_POLICY_GET_EXCEPTION_DEVICE_LIST GetExceptionDeviceList
;
140 extern EFI_GUID gEdkiiPlatformVTdPolicyProtocolGuid
;