]>
Commit | Line | Data |
---|---|---|
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 | 5 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r |
289b714b | 6 | SPDX-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 | |
d6b926e7 SB |
32 | #define TCG2_BIOS_INFORMATION_FLAG_HIERARCHY_CONTROL_STORAGE_DISABLE BIT8\r |
33 | #define TCG2_BIOS_INFORMATION_FLAG_HIERARCHY_CONTROL_ENDORSEMENT_DISABLE BIT9\r | |
1abfa4ce JY |
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 | |
e0972cfc ED |
54 | TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID |\\r |
55 | TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_ENABLE_BLOCK_SID)\r | |
e92ddda2 | 56 | \r |
1abfa4ce JY |
57 | /**\r |
58 | Check and execute the pending TPM request.\r | |
59 | \r | |
b3548d32 | 60 | The TPM request may come from OS or BIOS. This API will display request information and wait\r |
1abfa4ce | 61 | for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r |
b3548d32 | 62 | the TPM request is confirmed, and one or more reset may be required to make TPM request to\r |
1abfa4ce | 63 | take effect.\r |
b3548d32 | 64 | \r |
1abfa4ce | 65 | This API should be invoked after console in and console out are all ready as they are required\r |
b3548d32 | 66 | to display request information and get user input to confirm the request.\r |
1abfa4ce JY |
67 | \r |
68 | @param PlatformAuth platform auth value. NULL means no platform auth change.\r | |
69 | **/\r | |
70 | VOID\r | |
71 | EFIAPI\r | |
72 | Tcg2PhysicalPresenceLibProcessRequest (\r | |
73 | IN TPM2B_AUTH *PlatformAuth OPTIONAL\r | |
74 | );\r | |
75 | \r | |
76 | /**\r | |
77 | Check if the pending TPM request needs user input to confirm.\r | |
78 | \r | |
79 | The TPM request may come from OS. This API will check if TPM request exists and need user\r | |
80 | input to confirmation.\r | |
b3548d32 | 81 | \r |
1abfa4ce JY |
82 | @retval TRUE TPM needs input to confirm user physical presence.\r |
83 | @retval FALSE TPM doesn't need input to confirm user physical presence.\r | |
84 | \r | |
85 | **/\r | |
86 | BOOLEAN\r | |
87 | EFIAPI\r | |
88 | Tcg2PhysicalPresenceLibNeedUserConfirm (\r | |
89 | VOID\r | |
90 | );\r | |
91 | \r | |
92 | /**\r | |
93 | Return TPM2 ManagementFlags set by PP interface.\r | |
94 | \r | |
95 | @retval ManagementFlags TPM2 Management Flags.\r | |
96 | **/\r | |
97 | UINT32\r | |
98 | EFIAPI\r | |
99 | Tcg2PhysicalPresenceLibGetManagementFlags (\r | |
100 | VOID\r | |
101 | );\r | |
102 | \r | |
103 | /**\r | |
104 | The handler for TPM physical presence function:\r | |
105 | Return TPM Operation Response to OS Environment.\r | |
106 | \r | |
107 | This API should be invoked in OS runtime phase to interface with ACPI method.\r | |
108 | \r | |
109 | @param[out] MostRecentRequest Most recent operation request.\r | |
110 | @param[out] Response Response to the most recent operation request.\r | |
111 | \r | |
112 | @return Return Code for Return TPM Operation Response to OS Environment.\r | |
113 | **/\r | |
114 | UINT32\r | |
115 | EFIAPI\r | |
116 | Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (\r | |
117 | OUT UINT32 *MostRecentRequest,\r | |
118 | OUT UINT32 *Response\r | |
119 | );\r | |
120 | \r | |
edb0fda2 ZC |
121 | /**\r |
122 | The handler for TPM physical presence function:\r | |
123 | Submit TPM Operation Request to Pre-OS Environment and\r | |
124 | Submit TPM Operation Request to Pre-OS Environment 2.\r | |
125 | \r | |
126 | This API should be invoked in OS runtime phase to interface with ACPI method.\r | |
127 | \r | |
128 | Caution: This function may receive untrusted input.\r | |
129 | \r | |
3e14edf8 ZC |
130 | @param[in, out] Pointer to OperationRequest TPM physical presence operation request.\r |
131 | @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter.\r | |
edb0fda2 ZC |
132 | \r |
133 | @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r | |
134 | Submit TPM Operation Request to Pre-OS Environment 2.\r | |
135 | **/\r | |
136 | UINT32\r | |
137 | Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (\r | |
138 | IN OUT UINT32 *OperationRequest,\r | |
139 | IN OUT UINT32 *RequestParameter\r | |
140 | );\r | |
1abfa4ce JY |
141 | \r |
142 | /**\r | |
143 | The handler for TPM physical presence function:\r | |
144 | Submit TPM Operation Request to Pre-OS Environment and\r | |
145 | Submit TPM Operation Request to Pre-OS Environment 2.\r | |
146 | \r | |
147 | This API should be invoked in OS runtime phase to interface with ACPI method.\r | |
148 | \r | |
149 | Caution: This function may receive untrusted input.\r | |
edb0fda2 | 150 | \r |
1abfa4ce JY |
151 | @param[in] OperationRequest TPM physical presence operation request.\r |
152 | @param[in] RequestParameter TPM physical presence operation request parameter.\r | |
153 | \r | |
154 | @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r | |
155 | Submit TPM Operation Request to Pre-OS Environment 2.\r | |
156 | **/\r | |
157 | UINT32\r | |
158 | EFIAPI\r | |
159 | Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (\r | |
160 | IN UINT32 OperationRequest,\r | |
161 | IN UINT32 RequestParameter\r | |
162 | );\r | |
163 | \r | |
164 | /**\r | |
165 | The handler for TPM physical presence function:\r | |
166 | Get User Confirmation Status for Operation.\r | |
167 | \r | |
168 | This API should be invoked in OS runtime phase to interface with ACPI method.\r | |
169 | \r | |
170 | Caution: This function may receive untrusted input.\r | |
b3548d32 | 171 | \r |
1abfa4ce JY |
172 | @param[in] OperationRequest TPM physical presence operation request.\r |
173 | \r | |
174 | @return Return Code for Get User Confirmation Status for Operation.\r | |
175 | **/\r | |
176 | UINT32\r | |
177 | EFIAPI\r | |
178 | Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (\r | |
179 | IN UINT32 OperationRequest\r | |
180 | );\r | |
181 | \r | |
182 | #endif\r |