SecurityPkg: Tcg2Smm: Enhance TIS interface detection
authorZhang, Chao B <chao.b.zhang@intel.com>
Sun, 12 Jun 2016 02:23:16 +0000 (10:23 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Sun, 12 Jun 2016 13:15:53 +0000 (21:15 +0800)
TCG PC Client PTP spec defines that if InterfaceType is defined as TIS1.3. All the other fields of the FIFO Interface Identifier Register are skipped.
http://www.trustedcomputinggroup.org/pc-client-specific-platform-tpm-profile-for-tpm-2-0-v43-150126/

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c

index b4974755b2bda32518e7af05ac619004124b840f..1c2d8ba389a1e19b392cb800529218ab9d40beea 100644 (file)
@@ -50,18 +50,27 @@ GetPtpInterface (
   InterfaceId.Uint32 = MmioRead32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId);\r
   InterfaceCapability.Uint32 = MmioRead32 ((UINTN)&((PTP_FIFO_REGISTERS *)Register)->InterfaceCapability);\r
 \r
+  if (InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {\r
+    return PtpInterfaceTis;\r
+  }\r
+\r
   if ((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB) &&\r
       (InterfaceId.Bits.InterfaceVersion == PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_CRB) &&\r
       (InterfaceId.Bits.CapCRB != 0)) {\r
     return PtpInterfaceCrb;\r
   }\r
+\r
   if ((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO) &&\r
       (InterfaceId.Bits.InterfaceVersion == PTP_INTERFACE_IDENTIFIER_INTERFACE_VERSION_FIFO) &&\r
       (InterfaceId.Bits.CapFIFO != 0) &&\r
       (InterfaceCapability.Bits.InterfaceVersion == INTERFACE_CAPABILITY_INTERFACE_VERSION_PTP)) {\r
     return PtpInterfaceFifo;\r
   }\r
-  return PtpInterfaceTis;\r
+\r
+  //\r
+  // No Ptp interface available\r
+  //\r
+  return PtpInterfaceMax;\r
 }\r
 \r
 EFI_TPM2_ACPI_TABLE  mTpm2AcpiTemplate = {\r
@@ -400,6 +409,7 @@ PublishTpm2 (
   case PtpInterfaceTis:\r
     break;\r
   default:\r
+    DEBUG((EFI_D_ERROR, "TPM2 InterfaceType get error! %d\n", InterfaceType));\r
     break;\r
   }\r
 \r