]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
SecurityPkg: Fix spelling errors
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Config / Tcg2ConfigDriver.c
index 34828eed7d648598d4f089df6eda0381aa2f1351..10d1c5cc78004aec40393ee701b42c17b19b1053 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   The module entry point for Tcg2 configuration module.\r
 \r
-Copyright (c) 2015 - 2017, 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) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -82,6 +76,7 @@ InitializeTcg2VersionInfo (
   TCG2_VERSION                  Tcg2Version;\r
   UINTN                         DataSize;\r
   UINT64                        PcdTcg2PpiVersion;\r
+  UINT8                         PcdTpm2AcpiTableRev;\r
 \r
   //\r
   // Get the PCD value before initializing efi varstore configuration data.\r
@@ -93,6 +88,8 @@ InitializeTcg2VersionInfo (
     AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))\r
     );\r
 \r
+  PcdTpm2AcpiTableRev = PcdGet8 (PcdTpm2AcpiTableRev);\r
+\r
   //\r
   // Initialize efi varstore configuration data.\r
   //\r
@@ -137,7 +134,7 @@ InitializeTcg2VersionInfo (
     }\r
   } else {\r
     //\r
-    // EFI variable doesn't exist.\r
+    // EFI variable doesn't exist or variable size is not expected.\r
     //\r
 \r
     //\r
@@ -175,6 +172,10 @@ InitializeTcg2VersionInfo (
         DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer default value is not same with the default value in VFR\n"));\r
         DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n"));\r
       }\r
+      if (PcdTpm2AcpiTableRev != Tcg2Version.Tpm2AcpiTableRev) {\r
+        DEBUG ((DEBUG_WARN, "WARNING: PcdTpm2AcpiTableRev default value is not same with the default value in VFR\n"));\r
+        DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n"));\r
+      }\r
     }\r
   }\r
   FreePool (ConfigRequestHdr);\r
@@ -182,7 +183,7 @@ InitializeTcg2VersionInfo (
   //\r
   // Get the PCD value again.\r
   // If the PCD value is not equal to the value in variable,\r
-  // the PCD is not DynamicHii type and maps to the setup option.\r
+  // the PCD is not DynamicHii type and does not map to the setup option.\r
   //\r
   PcdTcg2PpiVersion = 0;\r
   CopyMem (\r
@@ -191,7 +192,7 @@ InitializeTcg2VersionInfo (
     AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))\r
     );\r
   if (PcdTcg2PpiVersion != Tcg2Version.PpiVersion) {\r
-    DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and maps to TCG2_VERSION.PpiVersion\n"));\r
+    DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and does not map to TCG2_VERSION.PpiVersion\n"));\r
     DEBUG ((DEBUG_WARN, "WARNING: The TCG2 PPI version configuring from setup page will not work\n"));\r
   }\r
 \r
@@ -206,6 +207,29 @@ InitializeTcg2VersionInfo (
       ASSERT (FALSE);\r
       break;\r
   }\r
+\r
+  //\r
+  // Get the PcdTpm2AcpiTableRev value again.\r
+  // If the PCD value is not equal to the value in variable,\r
+  // the PCD is not DynamicHii type and does not map to TCG2_VERSION Variable.\r
+  //\r
+  PcdTpm2AcpiTableRev = PcdGet8 (PcdTpm2AcpiTableRev);\r
+  if (PcdTpm2AcpiTableRev != Tcg2Version.Tpm2AcpiTableRev) {\r
+    DEBUG ((DEBUG_WARN, "WARNING: PcdTpm2AcpiTableRev is not DynamicHii type and does not map to TCG2_VERSION.Tpm2AcpiTableRev\n"));\r
+    DEBUG ((DEBUG_WARN, "WARNING: The Tpm2 ACPI Revision configuring from setup page will not work\n"));\r
+  }\r
+\r
+  switch (PcdTpm2AcpiTableRev) {\r
+    case EFI_TPM2_ACPI_TABLE_REVISION_3:\r
+      HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_ACPI_REVISION_STATE_CONTENT), L"Rev 3", NULL);\r
+      break;\r
+    case EFI_TPM2_ACPI_TABLE_REVISION_4:\r
+      HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_ACPI_REVISION_STATE_CONTENT), L"Rev 4", NULL);\r
+      break;\r
+    default:\r
+      ASSERT (FALSE);\r
+      break;\r
+  }\r
 }\r
 \r
 /**\r
@@ -216,7 +240,7 @@ InitializeTcg2VersionInfo (
 \r
   @retval EFI_ALREADY_STARTED    The driver already exists in system.\r
   @retval EFI_OUT_OF_RESOURCES   Fail to execute entry point due to lack of resources.\r
-  @retval EFI_SUCCES             All the related protocols are installed on the driver.\r
+  @retval EFI_SUCCESS            All the related protocols are installed on the driver.\r
   @retval Others                 Fail to install protocols as indicated.\r
 \r
 **/\r
@@ -247,7 +271,7 @@ Tcg2ConfigDriverEntryPoint (
   if (!EFI_ERROR (Status)) {\r
     return EFI_ALREADY_STARTED;\r
   }\r
-  \r
+\r
   //\r
   // Create a private data structure.\r
   //\r
@@ -256,7 +280,7 @@ Tcg2ConfigDriverEntryPoint (
   mTcg2ConfigPrivateDate = PrivateData;\r
   //\r
   // Install private GUID.\r
-  //    \r
+  //\r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &ImageHandle,\r
                   &gEfiCallerIdGuid,\r
@@ -368,7 +392,7 @@ Tcg2ConfigDriverEntryPoint (
                                      );\r
     ASSERT_EFI_ERROR (Status);\r
   }\r
-  \r
+\r
   //\r
   // Install Tcg2 configuration form\r
   //\r
@@ -384,8 +408,8 @@ Tcg2ConfigDriverEntryPoint (
 ErrorExit:\r
   if (PrivateData != NULL) {\r
     UninstallTcg2ConfigForm (PrivateData);\r
-  }  \r
-  \r
+  }\r
+\r
   return Status;\r
 }\r
 \r
@@ -411,20 +435,20 @@ Tcg2ConfigDriverUnload (
                   ImageHandle,\r
                   &gEfiCallerIdGuid,\r
                   (VOID **) &PrivateData\r
-                  );  \r
+                  );\r
   if (EFI_ERROR (Status)) {\r
-    return Status;  \r
+    return Status;\r
   }\r
-  \r
+\r
   ASSERT (PrivateData->Signature == TCG2_CONFIG_PRIVATE_DATA_SIGNATURE);\r
 \r
   gBS->UninstallMultipleProtocolInterfaces (\r
-         &ImageHandle,\r
+         ImageHandle,\r
          &gEfiCallerIdGuid,\r
          PrivateData,\r
          NULL\r
          );\r
-  \r
+\r
   UninstallTcg2ConfigForm (PrivateData);\r
 \r
   return EFI_SUCCESS;\r