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