--- /dev/null
+/** @file\r
+ Tcg PP storage library instance that does support any storage specific PPI.\r
+\r
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#include <PiDxe.h>\r
+\r
+#include <Guid/TcgPhysicalPresenceStorageData.h>\r
+#include <IndustryStandard/TcgPhysicalPresence.h>\r
+\r
+#include <Protocol/SmmVariable.h>\r
+\r
+\r
+\r
+#include <Library/TcgPhysicalPresenceStorageLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/SmmServicesTableLib.h>\r
+\r
+\r
+EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpStorageSmmVariable;\r
+\r
+/**\r
+ The handler for TPM physical presence function:\r
+ Submit TPM Operation Request to Pre-OS Environment and\r
+ Submit TPM Operation Request to Pre-OS Environment 2.\r
+\r
+ Caution: This function may receive untrusted input.\r
+\r
+ @param[in] OperationRequest TPM physical presence operation request.\r
+ @param[in] RequestParameter TPM physical presence operation request parameter.\r
+\r
+ @return Return Code for Submit TPM Operation Request to Pre-OS Environment and\r
+ Submit TPM Operation Request to Pre-OS Environment 2.\r
+**/\r
+UINT32\r
+EFIAPI\r
+TcgPhysicalPresenceStorageLibSubmitRequestToPreOSFunction (\r
+ IN UINT32 OperationRequest,\r
+ IN UINT32 RequestParameter\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+\r
+ return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;\r
+}\r
+\r
+/**\r
+ The handler for TPM physical presence function:\r
+ Return TPM Operation Response to OS Environment.\r
+\r
+ @param[out] MostRecentRequest Most recent operation request.\r
+ @param[out] Response Response to the most recent operation request.\r
+\r
+ @return Return Code for Return TPM Operation Response to OS Environment.\r
+**/\r
+UINT32\r
+EFIAPI\r
+TcgPhysicalPresenceStorageLibReturnOperationResponseToOsFunction (\r
+ OUT UINT32 *MostRecentRequest,\r
+ OUT UINT32 *Response\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+\r
+ return TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS;\r
+}\r
+\r
+/**\r
+ Check if the pending TPM request needs user input to confirm.\r
+\r
+ The TPM request may come from OS. This API will check if TPM request exists and need user\r
+ input to confirmation.\r
+\r
+ @retval TRUE TPM needs input to confirm user physical presence.\r
+ @retval FALSE TPM doesn't need input to confirm user physical presence.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+TcgPhysicalPresenceStorageLibNeedUserConfirm(\r
+ VOID\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+\r
+ return FALSE;\r
+}\r
+\r
+/**\r
+ Check and execute the pending TPM request.\r
+\r
+ The TPM request may come from OS or BIOS. This API will display request information and wait\r
+ for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r
+ the TPM request is confirmed, and one or more reset may be required to make TPM request to\r
+ take effect.\r
+\r
+ This API should be invoked after console in and console out are all ready as they are required\r
+ to display request information and get user input to confirm the request.\r
+\r
+ @param[in] PlatformAuth platform auth value. NULL means no platform auth change.\r
+**/\r
+VOID\r
+EFIAPI\r
+TcgPhysicalPresenceStorageLibProcessRequest (\r
+ VOID\r
+ )\r
+{\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ The handler for TPM physical presence function:\r
+ Return TPM Operation flag variable.\r
+\r
+ @return Return Code for Return TPM Operation flag variable.\r
+**/\r
+UINT32\r
+EFIAPI\r
+TcgPhysicalPresenceStorageLibReturnStorageFlags (\r
+ VOID\r
+ )\r
+{\r
+ UINTN DataSize;\r
+ EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS PpiFlags;\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Get the Physical Presence storage flags\r
+ //\r
+ DataSize = sizeof (EFI_TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS);\r
+ Status = mTcg2PpStorageSmmVariable->SmmGetVariable (\r
+ TCG_PHYSICAL_PRESENCE_STORAGE_FLAGS_VARIABLE,\r
+ &gEfiTcgPhysicalPresenceStorageGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &PpiFlags\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_ERROR, "[TPM2] Get PP storage flags failure! Status = %r\n", Status));\r
+ PpiFlags.PPFlags = TCG_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT;\r
+ }\r
+\r
+ return PpiFlags.PPFlags;\r
+}\r
+\r
+/**\r
+\r
+ Install Boot Manager Menu driver.\r
+\r
+ @param ImageHandle The image handle.\r
+ @param SystemTable The system table.\r
+\r
+ @retval EFI_SUCEESS Install Boot manager menu success.\r
+ @retval Other Return error status.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TcgPhysicalPresenceStorageLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Locate SmmVariableProtocol.\r
+ //\r
+ Status = gSmst->SmmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mTcg2PpStorageSmmVariable);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+## @file\r
+# Tcg PP storage library instance that does support any storage specific PPI.\r
+#\r
+# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = SmmTcgPhysicalPresenceStorageLib\r
+ MODULE_UNI_FILE = SmmTcgPhysicalPresenceStorageLib.uni\r
+ FILE_GUID = BC66DA00-E4CF-4E61-9000-E636856F8881\r
+ MODULE_TYPE = DXE_SMM_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = TcgPhysicalPresenceStorageLib|DXE_SMM_DRIVER\r
+ CONSTRUCTOR = TcgPhysicalPresenceStorageLibConstructor\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ SmmTcgPhysicalPresenceStorageLib.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ SecurityPkg/SecurityPkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ DebugLib\r
+ SmmServicesTableLib\r
+\r
+[Guids]\r
+ gEfiTcgPhysicalPresenceStorageGuid ## SOMETIMES_CONSUMES ## HII\r
+\r
+[Depex]\r
+ gEfiSmmVariableProtocolGuid\r
Tpm12DeviceLib|SecurityPkg/Library/Tpm12DeviceLibTcg/Tpm12DeviceLibTcg.inf\r
Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf\r
Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf\r
+ TcgPhysicalPresenceStorageLib|SecurityPkg/Library/SmmTcgPhysicalPresenceStorageLib/SmmTcgPhysicalPresenceStorageLib.inf\r
\r
[PcdsDynamicDefault.common.DEFAULT]\r
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0xb6, 0xe5, 0x01, 0x8b, 0x19, 0x4f, 0xe8, 0x46, 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc}\r
SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLib.inf\r
SecurityPkg/Library/OpalPasswordSupportLib/OpalPasswordSupportLib.inf\r
SecurityPkg/Library/DxeTcgPhysicalPresenceStorageLib/DxeTcgPhysicalPresenceStorageLib.inf\r
+ SecurityPkg/Library/SmmTcgPhysicalPresenceStorageLib/SmmTcgPhysicalPresenceStorageLib.inf\r
\r
#\r
# Other\r