]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/TrEEConfig: Remove use of IoLib
authorMichael Kinney <michael.d.kinney@intel.com>
Thu, 21 Jan 2016 19:29:43 +0000 (19:29 +0000)
committermdkinney <mdkinney@Edk2>
Thu, 21 Jan 2016 19:29:43 +0000 (19:29 +0000)
Remove the use of the IoLib and Mmioxx() calls to detect dTPM.
This module calls the Tpm12DeviceLib to detect a TPM and the
implementation of the Tpm12DeviceLib for dTPM performs the same
Mmioxx() calls to detect a dTPM.  This change makes this module
more generic and portable by maximizing the use of the Tpm12DeviceLib
abstraction for TPM detection.

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@19724 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/Tcg/TrEEConfig/TpmDetection.c
SecurityPkg/Tcg/TrEEConfig/TrEEConfigPei.inf

index 54b1ff1128d5d9bffe4e3773dcee167cb14ec537..4e675d36020778a96a29ef6d85200d95a02aa8f0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   TPM1.2/dTPM2.0 auto detection.\r
 \r
-Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\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
@@ -18,7 +18,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-#include <Library/IoLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PeiServicesLib.h>\r
 #include <Library/PcdLib.h>\r
@@ -28,29 +27,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "TrEEConfigNvData.h"\r
 \r
-/**\r
-  This routine return if dTPM (1.2 or 2.0) present.\r
-\r
-  @retval TRUE  dTPM present\r
-  @retval FALSE dTPM not present\r
-**/\r
-BOOLEAN\r
-IsDtpmPresent (\r
-  VOID\r
-  )\r
-{\r
-  UINT8                             RegRead;\r
-  \r
-  RegRead = MmioRead8 ((UINTN)PcdGet64 (PcdTpmBaseAddress));\r
-  if (RegRead == 0xFF) {\r
-    DEBUG ((EFI_D_ERROR, "DetectTpmDevice: Dtpm not present\n"));\r
-    return FALSE;\r
-  } else {\r
-    DEBUG ((EFI_D_INFO, "DetectTpmDevice: Dtpm present\n"));\r
-    return TRUE;\r
-  }\r
-}\r
-\r
 /**\r
   This routine check both SetupVariable and real TPM device, and return final TpmDevice configuration.\r
 \r
@@ -100,10 +76,6 @@ DetectTpmDevice (
   }\r
 \r
   DEBUG ((EFI_D_INFO, "DetectTpmDevice:\n"));\r
-  if (!IsDtpmPresent ()) {\r
-    // dTPM not available\r
-    return TPM_DEVICE_NULL;\r
-  }\r
 \r
   // dTPM available and not disabled by setup\r
   // We need check if it is TPM1.2 or TPM2.0\r
@@ -111,7 +83,10 @@ DetectTpmDevice (
 \r
   Status = Tpm12RequestUseTpm ();\r
   if (EFI_ERROR (Status)) {\r
-    return TPM_DEVICE_2_0_DTPM;\r
+    //\r
+    // dTPM not available\r
+    //\r
+    return TPM_DEVICE_NULL;\r
   }\r
 \r
   if (BootMode == BOOT_ON_S3_RESUME) {\r
index e8de529f8bee4f08e25f3df30f7d3e3aba4a19cb..a4d6b58c6acf55a264d14046bd0f3b2d0092f454 100644 (file)
@@ -4,7 +4,7 @@
 #  This module initializes TPM device type based on variable and detection.\r
 #  NOTE: This module is only for reference only, each platform should have its own setup page.\r
 #\r
-# Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\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
@@ -49,7 +49,6 @@
   DebugLib\r
   PcdLib\r
   TimerLib\r
-  IoLib\r
   Tpm12CommandLib\r
   Tpm12DeviceLib\r
 \r