2 Ihis library is intended to be used by BDS modules.
3 This library will execute TPM2 request.
5 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _TCG2_PHYSICAL_PRESENCE_LIB_H_
17 #define _TCG2_PHYSICAL_PRESENCE_LIB_H_
19 #include <IndustryStandard/Tpm20.h>
20 #include <IndustryStandard/TcgPhysicalPresence.h>
21 #include <Protocol/Tcg2Protocol.h>
24 // UEFI TCG2 library definition bit of the BIOS TPM Management Flags
27 #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR BIT1
29 #define TCG2_LIB_PP_FLAG_RESET_TRACK BIT3
30 #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_ON BIT4
31 #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF BIT5
32 #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS BIT6
33 #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS BIT7
36 // UEFI TCG2 library definition bit of the BIOS Information Flags
38 #define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_STORAGE_DISABLE BIT8
39 #define TCG2_BIOS_INFORMATION_FLAG_HIERACHY_CONTROL_ENDORSEMENT_DISABLE BIT9
42 // UEFI TCG2 library definition bit of the BIOS Storage Management Flags
44 #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID BIT16
45 #define TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID BIT17
50 #define TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT (TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_TURN_OFF | \
51 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR | \
52 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS | \
53 TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS)
56 Check and execute the pending TPM request.
58 The TPM request may come from OS or BIOS. This API will display request information and wait
59 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after
60 the TPM request is confirmed, and one or more reset may be required to make TPM request to
63 This API should be invoked after console in and console out are all ready as they are required
64 to display request information and get user input to confirm the request.
66 @param PlatformAuth platform auth value. NULL means no platform auth change.
70 Tcg2PhysicalPresenceLibProcessRequest (
71 IN TPM2B_AUTH
*PlatformAuth OPTIONAL
75 Check if the pending TPM request needs user input to confirm.
77 The TPM request may come from OS. This API will check if TPM request exists and need user
78 input to confirmation.
80 @retval TRUE TPM needs input to confirm user physical presence.
81 @retval FALSE TPM doesn't need input to confirm user physical presence.
86 Tcg2PhysicalPresenceLibNeedUserConfirm (
91 Return TPM2 ManagementFlags set by PP interface.
93 @retval ManagementFlags TPM2 Management Flags.
97 Tcg2PhysicalPresenceLibGetManagementFlags (
102 The handler for TPM physical presence function:
103 Return TPM Operation Response to OS Environment.
105 This API should be invoked in OS runtime phase to interface with ACPI method.
107 @param[out] MostRecentRequest Most recent operation request.
108 @param[out] Response Response to the most recent operation request.
110 @return Return Code for Return TPM Operation Response to OS Environment.
114 Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (
115 OUT UINT32
*MostRecentRequest
,
121 The handler for TPM physical presence function:
122 Submit TPM Operation Request to Pre-OS Environment and
123 Submit TPM Operation Request to Pre-OS Environment 2.
125 This API should be invoked in OS runtime phase to interface with ACPI method.
127 Caution: This function may receive untrusted input.
129 @param[in] OperationRequest TPM physical presence operation request.
130 @param[in] RequestParameter TPM physical presence operation request parameter.
132 @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
133 Submit TPM Operation Request to Pre-OS Environment 2.
137 Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (
138 IN UINT32 OperationRequest
,
139 IN UINT32 RequestParameter
143 The handler for TPM physical presence function:
144 Get User Confirmation Status for Operation.
146 This API should be invoked in OS runtime phase to interface with ACPI method.
148 Caution: This function may receive untrusted input.
150 @param[in] OperationRequest TPM physical presence operation request.
152 @return Return Code for Get User Confirmation Status for Operation.
156 Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (
157 IN UINT32 OperationRequest