]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/TcgConfigDxe/TcgConfigDriver.c
SecurityPkg: TcgConfigDxe: Move TPM state string update to CallBack function
[mirror_edk2.git] / SecurityPkg / Tcg / TcgConfigDxe / TcgConfigDriver.c
index 2ec33e069e482ab0f850682ed0251828839fa2bd..a9d310545630a1b8f941fb59bb8578fb0e16979a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The module entry point for Tcg configuration module.\r
 \r
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 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
@@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "TcgConfigImpl.h"\r
-\r
-EFI_GUID gTcgConfigPrivateGuid = TCG_CONFIG_PRIVATE_GUID;\r
+#include <Guid/TpmInstance.h>\r
 \r
 /**\r
   The entry point for Tcg configuration driver.\r
@@ -39,7 +38,12 @@ TcgConfigDriverEntryPoint (
   TCG_CONFIG_PRIVATE_DATA   *PrivateData;\r
   EFI_TCG_PROTOCOL          *TcgProtocol;\r
 \r
-  Status = TisPcRequestUseTpm ((TIS_TPM_HANDLE) (UINTN) TPM_BASE_ADDRESS);\r
+  if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)){\r
+    DEBUG ((EFI_D_ERROR, "No TPM12 instance required!\n"));\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  Status = Tpm12RequestUseTpm ();\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((EFI_D_ERROR, "TPM not detected!\n"));\r
     return Status;\r
@@ -52,7 +56,7 @@ TcgConfigDriverEntryPoint (
   \r
   Status = gBS->OpenProtocol (\r
                   ImageHandle,\r
-                  &gTcgConfigPrivateGuid,\r
+                  &gEfiCallerIdGuid,\r
                   NULL,\r
                   ImageHandle,\r
                   ImageHandle,\r
@@ -69,10 +73,15 @@ TcgConfigDriverEntryPoint (
   if (PrivateData == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
+  PrivateData->Configuration = AllocatePool (sizeof (TCG_CONFIGURATION));\r
+  if (PrivateData->Configuration == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+    goto ErrorExit;\r
+  }\r
+\r
   PrivateData->TcgProtocol = TcgProtocol;\r
-  PrivateData->HideTpm     = (BOOLEAN) (PcdGetBool (PcdHideTpmSupport) && PcdGetBool (PcdHideTpm));\r
-  \r
+\r
   //\r
   // Install TCG configuration form\r
   //\r
@@ -86,7 +95,7 @@ TcgConfigDriverEntryPoint (
   //    \r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &ImageHandle,\r
-                  &gTcgConfigPrivateGuid,\r
+                  &gEfiCallerIdGuid,\r
                   PrivateData,\r
                   NULL\r
                   );\r
@@ -125,7 +134,7 @@ TcgConfigDriverUnload (
 \r
   Status = gBS->HandleProtocol (\r
                   ImageHandle,\r
-                  &gTcgConfigPrivateGuid,\r
+                  &gEfiCallerIdGuid,\r
                   (VOID **) &PrivateData\r
                   );  \r
   if (EFI_ERROR (Status)) {\r
@@ -136,7 +145,7 @@ TcgConfigDriverUnload (
 \r
   gBS->UninstallMultipleProtocolInterfaces (\r
          &ImageHandle,\r
-         &gTcgConfigPrivateGuid,\r
+         &gEfiCallerIdGuid,\r
          PrivateData,\r
          NULL\r
          );\r