1 /** @file
2   Ihis 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, Intel Corporation. All rights reserved.<BR>
11 This program and the accompanying materials
12 are licensed and made available under the terms and conditions of the BSD License
13 which accompanies this distribution.  The full text of the license may be found at
14 http://opensource.org/licenses/bsd-license.php
15 
16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 
19 **/
20 
21 #ifndef _TCG2_PP_VENDOR_LIB_H_
22 #define _TCG2_PP_VENDOR_LIB_H_
23 
24 #include <IndustryStandard/Tpm20.h>
25 #include <Protocol/Tcg2Protocol.h>
26 #include <Library/Tcg2PhysicalPresenceLib.h>
27 
28 /**
29   Check and execute the requested physical presence command.
30 
31   This API should be invoked in BIOS boot phase to process pending request.
32 
33   Caution: This function may receive untrusted input.
34 
35   If OperationRequest < 128, then ASSERT().
36 
37   @param[in]      PlatformAuth     platform auth value. NULL means no platform auth change.
38   @param[in]      OperationRequest TPM physical presence operation request.
39   @param[in, out] ManagementFlags  BIOS TPM Management Flags.
40   @param[out]     ResetRequired    If reset is required to vendor settings in effect.
41                                    True, it indicates the reset is required.
42                                    False, it indicates the reset is not required.
43 
44   @return TPM Operation Response to OS Environment.
45 **/
46 UINT32
47 EFIAPI
48 Tcg2PpVendorLibExecutePendingRequest (
49   IN TPM2B_AUTH             *PlatformAuth,  OPTIONAL
50   IN UINT32                 OperationRequest,
51   IN OUT UINT32             *ManagementFlags,
52   OUT BOOLEAN               *ResetRequired
53   );
54 
55 /**
56   Check if there is a valid physical presence command request.
57 
58   This API should be invoked in BIOS boot phase to process pending request.
59 
60   Caution: This function may receive untrusted input.
61 
62   If OperationRequest < 128, then ASSERT().
63 
64   @param[in]      OperationRequest TPM physical presence operation request.
65   @param[in]      ManagementFlags  BIOS TPM Management Flags.
66   @param[out]     RequestConfirmed If the physical presence operation command required user confirm from UI.
67                                    True, it indicates the command doesn't require user confirm.
68                                    False, it indicates the command need user confirm from UI.
69 
70   @retval  TRUE        Physical Presence operation command is valid.
71   @retval  FALSE       Physical Presence operation command is invalid.
72 **/
73 BOOLEAN
74 EFIAPI
75 Tcg2PpVendorLibHasValidRequest (
76   IN UINT32                 OperationRequest,
77   IN UINT32                 ManagementFlags,
78   OUT BOOLEAN               *RequestConfirmed
79   );
80 
81 /**
82   The callback for TPM vendor specific physical presence which is called for
83   Submit TPM Operation Request to Pre-OS Environment and
84   Submit TPM Operation Request to Pre-OS Environment 2.
85 
86   This API should be invoked in OS runtime phase to interface with ACPI method.
87 
88   Caution: This function may receive untrusted input.
89 
90   If OperationRequest < 128, then ASSERT().
91 
92   @param[in]      OperationRequest TPM physical presence operation request.
93   @param[in]      ManagementFlags  BIOS TPM Management Flags.
94   @param[in]      RequestParameter Extra parameter from the passed package.
95 
96   @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
97           Submit TPM Operation Request to Pre-OS Environment 2.
98 **/
99 UINT32
100 EFIAPI
101 Tcg2PpVendorLibSubmitRequestToPreOSFunction (
102   IN UINT32                 OperationRequest,
103   IN UINT32                 ManagementFlags,
104   IN UINT32                 RequestParameter
105   );
106 
107 /**
108   The callback for TPM vendor specific physical presence which is called for
109   Get User Confirmation Status for Operation.
110 
111   This API should be invoked in OS runtime phase to interface with ACPI method.
112 
113   Caution: This function may receive untrusted input.
114 
115   If OperationRequest < 128, then ASSERT().
116 
117   @param[in]      OperationRequest TPM physical presence operation request.
118   @param[in]      ManagementFlags  BIOS TPM Management Flags.
119 
120   @return Return Code for Get User Confirmation Status for Operation.
121 **/
122 UINT32
123 EFIAPI
124 Tcg2PpVendorLibGetUserConfirmationStatusFunction (
125   IN UINT32                 OperationRequest,
126   IN UINT32                 ManagementFlags
127   );
128 
129 #endif
130