summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2017-12-06 14:35:02 +0800
committerEric Dong <eric.dong@intel.com>2019-05-08 11:30:01 +0800
commit833f9f2696794bdc89a345ad89fc346cafe80ce0 (patch)
tree0a474b1aea7c0f7565952bc273c3fb618207e7e5
parent9ae0b486247adeb4ab849fa4a39a9514b62912b3 (diff)
downloadedk2-833f9f2696794bdc89a345ad89fc346cafe80ce0.tar.gz
edk2-833f9f2696794bdc89a345ad89fc346cafe80ce0.tar.bz2
edk2-833f9f2696794bdc89a345ad89fc346cafe80ce0.zip
SecurityPkg/SmmTcg2PhysicalPresenceLib: Add Tcg2PhysicalPresenceLibGetManagementFlags support.
OpalPasswordSmm driver need to use this API from this library, so enable this API. Signed-off-by: Eric Dong <eric.dong@intel.com>
-rw-r--r--SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
index ba4db1113a..5b49c59e23 100644
--- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
+++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c
@@ -35,6 +35,38 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
/**
+ Return TPM2 ManagementFlags set by PP interface.
+
+ @retval ManagementFlags TPM2 Management Flags.
+**/
+UINT32
+EFIAPI
+Tcg2PhysicalPresenceLibGetManagementFlags (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_TCG2_PHYSICAL_PRESENCE_FLAGS PpiFlags;
+ UINTN DataSize;
+
+ DEBUG ((EFI_D_INFO, "[TPM2] GetManagementFlags\n"));
+
+ DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);
+ Status = mTcg2PpSmmVariable->SmmGetVariable (
+ TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,
+ &gEfiTcg2PhysicalPresenceGuid,
+ NULL,
+ &DataSize,
+ &PpiFlags
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "[TPM2] Get PP flags variable failure! Status = %r\n", Status));
+ PpiFlags.PPFlags = TCG2_BIOS_TPM_MANAGEMENT_FLAG_DEFAULT | TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_DEFAULT;
+ }
+ return PpiFlags.PPFlags;
+}
+
+/**
The handler for TPM physical presence function:
Return TPM Operation Response to OS Environment.