2 Tcg PP storage library instance that does support any storage specific PPI.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Guid/TcgPhysicalPresenceStorageData.h>
17 #include <IndustryStandard/TcgPhysicalPresence.h>
19 #include <Protocol/SmmVariable.h>
23 #include <Library/TcgPhysicalPresenceStorageLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/SmmServicesTableLib.h>
28 EFI_SMM_VARIABLE_PROTOCOL
*mTcg2PpStorageSmmVariable
;
31 The handler for TPM physical presence function:
32 Submit TPM Operation Request to Pre-OS Environment and
33 Submit TPM Operation Request to Pre-OS Environment 2.
35 Caution: This function may receive untrusted input.
37 @param[in] OperationRequest TPM physical presence operation request.
38 @param[in] RequestParameter TPM physical presence operation request parameter.
40 @return Return Code for Submit TPM Operation Request to Pre-OS Environment and
41 Submit TPM Operation Request to Pre-OS Environment 2.
45 TcgPhysicalPresenceStorageLibSubmitRequestToPreOSFunction (
46 IN UINT32 OperationRequest
,
47 IN UINT32 RequestParameter
52 return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS
;
56 The handler for TPM physical presence function:
57 Return TPM Operation Response to OS Environment.
59 @param[out] MostRecentRequest Most recent operation request.
60 @param[out] Response Response to the most recent operation request.
62 @return Return Code for Return TPM Operation Response to OS Environment.
66 TcgPhysicalPresenceStorageLibReturnOperationResponseToOsFunction (
67 OUT UINT32
*MostRecentRequest
,
73 return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS
;
77 Check if the pending TPM request needs user input to confirm.
79 The TPM request may come from OS. This API will check if TPM request exists and need user
80 input to confirmation.
82 @retval TRUE TPM needs input to confirm user physical presence.
83 @retval FALSE TPM doesn't need input to confirm user physical presence.
88 TcgPhysicalPresenceStorageLibNeedUserConfirm(
98 Check and execute the pending TPM request.
100 The TPM request may come from OS or BIOS. This API will display request information and wait
101 for user confirmation if TPM request exists. The TPM request will be sent to TPM device after
102 the TPM request is confirmed, and one or more reset may be required to make TPM request to
105 This API should be invoked after console in and console out are all ready as they are required
106 to display request information and get user input to confirm the request.
108 @param[in] PlatformAuth platform auth value. NULL means no platform auth change.
112 TcgPhysicalPresenceStorageLibProcessRequest (
120 The handler for TPM physical presence function:
121 Return TPM Operation flag variable.
123 @return Return Code for Return TPM Operation flag variable.
127 TcgPhysicalPresenceStorageLibReturnStorageFlags (
132 EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS PpiFlags
;
136 // Get the Physical Presence storage flags
138 DataSize
= sizeof (EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS
);
139 Status
= mTcg2PpStorageSmmVariable
->SmmGetVariable (
140 TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS_VARIABLE
,
141 &gEfiTcgPhysicalPresenceStorageGuid
,
146 if (EFI_ERROR (Status
)) {
147 DEBUG ((EFI_D_ERROR
, "[TPM2] Get PP storage flags failure! Status = %r\n", Status
));
148 PpiFlags
.PPFlags
= TCG_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT
;
151 return PpiFlags
.PPFlags
;
156 Install Boot Manager Menu driver.
158 @param ImageHandle The image handle.
159 @param SystemTable The system table.
161 @retval EFI_SUCEESS Install Boot manager menu success.
162 @retval Other Return error status.
167 TcgPhysicalPresenceStorageLibConstructor (
168 IN EFI_HANDLE ImageHandle
,
169 IN EFI_SYSTEM_TABLE
*SystemTable
175 // Locate SmmVariableProtocol.
177 Status
= gSmst
->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid
, NULL
, (VOID
**)&mTcg2PpStorageSmmVariable
);
178 ASSERT_EFI_ERROR (Status
);