1 /** @file
2   This library is to support TCG PC Client Platform Physical Presence Interface Specification
3   Family "2.0" part, >= 128 Vendor Specific PPI Operation.
4 
5   The Vendor Specific PPI operation may change TPM state, BIOS TPM management
6   flags, and may need additional boot cycle.
7 
8   Caution: This function may receive untrusted input.
9 
10 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12 
13 **/
14 
15 #ifndef _TCG2_PP_VENDOR_LIB_H_
16 #define _TCG2_PP_VENDOR_LIB_H_
17 
18 #include <IndustryStandard/Tpm20.h>
19 #include <Protocol/Tcg2Protocol.h>
20 #include <Library/Tcg2PhysicalPresenceLib.h>
21 
22 /**
23   Check and execute the requested physical presence command.
24 
25   This API should be invoked in BIOS boot phase to process pending request.
26 
27   Caution: This function may receive untrusted input.
28 
29   If OperationRequest < 128, then ASSERT().
30 
31   @param[in]      PlatformAuth     platform auth value. NULL means no platform auth change.
32   @param[in]      OperationRequest TPM physical presence operation request.
33   @param[in, out] ManagementFlags  BIOS TPM Management Flags.
34   @param[out]     ResetRequired    If reset is required to vendor settings in effect.
35                                    True, it indicates the reset is required.
36                                    False, it indicates the reset is not required.
37 
38   @return TPM Operation Response to OS Environment.
39 **/
40 UINT32
41 EFIAPI
42 Tcg2PpVendorLibExecutePendingRequest (
43   IN TPM2B_AUTH             *PlatformAuth,  OPTIONAL
44   IN UINT32                 OperationRequest,
45   IN OUT UINT32             *ManagementFlags,
46   OUT BOOLEAN               *ResetRequired
47   );
48 
49 /**
50   Check if there is a valid physical presence command request.
51 
52   This API should be invoked in BIOS boot phase to process pending request.
53 
54   Caution: This function may receive untrusted input.
55 
56   If OperationRequest < 128, then ASSERT().
57 
58   @param[in]      OperationRequest TPM physical presence operation request.
59   @param[in]      ManagementFlags  BIOS TPM Management Flags.
60   @param[out]     RequestConfirmed If the physical presence operation command required user confirm from UI.
61                                    True, it indicates the command doesn't require user confirm.
62                                    False, it indicates the command need user confirm from UI.
63 
64   @retval  TRUE        Physical Presence operation command is valid.
65   @retval  FALSE       Physical Presence operation command is invalid.
66 **/
67 BOOLEAN
68 EFIAPI
69 Tcg2PpVendorLibHasValidRequest (
70   IN UINT32                 OperationRequest,
71   IN UINT32                 ManagementFlags,
72   OUT BOOLEAN               *RequestConfirmed
73   );
74 
75 /**
76   The callback for TPM vendor specific physical presence which is called for
77   Submit TPM Operation Request to Pre-OS Environment and
78   Submit TPM Operation Request to Pre-OS Environment 2.
79 
80   This API should be invoked in OS runtime phase to interface with ACPI method.
81 
82   Caution: This function may receive untrusted input.
83 
84   If OperationRequest < 128, then ASSERT().
85 
86   @param[in]      OperationRequest TPM physical presence operation request.
87   @param[in]      ManagementFlags  BIOS TPM Management Flags.
88   @param[in]      RequestParameter Extra parameter from the passed package.
89 
90   @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
91           Submit TPM Operation Request to Pre-OS Environment 2.
92 **/
93 UINT32
94 EFIAPI
95 Tcg2PpVendorLibSubmitRequestToPreOSFunction (
96   IN UINT32                 OperationRequest,
97   IN UINT32                 ManagementFlags,
98   IN UINT32                 RequestParameter
99   );
100 
101 /**
102   The callback for TPM vendor specific physical presence which is called for
103   Get User Confirmation Status for Operation.
104 
105   This API should be invoked in OS runtime phase to interface with ACPI method.
106 
107   Caution: This function may receive untrusted input.
108 
109   If OperationRequest < 128, then ASSERT().
110 
111   @param[in]      OperationRequest TPM physical presence operation request.
112   @param[in]      ManagementFlags  BIOS TPM Management Flags.
113 
114   @return Return Code for Get User Confirmation Status for Operation.
115 **/
116 UINT32
117 EFIAPI
118 Tcg2PpVendorLibGetUserConfirmationStatusFunction (
119   IN UINT32                 OperationRequest,
120   IN UINT32                 ManagementFlags
121   );
122 
123 #endif
124