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