]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h
Add TPM2 support defined in trusted computing group.
[mirror_edk2.git] / SecurityPkg / Include / Library / Tcg2PhysicalPresenceLib.h
CommitLineData
1abfa4ce
JY
1/** @file\r
2 Ihis library is intended to be used by BDS modules.\r
3 This library will execute TPM2 request.\r
4\r
5Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials \r
7are licensed and made available under the terms and conditions of the BSD License \r
8which accompanies this distribution. The full text of the license may be found at \r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _TCG2_PHYSICAL_PRESENCE_LIB_H_\r
17#define _TCG2_PHYSICAL_PRESENCE_LIB_H_\r
18\r
19#include <IndustryStandard/Tpm20.h>\r
20#include <IndustryStandard/TcgPhysicalPresence.h>\r
21#include <Protocol/Tcg2Protocol.h>\r
22\r
23//\r
24// UEFI TCG2 library definition bit of the BIOS TPM Management Flags\r
25//\r
26// BIT0 is reserved\r
27#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR BIT1\r
28// BIT2 is reserved\r
29#define TCG2_LIB_PP_FLAG_RESET_TRACK BIT3\r
30#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_ON BIT4\r
31#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF BIT5\r
32#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS BIT6\r
33#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS BIT7\r
34\r
35//\r
36// UEFI TCG2 library definition bit of the BIOS Information Flags\r
37//\r
38#define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_STORAGE_DISABLE BIT8\r
39#define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_ENDORSEMENT_DISABLE BIT9\r
40\r
41//\r
42// UEFI TCG2 library definition bit of the BIOS Storage Management Flags\r
43//\r
44#define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID BIT16\r
45#define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID BIT17\r
46\r
47//\r
48// Default value\r
49//\r
50#define TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF | \\r
51 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR | \\r
52 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS | \\r
53 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS)\r
54\r
55/**\r
56 Check and execute the pending TPM request.\r
57\r
58 The TPM request may come from OS or BIOS. This API will display request information and wait \r
59 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r
60 the TPM request is confirmed, and one or more reset may be required to make TPM request to \r
61 take effect.\r
62 \r
63 This API should be invoked after console in and console out are all ready as they are required\r
64 to display request information and get user input to confirm the request. \r
65\r
66 @param PlatformAuth platform auth value. NULL means no platform auth change.\r
67**/\r
68VOID\r
69EFIAPI\r
70Tcg2PhysicalPresenceLibProcessRequest (\r
71 IN TPM2B_AUTH *PlatformAuth OPTIONAL\r
72 );\r
73\r
74/**\r
75 Check if the pending TPM request needs user input to confirm.\r
76\r
77 The TPM request may come from OS. This API will check if TPM request exists and need user\r
78 input to confirmation.\r
79 \r
80 @retval TRUE TPM needs input to confirm user physical presence.\r
81 @retval FALSE TPM doesn't need input to confirm user physical presence.\r
82\r
83**/\r
84BOOLEAN\r
85EFIAPI\r
86Tcg2PhysicalPresenceLibNeedUserConfirm (\r
87 VOID\r
88 );\r
89\r
90/**\r
91 Return TPM2 ManagementFlags set by PP interface.\r
92\r
93 @retval ManagementFlags TPM2 Management Flags.\r
94**/\r
95UINT32\r
96EFIAPI\r
97Tcg2PhysicalPresenceLibGetManagementFlags (\r
98 VOID\r
99 );\r
100\r
101/**\r
102 The handler for TPM physical presence function:\r
103 Return TPM Operation Response to OS Environment.\r
104\r
105 This API should be invoked in OS runtime phase to interface with ACPI method.\r
106\r
107 @param[out] MostRecentRequest Most recent operation request.\r
108 @param[out] Response Response to the most recent operation request.\r
109\r
110 @return Return Code for Return TPM Operation Response to OS Environment.\r
111**/\r
112UINT32\r
113EFIAPI\r
114Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (\r
115 OUT UINT32 *MostRecentRequest,\r
116 OUT UINT32 *Response\r
117 );\r
118\r
119\r
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
129 @param[in] OperationRequest TPM physical presence operation request.\r
130 @param[in] RequestParameter TPM physical presence operation request parameter.\r
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
136EFIAPI\r
137Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (\r
138 IN UINT32 OperationRequest,\r
139 IN UINT32 RequestParameter\r
140 );\r
141\r
142/**\r
143 The handler for TPM physical presence function:\r
144 Get User Confirmation Status for Operation.\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
149 \r
150 @param[in] OperationRequest TPM physical presence operation request.\r
151\r
152 @return Return Code for Get User Confirmation Status for Operation.\r
153**/\r
154UINT32\r
155EFIAPI\r
156Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (\r
157 IN UINT32 OperationRequest\r
158 );\r
159\r
160#endif\r