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