"MdePkg/MdePkg.dec",\r
"MdeModulePkg/MdeModulePkg.dec",\r
"SecurityPkg/SecurityPkg.dec",\r
+ "StandaloneMmPkg/StandaloneMmPkg.dec",\r
"CryptoPkg/CryptoPkg.dec"\r
],\r
# For host based unit tests\r
gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1|UINT8|0x0001000E\r
\r
## Guid name to identify TPM instance.<BR><BR>\r
+ # NOTE: This Pcd must be FixedAtBuild if Standalone MM is used\r
# TPM_DEVICE_INTERFACE_NONE means disable.<BR>\r
# TPM_DEVICE_INTERFACE_TPM12 means TPM 1.2 DTPM.<BR>\r
# TPM_DEVICE_INTERFACE_DTPM2 means TPM 2.0 DTPM.<BR>\r
Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf\r
SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf\r
\r
+[LibraryClasses.common.MM_STANDALONE]\r
+ StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf\r
+ MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf\r
+ Tcg2PhysicalPresenceLib|SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.inf\r
+ MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf\r
+ HobLib|StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf\r
+ MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.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
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2InitializationPolicy|1\r
SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLockSmm.inf\r
SecurityPkg/Tcg/TcgSmm/TcgSmm.inf\r
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf\r
+ SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf\r
+ SecurityPkg/Tcg/Tcg2Smm/Tcg2MmDependencyDxe.inf\r
SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf\r
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.inf\r
SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/StandaloneMmTcg2PhysicalPresenceLib.inf\r
--- /dev/null
+/** @file\r
+ Runtime DXE part corresponding to StandaloneMM Tcg2 module.\r
+\r
+This module installs gTcg2MmSwSmiRegisteredGuid to notify readiness of\r
+StandaloneMM Tcg2 module.\r
+\r
+Copyright (c) 2019 - 2021, Arm Ltd. All rights reserved.\r
+Copyright (c) Microsoft Corporation.\r
+\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
+/**\r
+ The constructor function installs gTcg2MmSwSmiRegisteredGuid to notify\r
+ readiness of StandaloneMM Tcg2 module.\r
+\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the Management mode System Table.\r
+\r
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tcg2MmDependencyDxeEntryPoint (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_HANDLE Handle;\r
+\r
+ Handle = NULL;\r
+ Status = gBS->InstallProtocolInterface (\r
+ &Handle,\r
+ &gTcg2MmSwSmiRegisteredGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ NULL\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+## @file\r
+# Runtime DXE part corresponding to StandaloneMM Tcg2 module.\r
+#\r
+# This module installs gTcg2MmSwSmiRegisteredGuid to notify readiness of\r
+# StandaloneMM Tcg2 module.\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x0001001A\r
+ BASE_NAME = Tcg2MmDependencyDxe\r
+ FILE_GUID = 94C210EA-3113-4563-ADEB-76FE759C2F46\r
+ MODULE_TYPE = DXE_DRIVER\r
+ ENTRY_POINT = Tcg2MmDependencyDxeEntryPoint\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64\r
+#\r
+#\r
+\r
+[Sources]\r
+ Tcg2MmDependencyDxe.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ SecurityPkg/SecurityPkg.dec\r
+\r
+[LibraryClasses]\r
+ DebugLib\r
+ UefiBootServicesTableLib\r
+ UefiDriverEntryPoint\r
+\r
+[Guids]\r
+ gTcg2MmSwSmiRegisteredGuid ## PRODUCES ## GUID # Install protocol\r
+\r
+[Depex]\r
+ gEfiMmCommunication2ProtocolGuid\r
--- /dev/null
+/** @file\r
+ TCG2 Standalone MM driver that updates TPM2 items in ACPI table and registers\r
+ SMI2 callback functions for Tcg2 physical presence, ClearMemory, and\r
+ sample for dTPM StartMethod.\r
+\r
+ Caution: This module requires additional review when modified.\r
+ This driver will have external input - variable and ACPINvs data in SMM mode.\r
+ This external input must be validated carefully to avoid security issue.\r
+\r
+ PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.\r
+\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include "Tcg2Smm.h"\r
+#include <Library/StandaloneMmMemLib.h>\r
+\r
+/**\r
+ Notify the system that the SMM variable driver is ready.\r
+**/\r
+VOID\r
+Tcg2NotifyMmReady (\r
+ VOID\r
+ )\r
+{\r
+ // Do nothing\r
+}\r
+\r
+/**\r
+ This function is an abstraction layer for implementation specific Mm buffer validation routine.\r
+\r
+ @param Buffer The buffer start address to be checked.\r
+ @param Length The buffer length to be checked.\r
+\r
+ @retval TRUE This buffer is valid per processor architecture and not overlap with SMRAM.\r
+ @retval FALSE This buffer is not valid per processor architecture or overlap with SMRAM.\r
+**/\r
+BOOLEAN\r
+IsBufferOutsideMmValid (\r
+ IN EFI_PHYSICAL_ADDRESS Buffer,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ return MmIsBufferOutsideMmValid (Buffer, Length);\r
+}\r
+\r
+/**\r
+ The driver's entry point.\r
+\r
+ It install callbacks for TPM physical presence and MemoryClear, and locate\r
+ SMM variable to be used in the callback function.\r
+\r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
+ @param[in] SystemTable A pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+ @retval Others Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeTcgStandaloneMm (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_MM_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ return InitializeTcgCommon ();\r
+}\r
--- /dev/null
+## @file\r
+# Provides ACPI methods for TPM 2.0 support\r
+#\r
+# Spec Compliance Info:\r
+# "TCG ACPI Specification Version 1.2 Revision 8"\r
+# "Physical Presence Interface Specification Version 1.30 Revision 00.52"\r
+# along with\r
+# "Errata Version 0.4 for TCG PC Client Platform Physical Presence Interface Specification"\r
+# "Platform Reset Attack Mitigation Specification Version 1.00"\r
+# TPM2.0 ACPI device object\r
+# "TCG PC Client Platform Firmware Profile Specification for TPM Family 2.0 Level 00 Revision 1.03 v51"\r
+# along with\r
+# "Errata for PC Client Specific Platform Firmware Profile Specification Version 1.0 Revision 1.03"\r
+#\r
+# This driver implements TPM 2.0 definition block in ACPI table and\r
+# registers SMI callback functions for Tcg2 physical presence and\r
+# MemoryClear to handle the requests from ACPI method.\r
+#\r
+# Caution: This module requires additional review when modified.\r
+# This driver will have external input - variable and ACPINvs data in SMM mode.\r
+# This external input must be validated carefully to avoid security issue.\r
+#\r
+# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) Microsoft Corporation.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = Tcg2StandaloneMm\r
+ FILE_GUID = D40F321F-5349-4724-B667-131670587861\r
+ MODULE_TYPE = MM_STANDALONE\r
+ PI_SPECIFICATION_VERSION = 0x00010032\r
+ VERSION_STRING = 1.0\r
+ ENTRY_POINT = InitializeTcgStandaloneMm\r
+\r
+[Sources]\r
+ Tcg2Smm.h\r
+ Tcg2Smm.c\r
+ Tcg2StandaloneMm.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ SecurityPkg/SecurityPkg.dec\r
+ StandaloneMmPkg/StandaloneMmPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ BaseMemoryLib\r
+ StandaloneMmDriverEntryPoint\r
+ MmServicesTableLib\r
+ DebugLib\r
+ Tcg2PhysicalPresenceLib\r
+ PcdLib\r
+ MemLib\r
+\r
+[Guids]\r
+ ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl"\r
+ ## SOMETIMES_CONSUMES ## Variable:L"MemoryOverwriteRequestControl"\r
+ gEfiMemoryOverwriteControlDataGuid\r
+\r
+ gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCES ## GUID # TPM device identifier\r
+ gTpmNvsMmGuid ## CONSUMES\r
+\r
+[Protocols]\r
+ gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES\r
+ gEfiSmmVariableProtocolGuid ## CONSUMES\r
+ gEfiMmReadyToLockProtocolGuid ## CONSUMES\r
+\r
+[Pcd]\r
+ gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES\r
+\r
+[Depex]\r
+ gEfiSmmSwDispatch2ProtocolGuid AND\r
+ gEfiSmmVariableProtocolGuid\r