diff options
author | Michael Kinney <michael.d.kinney@intel.com> | 2016-01-21 19:30:05 +0000 |
---|---|---|
committer | mdkinney <mdkinney@Edk2> | 2016-01-21 19:30:05 +0000 |
commit | 83b9662fb0086841d4f6220147bbf78966c38c56 (patch) | |
tree | 169958edb81cb55c8e5c38d72afa3982e120dd46 /SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c | |
parent | e7c83012fd664fdf5312099441e6c02f1bf28592 (diff) | |
download | edk2-83b9662fb0086841d4f6220147bbf78966c38c56.tar.gz |
SecurityPkg/Tpm12CommandLib: Add TPM 1.2 commands used by TCG modules
Add the following APIs that are required by TcgPei and/or TcgDxe to
the Tpm12CommandLib instance:
Tpm12Extend()
Tpm12PhysicalPresence()
Tpm12ContinueSelfTest()
Tpm12GetCapabilityFlagPermanent()
Tpm12GetCapabilityFlagVolatile()
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19727 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c')
-rw-r--r-- | SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c b/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c new file mode 100644 index 0000000000..a730334c3f --- /dev/null +++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12PhysicalPresence.c @@ -0,0 +1,60 @@ +/** @file
+ Implement TPM1.2 Physical Presence related command.
+
+Copyright (c) 2016, Intel Corporation. All rights reserved. <BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <PiPei.h>
+#include <Library/Tpm12CommandLib.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/Tpm12DeviceLib.h>
+
+#pragma pack(1)
+
+typedef struct {
+ TPM_RQU_COMMAND_HDR Hdr;
+ TPM_PHYSICAL_PRESENCE PhysicalPresence;
+} TPM_CMD_PHYSICAL_PRESENCE;
+
+#pragma pack()
+
+/**
+Send TSC_PhysicalPresence command to TPM.
+
+@param[in] PhysicalPresence The state to set the TPMs Physical Presence flags.
+
+@retval EFI_SUCCESS Operation completed successfully.
+@retval EFI_TIMEOUT The register can't run into the expected status in time.
+@retval EFI_BUFFER_TOO_SMALL Response data buffer is too small.
+@retval EFI_DEVICE_ERROR Unexpected device behavior.
+
+**/
+EFI_STATUS
+EFIAPI
+Tpm12PhysicalPresence (
+ IN TPM_PHYSICAL_PRESENCE PhysicalPresence
+ )
+{
+ TPM_CMD_PHYSICAL_PRESENCE Command;
+ TPM_RSP_COMMAND_HDR Response;
+ UINT32 Length;
+
+ //
+ // send Tpm command TSC_ORD_PhysicalPresence
+ //
+ Command.Hdr.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
+ Command.Hdr.paramSize = SwapBytes32 (sizeof (Command));
+ Command.Hdr.ordinal = SwapBytes32 (TSC_ORD_PhysicalPresence);
+ Command.PhysicalPresence = SwapBytes16 (PhysicalPresence);
+ Length = sizeof (Response);
+ return Tpm12SubmitCommand (sizeof (Command), (UINT8 *)&Command, &Length, (UINT8 *)&Response);
+}
|