]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SecurityPkg / Library / Tpm2DeviceLibDTpm / Tpm2DeviceLibDTpm.c
index 7d10dbbe47dba64e6f42bd925bb169641bb0d2cc..7cc55df4365b57242d66358e03d57a9f1cd28b96 100644 (file)
@@ -1,15 +1,9 @@
 /** @file\r
-  Ihis library is TPM2 DTPM device lib.\r
+  This library is TPM2 DTPM device lib.\r
   Choosing this library means platform uses and only uses DTPM device as TPM2 engine.\r
 \r
-Copyright (c) 2013, 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
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -17,6 +11,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/Tpm2DeviceLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+#include "Tpm2DeviceLibDTpm.h"\r
 \r
 /**\r
   This service enables the sending of commands to the TPM2.\r
@@ -28,15 +25,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
   @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.\r
   @retval EFI_DEVICE_ERROR       The command was not successfully sent to the device or a response was not successfully received from the device.\r
-  @retval EFI_BUFFER_TOO_SMALL   The output parameter block is too small. \r
+  @retval EFI_BUFFER_TOO_SMALL   The output parameter block is too small.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 DTpm2SubmitCommand (\r
-  IN UINT32            InputParameterBlockSize,\r
-  IN UINT8             *InputParameterBlock,\r
-  IN OUT UINT32        *OutputParameterBlockSize,\r
-  IN UINT8             *OutputParameterBlock\r
+  IN UINT32      InputParameterBlockSize,\r
+  IN UINT8       *InputParameterBlock,\r
+  IN OUT UINT32  *OutputParameterBlockSize,\r
+  IN UINT8       *OutputParameterBlock\r
   );\r
 \r
 /**\r
@@ -62,15 +59,15 @@ DTpm2RequestUseTpm (
 \r
   @retval EFI_SUCCESS            The command byte stream was successfully sent to the device and a response was successfully received.\r
   @retval EFI_DEVICE_ERROR       The command was not successfully sent to the device or a response was not successfully received from the device.\r
-  @retval EFI_BUFFER_TOO_SMALL   The output parameter block is too small. \r
+  @retval EFI_BUFFER_TOO_SMALL   The output parameter block is too small.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 Tpm2SubmitCommand (\r
-  IN UINT32            InputParameterBlockSize,\r
-  IN UINT8             *InputParameterBlock,\r
-  IN OUT UINT32        *OutputParameterBlockSize,\r
-  IN UINT8             *OutputParameterBlock\r
+  IN UINT32      InputParameterBlockSize,\r
+  IN UINT8       *InputParameterBlock,\r
+  IN OUT UINT32  *OutputParameterBlockSize,\r
+  IN UINT8       *OutputParameterBlock\r
   )\r
 {\r
   return DTpm2SubmitCommand (\r
@@ -109,8 +106,22 @@ Tpm2RequestUseTpm (
 EFI_STATUS\r
 EFIAPI\r
 Tpm2RegisterTpm2DeviceLib (\r
-  IN TPM2_DEVICE_INTERFACE   *Tpm2Device\r
+  IN TPM2_DEVICE_INTERFACE  *Tpm2Device\r
   )\r
 {\r
   return EFI_UNSUPPORTED;\r
 }\r
+\r
+/**\r
+  The function caches current active TPM interface type.\r
+\r
+  @retval EFI_SUCCESS   DTPM2.0 instance is registered, or system does not support register DTPM2.0 instance\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm2DeviceLibConstructor (\r
+  VOID\r
+  )\r
+{\r
+  return InternalTpm2DeviceLibDTpmCommonConstructor ();\r
+}\r