]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h
SecurityPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / SecurityPkg / Include / Library / Tcg2PhysicalPresenceLib.h
CommitLineData
1abfa4ce 1/** @file\r
07309c3d 2 This library is intended to be used by BDS modules.\r
1abfa4ce
JY
3 This library will execute TPM2 request.\r
4\r
b3548d32 5Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
289b714b 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
1abfa4ce
JY
7\r
8**/\r
9\r
10#ifndef _TCG2_PHYSICAL_PRESENCE_LIB_H_\r
11#define _TCG2_PHYSICAL_PRESENCE_LIB_H_\r
12\r
13#include <IndustryStandard/Tpm20.h>\r
14#include <IndustryStandard/TcgPhysicalPresence.h>\r
15#include <Protocol/Tcg2Protocol.h>\r
16\r
17//\r
18// UEFI TCG2 library definition bit of the BIOS TPM Management Flags\r
19//\r
20// BIT0 is reserved\r
21#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR BIT1\r
22// BIT2 is reserved\r
23#define TCG2_LIB_PP_FLAG_RESET_TRACK BIT3\r
24#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_ON BIT4\r
25#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF BIT5\r
26#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS BIT6\r
27#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS BIT7\r
28\r
29//\r
30// UEFI TCG2 library definition bit of the BIOS Information Flags\r
31//\r
32#define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_STORAGE_DISABLE BIT8\r
33#define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_ENDORSEMENT_DISABLE BIT9\r
34\r
35//\r
36// UEFI TCG2 library definition bit of the BIOS Storage Management Flags\r
37//\r
38#define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID BIT16\r
39#define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID BIT17\r
e92ddda2 40#define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID BIT18\r
1abfa4ce
JY
41\r
42//\r
43// Default value\r
44//\r
45#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF | \\r
46 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR | \\r
47 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS | \\r
48 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS)\r
49\r
e92ddda2
SZ
50//\r
51// Default value\r
52//\r
53#define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID | \\r
54 TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID)\r
55\r
1abfa4ce
JY
56/**\r
57 Check and execute the pending TPM request.\r
58\r
b3548d32 59 The TPM request may come from OS or BIOS. This API will display request information and wait\r
1abfa4ce 60 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r
b3548d32 61 the TPM request is confirmed, and one or more reset may be required to make TPM request to\r
1abfa4ce 62 take effect.\r
b3548d32 63\r
1abfa4ce 64 This API should be invoked after console in and console out are all ready as they are required\r
b3548d32 65 to display request information and get user input to confirm the request.\r
1abfa4ce
JY
66\r
67 @param PlatformAuth platform auth value. NULL means no platform auth change.\r
68**/\r
69VOID\r
70EFIAPI\r
71Tcg2PhysicalPresenceLibProcessRequest (\r
72 IN TPM2B_AUTH *PlatformAuth OPTIONAL\r
73 );\r
74\r
75/**\r
76 Check if the pending TPM request needs user input to confirm.\r
77\r
78 The TPM request may come from OS. This API will check if TPM request exists and need user\r
79 input to confirmation.\r
b3548d32 80\r
1abfa4ce
JY
81 @retval TRUE TPM needs input to confirm user physical presence.\r
82 @retval FALSE TPM doesn't need input to confirm user physical presence.\r
83\r
84**/\r
85BOOLEAN\r
86EFIAPI\r
87Tcg2PhysicalPresenceLibNeedUserConfirm (\r
88 VOID\r
89 );\r
90\r
91/**\r
92 Return TPM2 ManagementFlags set by PP interface.\r
93\r
94 @retval ManagementFlags TPM2 Management Flags.\r
95**/\r
96UINT32\r
97EFIAPI\r
98Tcg2PhysicalPresenceLibGetManagementFlags (\r
99 VOID\r
100 );\r
101\r
102/**\r
103 The handler for TPM physical presence function:\r
104 Return TPM Operation Response to OS Environment.\r
105\r
106 This API should be invoked in OS runtime phase to interface with ACPI method.\r
107\r
108 @param[out] MostRecentRequest Most recent operation request.\r
109 @param[out] Response Response to the most recent operation request.\r
110\r
111 @return Return Code for Return TPM Operation Response to OS Environment.\r
112**/\r
113UINT32\r
114EFIAPI\r
115Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (\r
116 OUT UINT32 *MostRecentRequest,\r
117 OUT UINT32 *Response\r
118 );\r
119\r
edb0fda2
ZC
120/**\r
121 The handler for TPM physical presence function:\r
122 Submit TPM Operation Request to Pre-OS Environment and\r
123 Submit TPM Operation Request to Pre-OS Environment 2.\r
124\r
125 This API should be invoked in OS runtime phase to interface with ACPI method.\r
126\r
127 Caution: This function may receive untrusted input.\r
128\r
3e14edf8
ZC
129 @param[in, out] Pointer to OperationRequest TPM physical presence operation request.\r
130 @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter.\r
edb0fda2
ZC
131\r
132 @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
133 Submit TPM Operation Request to Pre-OS Environment 2.\r
134 **/\r
135UINT32\r
136Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (\r
137 IN OUT UINT32 *OperationRequest,\r
138 IN OUT UINT32 *RequestParameter\r
139 );\r
1abfa4ce
JY
140\r
141/**\r
142 The handler for TPM physical presence function:\r
143 Submit TPM Operation Request to Pre-OS Environment and\r
144 Submit TPM Operation Request to Pre-OS Environment 2.\r
145\r
146 This API should be invoked in OS runtime phase to interface with ACPI method.\r
147\r
148 Caution: This function may receive untrusted input.\r
edb0fda2 149\r
1abfa4ce
JY
150 @param[in] OperationRequest TPM physical presence operation request.\r
151 @param[in] RequestParameter TPM physical presence operation request parameter.\r
152\r
153 @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
154 Submit TPM Operation Request to Pre-OS Environment 2.\r
155**/\r
156UINT32\r
157EFIAPI\r
158Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (\r
159 IN UINT32 OperationRequest,\r
160 IN UINT32 RequestParameter\r
161 );\r
162\r
163/**\r
164 The handler for TPM physical presence function:\r
165 Get User Confirmation Status for Operation.\r
166\r
167 This API should be invoked in OS runtime phase to interface with ACPI method.\r
168\r
169 Caution: This function may receive untrusted input.\r
b3548d32 170\r
1abfa4ce
JY
171 @param[in] OperationRequest TPM physical presence operation request.\r
172\r
173 @return Return Code for Get User Confirmation Status for Operation.\r
174**/\r
175UINT32\r
176EFIAPI\r
177Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (\r
178 IN UINT32 OperationRequest\r
179 );\r
180\r
181#endif\r