SecuritPkg: Tcg2Smm: Add PlatformClass to TPM2 Table
authorZhang, Chao B <chao.b.zhang@intel.com>
Thu, 12 Jan 2017 02:42:29 +0000 (10:42 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Thu, 12 Jan 2017 04:28:52 +0000 (12:28 +0800)
Add PlatformClass info into TPM2 ACPI table, it is only valid with table
Rev 4 and later.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf

index 0c3b19ca74cc894fc94d30b840f47e2857d983bb..5a1fd3e363c7202375b93c0feb389d4da1686ca1 100644 (file)
@@ -512,6 +512,16 @@ PublishTpm2 (
   mTpm2AcpiTemplate.Header.Revision = PcdGet8(PcdTpm2AcpiTableRev);\r
   DEBUG((DEBUG_INFO, "Tpm2 ACPI table revision is %d\n", mTpm2AcpiTemplate.Header.Revision));\r
 \r
+  //\r
+  // PlatformClass is only valid for version 4 and above\r
+  //    BIT0~15:  PlatformClass \r
+  //    BIT16~31: Reserved\r
+  //\r
+  if (mTpm2AcpiTemplate.Header.Revision >= EFI_TPM2_ACPI_TABLE_REVISION_4) {\r
+    mTpm2AcpiTemplate.Flags = (mTpm2AcpiTemplate.Flags & 0xFFFF0000) | PcdGet8(PcdTpmPlatformClass);\r
+    DEBUG((DEBUG_INFO, "Tpm2 ACPI table PlatformClass is %d\n", (mTpm2AcpiTemplate.Flags & 0x0000FFFF)));\r
+  }\r
+\r
   //\r
   // Measure to PCR[0] with event EV_POST_CODE ACPI DATA\r
   //\r
index 27932427a2ba3c8f6b55827fd080e9621ca78b33..70184740c49d3bf9996b21aae132fd4e91a59e26 100644 (file)
@@ -74,6 +74,7 @@
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress               ## CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer  ## CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev                 ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass                 ## SOMETIMES_CONSUMES\r
 \r
 [Depex]\r
   gEfiAcpiTableProtocolGuid AND\r