]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SecurityPkg / Library / Tpm2DeviceLibTcg2 / Tpm2DeviceLibTcg2.c
index 1d59050a0b624003a02941afca4da36654133118..3c8cf4fa117a9ffcc20c6ebdf2b0bf0528c4f176 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   This library is TPM2 TCG2 protocol lib.\r
 \r
-Copyright (c) 2013 - 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
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved. <BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -20,7 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/Tcg2Protocol.h>\r
 #include <IndustryStandard/Tpm20.h>\r
 \r
-EFI_TCG2_PROTOCOL  *mTcg2Protocol = NULL; \r
+EFI_TCG2_PROTOCOL  *mTcg2Protocol = NULL;\r
 \r
 /**\r
   This service enables the sending of commands to the TPM2.\r
@@ -32,30 +26,31 @@ EFI_TCG2_PROTOCOL  *mTcg2Protocol = NULL;
 \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
-  EFI_STATUS                Status;\r
-  TPM2_RESPONSE_HEADER      *Header;\r
+  EFI_STATUS            Status;\r
+  TPM2_RESPONSE_HEADER  *Header;\r
 \r
   if (mTcg2Protocol == NULL) {\r
-    Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **) &mTcg2Protocol);\r
+    Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **)&mTcg2Protocol);\r
     if (EFI_ERROR (Status)) {\r
       //\r
       // Tcg2 protocol is not installed. So, TPM2 is not present.\r
       //\r
-      DEBUG ((EFI_D_ERROR, "Tpm2SubmitCommand - Tcg2 - %r\n", Status));\r
+      DEBUG ((DEBUG_ERROR, "Tpm2SubmitCommand - Tcg2 - %r\n", Status));\r
       return EFI_NOT_FOUND;\r
     }\r
   }\r
+\r
   //\r
   // Assume when Tcg2 Protocol is ready, RequestUseTpm already done.\r
   //\r
@@ -69,7 +64,8 @@ Tpm2SubmitCommand (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  Header = (TPM2_RESPONSE_HEADER *)OutputParameterBlock;\r
+\r
+  Header                    = (TPM2_RESPONSE_HEADER *)OutputParameterBlock;\r
   *OutputParameterBlockSize = SwapBytes32 (Header->paramSize);\r
 \r
   return EFI_SUCCESS;\r
@@ -88,18 +84,19 @@ Tpm2RequestUseTpm (
   VOID\r
   )\r
 {\r
-  EFI_STATUS   Status;\r
+  EFI_STATUS  Status;\r
 \r
   if (mTcg2Protocol == NULL) {\r
-    Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **) &mTcg2Protocol);\r
+    Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **)&mTcg2Protocol);\r
     if (EFI_ERROR (Status)) {\r
       //\r
       // Tcg2 protocol is not installed. So, TPM2 is not present.\r
       //\r
-      DEBUG ((EFI_D_ERROR, "Tpm2RequestUseTpm - Tcg2 - %r\n", Status));\r
+      DEBUG ((DEBUG_ERROR, "Tpm2RequestUseTpm - Tcg2 - %r\n", Status));\r
       return EFI_NOT_FOUND;\r
     }\r
   }\r
+\r
   //\r
   // Assume when Tcg2 Protocol is ready, RequestUseTpm already done.\r
   //\r
@@ -118,7 +115,7 @@ 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