1 /** @file
2   VT-d policy definitions.
3 
4   Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 **/
7 #ifndef _VTD_CONFIG_H_
8 #define _VTD_CONFIG_H_
9 
10 #include <Library/VtdInfoLib.h>
11 #pragma pack(push, 1)
12 
13 #define VTD_CONFIG_REVISION 1
14 #define VTD_DXE_CONFIG_REVISION 2
15 
16 /**
17   The data elements should be initialized by a Platform Module.
18   The data structure is for VT-d driver initialization\n
19   <b>Revision 1</b>:
20   - Initial version.
21 **/
22 typedef struct {
23   CONFIG_BLOCK_HEADER  Header;                      ///< Offset 0-27 Config Block Header
24   /**
25     Offset 28:
26     VT-D Support can be verified by reading CAP ID register as expalined in BIOS Spec.
27     This policy is for debug purpose only.
28     If VT-D is not supported, all other policies in this config block will be ignored.
29     <b>0 = To use Vt-d</b>;
30     1 = Avoids programming Vtd bars, Vtd overrides and DMAR table.
31   **/
32   UINT8        VtdDisable;
33   UINT8        X2ApicOptOut;        ///< Offset 29 :This field is used to enable the X2APIC_OPT_OUT bit in the DMAR table. 1=Enable/Set and <b>0=Disable/Clear</b>
34   UINT8        DmaControlGuarantee; ///< Offset 30 :This field is used to enable the DMA_CONTROL_GUARANTEE bit in the DMAR table. 1=Enable/Set and <b>0=Disable/Clear</b>
35   UINT8        VtdIgdEnable;        ///< Offset 31 :This field is used to enable the VtdIgdEnable Policy. 1=Enable/Set and <b>0=Disable/Clear</b>
36   UINT8        VtdIpuEnable;        ///< Offset 32 :This field is used to enable the VtdIpuEnable Policy. 1=Enable/Set and <b>0=Disable/Clear</b>
37   UINT8        VtdIopEnable;        ///< Offset 33 :This field is used to enable the VtdIopEnable Policy. 1=Enable/Set and <b>0=Disable/Clear</b>
38   UINT8        VtdItbtEnable;       ///< Offset 34 :This field is used to enable the VtdItbtEnable Policy. 1=Enable/Set and <b>0=Disable/Clear</b>
39   UINT8        PreBootDmaMask;      ///< Offset 35 :Convey PcdVTdPolicyPropertyMask value from EDK2 IntelSiliconPkg
40   /**
41     Offset 36:
42     This field is used to describe the base addresses for VT-d function:\n
43     VTD BAR for Gfx if IGfx is supported : <b>BaseAddress[0]=0xFED90000,\n
44     VTD BAR for IPU if IPU is supporrted : BaseAddress[1]=0xFED92000,\n
45     VTD BAR for other DMA Agents (except Igfx and IPU) : BaseAddress[2]=0xFED91000,\n
46     VTD BAR for iTBT if iTBT is supported : BaseAddress[3]=0xFED84000, BaseAddress[4]=0xFED85000, BaseAddress[5]=0xFED86000,BaseAddress[6]=0xFED87000</b>
47   **/
48   UINT32       BaseAddress[VTD_ENGINE_NUMBER];
49   UINT32       DmaBufferSize;      ///< Offset 64 :Protect Memory Region (PMR) DMA buffer size
50 
51 
52 } VTD_CONFIG;
53 
54 /**
55   The data structure is for VT-d driver initialization in DXE\n
56   <b>Revision 1</b>:
57   - Initial version.
58 **/
59 typedef struct {
60   CONFIG_BLOCK_HEADER   Header;                    ///< Offset 0-27 Config Block Header
61 } VTD_DXE_CONFIG;
62 #pragma pack(pop)
63 
64 #endif   //  _VTD_CONFIG_H_
65