]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
SecurityPkg: Cache TPM interface type info
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Smm / Tcg2Smm.h
CommitLineData
1abfa4ce
JY
1/** @file\r
2 The header file for Tcg2 SMM driver.\r
3 \r
c4122dca 4Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
1abfa4ce
JY
5This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __TCG2_SMM_H__\r
16#define __TCG2_SMM_H__\r
17\r
18#include <PiDxe.h>\r
19#include <IndustryStandard/Acpi.h>\r
20#include <IndustryStandard/Tpm2Acpi.h>\r
21\r
22#include <Guid/MemoryOverwriteControl.h>\r
23#include <Guid/TpmInstance.h>\r
24\r
25#include <Protocol/SmmSwDispatch2.h>\r
26#include <Protocol/AcpiTable.h>\r
27#include <Protocol/SmmVariable.h>\r
28#include <Protocol/Tcg2Protocol.h>\r
29\r
30#include <Library/BaseLib.h>\r
31#include <Library/BaseMemoryLib.h>\r
32#include <Library/DebugLib.h>\r
33#include <Library/SmmServicesTableLib.h>\r
34#include <Library/UefiDriverEntryPoint.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/DxeServicesLib.h>\r
37#include <Library/TpmMeasurementLib.h>\r
73126ac2 38#include <Library/Tpm2CommandLib.h>\r
1abfa4ce 39#include <Library/Tcg2PhysicalPresenceLib.h>\r
d967d6d9 40#include <Library/IoLib.h>\r
73126ac2 41#include <Library/PrintLib.h>\r
c4122dca 42#include <Library/PcdLib.h>\r
f15cb995 43#include <Library/Tpm2DeviceLib.h>\r
d967d6d9
JY
44\r
45#include <IndustryStandard/TpmPtp.h>\r
1abfa4ce
JY
46\r
47#pragma pack(1)\r
48typedef struct {\r
49 UINT8 SoftwareSmi;\r
50 UINT32 Parameter;\r
51 UINT32 Response;\r
52 UINT32 Request;\r
53 UINT32 RequestParameter;\r
54 UINT32 LastRequest;\r
55 UINT32 ReturnCode;\r
56} PHYSICAL_PRESENCE_NVS;\r
57\r
58typedef struct {\r
59 UINT8 SoftwareSmi;\r
60 UINT32 Parameter;\r
61 UINT32 Request;\r
62 UINT32 ReturnCode;\r
63} MEMORY_CLEAR_NVS;\r
64\r
65typedef struct {\r
66 PHYSICAL_PRESENCE_NVS PhysicalPresence;\r
67 MEMORY_CLEAR_NVS MemoryClear;\r
053f31e3 68 UINT32 PPRequestUserConfirm;\r
c4122dca
ZC
69 UINT32 TpmIrqNum;\r
70 BOOLEAN IsShortFormPkgLength;\r
1abfa4ce
JY
71} TCG_NVS;\r
72\r
73typedef struct {\r
74 UINT8 OpRegionOp;\r
75 UINT32 NameString;\r
76 UINT8 RegionSpace;\r
77 UINT8 DWordPrefix;\r
78 UINT32 RegionOffset;\r
79 UINT8 BytePrefix;\r
80 UINT8 RegionLen;\r
81} AML_OP_REGION_32_8;\r
82#pragma pack()\r
83\r
84//\r
85// The definition for TCG MOR\r
86//\r
87#define ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE 1\r
88#define ACPI_FUNCTION_PTS_CLEAR_MOR_BIT 2\r
89\r
90//\r
91// The return code for Memory Clear Interface Functions\r
92//\r
93#define MOR_REQUEST_SUCCESS 0\r
94#define MOR_REQUEST_GENERAL_FAILURE 1\r
95\r
cd643013
ZC
96//\r
97// Physical Presence Interface Version supported by Platform\r
98//\r
99#define PHYSICAL_PRESENCE_VERSION_TAG "$PV"\r
100#define PHYSICAL_PRESENCE_VERSION_SIZE 4\r
101\r
73126ac2
ZC
102//\r
103// PNP _HID for TPM2 device\r
104//\r
9a9fa14e 105#define TPM_HID_TAG "NNNN0000"\r
73126ac2
ZC
106#define TPM_HID_PNP_SIZE 8\r
107#define TPM_HID_ACPI_SIZE 9\r
108\r
c4122dca
ZC
109#define TPM_PRS_RESL "RESL"\r
110#define TPM_PRS_RESS "RESS"\r
111#define TPM_PRS_RES_NAME_SIZE 4\r
112//\r
113// Minimum PRS resource template size\r
114// 1 byte for BufferOp\r
115// 1 byte for PkgLength\r
116// 2 bytes for BufferSize\r
117// 12 bytes for Memory32Fixed descriptor\r
118// 5 bytes for Interrupt descriptor\r
119// 2 bytes for END Tag\r
120//\r
121#define TPM_POS_RES_TEMPLATE_MIN_SIZE (1 + 1 + 2 + 12 + 5 + 2)\r
122\r
123//\r
124// Max Interrupt buffer size for PRS interrupt resource\r
125// Now support 15 interrupts in maxmum\r
126//\r
127#define MAX_PRS_INT_BUF_SIZE (15*4)\r
1abfa4ce 128#endif // __TCG_SMM_H__\r